Update RPM repo cfg file URL
[integration/packaging.git] / tutorials / l2switch / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 # Vagrantfile API/syntax version.
5 VAGRANTFILE_API_VERSION = "2"
6
7 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
8
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
12     virtualbox.cpus = 1
13   end
14
15   # Configure VM RAM and CPU for LibVirt. Change this to meet your needs.
16   config.vm.provider :libvirt do |libvirt|
17     libvirt.memory = 4096
18     libvirt.cpus = 1
19   end
20
21   # NFS is fragile, disable it and use rsync
22   config.nfs.functional = false
23
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"
28
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
31
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\""
35
36     # Install ODL using the RPM repo config added above
37     l2switch.vm.provision "shell", inline: "dnf install -y opendaylight"
38
39     # Start ODL's service via systemd
40     l2switch.vm.provision "shell", inline: "systemctl start opendaylight"
41
42     # Modify bashrc to set JAVA path
43     l2switch.vm.provision "shell", inline: "echo 'export JAVA_HOME=/usr/lib/jvm/default-java' >> /etc/bashrc"
44
45     # Install git and sshpass
46     l2switch.vm.provision "shell", inline: "dnf install -y git sshpass"
47
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"
53
54     # Install Open vSwitch
55     l2switch.vm.provision "shell", inline: "dnf install -y openvswitch"
56
57     # Start Open vSwitch
58     l2switch.vm.provision "shell", inline: "sudo /usr/share/openvswitch/scripts/ovs-ctl restart"
59
60     # Install Mininet
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"
64
65     # Create a sample Mininet Topology using mininet.py
66     l2switch.vm.provision "shell", path: "mininet.py"
67   end
68 end