summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
authorHenning Surmeier <me@hensur.de>2022-04-06 13:25:35 +0200
committerHenning Surmeier <me@hensur.de>2022-04-06 13:29:18 +0200
commit45734d25f6b4f930fbc572be7ab247a377e179bf (patch)
tree3048a56867d849fa340f448232c51b14125e464b /smoketest/scripts/cli
parent9fc6dba84177702e24fc6b8e6668f638ef156995 (diff)
downloadvyos-1x-45734d25f6b4f930fbc572be7ab247a377e179bf.tar.gz
vyos-1x-45734d25f6b4f930fbc572be7ab247a377e179bf.zip
correctly set fwmk from current config on removals, fix smoketest
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_policy.py55
1 files changed, 42 insertions, 13 deletions
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py
index 50f2d7b43..a636a8097 100755
--- a/smoketest/scripts/cli/test_policy.py
+++ b/smoketest/scripts/cli/test_policy.py
@@ -1030,13 +1030,6 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.assertEqual(sort_ip(tmp), sort_ip(original_second))
-
-def sort_ip(output):
- o = '\n'.join([' '.join(line.strip().split()) for line in output.strip().splitlines()])
- o = o.splitlines()
- o.sort()
- return o
-
# Test set table for fwmark
def test_fwmark_table_id(self):
path = base_path + ['local-route']
@@ -1050,9 +1043,6 @@ def sort_ip(output):
self.cli_commit()
- # Check generated configuration
-
- # Expected values
original = """
101: from all fwmark 0x18 lookup 154
"""
@@ -1077,9 +1067,6 @@ def sort_ip(output):
self.cli_commit()
- # Check generated configuration
-
- # Expected values
original = """
100: from 203.0.113.11 fwmark 0x17 lookup 150
100: from 203.0.113.12 fwmark 0x17 lookup 150
@@ -1090,5 +1077,47 @@ def sort_ip(output):
self.assertEqual(tmp, original)
+ # Test remove fwmark for sources with fwmark
+ def test_source_fwmk_remove(self):
+ path = base_path + ['local-route']
+
+ src = '203.0.113.11'
+ dst = '203.0.113.0/24'
+ fwmk = '23'
+ rule = '100'
+ table = '150'
+ self.cli_set(path + ['rule', rule, 'set', 'table', table])
+ self.cli_set(path + ['rule', rule, 'source', src])
+ self.cli_set(path + ['rule', rule, 'destination', dst])
+ self.cli_set(path + ['rule', rule, 'fwmark', fwmk])
+
+ self.cli_commit()
+
+ original = """
+ 100: from 203.0.113.11 to 203.0.113.0/24 fwmark 0x17 lookup 150
+ """
+ tmp = cmd('ip rule show prio 100')
+ original = original.split()
+ tmp = tmp.split()
+
+ self.assertEqual(tmp, original)
+
+ self.cli_delete(path + ['rule', rule, 'source', src])
+ self.cli_commit()
+
+ original = """
+ 100: from all to 203.0.113.0/24 fwmark 0x17 lookup 150
+ """
+ tmp = cmd('ip rule show prio 100')
+ original = original.split()
+ tmp = tmp.split()
+ self.assertEqual(tmp, original)
+
+def sort_ip(output):
+ o = '\n'.join([' '.join(line.strip().split()) for line in output.strip().splitlines()])
+ o = o.splitlines()
+ o.sort()
+ return o
+
if __name__ == '__main__':
unittest.main(verbosity=2)