CSIT-186: Add multilink to Vagrant file
[csit.git] / resources / tools / vagrant / Vagrantfile
index 46e2146..86e7860 100644 (file)
@@ -41,7 +41,8 @@ $install_vpp = <<-SHELL
 SHELL
 
 
-def add_dut(config, name, mgmt_ip, net1, net2)
+def add_dut(config, name, mgmt_ip, port1, port2, port3, port4)
+  config.vm.box_check_update = false
   config.vm.define name do |node|
     node.vm.box = "fdio-csit/ubuntu-14.04.4_2016-05-25_1.0"
     node.vm.hostname = name
@@ -50,17 +51,18 @@ def add_dut(config, name, mgmt_ip, net1, net2)
     node.vm.provision "shell", inline: $install_vpp
 
     node.vm.network "private_network", ip: mgmt_ip
-    node.vm.network "private_network", type: "dhcp", auto_config: false,
-        virtualbox__intnet: net1
-    node.vm.network "private_network", type: "dhcp", auto_config: false,
-        virtualbox__intnet: net2
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port1
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port2
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port3
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port4
     node.vm.provider "virtualbox" do |vb|
       vb.memory = "3232"
       vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
       vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
+      vb.customize ["modifyvm", :id, "--nicpromisc5", "allow-all"]
+      vb.customize ["modifyvm", :id, "--nicpromisc6", "allow-all"]
     end
   end
-
 end
 
 net_prefix = ''
@@ -68,9 +70,9 @@ if ENV.key?('VPP_VAGRANT_NET_PREFIX')
   net_prefix = ENV['VPP_VAGRANT_NET_PREFIX'] + '_'
 end
 
-Vagrant.configure(2) do |config|
+def add_tg(config, name, mgmt_ip, port1, port2, port3, port4, port5, port6)
   config.vm.box_check_update = false
-  config.vm.define "tg" do |tg|
+  config.vm.define name do |node|
     if Vagrant.has_plugin?("vagrant-proxyconf")
       if ENV["http_proxy"]
         config.proxy.http     = ENV["http_proxy"]
@@ -82,25 +84,32 @@ Vagrant.configure(2) do |config|
         config.proxy.no_proxy = ENV["no_proxy"]
       end
     end
-    tg.vm.box = "fdio-csit/ubuntu-14.04.4_2016-05-25_1.0"
-    tg.vm.hostname = "tg"
+    node.vm.box = "fdio-csit/ubuntu-14.04.4_2016-05-25_1.0"
+    node.vm.hostname = name
+    node.vm.provision "shell", inline: $user_addition
+    node.vm.provision "shell", inline: $install_prereqs
 
-    tg.vm.provision "shell", inline: $user_addition
-    tg.vm.provision "shell", inline: $install_prereqs
-    tg.vm.network "private_network", ip: '192.168.255.100/24'
-    tg.vm.network "private_network", type: "dhcp", auto_config: false,
-        virtualbox__intnet: net_prefix + "tg_dut1"
-    tg.vm.network "private_network", type: "dhcp", auto_config: false,
-        virtualbox__intnet: net_prefix + "tg_dut2"
-    tg.vm.provider "virtualbox" do |vb|
+    node.vm.network "private_network", ip: mgmt_ip
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port1
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port2
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port3
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port4
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port5
+    node.vm.network "private_network", type: "dhcp", auto_config: false, virtualbox__intnet: port6
+    node.vm.provider "virtualbox" do |vb|
       vb.memory = "2048"
       vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
       vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
+      vb.customize ["modifyvm", :id, "--nicpromisc5", "allow-all"]
+      vb.customize ["modifyvm", :id, "--nicpromisc6", "allow-all"]
+      vb.customize ["modifyvm", :id, "--nicpromisc7", "allow-all"]
+      vb.customize ["modifyvm", :id, "--nicpromisc8", "allow-all"]
     end
-
   end
-
-  add_dut(config, "dut1", "192.168.255.101/24", net_prefix + "tg_dut1", net_prefix + "dut1_dut2")
-  add_dut(config, "dut2", "192.168.255.102/24", net_prefix + "tg_dut2", net_prefix + "dut1_dut2")
 end
 
+Vagrant.configure(2) do |config|
+  add_tg(config,  "tg",   "192.168.255.100/24", net_prefix + "tg_tg", net_prefix + "tg_tg", net_prefix + "tg_dut1_1", net_prefix + "tg_dut1_2", net_prefix + "tg_dut2_1", net_prefix + "tg_dut2_2")
+  add_dut(config, "dut1", "192.168.255.101/24", net_prefix + "tg_dut1_1", net_prefix + "tg_dut1_2", net_prefix + "dut1_dut2_1", net_prefix + "dut1_dut2_2")
+  add_dut(config, "dut2", "192.168.255.102/24", net_prefix + "tg_dut2_1", net_prefix + "tg_dut2_2", net_prefix + "dut1_dut2_1", net_prefix + "dut1_dut2_2")
+end