diff options
-rw-r--r-- | interface-definitions/interfaces-tunnel.xml.in | 12 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_tunnel.py | 27 |
2 files changed, 22 insertions, 17 deletions
diff --git a/interface-definitions/interfaces-tunnel.xml.in b/interface-definitions/interfaces-tunnel.xml.in index e4bdcb3d7..536edcb99 100644 --- a/interface-definitions/interfaces-tunnel.xml.in +++ b/interface-definitions/interfaces-tunnel.xml.in @@ -158,9 +158,6 @@ <help>ERSPAN Tunnel parameters</help> </properties> <children> - -<!--- -Temporary disabled b/c of https://github.com/shemminger/iproute2/issues/41 <leafNode name="direction"> <properties> <help>Specifies mirrored traffic direction</help> @@ -188,12 +185,10 @@ Temporary disabled b/c of https://github.com/shemminger/iproute2/issues/41 <description>Unique identifier of ERSPAN engine</description> </valueHelp> <constraint> -fix double hyphen below ... - <validator name="numeric" argument="- -range 0-1048575"/> + <validator name="numeric" argument="--range 0-1048575"/> </constraint> </properties> </leafNode> ---> <leafNode name="index"> <properties> <help>Specifify ERSPAN version 1 index field</help> @@ -213,15 +208,12 @@ fix double hyphen below ... <format>1</format> <description>ERSPAN Type II</description> </valueHelp> -<!-- -Temporary disabled b/c of https://github.com/shemminger/iproute2/issues/41 <valueHelp> <format>2</format> <description>ERSPAN Type III</description> </valueHelp> ---> <constraint> - <validator name="numeric" argument="--range 1-1"/> + <validator name="numeric" argument="--range 1-2"/> </constraint> </properties> <defaultValue>1</defaultValue> diff --git a/smoketest/scripts/cli/test_interfaces_tunnel.py b/smoketest/scripts/cli/test_interfaces_tunnel.py index 0e021b385..ebb0158dc 100755 --- a/smoketest/scripts/cli/test_interfaces_tunnel.py +++ b/smoketest/scripts/cli/test_interfaces_tunnel.py @@ -232,7 +232,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.TestCase): conf = get_interface_config(interface) self.assertEqual(new_remote, conf['linkinfo']['info_data']['remote']) - def test_erspan(self): + def test_erspan_v1(self): interface = f'tun1070' encapsulation = 'erspan' ip_key = '77' @@ -262,6 +262,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.TestCase): 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']) @@ -275,24 +276,35 @@ class TunnelInterfaceTest(BasicInterfaceTest.TestCase): conf = get_interface_config(interface) self.assertEqual(new_remote, conf['linkinfo']['info_data']['remote']) - def test_ip6erspan(self): + def test_ip6erspan_v2(self): interface = f'tun1070' encapsulation = 'ip6erspan' ip_key = '77' - erspan_ver = '2' - direction = 'ingres' + 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]) - self.cli_set(self._base_path + [interface, 'parameters', 'erspan', 'index', '10']) - # 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() @@ -305,7 +317,8 @@ class TunnelInterfaceTest(BasicInterfaceTest.TestCase): 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(1, conf['linkinfo']['info_data']['erspan_ver']) + 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']) |