summaryrefslogtreecommitdiff
path: root/smoketest/scripts
diff options
context:
space:
mode:
authorHenning Surmeier <me@hensur.de>2022-04-09 13:21:26 +0200
committerHenning Surmeier <me@hensur.de>2022-04-09 13:21:26 +0200
commit19e85acabcbc2eb839a2624d5e5e422ae675c7da (patch)
tree24c215427362d15f9d11f9cb859e369d8fae55cc /smoketest/scripts
parent45734d25f6b4f930fbc572be7ab247a377e179bf (diff)
downloadvyos-1x-19e85acabcbc2eb839a2624d5e5e422ae675c7da.tar.gz
vyos-1x-19e85acabcbc2eb839a2624d5e5e422ae675c7da.zip
respect table changes for remove_rule
Diffstat (limited to 'smoketest/scripts')
-rwxr-xr-xsmoketest/scripts/cli/test_policy.py52
1 files changed, 35 insertions, 17 deletions
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py
index a636a8097..ab63cbcf7 100755
--- a/smoketest/scripts/cli/test_policy.py
+++ b/smoketest/scripts/cli/test_policy.py
@@ -902,8 +902,6 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
- # Check generated configuration
- # Expected values
original = """
102: from 2001:db8:1338::/126 iif lo lookup 150
102: from 2001:db8:1339::/126 iif lo lookup 150
@@ -1047,10 +1045,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
101: from all fwmark 0x18 lookup 154
"""
tmp = cmd('ip rule show prio 101')
- original = original.split()
- tmp = tmp.split()
-
- self.assertEqual(tmp, original)
+ self.assertEqual(sort_ip(tmp), sort_ip(original))
# Test set table for sources with fwmark
def test_fwmark_sources_table_id(self):
@@ -1072,10 +1067,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
100: from 203.0.113.12 fwmark 0x17 lookup 150
"""
tmp = cmd('ip rule show prio 100')
- original = original.split()
- tmp = tmp.split()
-
- self.assertEqual(tmp, original)
+ self.assertEqual(sort_ip(tmp), sort_ip(original))
# Test remove fwmark for sources with fwmark
def test_source_fwmk_remove(self):
@@ -1097,10 +1089,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
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.assertEqual(sort_ip(tmp), sort_ip(original))
self.cli_delete(path + ['rule', rule, 'source', src])
self.cli_commit()
@@ -1109,9 +1098,38 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
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)
+ self.assertEqual(sort_ip(tmp), sort_ip(original))
+
+ # Test change table for sources with fwmark
+ def test_source_change_table(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')
+ self.assertEqual(sort_ip(tmp), sort_ip(original))
+
+ self.cli_set(path + ['rule', rule, 'set', 'table', '151'])
+ self.cli_commit()
+
+ original = """
+ 100: from 203.0.113.11 to 203.0.113.0/24 fwmark 0x17 lookup 151
+ """
+ tmp = cmd('ip rule show prio 100')
+ self.assertEqual(sort_ip(tmp), sort_ip(original))
def sort_ip(output):
o = '\n'.join([' '.join(line.strip().split()) for line in output.strip().splitlines()])