As I so often do, I took some inspiration from one of Brent’s posts on setting up OpenDaylight:
And decided to try it out with Vagrant. For those unfamiliar, Vagrant is a tool to make reproducible VMs. By default it works with VirtualBox, but can be configured to work with other virtualization technologies as well. To get started you download and install Vagrant for your OS (Mac, Win, Linux are all supported): http://downloads.vagrantup.com/
And the same goes for VirtualBox if you don’t already have it: https://www.virtualbox.org/wiki/Downloads
Once you’ve got them installed, you can copy someone’s Vagrant file, and run
vagrant up in the directory to bring up the VM with the configuration specified in the file. I’ve posted my OpenDaylight Vagrant file on github:
So for this example you can clone it:
git clone https://github.com/fredhsu/odl-vagrant.git
Then cd to the directory and type:
This will download create a VM with Ubuntu, install all the packages needed, and then finally startup the OpenDaylight controller. The whole process will take a few minutes, but when its all done you should be able to browse to the controller by going to
http://localhost:8080 since I’ve port forwarded port 8080 to the VM from localhost. I’ve also forwarded ports 6633 and 8090 for OpenFlow and the OSGI console respectively. To access the OSGI console you can
telnet localhost 8090. You can also ssh to the VM by issuing a
vagrant ssh. Another cool thing is that the directory you started the vm from is shared with the VM, so you can copy files back and forth. Check out the vagrant docs for more details.
If anyone has any suggestions on things to add the the Vagrantfile, please feel free to modify and push to the repo. I left out mininet, but might add it to a separate version. I hope people find this useful. I think it is a great way to be able to easily distribute and replicate VM configs. Another nice thing with this setup is that it always downloads a fresh copy of ODL, so you’re running with the latest code each time. No need to maintain a static VM image.