Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit c47b0cf

Browse files
committed
Added vagrant script for creating VM
Follows instructions from pyretic VM, but programmatically!
1 parent a358120 commit c47b0cf

File tree

6 files changed

+86
-0
lines changed

6 files changed

+86
-0
lines changed

vagrant/Vagrantfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby :
3+
4+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5+
VAGRANTFILE_API_VERSION = "2"
6+
7+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8+
# All Vagrant configuration is done here. The most common configuration
9+
# options are documented and commented below. For a complete reference,
10+
# please see the online documentation at vagrantup.com.
11+
12+
config.vm.box = "saucy64"
13+
14+
# The url from where the 'config.vm.box' box will be fetched if it
15+
# doesn't already exist on the user's system.
16+
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box"
17+
18+
config.vm.provision :shell, :path => "bootstrap.sh"
19+
config.vm.provision :shell, privileged: false, :path => "setup-mininet.sh"
20+
config.vm.provision :shell, privileged: false, :path => "setup-pox.sh"
21+
config.vm.provision :shell, privileged: false, :path => "setup-pyretic.sh"
22+
config.vm.provision :shell, privileged: false, :path => "clean-shutdown.sh"
23+
24+
# Create a forwarded port mapping which allows access to a specific port
25+
# within the machine from a port on the host machine. In the example below,
26+
# accessing "localhost:8080" will access port 80 on the guest machine.
27+
# config.vm.network :forwarded_port, guest: 80, host: 8080
28+
29+
# If true, then any SSH connections made will enable agent forwarding.
30+
# Default value: false
31+
# config.ssh.forward_agent = true
32+
33+
config.vm.provider :virtualbox do |vb|
34+
# Don't boot with headless mode
35+
# vb.gui = true
36+
37+
# Use VBoxManage to customize the VM. For example to change memory:
38+
vb.customize ["modifyvm", :id, "--memory", "4096"]
39+
end
40+
41+
end

vagrant/bootstrap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
apt-get update
4+
apt-get install -y python-software-properties build-essential m4 python-networkx wireshark git

vagrant/clean-shutdown.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
# To be run before creating a VM image to share (to reduce space usage)
3+
4+
sudo cat /dev/zero > zero.fill; sudo sync; sleep 1; sudo sync; sudo rm -f zero.fill
5+
sudo shutdown -h now

vagrant/setup-mininet.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
git clone git://github.com/mininet/mininet
4+
pushd mininet
5+
git checkout -b 2.1.0 2.1.0
6+
# Install reference switch, kernel module, wireshark disector, openvswitch, mininet
7+
. util/install.sh -fmwvn

vagrant/setup-pox.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
git clone https://github.com/noxrepo/pox.git
4+
pushd pox
5+
git checkout bab636b

vagrant/setup-pyretic.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
sudo apt-get install -y python-dev python-pip screen hping3
4+
sudo pip install networkx bitarray netaddr ipaddr pytest ipdb
5+
6+
wget https://raw.github.com/frenetic-lang/pyretic/master/pyretic/backend/patch/asynchat.py
7+
sudo mv asynchat.py /usr/lib/python2.7/
8+
sudo chown root:root /usr/lib/python2.7/asynchat.py
9+
10+
11+
git clone https://github.com/git/git.git
12+
pushd git/contrib/subtree/
13+
git checkout v1.8.4
14+
make
15+
sudo install -m 755 git-subtree /usr/lib/git-core
16+
popd
17+
rm -rf git
18+
19+
git clone git://github.com/frenetic-lang/pyretic.git
20+
21+
echo "export PATH=$PATH:$HOME/pyretic:$HOME/pox\
22+
export PYTHONPATH=$HOME/pyretic:$HOME/mininet:$HOME/pox" >> ~/.profile
23+
24+
wget http://frenetic-lang.org/pyretic/useful/.screenrc

0 commit comments

Comments
 (0)