Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ dist
doc/html
doc/latex
trunk

.vagrant
13 changes: 13 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ like to contribute an installation script, we would welcome it!)
it's running on. Therefore, if you have a multiuser system, you
may wish to consider running Mininet in a VM.

1.1 Use a Vagrant VM

If you have Vagrant installed, you can also simply issue the `vagrant up`
command within the project root. This will download an Ubuntu base box
and customize it. By default, it clones the master branch of the Mininet
GitHub repo and checks out master.

This can be overridden by setting the environment variable `BRANCH`, i.e.,
`BRANCH=feat-1 vagrant up` to clone Mininet and check out the `feat-1`
branch.

To connect to the VM you can then type `vagrant ssh`.

2. Next-easiest option: use our Ubuntu package!

To install Mininet itself (i.e. `mn` and the Python API) on Ubuntu
Expand Down
21 changes: 21 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# The vagrant configuration for basic Mininet VMs.
# By default the configuraion will take any provider you have installed.
#
# The base image is an ubuntu 20.04, customised to have Mininet preinstalled.

Vagrant.configure("2") do |config|
config.vm.hostname = "mininet-vm"

config.vm.box = "generic/ubuntu2004"
config.vm.box_version = "3.6.8"

config.vm.provider :libvirt do |lv|
lv.title = "mininet"
lv.memory = "2048"
end

config.vm.provision "shell", path: "./util/vm/vagrant_provision.sh", args: ENV['BRANCH']
end
12 changes: 8 additions & 4 deletions util/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,10 @@ net.ipv6.conf.lo.disable_ipv6 = 1' | sudo tee -a /etc/sysctl.conf > /dev/null
$install vlan
fi

# Clear git changes
git config --global user.name "None"
git config --global user.email "None"

# Set git to colorize everything.
git config --global color.diff auto
git config --global color.status auto
Expand Down Expand Up @@ -826,11 +830,9 @@ exit 0

# Remove leftover install script if any
rm -f install-mininet-vm.sh
}

# Clear git changes
git config --global user.name "None"
git config --global user.email "None"

function zero_out {
# Note: you can shrink the .vmdk in vmware using
# vmware-vdiskmanager -k *.vmdk
echo "Zeroing out disk blocks for efficient compaction..."
Expand Down Expand Up @@ -869,6 +871,7 @@ function usage {
printf -- ' -w: install OpenFlow (W)ireshark dissector\n' >&2
printf -- ' -y: install R(y)u Controller\n' >&2
printf -- ' -x: install NO(X) Classic OpenFlow controller\n' >&2
printf -- ' -z: zero out /tmp\n' >&2
printf -- ' -0: (default) -0[fx] installs OpenFlow 1.0 versions\n' >&2
printf -- ' -3: -3[fx] installs OpenFlow 1.3 versions\n' >&2
exit 2
Expand Down Expand Up @@ -914,6 +917,7 @@ else
*) echo "Invalid OpenFlow version $OF_VERSION";;
esac;;
y) ryu;;
z) zero_out;;
0) OF_VERSION=1.0;;
3) OF_VERSION=1.3;;
?) usage;;
Expand Down
2 changes: 1 addition & 1 deletion util/vm/install-mininet-vm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ python --version || $APT install python-is-python3
time PYTHON=python2 mininet/util/install.sh -n
time PYTHON=python3 mininet/util/install.sh
# Finalize VM
time mininet/util/install.sh -tcd
time mininet/util/install.sh -tcdz
# Ignoring this since NOX classic is deprecated
#if ! grep NOX_CORE_DIR .bashrc; then
# echo "export NOX_CORE_DIR=~/noxcore/build/src/" >> .bashrc
Expand Down
34 changes: 34 additions & 0 deletions util/vm/vagrant_provision.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# This script is intended to install Mininet into
# a brand-new Ubuntu virtual machine,
# to create a fully usable "tutorial" VM.
#
# optional argument: Mininet branch to install

set -euo pipefail

# sudo apt-get -qq update && sudo apt-get -qq -y upgrade > /dev/null

sudo sed -i -e 's/Default/#Default/' /etc/sudoers
sudo sed -i -e 's/quiet/text/' /etc/default/grub
sudo update-grub

# Clean up vmware easy install junk if present
if [ -e /etc/issue.backup ]; then
sudo mv /etc/issue.backup /etc/issue
fi
if [ -e /etc/rc.local.backup ]; then
sudo mv /etc/rc.local.backup /etc/rc.local
fi

# Fetch Mininet
git clone https://github.com/mininet/mininet --branch "${1:-master}"

# Install Mininet for Python3
sudo apt-get -qq -y install python-is-python3
time PYTHON=python3 mininet/util/install.sh

# Finalize VM
time mininet/util/install.sh -tc
sudo mn --test pingall
echo "Done preparing Mininet VM."