summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_interfaces_tunnel.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-20 17:07:55 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-20 17:07:55 +0100
commit7508af79700ea46198f1bf3081c8f2ae3be00c0b (patch)
treecef0db924b051bf9b89da67854851940c670d256 /smoketest/scripts/cli/test_interfaces_tunnel.py
parent9207897983a3bfafa0ec3e436c1ad67790f09f06 (diff)
downloadvyos-1x-7508af79700ea46198f1bf3081c8f2ae3be00c0b.tar.gz
vyos-1x-7508af79700ea46198f1bf3081c8f2ae3be00c0b.zip
tunnel: T3173: bugfix nopmtu raw key
The raw key was not copied into the class member variable. Also added a smoketest to ensure the configured parameters are always set.
Diffstat (limited to 'smoketest/scripts/cli/test_interfaces_tunnel.py')
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_tunnel.py31
1 files changed, 28 insertions, 3 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_tunnel.py b/smoketest/scripts/cli/test_interfaces_tunnel.py
index f67b813af..8405fc7d0 100755
--- a/smoketest/scripts/cli/test_interfaces_tunnel.py
+++ b/smoketest/scripts/cli/test_interfaces_tunnel.py
@@ -84,7 +84,6 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
self.session.delete(['interfaces', 'dummy', source_if])
super().tearDown()
-
def test_ipv4_encapsulations(self):
# When running tests ensure that for certain encapsulation types the
# local and remote IP address is actually an IPv4 address
@@ -106,7 +105,6 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
with self.assertRaises(ConfigSessionError):
self.session.commit()
self.session.set(self._base_path + [interface, 'remote-ip', remote_ip4])
-
self.session.set(self._base_path + [interface, 'source-interface', source_if])
# Source interface can not be used with sit and gre-bridge
@@ -130,6 +128,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
self.assertEqual(self.local_v4, conf['linkinfo']['info_data']['local'])
self.assertEqual(remote_ip4, conf['linkinfo']['info_data']['remote'])
+ self.assertTrue(conf['linkinfo']['info_data']['pmtudisc'])
# cleanup this instance
self.session.delete(self._base_path + [interface])
@@ -177,7 +176,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
self.assertEqual(encapsulation, conf['link_type'])
self.assertEqual(self.local_v6, conf['linkinfo']['info_data']['local'])
- self.assertEqual(remote_ip6, conf['linkinfo']['info_data']['remote'])
+ self.assertEqual(remote_ip6, conf['linkinfo']['info_data']['remote'])
# cleanup this instance
self.session.delete(self._base_path + [interface])
@@ -203,5 +202,31 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
# Check if commit is ok
self.session.commit()
+ def test_tunnel_parameters_gre(self):
+ interface = f'tun1030'
+ gre_key = '10'
+ encapsulation = 'gre'
+ tos = '20'
+
+ self.session.set(self._base_path + [interface, 'encapsulation', encapsulation])
+ self.session.set(self._base_path + [interface, 'local-ip', self.local_v4])
+ self.session.set(self._base_path + [interface, 'remote-ip', remote_ip4])
+
+ self.session.set(self._base_path + [interface, 'parameters', 'ip', 'no-pmtu-discovery'])
+ self.session.set(self._base_path + [interface, 'parameters', 'ip', 'key', gre_key])
+ self.session.set(self._base_path + [interface, 'parameters', 'ip', 'tos', tos])
+
+ # Check if commit is ok
+ self.session.commit()
+
+ conf = tunnel_conf(interface)
+ self.assertEqual(mtu, conf['mtu'])
+ self.assertEqual(interface, conf['ifname'])
+ self.assertEqual(encapsulation, conf['link_type'])
+ 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.assertFalse( conf['linkinfo']['info_data']['pmtudisc'])
+
if __name__ == '__main__':
unittest.main(verbosity=2)