summaryrefslogtreecommitdiff
path: root/smoketest
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-12-04 09:14:53 +0100
committerGitHub <noreply@github.com>2020-12-04 09:14:53 +0100
commitf84c971d336d5125103c3eaf772a5384af2f71da (patch)
tree4080194919921cbdd609d46d269e42c0912f1039 /smoketest
parenta237979853a97945103291202d851de1e7bcd3f2 (diff)
parentede2972be4c49962a04b1addb9df6ce58f2d9f42 (diff)
downloadvyos-1x-f84c971d336d5125103c3eaf772a5384af2f71da.tar.gz
vyos-1x-f84c971d336d5125103c3eaf772a5384af2f71da.zip
Merge pull request #621 from jack9603301/T3089
interface: T3089: Migrate port mirroring to vyos-1x
Diffstat (limited to 'smoketest')
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py28
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_bonding.py1
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_bridge.py1
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_ethernet.py1
4 files changed, 31 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index e02424073..0a4e85c0f 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -33,6 +33,7 @@ class BasicInterfaceTest:
_test_vlan = False
_test_qinq = False
_test_ipv6 = False
+ _test_mirror = False
_base_path = []
_options = {}
@@ -66,6 +67,33 @@ class BasicInterfaceTest:
self.session.commit()
del self.session
+
+ def test_mirror(self):
+ Success = 0
+ i = 0
+ if self._test_mirror:
+ for interface in self._interfaces:
+ self.session.set(self._base_path + [interface, 'mirror', 'lo'])
+ i+=1
+ self.session.commit()
+ # Parse configuration
+ for interface in self._interfaces:
+ get_tc_cmd = 'tc -j qdisc'
+ tmp = cmd(get_tc_cmd, shell=True)
+ data = json.loads(tmp)
+ for rule in data:
+ dev = rule['dev']
+ handle = rule['handle']
+ kind = rule['kind']
+ if dev == interface and handle == "ffff:" and kind == "ingress":
+ Success+=1
+ if Success == i:
+ self.assertTrue(True)
+ else:
+ self.assertTrue(False)
+ else:
+ return None
+
def test_add_description(self):
"""
diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py
index ac5e01e50..93ed1ced5 100755
--- a/smoketest/scripts/cli/test_interfaces_bonding.py
+++ b/smoketest/scripts/cli/test_interfaces_bonding.py
@@ -34,6 +34,7 @@ class BondingInterfaceTest(BasicInterfaceTest.BaseTest):
self._test_vlan = True
self._test_qinq = True
self._test_ipv6 = True
+ self._test_mirror = True
self._members = []
# we need to filter out VLAN interfaces identified by a dot (.)
diff --git a/smoketest/scripts/cli/test_interfaces_bridge.py b/smoketest/scripts/cli/test_interfaces_bridge.py
index 3742491e8..9bddede31 100755
--- a/smoketest/scripts/cli/test_interfaces_bridge.py
+++ b/smoketest/scripts/cli/test_interfaces_bridge.py
@@ -31,6 +31,7 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest):
self._test_ipv6 = True
self._test_vlan = True
self._test_qinq = True
+ self._test_mirror = True
self._base_path = ['interfaces', 'bridge']
self._interfaces = ['br0']
diff --git a/smoketest/scripts/cli/test_interfaces_ethernet.py b/smoketest/scripts/cli/test_interfaces_ethernet.py
index 761ec7506..bdb20a5c7 100755
--- a/smoketest/scripts/cli/test_interfaces_ethernet.py
+++ b/smoketest/scripts/cli/test_interfaces_ethernet.py
@@ -30,6 +30,7 @@ class EthernetInterfaceTest(BasicInterfaceTest.BaseTest):
self._test_vlan = True
self._test_qinq = True
self._test_ipv6 = True
+ self._test_mirror = True
self._interfaces = []
# we need to filter out VLAN interfaces identified by a dot (.)