Update ubuntu-mininet-2.3 vagrant definition for private cloud 83/38383/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 4 May 2016 16:49:51 +0000 (12:49 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 4 May 2016 18:26:57 +0000 (14:26 -0400)
This updates the vagrant definition for integration-robotframework to be
in line with the private cloiud designs.

Change-Id: Ia7f3028f50c254d3f91931ff122e132e49aa58fb
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
vagrant/ubuntu-mininet-ovs-2.3/Vagrantfile
vagrant/ubuntu-mininet-ovs-2.3/bootstrap.sh

index 54b001f3f37c30be3195a6ec5e8a468138e54b91..cb6b627931974a163653783e1be6d93487dd0847 100644 (file)
@@ -5,46 +5,60 @@
 VAGRANTFILE_API_VERSION = "2"
 
 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
-  # root off of the rackspace provider dummy box
+  # root off of the openstack provider dummy box
   config.vm.box = "dummy"
-
-  # rackspace systems, even with cloud-init
-  # don't seem to have the cloud int user ${osname} (or similar)
-  # getting the ssh key for some reason, root does for sure
-  # so use that
   config.ssh.username = 'root'
 
-  # Only baseline image should have config.ssh.pty = true
-  # Ensure we disable it.
-  config.ssh.pty = false
-
   # make sure to set the following in your
-  # ~/.vagrant.d/boxes/dummy/0/rackspace/Vagrantfile
-  # rs.username
-  # rs.api_key
-  # rs.rackspace_region
+  # ~/.vagrant.d/boxes/dummy/0/openstack/Vagrantfile
+  #
+  # os.openstack_auth_url
+  # os.endpoint_type
+  # os.flavor
+  # os.tenant_name
+  # os.username
+  # os.password
+  # os.networks
   #
   # If you are not using an SSH token / smartcard also set this
-  # rs.key_name
-  # config.ssh.private_key_path -- set this outside the rackspace block
+  # os.key_name
+  # config.ssh.private_key_path -- set this outside the openstack block
   #         in your base box
-  config.vm.provider :rackspace do |rs|
-    # create these base builds always on the smallest system possible
-    rs.flavor = 'general1-1'
-
-    # allow for switching to ORD cloud but default to DFW
-    if (ENV['RSREGION'] == 'ord')
-      rs.rackspace_region = :ord
+  config.vm.provider :openstack do |os, override|
+    if ENV['BOX']
+      override.vm.box = ENV['BOX']
     else
-      rs.rackspace_region = :dfw
+      override.vm.box = 'dummy'
     end
+    config.ssh.username = 'centos'
+    os.flavor = 'm1.small'
 
-    # Default the Ubuntu 14.04 - Vagrant ready image unless overriden by a RSIMAGE
-    # environment variable
-    if ENV['RSIMAGE']
-      rs.image = ENV['RSIMAGE']
+    # require an IMAGE to be passed in
+    # IMAGE must be a human name and not an image ID!
+    if ENV['IMAGE']
+      os.image = ENV['IMAGE']
     else
-      rs.image = 'Ubuntu 14.04 - Vagrant ready'
+      os.image = 'BAD IMAGE'
+      override.ssh.username = 'baduser'
+    end
+
+    case ENV['IMAGE']
+      when /.*ubuntu.*/i
+        override.ssh.username = 'ubuntu'
+
+      when /.*fedora.*/i
+        override.ssh.username = 'fedora'
+
+        # take care of the tty requirement by fedora for sudo
+        os.user_data = "#!/bin/bash
+/bin/sed -i 's/ requiretty/ !requiretty/' /etc/sudoers;"
+
+      when /.*centos.*/i
+        override.ssh.username = 'centos'
+
+        # take care of the tty requirement by centos for sudo
+        os.user_data = "#!/bin/bash
+/bin/sed -i 's/ requiretty/ !requiretty/' /etc/sudoers;"
     end
   end
 
@@ -52,19 +66,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
   config.vm.synced_folder ".", "/vagrant"
   config.vm.synced_folder "../lib/", "/vagrant/lib"
 
-  # run our bootstrapping for the system
-  config.vm.provision 'shell', path: 'bootstrap.sh'
-
-
-  #################
-  # LF NETWORKING #
-  #################
+  # Do a full system update and enable enforcing if needed
+  config.vm.provision 'shell', path: '../lib/baseline.sh'
 
-  if ENV['LFNETWORK']
-    # reconfigure the network setup to support our special private setup
-    config.vm.provision 'shell', path: '../lib/lf-networking/configure_lf_infra.sh',
-      args: ENV['RSSUBDOMAIN']
-  end
+  # run our bootstrapping
+  config.vm.provision 'shell', path: 'bootstrap.sh'
 
 
   #################
index 6e0fc75819aab66fff8995eb01d32170c0b73ac8..02bc33923eb8c692de50525c158945d8f3cdf697 100644 (file)
@@ -2,10 +2,9 @@
 
 # vim: sw=4 ts=4 sts=4 et tw=72 :
 
-echo "---> Updating operating system"
-apt-get update -qq
-DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --force-yes -qq \
-    -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
+# Ensure that necessary variables are set to enable noninteractive mode in
+# commands.
+export DEBIAN_FRONTEND=noninteractive
 
 # To handle the prompt style that is expected all over the environment
 # with how use use robotframework we need to make sure that it is
@@ -13,12 +12,11 @@ DEBIAN_FRONTEND=noninteractive apt-get upgrade -y --force-yes -qq \
 # ups
 echo 'PS1="[\u@\h \W]> "' >> /etc/skel/.bashrc
 
-# Install OpenVSwitch 2.3.1
+echo '---> Install OpenVSwitch 2.3.1'
 add-apt-repository -y ppa:vshn/openvswitch
-apt-get update -qq
 apt-get install -y --force-yes -qq openvswitch-switch
 
-# Install CPqD
+echo '---> Installing CPqD and dependencies'
 apt-get install -y --force-yes -qq build-essential cmake flex
 apt-get install -y --force-yes -qq libpcre++-dev libxerces-c-dev libpcap-dev libboost-all-dev
 
@@ -47,15 +45,14 @@ make
 make install
 cd ..
 
-# Install mininet 2.2.1
+echo '---> Installing mininet 2.2.1'
 git clone git://github.com/mininet/mininet
 cd mininet
 git checkout -b 2.2.1 2.2.1
 cd ..
 mininet/util/install.sh -nf
 
-# cbench installation for running openflow performance tests
-
+echo '---> Installing cbench for openflow performance tests'
 OF_DIR=$HOME/openflow  # Directory that contains OpenFlow code
 OFLOPS_DIR=$HOME/oflops  # Directory that contains oflops repo
 
@@ -70,6 +67,5 @@ cd $OFLOPS_DIR
 make
 make install
 
-# Installing exabgp
+echo '---> Installing exabgp'
 apt-get install -y --force-yes -qq exabgp
-