Radek Krejci | 2d03809 | 2017-11-09 11:08:51 +0100 | [diff] [blame^] | 1 | # -*- mode: ruby -*- |
| 2 | # vi: set ft=ruby : |
| 3 | |
| 4 | $tools = <<SCRIPT |
| 5 | zypper refresh |
| 6 | zypper update -y |
| 7 | zypper install -y llvm-clang git cmake |
| 8 | zypper install -y pcre-devel python3-devel swig |
| 9 | zypper install -y libssh-devel libopenssl-devel |
| 10 | zypper install -y libffi-devel npm8 python3-pip python3-Flask |
| 11 | zypper install -y protobuf-c libev-devel |
| 12 | SCRIPT |
| 13 | |
| 14 | $libyang = <<SCRIPT |
| 15 | rm -rf libyang |
| 16 | git clone -b devel https://github.com/CESNET/libyang.git |
| 17 | cd libyang; mkdir build; cd build |
| 18 | cmake -DGEN_LANGUAGE_BINDINGS=ON .. && make && make install |
| 19 | cd ../.. |
| 20 | ldconfig |
| 21 | SCRIPT |
| 22 | |
| 23 | $libnetconf2 = <<SCRIPT |
| 24 | rm -rf libnetconf2 |
| 25 | git clone -b devel https://github.com/CESNET/libnetconf2.git |
| 26 | cd libnetconf2; mkdir build; cd build |
| 27 | cmake -DENABLE_PYTHON=ON .. && make && make install |
| 28 | cd ../.. |
| 29 | ldconfig |
| 30 | SCRIPT |
| 31 | |
| 32 | $redblack = <<SCRIPT |
| 33 | rm -rf libredblack |
| 34 | git clone https://github.com/sysrepo/libredblack.git |
| 35 | cd libredblack; ./configure && make && make install |
| 36 | cd .. |
| 37 | ldconfig |
| 38 | SCRIPT |
| 39 | |
| 40 | $sysrepo = <<SCRIPT |
| 41 | rm -rf sysrepo |
| 42 | git clone -b devel https://github.com/sysrepo/sysrepo.git |
| 43 | cd sysrepo; mkdir build; cd build |
| 44 | cmake -DGEN_LANGUAGE_BINDINGS=OFF .. && make && make install |
| 45 | cd ../.. |
| 46 | ldconfig |
| 47 | SCRIPT |
| 48 | |
| 49 | $netopeer = <<SCRIPT |
| 50 | rm -rf Netopeer2 |
| 51 | git clone -b devel-server https://github.com/CESNET/Netopeer2.git |
| 52 | cd Netopeer2/keystored; mkdir build; cd build |
| 53 | cmake .. && make && make install |
| 54 | cd ../../server; mkdir build; cd build |
| 55 | cmake .. && make && make install |
| 56 | cd ../../.. |
| 57 | SCRIPT |
| 58 | |
| 59 | $liberoutergui = <<SCRIPT |
| 60 | rm -rf liberouter-gui |
| 61 | git clone https://github.com/CESNET/liberouter-gui.git |
| 62 | ln -s /home/vagrant/Netopeer2GUI liberouter-gui/modules/netopeer |
| 63 | cd liberouter-gui |
| 64 | python3 ./bootstrap.py |
| 65 | pip3 install -r backend/requirements.txt |
| 66 | cd frontend |
| 67 | npm install --unsafe-perm -g @angular/cli |
| 68 | npm install --unsafe-perm |
| 69 | cd ../.. |
| 70 | SCRIPT |
| 71 | |
| 72 | $backend = <<SCRIPT |
| 73 | cd liberouter-gui |
| 74 | python3 backend > backend.log 2>&1 & |
| 75 | cd .. |
| 76 | SCRIPT |
| 77 | |
| 78 | $frontend = <<SCRIPT |
| 79 | cd liberouter-gui/frontend |
| 80 | /usr/local/bin/ng serve --host 0.0.0.0 --proxy proxy.json > ../frontend.log 2>&1 & |
| 81 | cd ../.. |
| 82 | SCRIPT |
| 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 & |
| 88 | SCRIPT |
| 89 | |
| 90 | Vagrant.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 |
| 117 | end |