summaryrefslogtreecommitdiff
path: root/smoketest
diff options
context:
space:
mode:
authorHenning Surmeier <me@hensur.de>2022-01-28 17:28:32 +0100
committerHenning Surmeier <me@hensur.de>2022-01-28 17:28:32 +0100
commitc501ae0fdc5de3c24c998891f78c8bb05ffb35c7 (patch)
treee98947cd1435ef42d7498a1109f10941813db7c1 /smoketest
parenta414fa198a96ac5557bc1bd827e8dc18c3150825 (diff)
downloadvyos-1x-c501ae0fdc5de3c24c998891f78c8bb05ffb35c7.tar.gz
vyos-1x-c501ae0fdc5de3c24c998891f78c8bb05ffb35c7.zip
policy: T4151: remove all previous rules on edit
Diffstat (limited to 'smoketest')
-rwxr-xr-xsmoketest/scripts/cli/test_policy.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py
index d055762f4..6dac28a0f 100755
--- a/smoketest/scripts/cli/test_policy.py
+++ b/smoketest/scripts/cli/test_policy.py
@@ -1438,6 +1438,43 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.assertEqual(sort_ip(tmp), original)
self.assertEqual(sort_ip(tmp_v6), original_v6)
+ # Test multiple commits ipv4
+ def test_multiple_commit_ipv4_table_id(self):
+ path = base_path + ['local-route']
+
+ sources = ['192.0.2.1', '192.0.2.2']
+ destination = '203.0.113.25'
+ rule = '105'
+ table = '151'
+ self.cli_set(path + ['rule', rule, 'set', 'table', table])
+ for src in sources:
+ self.cli_set(path + ['rule', rule, 'source', src])
+
+ self.cli_commit()
+
+ # Check generated configuration
+ # Expected values
+ original_first = """
+ 105: from 192.0.2.1 lookup 151
+ 105: from 192.0.2.2 lookup 151
+ """
+ tmp = cmd('ip rule show prio 105')
+
+ self.assertEqual(sort_ip(tmp), sort_ip(original_first))
+
+ # Create second commit with added destination
+ self.cli_set(path + ['rule', rule, 'destination', destination])
+ self.cli_commit()
+
+ original_second = """
+ 105: from 192.0.2.1 to 203.0.113.25 lookup 151
+ 105: from 192.0.2.2 to 203.0.113.25 lookup 151
+ """
+ tmp = cmd('ip rule show prio 105')
+
+ self.assertEqual(sort_ip(tmp), sort_ip(original_second))
+
+
def sort_ip(output):
return output.splitlines().sort()