summaryrefslogtreecommitdiffstats
path: root/kud/tests/cFW/Vagrantfile
diff options
context:
space:
mode:
Diffstat (limited to 'kud/tests/cFW/Vagrantfile')
-rw-r--r--kud/tests/cFW/Vagrantfile93
1 files changed, 72 insertions, 21 deletions
diff --git a/kud/tests/cFW/Vagrantfile b/kud/tests/cFW/Vagrantfile
index d02e7d01..de0031cd 100644
--- a/kud/tests/cFW/Vagrantfile
+++ b/kud/tests/cFW/Vagrantfile
@@ -1,33 +1,84 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
+##############################################################################
+# Copyright (c) 2020
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+$no_proxy = ENV['NO_PROXY'] || ENV['no_proxy'] || "127.0.0.1,localhost"
+# NOTE: This range is based on vagrant-libvirt network definition CIDR 192.168.121.0/24
+(1..254).each do |i|
+ $no_proxy += ",192.168.121.#{i}"
+end
+$no_proxy += ",10.0.2.15"
+$socks_proxy = ENV['socks_proxy'] || ENV['SOCKS_PROXY'] || ""
Vagrant.configure("2") do |config|
- config.vm.box = "elastic/ubuntu-16.04-x86_64"
- config.vm.hostname = "demo"
- config.vm.provision 'shell', path: 'postinstall.sh'
- config.vm.network :private_network, :ip => "192.168.10.5", :type => :static # unprotected_private_net_cidr
- config.vm.network :private_network, :ip => "192.168.20.5", :type => :static # protected_private_net_cidr
- config.vm.network :private_network, :ip => "10.10.12.5", :type => :static, :netmask => "16" # onap_private_net_cidr
+ config.vm.provider :libvirt
+ config.vm.provider :virtualbox
- if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil
- if not Vagrant.has_plugin?('vagrant-proxyconf')
- system 'vagrant plugin install vagrant-proxyconf'
- raise 'vagrant-proxyconf was installed but it requires to execute again'
+ config.vm.box = "generic/ubuntu1804"
+ config.vm.box_version = "3.0.8"
+ config.vm.synced_folder './', '/vagrant'
+
+ [:virtualbox, :libvirt].each do |provider|
+ config.vm.provider provider do |p|
+ p.cpus = 2
+ p.memory = 4096
end
- config.proxy.http = ENV['http_proxy'] || ENV['HTTP_PROXY'] || ""
- config.proxy.https = ENV['https_proxy'] || ENV['HTTPS_PROXY'] || ""
- config.proxy.no_proxy = ENV['NO_PROXY'] || ENV['no_proxy'] || "127.0.0.1,localhost"
- config.proxy.enabled = { docker: false }
end
- config.vm.provider 'virtualbox' do |v|
- v.customize ["modifyvm", :id, "--memory", 8192]
- v.customize ["modifyvm", :id, "--cpus", 2]
+ config.vm.provider "virtualbox" do |v|
+ v.gui = false
end
- config.vm.provider 'libvirt' do |v|
- v.memory = 8192
- v.cpus = 2
- v.nested = true
+
+ config.vm.provider :libvirt do |v|
v.cpu_mode = 'host-passthrough'
+ v.random_hostname = true
+ v.management_network_address = "192.168.121.0/24"
end
+
+ if ENV['http_proxy'] != nil and ENV['https_proxy'] != nil
+ if Vagrant.has_plugin?('vagrant-proxyconf')
+ config.proxy.http = ENV['http_proxy'] || ENV['HTTP_PROXY'] || ""
+ config.proxy.https = ENV['https_proxy'] || ENV['HTTPS_PROXY'] || ""
+ config.proxy.no_proxy = $no_proxy
+ config.proxy.enabled = { docker: false, git: false }
+ end
+ end
+ # Install requirements
+ config.vm.provision 'shell', privileged: false, inline: <<-SHELL
+ source /etc/os-release || source /usr/lib/os-release
+ case ${ID,,} in
+ ubuntu|debian)
+ sudo apt-get update
+ sudo apt-get install -y -qq -o=Dpkg::Use-Pty=0 curl
+ ;;
+ esac
+ # NOTE: Shorten link -> https://github.com/electrocucaracha/pkg-mgr_scripts
+ curl -fsSL http://bit.ly/install_pkg | PKG="docker docker-compose" bash
+ SHELL
+
+ # Deploy services
+ config.vm.provision 'shell', inline: <<-SHELL
+ set -o pipefail
+ set -o errexit
+
+ cd /vagrant
+ docker network create --subnet 10.10.0.0/16 --opt com.docker.network.bridge.name=docker_gwbridge docker_gwbridge
+ docker swarm init --advertise-addr 10.0.2.15
+ docker build --no-cache -t vpp vpp/
+ docker-compose up -d
+ docker image prune --force
+ #curl -X PUT \
+ # -H "Authorization: Basic YWRtaW46YWRtaW4=" \
+ # -H "Content-Type: application/json" \
+ # -H "Cache-Control: no-cache" \
+ # -d '{"pg-streams":{"pg-stream": [{"id":"fw_udp1", "is-enabled":"true"},{"id":"fw_udp2", "is-enabled":"true"},{"id":"fw_udp3", "is-enabled":"true"},{"id":"fw_udp4", "is-enabled":"true"},{"id":"fw_udp5", "is-enabled":"true"}]}}' \
+ # "http://127.0.0.1:8083/restconf/config/sample-plugin:sample-plugin/pg-streams"
+ SHELL
+ config.vm.network :forwarded_port, guest: 8080, host: 8080
end