Vagrant – Overview and Opendaylight Vagrant Image

Recently, I came across this tool called Vagrant that eases the creation and sharing of VM work environment. I played with it and found it very useful. Vagrant integrates with VM hosting providers like Virtualbox, Vmware and AWS. Different devops tools like Chef, Puppet, Ansible are integrated with Vagrant. In this blog, I will cover high level overview and use cases of Vagrant, Vagrant workflow and an application that I created using Vagrant. In the application, I have created a Vagrant Opendaylight(ODL) box using Ubuntu 12.04 as baseline. I will describe the steps that I followed to create the Vagrant ODL box and how it can be used.

Vagrant Use cases:

  • Easier to share VM and this allows for better collaboration. Rather than sharing large OVA files, Vagrant configuration files can be shared.
  • Same VM base can be used for different applications. For example, Vagrant box can be a Ubuntu OS which contains the OS alone. Vagrant box could also be Ubuntu OS plus LAMP stack, this base box can be used for developers wanting to develop applications on top of LAMP stack.
  • VagrantCloud can be used to find base VMs for a lot of different use cases. The same site can be used to host new base VMs. Free VagrantCloud account does not allow hosting.
  • Vagrant integrates well with devops tools like Chef, Puppet and Ansible and this makes the recipe installation easier.


  • Download and Install Vagrant and Virtualbox. Other VM hosting providers like VMWare VMfusion can also be used.  I installed this on a Windows 7 machine.
  • Select base VM based on the need and download it. Once the base VM is downloaded, it gets cached and does not get downloaded for new VM instances.
  • Default Vagrantfile gets created during initial setup. Each VM needs a Vagrantfile. Vagrantfile defines base VM name, VM configuration parameters like memory, networking aspects, ssh settings, location of provisioning file. Vagrantfile is written in Ruby, so this makes it flexible.
  • Provisioning file is a shell script that does the VM configuration once its up and running. Vagrantfile specifies the provisioning script name and location.
  • Based on our need, we can modify the Vagrantfile and provisioning script and once the VM is setup the way we need, we can share the VM either by sharing the Vagrantfile and script or by uploading the box to Vagrantcloud or by packaging it locally and distributing the box image.

Useful commands:

Exhaustive command list is the Vagrant webpage and in the help. I have put some useful commands below.

 vagrant box add (just downloads, need to change vagrantfile manually)
 vagrant init  (downloads, updates vagrantfile etc)
 vagrant login (login to vagrantcloud)
 vagrant up (starts VM)
 vagrant share (to share the development environment, this gives a http link)
 vagrant reload (Reload VM)
 vagrant reload --provision (reload and rerun provisioning sciprt)
 vagrant box add hashicorp/precise64 - downloads ubuntu 64 bit edition from vagrant cloud
 vagrant package (creates a base box that can be shared, hosting not free in cloud)
 vagrant destroy (destroys VM)
 vagrant ssh (ssh to the VM)

 ODL Vagrant application:

  • I created an ODL development environment using Ubuntu64 base VM. This can be used by folks wanting to develop ODL applications or to just play with ODL.
  • On top of Ubuntu 64, I have installed ODL hydrogen virtualization edition, ODL helium edition, Mininet simulator, Wireshark.
  • To use this, you can download the Vagrantfile and from here. Save these 2 files in a directory and do “vagrant up”. This will download the base VM for the first time and do all the provisioning needed to setup the ODL environment.
  • Some of the Vagrantfile settings specific to ODL I did are increased VM memory to 2G, setup port forwarding to expose ODL ports, setup provisioning file “”.
  • ssh to the VM using localhost:2222 and use “vagrant” as username and password.
  • When ODL hydrogen edition is started, localhost:8080 in browser will be able to access ODL web interface since port forwarding redirects the request to the VM.
  • Later, I realized that I need to update ovs version to the latest. All I needed to do was to update the with few more steps and the new environment is ready now. Updated can be found here.
  • For running any GUI based applications in VM, I exported the display to my Windows machine and ran Xserver in my windows machine.


3 thoughts on “Vagrant – Overview and Opendaylight Vagrant Image

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s