1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
15 # vi: set ts=2 sw=2 sts=2 et ft=ruby :
17 $user_addition = <<-SHELL
19 sudo adduser --disabled-password --gecos "" csit
20 echo csit:csit | sudo chpasswd
21 sudo adduser csit vagrant
25 $install_prereqs = <<-SHELL
26 sudo apt-get -y update
27 sudo apt-get -y -f install
28 sudo apt-get -y install python-virtualenv python-dev iproute2 debhelper dkms
29 sudo update-alternatives --install /bin/sh sh /bin/bash 100
32 $install_vpp = <<-SHELL
34 vpp_pkgs="$(echo vpp*.deb)"
35 if [ "$vpp_pkgs" != "vpp*.deb" ]; then
36 if [ "$(dpkg -l | grep vpp)" != "" ] ; then
37 sudo apt-get -y purge vpp\*
40 vppcfg="/etc/vpp/startup.conf"
41 sudo rm -f $vppcfg.orig
42 sudo cp $vppcfg $vppcfg.orig
43 echo -e '\nheapsize 512M' | sudo tee -a $vppcfg
48 def add_dut(config, name, mgmt_ip, net1, net2)
49 config.vm.define name do |node|
50 node.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
51 node.vm.hostname = name
52 node.vm.provision "shell", inline: $user_addition
53 node.vm.provision "shell", inline: $install_prereqs
54 node.vm.provision "shell", inline: $install_vpp
56 node.vm.network "private_network", ip: mgmt_ip
57 node.vm.network "private_network", type: "dhcp", auto_config: false,
58 virtualbox__intnet: net1
59 node.vm.network "private_network", type: "dhcp", auto_config: false,
60 virtualbox__intnet: net2
61 node.vm.provider "virtualbox" do |vb|
63 vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
64 vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
70 Vagrant.configure(2) do |config|
71 if Vagrant.has_plugin?("vagrant-proxyconf")
73 config.proxy.http = ENV["http_proxy"]
76 config.proxy.https = ENV["https_proxy"]
79 config.proxy.no_proxy = ENV["no_proxy"]
82 config.vm.define "tg" do |tg|
83 tg.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
86 tg.vm.provision "shell", inline: $user_addition
87 tg.vm.provision "shell", inline: $install_prereqs
88 tg.vm.network "private_network", ip: '192.168.255.100/24'
89 tg.vm.network "private_network", type: "dhcp", auto_config: false,
90 virtualbox__intnet: "tg_dut1"
91 tg.vm.network "private_network", type: "dhcp", auto_config: false,
92 virtualbox__intnet: "tg_dut2"
93 tg.vm.provider "virtualbox" do |vb|
95 vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
96 vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"]
101 add_dut(config, "dut1", "192.168.255.101/24", "tg_dut1", "dut1_dut2")
102 add_dut(config, "dut2", "192.168.255.102/24", "tg_dut2", "dut1_dut2")