blob: 58b4d04c2b2459b3553e18b424010d273bcf4478 [file] [log] [blame]
Radek Krejci2d038092017-11-09 11:08:51 +01001# -*- mode: ruby -*-
2# vi: set ft=ruby :
3
4$tools = <<SCRIPT
5zypper refresh
6zypper update -y
7zypper install -y llvm-clang git cmake
8zypper install -y pcre-devel python3-devel swig
9zypper install -y libssh-devel libopenssl-devel
10zypper install -y libffi-devel npm8 python3-pip python3-Flask
11zypper install -y protobuf-c libev-devel
12SCRIPT
13
14$libyang = <<SCRIPT
15rm -rf libyang
16git clone -b devel https://github.com/CESNET/libyang.git
17cd libyang; mkdir build; cd build
18cmake -DGEN_LANGUAGE_BINDINGS=ON .. && make && make install
19cd ../..
20ldconfig
21SCRIPT
22
23$libnetconf2 = <<SCRIPT
24rm -rf libnetconf2
25git clone -b devel https://github.com/CESNET/libnetconf2.git
26cd libnetconf2; mkdir build; cd build
27cmake -DENABLE_PYTHON=ON .. && make && make install
28cd ../..
29ldconfig
30SCRIPT
31
32$redblack = <<SCRIPT
33rm -rf libredblack
34git clone https://github.com/sysrepo/libredblack.git
35cd libredblack; ./configure && make && make install
36cd ..
37ldconfig
38SCRIPT
39
40$sysrepo = <<SCRIPT
41rm -rf sysrepo
42git clone -b devel https://github.com/sysrepo/sysrepo.git
43cd sysrepo; mkdir build; cd build
44cmake -DGEN_LANGUAGE_BINDINGS=OFF .. && make && make install
45cd ../..
46ldconfig
47SCRIPT
48
49$netopeer = <<SCRIPT
50rm -rf Netopeer2
51git clone -b devel-server https://github.com/CESNET/Netopeer2.git
52cd Netopeer2/keystored; mkdir build; cd build
53cmake .. && make && make install
54cd ../../server; mkdir build; cd build
55cmake .. && make && make install
56cd ../../..
57SCRIPT
58
59$liberoutergui = <<SCRIPT
60rm -rf liberouter-gui
61git clone https://github.com/CESNET/liberouter-gui.git
62ln -s /home/vagrant/Netopeer2GUI liberouter-gui/modules/netopeer
63cd liberouter-gui
64python3 ./bootstrap.py
65pip3 install -r backend/requirements.txt
66cd frontend
67npm install --unsafe-perm -g @angular/cli
68npm install --unsafe-perm
69cd ../..
70SCRIPT
71
72$backend = <<SCRIPT
73cd liberouter-gui
74python3 backend > backend.log 2>&1 &
75cd ..
76SCRIPT
77
78$frontend = <<SCRIPT
79cd liberouter-gui/frontend
80/usr/local/bin/ng serve --host 0.0.0.0 --proxy proxy.json > ../frontend.log 2>&1 &
81cd ../..
82SCRIPT
83
84$netconf = <<SCRIPT
85/usr/local/bin/sysrepod &
86/home/vagrant/sysrepo/build/examples/application_example turing-machine &
87/usr/local/bin/netopeer2-server &
88SCRIPT
89
90Vagrant.configure("2") do |config|
91 config.vm.provider :virtualbox do |vb|
92 vb.customize ["modifyvm", :id, "--memory", "1024"]
93 vb.customize ["modifyvm", :id, "--cpus", "1"]
94 vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
95 vb.customize ["modifyvm", :id, "--audio", "none"]
96 vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
97 end
98
99 config.vm.define "Netopeer2GUI" do |gui|
100 gui.vm.synced_folder "../../", "/home/vagrant/Netopeer2GUI", create: true
101 gui.vm.box = "opensuse/openSUSE-Tumbleweed-x86_64"
102 gui.vm.network "forwarded_port", host: "4200", guest: "4200", auto_correct: true
103 gui.vm.network "forwarded_port", host: "830", guest: "830", auto_correct: true
104 gui.ssh.shell = "sh"
105
106 gui.vm.provision :shell, inline: $tools
107 gui.vm.provision :shell, inline: $libyang
108 gui.vm.provision :shell, inline: $libnetconf2
109 gui.vm.provision :shell, inline: $redblack
110 gui.vm.provision :shell, inline: $sysrepo
111 gui.vm.provision :shell, inline: $netopeer
112 gui.vm.provision :shell, inline: $liberoutergui
113 gui.vm.provision :shell, inline: $netconf, run: "always"
114 gui.vm.provision :shell, inline: $backend, run: "always"
115 gui.vm.provision :shell, inline: $frontend, run: "always"
116 end
117end