summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuya Kusakabe <yuya.kusakabe@gmail.com>2017-01-13 16:20:14 +0900
committerYuya Kusakabe <yuya.kusakabe@gmail.com>2017-01-13 16:22:15 +0900
commit09c39086238bbc927cf63d2f9871661239fcbf64 (patch)
tree9239bff5579381453cd18cc2faf0bab912d51d35
parent24008e5494f9aa52474fd9492bbe8a189a8dfb00 (diff)
downloadvyos-integration-test-09c39086238bbc927cf63d2f9871661239fcbf64.tar.gz
vyos-integration-test-09c39086238bbc927cf63d2f9871661239fcbf64.zip
Add bgp4 test
-rw-r--r--spec/bgp4/Vagrantfile36
-rw-r--r--spec/bgp4/config.yaml15
-rw-r--r--spec/bgp4/vyos1_script.sh13
-rw-r--r--spec/bgp4/vyos1_spec.rb4
-rw-r--r--spec/bgp4/vyos2_script.sh13
-rw-r--r--spec/bgp4/vyos2_spec.rb4
-rw-r--r--spec/bgp4/vyos3_script.sh8
-rw-r--r--spec/bgp4/vyos3_spec.rb11
-rw-r--r--spec/bgp4/vyos4_script.sh8
-rw-r--r--spec/bgp4/vyos4_spec.rb11
10 files changed, 123 insertions, 0 deletions
diff --git a/spec/bgp4/Vagrantfile b/spec/bgp4/Vagrantfile
new file mode 100644
index 0000000..a218807
--- /dev/null
+++ b/spec/bgp4/Vagrantfile
@@ -0,0 +1,36 @@
+require 'yaml'
+
+configs = YAML.load_file('config.yaml')
+
+Vagrant.configure('2') do |config|
+ config.vm.provider :libvirt do |libvirt|
+ cpuinfo = File.read('/proc/cpuinfo')
+ if cpuinfo =~ /vmx|svm/
+ libvirt.cpu_mode = 'host-passthrough'
+ else
+ libvirt.driver = 'qemu'
+ libvirt.cpu_mode = 'custom'
+ libvirt.cpu_model = 'Nehalem'
+ libvirt.cpu_feature name: 'vmx', policy: 'force'
+ end
+ end
+ configs.keys.each do |host|
+ config.vm.define host.to_sym do |c|
+ c.vm.box = 'higebu/vyos'
+ c.vm.synced_folder './', '/vagrant',
+ owner: 'vagrant',
+ group: 'vyattacfg',
+ mount_options: ['dmode=775,fmode=775']
+ c.vm.hostname = host
+ if !configs[host].nil? && configs[host].key?(:networks)
+ configs[host][:networks].keys.each do |net|
+ c.vm.network :private_network,
+ ip: configs[host][:networks][net],
+ libvirt__network_name: net,
+ libvirt__dhcp_enabled: false
+ end
+ end
+ c.vm.provision 'shell', path: "#{host}_script.sh"
+ end
+ end
+end
diff --git a/spec/bgp4/config.yaml b/spec/bgp4/config.yaml
new file mode 100644
index 0000000..01178dc
--- /dev/null
+++ b/spec/bgp4/config.yaml
@@ -0,0 +1,15 @@
+---
+vyos1:
+ :networks:
+ net1: "10.0.1.11"
+ net2: "10.0.2.11"
+vyos2:
+ :networks:
+ net1: "10.0.1.12"
+ net3: "10.0.3.11"
+vyos3:
+ :networks:
+ net2: "10.0.2.13"
+vyos4:
+ :networks:
+ net3: "10.0.3.14"
diff --git a/spec/bgp4/vyos1_script.sh b/spec/bgp4/vyos1_script.sh
new file mode 100644
index 0000000..3adbc0f
--- /dev/null
+++ b/spec/bgp4/vyos1_script.sh
@@ -0,0 +1,13 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+set protocols bgp 65536 neighbor 10.0.1.12 ebgp-multihop 2
+set protocols bgp 65536 neighbor 10.0.1.12 remote-as 65537
+set protocols bgp 65536 neighbor 10.0.1.12 update-source 10.0.1.11
+set protocols bgp 65536 neighbor 10.0.1.12 advertisement-interval 1
+set protocols bgp 65536 network 10.0.2.0/24
+set protocols bgp 65536 parameters router-id 10.0.1.11
+
+commit
+save
diff --git a/spec/bgp4/vyos1_spec.rb b/spec/bgp4/vyos1_spec.rb
new file mode 100644
index 0000000..76740d4
--- /dev/null
+++ b/spec/bgp4/vyos1_spec.rb
@@ -0,0 +1,4 @@
+require_relative '../spec_helper'
+require_relative '../config_spec'
+
+config_spec
diff --git a/spec/bgp4/vyos2_script.sh b/spec/bgp4/vyos2_script.sh
new file mode 100644
index 0000000..1be2c7e
--- /dev/null
+++ b/spec/bgp4/vyos2_script.sh
@@ -0,0 +1,13 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+set protocols bgp 65537 neighbor 10.0.1.11 ebgp-multihop 2
+set protocols bgp 65537 neighbor 10.0.1.11 remote-as 65536
+set protocols bgp 65537 neighbor 10.0.1.11 update-source 10.0.1.12
+set protocols bgp 65537 neighbor 10.0.1.11 advertisement-interval 1
+set protocols bgp 65537 network 10.0.3.0/24
+set protocols bgp 65537 parameters router-id 10.0.1.12
+
+commit
+save
diff --git a/spec/bgp4/vyos2_spec.rb b/spec/bgp4/vyos2_spec.rb
new file mode 100644
index 0000000..76740d4
--- /dev/null
+++ b/spec/bgp4/vyos2_spec.rb
@@ -0,0 +1,4 @@
+require_relative '../spec_helper'
+require_relative '../config_spec'
+
+config_spec
diff --git a/spec/bgp4/vyos3_script.sh b/spec/bgp4/vyos3_script.sh
new file mode 100644
index 0000000..e443225
--- /dev/null
+++ b/spec/bgp4/vyos3_script.sh
@@ -0,0 +1,8 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+set protocols static route 10.0.3.0/24 next-hop 10.0.2.11
+
+commit
+save
diff --git a/spec/bgp4/vyos3_spec.rb b/spec/bgp4/vyos3_spec.rb
new file mode 100644
index 0000000..f4ae8b6
--- /dev/null
+++ b/spec/bgp4/vyos3_spec.rb
@@ -0,0 +1,11 @@
+require_relative '../spec_helper'
+require_relative '../config_spec'
+
+config_spec
+
+# Wait for advertising
+sleep(10)
+
+describe host('10.0.3.14') do
+ it { should be_reachable.with(timeout: 10) }
+end
diff --git a/spec/bgp4/vyos4_script.sh b/spec/bgp4/vyos4_script.sh
new file mode 100644
index 0000000..ec45e72
--- /dev/null
+++ b/spec/bgp4/vyos4_script.sh
@@ -0,0 +1,8 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+set protocols static route 10.0.2.0/24 next-hop 10.0.3.11
+
+commit
+save
diff --git a/spec/bgp4/vyos4_spec.rb b/spec/bgp4/vyos4_spec.rb
new file mode 100644
index 0000000..770fbd6
--- /dev/null
+++ b/spec/bgp4/vyos4_spec.rb
@@ -0,0 +1,11 @@
+require_relative '../spec_helper'
+require_relative '../config_spec'
+
+config_spec
+
+# Wait for advertising
+sleep(10)
+
+describe host('10.0.2.13') do
+ it { should be_reachable.with(timeout: 10) }
+end