diff options
author | Henning Surmeier <me@hensur.de> | 2022-02-23 22:13:36 +0100 |
---|---|---|
committer | Henning Surmeier <me@hensur.de> | 2022-02-23 22:13:36 +0100 |
commit | 5601e50d386635d67e9ffb6f9d3678538b661109 (patch) | |
tree | 0c508f98dc5847e51ef2befebc876a68ff6ee61a /smoketest | |
parent | 00b680a4ac975759b088f6b480e311b5919a2e09 (diff) | |
download | vyos-1x-5601e50d386635d67e9ffb6f9d3678538b661109.tar.gz vyos-1x-5601e50d386635d67e9ffb6f9d3678538b661109.zip |
backport: policy: T4151: remove all previous rules on edit
Diffstat (limited to 'smoketest')
-rwxr-xr-x | smoketest/scripts/cli/test_policy.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py index 7dc154fbf..fc5a0d48b 100755 --- a/smoketest/scripts/cli/test_policy.py +++ b/smoketest/scripts/cli/test_policy.py @@ -981,6 +981,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() |