forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
80 lines (65 loc) · 2.91 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Copyright 2019 Orange
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
$script = <<SCRIPT
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install git python-pip fuse libfuse-dev dh-autoreconf openssl libssl-dev cmake libpcap-dev python-yaml
SCRIPT
$switch_script = <<SWITCH_SCRIPT
/vagrant/setup-switch.sh
SWITCH_SCRIPT
$pktgen_script = <<PKTGEN_SCRIPT
/vagrant/setup-pktgen.sh
PKTGEN_SCRIPT
Vagrant.configure("2") do |config|
config.vm.boot_timeout = 600
# Configure switch, i.e., device under test (DUT)
config.vm.define "switch" do |switch|
switch.vm.box = "ubuntu/xenial64"
switch.vm.network "private_network", ip: "172.16.0.10", netmask: "255.255.255.0", virtualbox__intnet: "sw-up"
switch.vm.network "private_network", ip: "172.16.0.11", netmask: "255.255.255.0", virtualbox__intnet: "sw-down"
switch.vm.network "private_network", ip: "192.168.100.10"
switch.vm.provider "virtualbox" do |virtualbox|
# Customize the amount of memory on the VM:
virtualbox.memory = "16296"
virtualbox.cpus = "4"
# Enable promiscuous mode
virtualbox.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
virtualbox.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
end
# Setup switch
switch.vm.provision "shell", inline: $switch_script
end
# Configure generator
config.vm.define "generator" do |generator|
generator.vm.box = "ubuntu/xenial64"
generator.vm.network "private_network", ip: "172.16.0.12", netmask: "255.255.255.0", virtualbox__intnet: "sw-up"
generator.vm.network "private_network", ip: "172.16.0.13", netmask: "255.255.255.0", virtualbox__intnet: "sw-down"
generator.vm.network "private_network", ip: "192.168.100.20"
generator.vm.provider "virtualbox" do |virtualbox|
# Customize the amount of memory on the VM:
virtualbox.memory = "4096"
virtualbox.cpus = "4"
# Enable promiscuous mode
virtualbox.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"]
virtualbox.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"]
end
# Setup generator
generator.vm.provision "shell", inline: $pktgen_script
end
# Install essentials
config.vm.provision "shell", inline: $script
end