OpenContrail contains a quick start guide with step-by-step instructions to install a single server all in one setup (including Openstack). More often than not, I was in need of a clean OpenContrail node to test a few things against it, only to tear it down again or leave it as a suspended and soon forgotten VM image on the disk.
https://www.vagrantup.com offers a development environment to create and configure lightweight, reproducible, and portable development environments. Starting from the official Ubuntu Server 14.04 LTS cloud image (https://vagrantcloud.com/ubuntu/boxes/trusty64), I created a Vagrantfile for a VirtualBox virtual machine with 8 GBytes of RAM and 2 vcpu’s and a private network (in addition to vagrant’s default NAT network) with a fixed IP address of 192.168.33.10. That address can be changed in the Vagrantfile to suit your needs. The provisioning/install of OpenContrail is controlled via the shell script provision.sh. That script follows the quick start guide mentioned earlier by first updating Ubuntu to the latest patch release, then downloading and installing OpenContrail 1.20 and OpenStack Icehouse.
The required Vagrantfile and provisioning script can be downloaded from github at https://github.com/mwiget/opencontrail:
$ mkdir temp $ cd temp $ git clone git://github.com/mwiget/opencontrail.git Cloning into 'opencontrail'... remote: Counting objects: 11, done. remote: Compressing objects: 100% (11/11), done. remote: Total 11 (delta 2), reused 4 (delta 0) Receiving objects: 100% (11/11), 10.44 KiB | 0 bytes/s, done. Resolving deltas: 100% (2/2), done. Checking connectivity... done. $
The following files should be present in the automatically created directory ‘opencontrail’:
$ cd opencontrail $ ls LICENSE README.md Vagrantfile provision.sh $
Ubuntu, OpenContrail and Openstack will be downloaded automatically from the Internet when the virtual machine is launched via ‘vagrant up’. The initial installation will typically take about 20 minutes and depends on the Internet access speed and the CPU.
$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'ubuntu/trusty64'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'ubuntu/trusty64' is up to date... ==> default: Setting the name of the VM: simple-gateway-vagrant_default_1416160329884_44357 ==> default: Clearing any previously set forwarded ports... ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports... default: 22 => 2222 (adapter 1) ==> default: Running 'pre-boot' VM customizations... ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Connection timeout. Retrying... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... ==> default: Mounting shared folders... default: /vagrant => /Users/mwiget/projects/temp/opencontrail ==> default: Running provisioner: shell... default: Running: /var/folders/8m/0w01fsfn6j79rb_5x7npp1m40000gn/T/vagrant-shell20141116-9617-wys9ae.sh ==> default: stdin: is not a tty ==> default: Fix ssh to allow password login ==> default: ssh stop/waiting ==> default: ssh start/running, process 1701 ==> default: Installing OpenContrail ... ==> default: apt-get update ... ==> default: installing curl ... ==> default: Reading package lists... ==> default: Building dependency tree... . . . (bulk of the install messages removed) . . . ==> default: 2014-11-19 09:46:54:628479: ==> default: 2014-11-19 09:46:54:628595: Done. ==> default: 2014-11-19 09:46:54:628618: Disconnecting from 192.168.33.10... done. ==> default: 2014-11-19 09:46:54:701249: ==> default: You can access horizon web UI http://192.168.33.10/horizon ==> default: You can access OpenContrail web UI http://192.168.33.10:8080 ==> default: all done.
That’s it! OpenContrail is rebooting and once its back up, is ready for action. The default UI username and password are admin/secret123 and can be changed in provision.sh. Access the CLI via ‘vagrant ssh’ and check the status of OpenContrail:
$ vagrant ssh Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-39-generic x86_64) * Documentation: https://help.ubuntu.com/ System information as of Wed Nov 19 09:47:09 UTC 2014 System load: 0.0 Memory usage: 1% Processes: 57 Usage of /: 6.3% of 39.34GB Swap usage: 0% Users logged in: 0 Graph this data and manage this system at: https://landscape.canonical.com/ Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud vagrant@vagrant-ubuntu-trusty-64:~$ contrail-status == Contrail vRouter == supervisor-vrouter: active contrail-vrouter-agent active contrail-vrouter-nodemgr active == Contrail Control == supervisor-control: active contrail-control active contrail-control-nodemgr active contrail-dns active contrail-named active == Contrail Analytics == supervisor-analytics: active contrail-analytics-api active contrail-analytics-nodemgr active contrail-collector active contrail-query-engine active == Contrail Config == supervisor-config: active contrail-api:0 active contrail-config-nodemgr active contrail-discovery:0 active contrail-schema active contrail-svc-monitor active ifmap active == Contrail Web UI == supervisor-webui: active contrail-webui active contrail-webui-middleware active redis-webui active == Contrail Database == supervisord-contrail-database:active contrail-database active contrail-database-nodemgr active == Contrail Support Services == supervisor-support-service: active rabbitmq-server active
Access the UI at URL http://192.168.33.10:8080
Use vagrant commands to suspend, resume and destroy the virtual machine as needed.
$ vagrant destroy default: Are you sure you want to destroy the 'default' VM? [y/N] y ==> default: Forcing shutdown of VM... ==> default: Destroying VM and associated drives... ==> default: Running cleanup tasks for 'shell' provisioner... $