4 # Vagrantfile API/syntax version.
5 VAGRANTFILE_API_VERSION = "2"
7 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
9 # Configure VM RAM and CPU for VirtualBox. Change this to meet your needs.
10 config.vm.provider :virtualbox do |virtualbox|
11 virtualbox.memory = 4096
15 # Configure VM RAM and CPU for LibVirt. Change this to meet your needs.
16 config.vm.provider :libvirt do |libvirt|
21 # NFS is fragile, disable it and use rsync
22 config.nfs.functional = false
24 # Box that installs the L2switch Tutorial
25 config.vm.define "l2switch" do |l2switch|
26 # Build Vagrant box based on Fedora 26
27 l2switch.vm.box = "fedora/26-cloud-base"
29 # Forward ODL's web GUI (DLUX) port so it's accessible on the host machine
30 l2switch.vm.network "forwarded_port", guest: 8181, host: 8181
32 # Add ODL RPM repo config to correct location in box filesystem
33 # Repo configs are provided by upstream OpenDaylight Integration/Packaging
34 l2switch.vm.provision "shell", inline: "curl --silent -o /etc/yum.repos.d/opendaylight-6-release.repo \"https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=blob_plain;f=packages/rpm/example_repo_configs/opendaylight-6-release.repo;hb=refs/heads/master\""
36 # Install ODL using the RPM repo config added above
37 l2switch.vm.provision "shell", inline: "dnf install -y opendaylight"
39 # Start ODL's service via systemd
40 l2switch.vm.provision "shell", inline: "systemctl start opendaylight"
42 # Modify bashrc to set JAVA path
43 l2switch.vm.provision "shell", inline: "echo 'export JAVA_HOME=/usr/lib/jvm/default-java' >> /etc/bashrc"
45 # Install git and sshpass
46 l2switch.vm.provision "shell", inline: "dnf install -y git sshpass"
48 # Install ODL Karaf features required for DLUX and L2Switch
49 # Config management tools do this by adding features to featuresBoot in
50 # /opt/opendaylight/etc/org.apache.karaf.features.cfg
51 # A human user would typically SSH into ODL's Karaf shell, as we're demoing
52 l2switch.vm.provision "shell", inline: "sshpass -p karaf ssh -tt -p 8101 -o StrictHostKeyChecking=no karaf@localhost feature:install odl-l2switch-switch-ui"
54 # Install Open vSwitch
55 l2switch.vm.provision "shell", inline: "dnf install -y openvswitch"
58 l2switch.vm.provision "shell", inline: "sudo /usr/share/openvswitch/scripts/ovs-ctl restart"
61 l2switch.vm.provision "shell", inline: "git clone git://github.com/mininet/mininet"
62 l2switch.vm.provision "shell", inline: "cd mininet;git checkout -b 2.2.1 2.2.1;cd .."
63 l2switch.vm.provision "shell", inline: "mininet/util/install.sh -nf"
65 # Create a sample Mininet Topology using mininet.py
66 l2switch.vm.provision "shell", path: "mininet.py"