# -*- mode: ruby -*- # vi: set ft=ruby : # Vagrantfile API/syntax version. VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Configure VM RAM and CPU for VirtualBox. Change this to meet your needs. config.vm.provider :virtualbox do |virtualbox| virtualbox.memory = 4096 virtualbox.cpus = 1 end # Configure VM RAM and CPU for LibVirt. Change this to meet your needs. config.vm.provider :libvirt do |libvirt| libvirt.memory = 4096 libvirt.cpus = 1 end # NFS is fragile, disable it and use rsync config.nfs.functional = false # Box that installs the L2switch Tutorial config.vm.define "l2switch" do |l2switch| # Build Vagrant box based on Fedora 26 l2switch.vm.box = "fedora/26-cloud-base" # Forward ODL's web GUI (DLUX) port so it's accessible on the host machine l2switch.vm.network "forwarded_port", guest: 8181, host: 8181 # Add ODL RPM repo config to correct location in box filesystem # Repo configs are provided by upstream OpenDaylight Integration/Packaging 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\"" # Install ODL using the RPM repo config added above l2switch.vm.provision "shell", inline: "dnf install -y opendaylight" # Start ODL's service via systemd l2switch.vm.provision "shell", inline: "systemctl start opendaylight" # Modify bashrc to set JAVA path l2switch.vm.provision "shell", inline: "echo 'export JAVA_HOME=/usr/lib/jvm/default-java' >> /etc/bashrc" # Install git and sshpass l2switch.vm.provision "shell", inline: "dnf install -y git sshpass" # Install ODL Karaf features required for DLUX and L2Switch # Config management tools do this by adding features to featuresBoot in # /opt/opendaylight/etc/org.apache.karaf.features.cfg # A human user would typically SSH into ODL's Karaf shell, as we're demoing l2switch.vm.provision "shell", inline: "sshpass -p karaf ssh -tt -p 8101 -o StrictHostKeyChecking=no karaf@localhost feature:install odl-l2switch-switch-ui" # Install Open vSwitch l2switch.vm.provision "shell", inline: "dnf install -y openvswitch" # Start Open vSwitch l2switch.vm.provision "shell", inline: "sudo /usr/share/openvswitch/scripts/ovs-ctl restart" # Install Mininet l2switch.vm.provision "shell", inline: "git clone git://github.com/mininet/mininet" l2switch.vm.provision "shell", inline: "cd mininet;git checkout -b 2.2.1 2.2.1;cd .." l2switch.vm.provision "shell", inline: "mininet/util/install.sh -nf" # Create a sample Mininet Topology using mininet.py l2switch.vm.provision "shell", path: "mininet.py" end end