summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuya Kusakabe <yuya.kusakabe@gmail.com>2017-07-22 22:31:25 +0900
committerYuya Kusakabe <yuya.kusakabe@gmail.com>2017-07-22 22:31:25 +0900
commitef1952b6d89f2326c56932bfc07e19ff7f713a01 (patch)
tree127561d1a75566c99855a6daf2faea8f55a8cfb0
parent2462c51c199bef49b6e3673dfd5d6168983340b9 (diff)
downloadvyos-integration-test-ef1952b6d89f2326c56932bfc07e19ff7f713a01.tar.gz
vyos-integration-test-ef1952b6d89f2326c56932bfc07e19ff7f713a01.zip
Run script with vyattacfg group
-rw-r--r--.gitignore1
-rw-r--r--Gemfile1
-rw-r--r--Rakefile3
-rw-r--r--Vagrantfile7
-rw-r--r--spec/bgp4/config.yaml12
-rw-r--r--spec/bgp4/vyos1_script.sh4
-rw-r--r--spec/bgp4/vyos2_script.sh4
-rw-r--r--spec/bgp4/vyos3_script.sh4
-rw-r--r--spec/bgp4/vyos4_script.sh4
-rw-r--r--spec/bgp6/vyos1_script.sh4
-rw-r--r--spec/bgp6/vyos2_script.sh4
-rw-r--r--spec/bgp6/vyos3_script.sh4
-rw-r--r--spec/bgp6/vyos4_script.sh4
-rw-r--r--spec/interface_script.erb4
-rw-r--r--spec/one_node/vyos_script.sh4
-rw-r--r--spec/site_to_site_vpn/config.yaml12
-rw-r--r--spec/site_to_site_vpn/vyos1_script.sh4
-rw-r--r--spec/site_to_site_vpn/vyos2_script.sh4
-rw-r--r--spec/site_to_site_vpn/vyos3_script.sh4
-rw-r--r--spec/site_to_site_vpn/vyos4_script.sh4
20 files changed, 78 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index d333f0f..bcd9b98 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,4 @@ tmp
.rbenv-gemsets
.vagrant
.rake_tasks~
+*_interface.sh
diff --git a/Gemfile b/Gemfile
index 0c5e2c2..18f6659 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,5 +1,6 @@
source 'https://rubygems.org'
gem 'rake'
+gem 'rspec_junit_formatter'
gem 'serverspec'
gem 'serverspec-vyos-config'
diff --git a/Rakefile b/Rakefile
index cc8bfb1..5a16412 100644
--- a/Rakefile
+++ b/Rakefile
@@ -41,6 +41,9 @@ namespace :spec do
RSpec::Core::RakeTask.new(host.to_sym) do |t|
ENV['TARGET_TEST'] = test
ENV['TARGET_HOST'] = host
+ if ENV['CI_FLAG']
+ t.rspec_opts = "--format RspecJunitFormatter --out ../report/serverspec/results_#{test}_#{host}.xml"
+ end
t.pattern = "spec/#{test}/#{host}_spec.rb"
end
end
diff --git a/Vagrantfile b/Vagrantfile
index f119ff4..e353eaf 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -17,8 +17,9 @@ Vagrant.configure('2') do |config|
end
configs.keys.each do |host|
config.vm.define host.to_sym do |c|
- c.vm.box = 'higebu/vyos'
+ c.vm.box = ENV['VYOS_VAGRANT_BOX'] || 'higebu/vyos'
c.vm.synced_folder './', '/vagrant',
+ type: "rsync",
owner: 'vagrant',
group: 'vyattacfg',
mount_options: ['dmode=775,fmode=775']
@@ -36,7 +37,9 @@ Vagrant.configure('2') do |config|
$script = ERB.new(File.read('../interface_script.erb')).result(binding)
end
if !$script.empty?
- c.vm.provision 'shell', inline: $script
+ File.write("#{host}_interface.sh", $script)
+ c.vm.provision 'file', source: "#{host}_interface.sh", destination: "/tmp/#{host}_interface.sh"
+ c.vm.provision 'shell', path: "#{host}_interface.sh"
end
c.vm.provision 'shell', path: "#{host}_script.sh"
end
diff --git a/spec/bgp4/config.yaml b/spec/bgp4/config.yaml
index 01178dc..35406da 100644
--- a/spec/bgp4/config.yaml
+++ b/spec/bgp4/config.yaml
@@ -1,15 +1,15 @@
---
vyos1:
:networks:
- net1: "10.0.1.11"
- net2: "10.0.2.11"
+ net1: "10.0.1.11/24"
+ net2: "10.0.2.11/24"
vyos2:
:networks:
- net1: "10.0.1.12"
- net3: "10.0.3.11"
+ net1: "10.0.1.12/24"
+ net3: "10.0.3.11/24"
vyos3:
:networks:
- net2: "10.0.2.13"
+ net2: "10.0.2.13/24"
vyos4:
:networks:
- net3: "10.0.3.14"
+ net3: "10.0.3.14/24"
diff --git a/spec/bgp4/vyos1_script.sh b/spec/bgp4/vyos1_script.sh
index 3adbc0f..3767236 100644
--- a/spec/bgp4/vyos1_script.sh
+++ b/spec/bgp4/vyos1_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols bgp 65536 neighbor 10.0.1.12 ebgp-multihop 2
diff --git a/spec/bgp4/vyos2_script.sh b/spec/bgp4/vyos2_script.sh
index 1be2c7e..7cb0586 100644
--- a/spec/bgp4/vyos2_script.sh
+++ b/spec/bgp4/vyos2_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols bgp 65537 neighbor 10.0.1.11 ebgp-multihop 2
diff --git a/spec/bgp4/vyos3_script.sh b/spec/bgp4/vyos3_script.sh
index e443225..3db2539 100644
--- a/spec/bgp4/vyos3_script.sh
+++ b/spec/bgp4/vyos3_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols static route 10.0.3.0/24 next-hop 10.0.2.11
diff --git a/spec/bgp4/vyos4_script.sh b/spec/bgp4/vyos4_script.sh
index ec45e72..df048bb 100644
--- a/spec/bgp4/vyos4_script.sh
+++ b/spec/bgp4/vyos4_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols static route 10.0.2.0/24 next-hop 10.0.3.11
diff --git a/spec/bgp6/vyos1_script.sh b/spec/bgp6/vyos1_script.sh
index 51dbac9..67e4624 100644
--- a/spec/bgp6/vyos1_script.sh
+++ b/spec/bgp6/vyos1_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols bgp 65536 neighbor fd00:5679:4f53:1::c ebgp-multihop 2
diff --git a/spec/bgp6/vyos2_script.sh b/spec/bgp6/vyos2_script.sh
index e6c9187..ea4c67c 100644
--- a/spec/bgp6/vyos2_script.sh
+++ b/spec/bgp6/vyos2_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols bgp 65537 neighbor fd00:5679:4f53:1::b ebgp-multihop 2
diff --git a/spec/bgp6/vyos3_script.sh b/spec/bgp6/vyos3_script.sh
index 1016f55..4fd8d3e 100644
--- a/spec/bgp6/vyos3_script.sh
+++ b/spec/bgp6/vyos3_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols static route6 fd00:5679:4f53:3::/64 next-hop fd00:5679:4f53:2::b
diff --git a/spec/bgp6/vyos4_script.sh b/spec/bgp6/vyos4_script.sh
index 4354cb4..fa1cd7e 100644
--- a/spec/bgp6/vyos4_script.sh
+++ b/spec/bgp6/vyos4_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols static route6 fd00:5679:4f53:2::/64 next-hop fd00:5679:4f53:3::b
diff --git a/spec/interface_script.erb b/spec/interface_script.erb
index d2000e7..1bfda78 100644
--- a/spec/interface_script.erb
+++ b/spec/interface_script.erb
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
<% configs[host][:networks].keys.each_with_index do |net, i| %>
diff --git a/spec/one_node/vyos_script.sh b/spec/one_node/vyos_script.sh
index edb0afe..2caa038 100644
--- a/spec/one_node/vyos_script.sh
+++ b/spec/one_node/vyos_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set system time-zone Asia/Tokyo
diff --git a/spec/site_to_site_vpn/config.yaml b/spec/site_to_site_vpn/config.yaml
index 01178dc..35406da 100644
--- a/spec/site_to_site_vpn/config.yaml
+++ b/spec/site_to_site_vpn/config.yaml
@@ -1,15 +1,15 @@
---
vyos1:
:networks:
- net1: "10.0.1.11"
- net2: "10.0.2.11"
+ net1: "10.0.1.11/24"
+ net2: "10.0.2.11/24"
vyos2:
:networks:
- net1: "10.0.1.12"
- net3: "10.0.3.11"
+ net1: "10.0.1.12/24"
+ net3: "10.0.3.11/24"
vyos3:
:networks:
- net2: "10.0.2.13"
+ net2: "10.0.2.13/24"
vyos4:
:networks:
- net3: "10.0.3.14"
+ net3: "10.0.3.14/24"
diff --git a/spec/site_to_site_vpn/vyos1_script.sh b/spec/site_to_site_vpn/vyos1_script.sh
index 8033692..32a2395 100644
--- a/spec/site_to_site_vpn/vyos1_script.sh
+++ b/spec/site_to_site_vpn/vyos1_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set vpn ipsec ike-group ike-g proposal 1 encryption aes256
diff --git a/spec/site_to_site_vpn/vyos2_script.sh b/spec/site_to_site_vpn/vyos2_script.sh
index 2e01140..61bd0df 100644
--- a/spec/site_to_site_vpn/vyos2_script.sh
+++ b/spec/site_to_site_vpn/vyos2_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set vpn ipsec ike-group ike-g proposal 1 encryption aes256
diff --git a/spec/site_to_site_vpn/vyos3_script.sh b/spec/site_to_site_vpn/vyos3_script.sh
index e443225..3db2539 100644
--- a/spec/site_to_site_vpn/vyos3_script.sh
+++ b/spec/site_to_site_vpn/vyos3_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols static route 10.0.3.0/24 next-hop 10.0.2.11
diff --git a/spec/site_to_site_vpn/vyos4_script.sh b/spec/site_to_site_vpn/vyos4_script.sh
index ec45e72..df048bb 100644
--- a/spec/site_to_site_vpn/vyos4_script.sh
+++ b/spec/site_to_site_vpn/vyos4_script.sh
@@ -1,5 +1,9 @@
#!/bin/vbash
+if [ "$(id -g -n)" != 'vyattacfg' ] ; then
+ exec sg vyattacfg -c "/bin/vbash $(readlink -f $0) $@"
+fi
+
source /opt/vyatta/etc/functions/script-template
set protocols static route 10.0.2.0/24 next-hop 10.0.3.11