summaryrefslogtreecommitdiff
path: root/smoketest
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest')
-rw-r--r--smoketest/configs/bgp-bfd-communities2
-rw-r--r--smoketest/configs/bgp-evpn-leaf1
-rw-r--r--smoketest/configs/tunnel-broker15
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py2
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_l2tpv3.py13
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_tunnel.py99
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py19
7 files changed, 122 insertions, 29 deletions
diff --git a/smoketest/configs/bgp-bfd-communities b/smoketest/configs/bgp-bfd-communities
index 3b3056a51..1a331f9ff 100644
--- a/smoketest/configs/bgp-bfd-communities
+++ b/smoketest/configs/bgp-bfd-communities
@@ -421,8 +421,6 @@ protocols {
local 220
}
}
- graceful-restart {
- }
}
peer-group DAL13 {
address-family {
diff --git a/smoketest/configs/bgp-evpn-leaf b/smoketest/configs/bgp-evpn-leaf
index 73d658de8..020490186 100644
--- a/smoketest/configs/bgp-evpn-leaf
+++ b/smoketest/configs/bgp-evpn-leaf
@@ -29,6 +29,7 @@ interfaces {
loopback lo {
}
vxlan vxlan100 {
+ mtu 1500
parameters {
nolearning
}
diff --git a/smoketest/configs/tunnel-broker b/smoketest/configs/tunnel-broker
index b52ba2541..d4a5c2dfc 100644
--- a/smoketest/configs/tunnel-broker
+++ b/smoketest/configs/tunnel-broker
@@ -21,40 +21,34 @@ interfaces {
address 172.18.202.10/24
}
l2tpv3 l2tpeth10 {
- description "L2 VPN Tunnel"
destination-port 5010
encapsulation ip
local-ip 172.18.202.10
- mtu 1500
peer-session-id 110
peer-tunnel-id 10
- remote-ip 172.18.254.201
+ remote-ip 172.18.202.110
session-id 110
source-port 5010
tunnel-id 10
}
l2tpv3 l2tpeth20 {
- description "L2 VPN Tunnel"
destination-port 5020
encapsulation ip
local-ip 172.18.202.10
- mtu 1500
peer-session-id 120
peer-tunnel-id 20
- remote-ip 172.18.254.202
+ remote-ip 172.18.202.120
session-id 120
source-port 5020
tunnel-id 20
}
l2tpv3 l2tpeth30 {
- description "L2 VPN Tunnel"
destination-port 5030
encapsulation ip
local-ip 172.18.202.10
- mtu 1500
peer-session-id 130
peer-tunnel-id 30
- remote-ip 172.18.254.203
+ remote-ip 172.18.202.130
session-id 130
source-port 5030
tunnel-id 30
@@ -93,8 +87,7 @@ interfaces {
protocols {
static {
route 0.0.0.0/0 {
- next-hop 172.18.202.1 {
- distance 10
+ next-hop 172.18.202.254 {
}
}
}
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index f897088ef..bc95c78b1 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -437,7 +437,7 @@ class BasicInterfaceTest:
tmp = read_file(f'/proc/sys/net/ipv6/conf/{interface}/dad_transmits')
self.assertEqual(dad_transmits, tmp)
- def test_dhcpv6_clinet_options(self):
+ def test_dhcpv6_client_options(self):
if not self._test_ipv6_dhcpc6:
self.skipTest('not supported')
diff --git a/smoketest/scripts/cli/test_interfaces_l2tpv3.py b/smoketest/scripts/cli/test_interfaces_l2tpv3.py
index 24cb9464e..06ced5c40 100755
--- a/smoketest/scripts/cli/test_interfaces_l2tpv3.py
+++ b/smoketest/scripts/cli/test_interfaces_l2tpv3.py
@@ -14,13 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import os
import json
import unittest
from base_interfaces_test import BasicInterfaceTest
from vyos.util import cmd
-class GeneveInterfaceTest(BasicInterfaceTest.TestCase):
+class L2TPv3InterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -53,9 +54,17 @@ class GeneveInterfaceTest(BasicInterfaceTest.TestCase):
for opt in self._options[interface]:
dict.update({opt.split()[0].replace('-','_'): opt.split()[1]})
- for key in ['peer_session_id', 'peer_tunnel_id', 'session_id', 'tunnel_id']:
+ for key in ['peer_session_id', 'peer_tunnel_id',
+ 'session_id', 'tunnel_id']:
self.assertEqual(str(config[key]), dict[key])
if __name__ == '__main__':
+ # when re-running this test, cleanup loaded modules first so they are
+ # reloaded on demand - not needed but test more and more features
+ for module in ['l2tp_ip6', 'l2tp_ip', 'l2tp_eth', 'l2tp_eth',
+ 'l2tp_netlink', 'l2tp_core']:
+ if os.path.exists(f'/sys/module/{module}'):
+ cmd(f'sudo rmmod {module}')
+
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_interfaces_tunnel.py b/smoketest/scripts/cli/test_interfaces_tunnel.py
index 6af31ddff..ebb0158dc 100755
--- a/smoketest/scripts/cli/test_interfaces_tunnel.py
+++ b/smoketest/scripts/cli/test_interfaces_tunnel.py
@@ -232,5 +232,104 @@ class TunnelInterfaceTest(BasicInterfaceTest.TestCase):
conf = get_interface_config(interface)
self.assertEqual(new_remote, conf['linkinfo']['info_data']['remote'])
+ def test_erspan_v1(self):
+ interface = f'tun1070'
+ encapsulation = 'erspan'
+ ip_key = '77'
+ idx = '20'
+
+ self.cli_set(self._base_path + [interface, 'encapsulation', encapsulation])
+ self.cli_set(self._base_path + [interface, 'source-address', self.local_v4])
+ self.cli_set(self._base_path + [interface, 'remote', remote_ip4])
+
+ self.cli_set(self._base_path + [interface, 'parameters', 'erspan', 'index', idx])
+
+ # ERSPAN requires ip key parameter
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'parameters', 'ip', 'key', ip_key])
+
+ # Check if commit is ok
+ self.cli_commit()
+
+ conf = get_interface_config(interface)
+ self.assertEqual(mtu, conf['mtu'])
+ self.assertEqual(interface, conf['ifname'])
+ self.assertEqual(encapsulation, conf['linkinfo']['info_kind'])
+ self.assertEqual(self.local_v4, conf['linkinfo']['info_data']['local'])
+ self.assertEqual(remote_ip4, conf['linkinfo']['info_data']['remote'])
+ self.assertEqual(0, conf['linkinfo']['info_data']['ttl'])
+ self.assertEqual(f'0.0.0.{ip_key}', conf['linkinfo']['info_data']['ikey'])
+ self.assertEqual(f'0.0.0.{ip_key}', conf['linkinfo']['info_data']['okey'])
+ self.assertEqual(int(idx), conf['linkinfo']['info_data']['erspan_index'])
+ # version defaults to 1
+ self.assertEqual(1, conf['linkinfo']['info_data']['erspan_ver'])
+ self.assertTrue( conf['linkinfo']['info_data']['iseq'])
+ self.assertTrue( conf['linkinfo']['info_data']['oseq'])
+
+ # Change remote ip address (inc host by 2
+ new_remote = inc_ip(remote_ip4, 2)
+ self.cli_set(self._base_path + [interface, 'remote', new_remote])
+ # Check if commit is ok
+ self.cli_commit()
+
+ conf = get_interface_config(interface)
+ self.assertEqual(new_remote, conf['linkinfo']['info_data']['remote'])
+
+ def test_ip6erspan_v2(self):
+ interface = f'tun1070'
+ encapsulation = 'ip6erspan'
+ ip_key = '77'
+ erspan_ver = 2
+ direction = 'ingress'
+
+ self.cli_set(self._base_path + [interface, 'encapsulation', encapsulation])
+ self.cli_set(self._base_path + [interface, 'source-address', self.local_v6])
+ self.cli_set(self._base_path + [interface, 'remote', remote_ip6])
+
+ # ERSPAN requires ip key parameter
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'parameters', 'ip', 'key', ip_key])
+
+ self.cli_set(self._base_path + [interface, 'parameters', 'erspan', 'version', str(erspan_ver)])
+
+ # ERSPAN index is not valid on version 2
+ self.cli_set(self._base_path + [interface, 'parameters', 'erspan', 'index', '10'])
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_delete(self._base_path + [interface, 'parameters', 'erspan', 'index'])
+
+ # ERSPAN requires direction to be set
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'parameters', 'erspan', 'direction', direction])
+
+ # Check if commit is ok
+ self.cli_commit()
+
+ conf = get_interface_config(interface)
+ self.assertEqual(mtu, conf['mtu'])
+ self.assertEqual(interface, conf['ifname'])
+ self.assertEqual(encapsulation, conf['linkinfo']['info_kind'])
+ self.assertEqual(self.local_v6, conf['linkinfo']['info_data']['local'])
+ self.assertEqual(remote_ip6, conf['linkinfo']['info_data']['remote'])
+ self.assertEqual(0, conf['linkinfo']['info_data']['ttl'])
+ self.assertEqual(f'0.0.0.{ip_key}', conf['linkinfo']['info_data']['ikey'])
+ self.assertEqual(f'0.0.0.{ip_key}', conf['linkinfo']['info_data']['okey'])
+ self.assertEqual(erspan_ver, conf['linkinfo']['info_data']['erspan_ver'])
+ self.assertEqual(direction, conf['linkinfo']['info_data']['erspan_dir'])
+ self.assertTrue( conf['linkinfo']['info_data']['iseq'])
+ self.assertTrue( conf['linkinfo']['info_data']['oseq'])
+
+ # Change remote ip address (inc host by 2
+ new_remote = inc_ip(remote_ip6, 2)
+ self.cli_set(self._base_path + [interface, 'remote', new_remote])
+ # Check if commit is ok
+ self.cli_commit()
+
+ conf = get_interface_config(interface)
+ self.assertEqual(new_remote, conf['linkinfo']['info_data']['remote'])
+
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index 4f39948c0..40afca615 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -102,8 +102,7 @@ peer_group_config = {
'password' : 'VyOS-Secure123',
'shutdown' : '',
'cap_over' : '',
-# XXX: not available in current Perl backend
-# 'ttl_security': '5',
+ 'ttl_security': '5',
},
'bar' : {
'description' : 'foo peer bar group',
@@ -127,7 +126,6 @@ peer_group_config = {
},
}
-
class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
def setUp(self):
self.cli_set(['policy', 'route-map', route_map_in, 'rule', '10', 'action', 'permit'])
@@ -142,6 +140,8 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.cli_set(['policy', 'prefix-list6', prefix_list_out6, 'rule', '10', 'action', 'deny'])
self.cli_set(['policy', 'prefix-list6', prefix_list_out6, 'rule', '10', 'prefix', '2001:db8:2000::/64'])
+ self.cli_set(base_path + ['local-as', ASN])
+
def tearDown(self):
self.cli_delete(['policy', 'route-map', route_map_in])
self.cli_delete(['policy', 'route-map', route_map_out])
@@ -214,7 +214,9 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.cli_set(base_path + ['parameters', 'router-id', router_id])
self.cli_set(base_path + ['parameters', 'log-neighbor-changes'])
- # Local AS number MUST be defined
+ # Local AS number MUST be defined - as this is set in setUp() we remove
+ # this once for testing of the proper error
+ self.cli_delete(base_path + ['local-as'])
with self.assertRaises(ConfigSessionError):
self.cli_commit()
self.cli_set(base_path + ['local-as', ASN])
@@ -257,7 +259,6 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
def test_bgp_02_neighbors(self):
- self.cli_set(base_path + ['local-as', ASN])
# Test out individual neighbor configuration items, not all of them are
# also available to a peer-group!
for peer, peer_config in neighbor_config.items():
@@ -332,7 +333,6 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.verify_frr_config(peer, peer_config, frrconfig)
def test_bgp_03_peer_groups(self):
- self.cli_set(base_path + ['local-as', ASN])
# Test out individual peer-group configuration items
for peer_group, config in peer_group_config.items():
if 'cap_dynamic' in config:
@@ -403,8 +403,6 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
},
}
- self.cli_set(base_path + ['local-as', ASN])
-
# We want to redistribute ...
redistributes = ['connected', 'isis', 'kernel', 'ospf', 'rip', 'static']
for redistribute in redistributes:
@@ -451,8 +449,6 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
},
}
- self.cli_set(base_path + ['local-as', ASN])
-
# We want to redistribute ...
redistributes = ['connected', 'kernel', 'ospfv3', 'ripng', 'static']
for redistribute in redistributes:
@@ -495,7 +491,6 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
listen_ranges = ['192.0.2.0/25', '192.0.2.128/25']
peer_group = 'listenfoobar'
- self.cli_set(base_path + ['local-as', ASN])
self.cli_set(base_path + ['listen', 'limit', limit])
for prefix in listen_ranges:
@@ -527,8 +522,6 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
vnis = ['10010', '10020', '10030']
neighbors = ['192.0.2.10', '192.0.2.20', '192.0.2.30']
- self.cli_set(base_path + ['local-as', ASN])
-
self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-all-vni'])
self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-default-gw'])
self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-svi-ip'])