hwchiu | 2639686 | 2017-12-27 22:10:34 +0800 | [diff] [blame] | 1 | # -*- mode: ruby -*- |
| 2 | # vi: set ft=ruby : |
| 3 | |
Andrea Campanella | 6adf002 | 2018-06-19 16:24:17 +0200 | [diff] [blame^] | 4 | required_plugins = %w(vagrant-reload vagrant-vbguest) |
| 5 | |
| 6 | plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin } |
| 7 | if not plugins_to_install.empty? |
| 8 | puts "Installing plugins: #{plugins_to_install.join(' ')}" |
| 9 | if system "vagrant plugin install #{plugins_to_install.join(' ')}" |
| 10 | exec "vagrant #{ARGV.join(' ')}" |
| 11 | else |
| 12 | abort "Installation of one or more plugins has failed. Aborting." |
| 13 | end |
| 14 | end |
| 15 | |
hwchiu | 2639686 | 2017-12-27 22:10:34 +0800 | [diff] [blame] | 16 | Vagrant.configure("2") do |config| |
| 17 | config.vm.box = "ubuntu/xenial64" |
Andrea Campanella | 6adf002 | 2018-06-19 16:24:17 +0200 | [diff] [blame^] | 18 | config.vm.box_version = "20180717.0.0" |
hwchiu | 2639686 | 2017-12-27 22:10:34 +0800 | [diff] [blame] | 19 | config.vm.hostname = 'trellis-example' |
Andrea Campanella | 0a21956 | 2018-07-04 14:51:35 +0200 | [diff] [blame] | 20 | config.ssh.forward_agent = true |
| 21 | config.ssh.forward_x11 = true |
hwchiu | 2639686 | 2017-12-27 22:10:34 +0800 | [diff] [blame] | 22 | |
| 23 | config.vm.provision "shell", privileged: false, inline: <<-SHELL |
| 24 | set -e -x -u |
| 25 | sudo apt-get update |
| 26 | sudo apt-get install -y gawk texinfo python-pip build-essential iptables automake autoconf libtool mininet isc-dhcp-server |
Andrea Campanella | 0a21956 | 2018-07-04 14:51:35 +0200 | [diff] [blame] | 27 | sudo DEBIAN_FRONTEND=noninteractive apt-get -yq install wireshark |
hwchiu | 2639686 | 2017-12-27 22:10:34 +0800 | [diff] [blame] | 28 | sudo pip install -U pip |
| 29 | sudo pip install ipaddress |
| 30 | git clone -b onos-1.11 https://gerrit.opencord.org/quagga |
| 31 | cd quagga |
| 32 | ./bootstrap.sh |
| 33 | ./configure --enable-fpm --sbindir=/usr/lib/quagga enable_user=root enable_group=root |
| 34 | make |
| 35 | sudo make install |
| 36 | cd .. |
| 37 | |
| 38 | sudo /etc/init.d/apparmor stop |
| 39 | sudo ln -s /etc/apparmor.d/usr.sbin.dhcpd /etc/apparmor.d/disable/ |
| 40 | sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.dhcpd |
| 41 | sudo sed -i '30i /var/lib/dhcp{,3}/dhcpclient* lrw,' /etc/apparmor.d/sbin.dhclient |
| 42 | sudo /etc/init.d/apparmor start |
| 43 | |
| 44 | git clone https://gerrit.onosproject.org/routing |
| 45 | |
| 46 | sudo ldconfig |
Andrea Campanella | 6adf002 | 2018-06-19 16:24:17 +0200 | [diff] [blame^] | 47 | |
| 48 | mkdir 4.15 && cd 4.15 |
| 49 | wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500_4.15.0-041500.201802011154_all.deb |
| 50 | wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-headers-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb |
| 51 | wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.15/linux-image-4.15.0-041500-generic_4.15.0-041500.201802011154_amd64.deb |
| 52 | sudo dpkg -i *.deb |
| 53 | SHELL |
| 54 | |
| 55 | config.vm.provision :reload |
| 56 | |
| 57 | config.vm.provision "shell", privileged: true, inline: <<-SHELL |
| 58 | /etc/init.d/openvswitch-switch stop |
| 59 | cd /tmp |
| 60 | wget http://openvswitch.org/releases/openvswitch-2.9.2.tar.gz |
| 61 | tar zxvf openvswitch-2.9.2.tar.gz |
| 62 | cd openvswitch-2.9.2 |
| 63 | ./configure --prefix=/usr --with-linux=/lib/modules/`uname -r`/build |
| 64 | make |
| 65 | make install |
| 66 | make modules_install |
| 67 | rmmod openvswitch |
| 68 | depmod -a |
| 69 | /etc/init.d/openvswitch-switch start |
| 70 | rm -rf /tmp/openvswitch-2.9.2* |
| 71 | ovs-vsctl set Open_vSwitch . other_config:vlan-limit=2 |
| 72 | SHELL |
hwchiu | 2639686 | 2017-12-27 22:10:34 +0800 | [diff] [blame] | 73 | |
| 74 | config.vm.provider :virtualbox do |v| |
| 75 | v.customize ["modifyvm", :id, "--cpus", 2] |
| 76 | # enable this when you want to have more memory |
| 77 | # v.customize ["modifyvm", :id, "--memory", 4096] |
| 78 | v.customize ['modifyvm', :id, '--nicpromisc1', 'allow-all'] |
| 79 | end |
| 80 | end |