blob: c67ae92616b221452b43da4123767b220141d6c6 [file] [log] [blame]
# -*- mode: ruby -*-
# vi: set ft=ruby :
$tools = <<SCRIPT
zypper addrepo --no-gpgcheck https://download.opensuse.org/repositories/utilities/openSUSE_Leap_42.3/utilities.repo
zypper addrepo --no-gpgcheck https://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_Leap_42.3/devel:languages:nodejs.repo
zypper refresh
zypper update -y
zypper install -y llvm-clang git cmake
zypper install -y pcre-devel python3-devel swig
zypper install -y openssl libopenssl-devel libssh-devel
zypper install -y libffi-devel npm8 python3-pip python3-Flask
zypper install -y protobuf-c libev-devel
SCRIPT
$libyang = <<SCRIPT
rm -rf libyang
git clone -b devel https://github.com/CESNET/libyang.git
cd libyang; mkdir build; cd build
cmake -DGEN_LANGUAGE_BINDINGS=ON .. && make && make install
cd ../..
ldconfig
SCRIPT
$libnetconf2 = <<SCRIPT
rm -rf libnetconf2
git clone -b devel https://github.com/CESNET/libnetconf2.git
cd libnetconf2; mkdir build; cd build
cmake -DENABLE_PYTHON=ON .. && make && make install
cd ../..
ldconfig
SCRIPT
$redblack = <<SCRIPT
rm -rf libredblack
git clone https://github.com/sysrepo/libredblack.git
cd libredblack; ./configure && make && make install
cd ..
ldconfig
SCRIPT
$sysrepo = <<SCRIPT
rm -rf sysrepo
git clone -b devel https://github.com/sysrepo/sysrepo.git
cd sysrepo; mkdir build; cd build
cmake -DGEN_LANGUAGE_BINDINGS=OFF .. && make && make install
cd ../..
ldconfig
SCRIPT
$netopeer = <<SCRIPT
rm -rf Netopeer2
git clone -b devel-server https://github.com/CESNET/Netopeer2.git
cd Netopeer2/keystored; mkdir build; cd build
cmake .. && make && make install
cd ../../server; mkdir build; cd build
cmake .. && make && make install
cd ../../..
chown -R vagrant:vagrant ./sysrepo/build/repository
SCRIPT
$liberoutergui = <<SCRIPT
rm -rf liberouter-gui
git clone -b devel https://github.com/CESNET/liberouter-gui.git
ln -s /home/vagrant/Netopeer2GUI liberouter-gui/modules/netopeer
cd liberouter-gui
cp -f modules/netopeer/app.config.json modules/
python3 ./bootstrap.py
pip3 install --upgrade pip
pip3 install -r backend/requirements.txt
cd frontend
npm install --unsafe-perm -g @angular/cli
npm install --unsafe-perm
cd ../..
SCRIPT
$backend = <<SCRIPT
cd liberouter-gui
python3 backend > backend.log 2>&1 &
cd ..
SCRIPT
$frontend = <<SCRIPT
cd liberouter-gui/frontend
/usr/local/bin/ng serve --preserve-symlinks --host 0.0.0.0 --proxy proxy.json > ../frontend.log 2>&1 &
cd ../..
SCRIPT
$netconf = <<SCRIPT
/usr/local/bin/sysrepod -d > sysrepod.log 2>&1 &
/home/vagrant/sysrepo/build/examples/application_example turing-machine > turing-machine.log 2>&1 &
/usr/local/bin/netopeer2-server -d > netopeer2.log 2>&1 &
SCRIPT
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
Vagrant.configure("2") do |config|
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
vb.customize ["modifyvm", :id, "--audio", "none"]
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
end
config.vm.define "Netopeer2GUI" do |gui|
gui.vm.synced_folder "../../", "/home/vagrant/Netopeer2GUI", create: true
gui.vm.box = "opensuse/openSUSE-42.3-x86_64"
gui.vm.network "forwarded_port", host: "4200", guest: "4200", auto_correct: true
gui.vm.network "forwarded_port", host: "8830", host_ip: "127.0.0.1", guest: "830", auto_correct: true
gui.ssh.shell = "sh"
gui.vm.provision :shell, inline: $tools
gui.vm.provision :shell, inline: $libyang
gui.vm.provision :shell, inline: $libnetconf2
gui.vm.provision :shell, inline: $redblack
gui.vm.provision :shell, inline: $sysrepo
gui.vm.provision :shell, inline: $netopeer
gui.vm.provision :shell, inline: $liberoutergui
gui.vm.provision :shell, inline: $netconf, run: "always"
gui.vm.provision :shell, inline: $backend, run: "always"
gui.vm.provision :shell, inline: $frontend, run: "always"
end
end