summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/bgp6/Vagrantfile44
-rw-r--r--spec/bgp6/config.yaml15
-rw-r--r--spec/bgp6/vyos1_script.sh14
-rw-r--r--spec/bgp6/vyos1_spec.rb4
-rw-r--r--spec/bgp6/vyos2_script.sh14
-rw-r--r--spec/bgp6/vyos2_spec.rb4
-rw-r--r--spec/bgp6/vyos3_script.sh8
-rw-r--r--spec/bgp6/vyos3_spec.rb12
-rw-r--r--spec/bgp6/vyos4_script.sh8
-rw-r--r--spec/bgp6/vyos4_spec.rb11
-rw-r--r--spec/interface_script.erb10
11 files changed, 144 insertions, 0 deletions
diff --git a/spec/bgp6/Vagrantfile b/spec/bgp6/Vagrantfile
new file mode 100644
index 0000000..f119ff4
--- /dev/null
+++ b/spec/bgp6/Vagrantfile
@@ -0,0 +1,44 @@
+require 'erb'
+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
+
+ $script = ''
+ if !configs[host].nil? && configs[host].key?(:networks)
+ configs[host][:networks].keys.each do |net|
+ c.vm.network :private_network,
+ auto_config: false,
+ libvirt__network_name: net,
+ libvirt__dhcp_enabled: false,
+ libvirt__forward_mode: 'veryisolated'
+ end
+ $script = ERB.new(File.read('../interface_script.erb')).result(binding)
+ end
+ if !$script.empty?
+ c.vm.provision 'shell', inline: $script
+ end
+ c.vm.provision 'shell', path: "#{host}_script.sh"
+ end
+ end
+end
diff --git a/spec/bgp6/config.yaml b/spec/bgp6/config.yaml
new file mode 100644
index 0000000..a3c0713
--- /dev/null
+++ b/spec/bgp6/config.yaml
@@ -0,0 +1,15 @@
+---
+vyos1:
+ :networks:
+ net61: "fd00:5679:4f53:1::b/64"
+ net62: "fd00:5679:4f53:2::b/64"
+vyos2:
+ :networks:
+ net61: "fd00:5679:4f53:1::c/64"
+ net63: "fd00:5679:4f53:3::b/64"
+vyos3:
+ :networks:
+ net62: "fd00:5679:4f53:2::d/64"
+vyos4:
+ :networks:
+ net63: "fd00:5679:4f53:3::e/64"
diff --git a/spec/bgp6/vyos1_script.sh b/spec/bgp6/vyos1_script.sh
new file mode 100644
index 0000000..51dbac9
--- /dev/null
+++ b/spec/bgp6/vyos1_script.sh
@@ -0,0 +1,14 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+set protocols bgp 65536 neighbor fd00:5679:4f53:1::c ebgp-multihop 2
+set protocols bgp 65536 neighbor fd00:5679:4f53:1::c remote-as 65537
+set protocols bgp 65536 neighbor fd00:5679:4f53:1::c update-source eth1
+set protocols bgp 65536 neighbor fd00:5679:4f53:1::c advertisement-interval 1
+set protocols bgp 65536 neighbor fd00:5679:4f53:1::c address-family ipv6-unicast
+set protocols bgp 65536 address-family ipv6-unicast network fd00:5679:4f53:2::/64
+set protocols bgp 65536 parameters router-id 10.0.1.11
+
+commit
+save
diff --git a/spec/bgp6/vyos1_spec.rb b/spec/bgp6/vyos1_spec.rb
new file mode 100644
index 0000000..76740d4
--- /dev/null
+++ b/spec/bgp6/vyos1_spec.rb
@@ -0,0 +1,4 @@
+require_relative '../spec_helper'
+require_relative '../config_spec'
+
+config_spec
diff --git a/spec/bgp6/vyos2_script.sh b/spec/bgp6/vyos2_script.sh
new file mode 100644
index 0000000..e6c9187
--- /dev/null
+++ b/spec/bgp6/vyos2_script.sh
@@ -0,0 +1,14 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+set protocols bgp 65537 neighbor fd00:5679:4f53:1::b ebgp-multihop 2
+set protocols bgp 65537 neighbor fd00:5679:4f53:1::b remote-as 65536
+set protocols bgp 65537 neighbor fd00:5679:4f53:1::b update-source eth1
+set protocols bgp 65537 neighbor fd00:5679:4f53:1::b advertisement-interval 1
+set protocols bgp 65537 neighbor fd00:5679:4f53:1::b address-family ipv6-unicast
+set protocols bgp 65537 address-family ipv6-unicast network fd00:5679:4f53:3::/64
+set protocols bgp 65537 parameters router-id 10.0.1.12
+
+commit
+save
diff --git a/spec/bgp6/vyos2_spec.rb b/spec/bgp6/vyos2_spec.rb
new file mode 100644
index 0000000..76740d4
--- /dev/null
+++ b/spec/bgp6/vyos2_spec.rb
@@ -0,0 +1,4 @@
+require_relative '../spec_helper'
+require_relative '../config_spec'
+
+config_spec
diff --git a/spec/bgp6/vyos3_script.sh b/spec/bgp6/vyos3_script.sh
new file mode 100644
index 0000000..1016f55
--- /dev/null
+++ b/spec/bgp6/vyos3_script.sh
@@ -0,0 +1,8 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+set protocols static route6 fd00:5679:4f53:3::/64 next-hop fd00:5679:4f53:2::b
+
+commit
+save
diff --git a/spec/bgp6/vyos3_spec.rb b/spec/bgp6/vyos3_spec.rb
new file mode 100644
index 0000000..ddcbb9b
--- /dev/null
+++ b/spec/bgp6/vyos3_spec.rb
@@ -0,0 +1,12 @@
+require_relative '../spec_helper'
+require_relative '../config_spec'
+
+config_spec
+
+# Wait for advertising
+sleep(10)
+
+describe command('ping6 -w 5 -c 2 -n fd00:5679:4f53:3::e') do
+ its(:exit_status) { should eq 0 }
+end
+
diff --git a/spec/bgp6/vyos4_script.sh b/spec/bgp6/vyos4_script.sh
new file mode 100644
index 0000000..4354cb4
--- /dev/null
+++ b/spec/bgp6/vyos4_script.sh
@@ -0,0 +1,8 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+set protocols static route6 fd00:5679:4f53:2::/64 next-hop fd00:5679:4f53:3::b
+
+commit
+save
diff --git a/spec/bgp6/vyos4_spec.rb b/spec/bgp6/vyos4_spec.rb
new file mode 100644
index 0000000..3f0cde7
--- /dev/null
+++ b/spec/bgp6/vyos4_spec.rb
@@ -0,0 +1,11 @@
+require_relative '../spec_helper'
+require_relative '../config_spec'
+
+config_spec
+
+# Wait for advertising
+sleep(10)
+
+describe command('ping6 -w 5 -c 2 -n fd00:5679:4f53:2::d') do
+ its(:exit_status) { should eq 0 }
+end
diff --git a/spec/interface_script.erb b/spec/interface_script.erb
new file mode 100644
index 0000000..d2000e7
--- /dev/null
+++ b/spec/interface_script.erb
@@ -0,0 +1,10 @@
+#!/bin/vbash
+
+source /opt/vyatta/etc/functions/script-template
+
+<% configs[host][:networks].keys.each_with_index do |net, i| %>
+set interface ethernet eth<%= i+1 %> address <%= configs[host][:networks][net] %>
+<% end %>
+
+commit
+save