summaryrefslogtreecommitdiff
path: root/smoketest
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-02-22 07:53:37 +0100
committerChristian Poessinger <christian@poessinger.com>2022-02-22 07:53:37 +0100
commit055841e88ea43012d6017a4c9341dce6c17f887e (patch)
tree4eaa9d761eb66df10ce0da9b47fa087306ec9f1d /smoketest
parente22b8a31536e44b807aa285cf6e0164b35b4abb4 (diff)
downloadvyos-1x-055841e88ea43012d6017a4c9341dce6c17f887e.tar.gz
vyos-1x-055841e88ea43012d6017a4c9341dce6c17f887e.zip
Revert "backport: policy: T4151: bugfix smoketest"
This reverts commit ad26e92a5dccb4a7b6777d11781c323af2557db7.
Diffstat (limited to 'smoketest')
-rwxr-xr-xsmoketest/scripts/cli/test_policy.py55
1 files changed, 45 insertions, 10 deletions
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py
index 6697b9f16..c9d178554 100755
--- a/smoketest/scripts/cli/test_policy.py
+++ b/smoketest/scripts/cli/test_policy.py
@@ -678,6 +678,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
50: from 203.0.113.1 lookup 23
50: from 203.0.113.2 lookup 23
@@ -699,6 +702,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
101: from all fwmark 0x18 lookup 154
"""
@@ -719,6 +725,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
102: from all to 203.0.113.1 lookup 154
"""
@@ -741,6 +750,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
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
@@ -767,6 +779,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
103: from 203.0.113.11 to 203.0.113.13 fwmark 0x17 lookup 150
103: from 203.0.113.11 to 203.0.113.15 fwmark 0x17 lookup 150
@@ -790,6 +805,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
50: from 2001:db8:123::/48 lookup 23
50: from 2001:db8:126::/48 lookup 23
@@ -811,6 +829,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
100: from all fwmark 0x18 lookup 154
"""
@@ -831,6 +852,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
101: from all to 2001:db8:1337::/126 lookup 154
"""
@@ -853,6 +877,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
102: from 2001:db8:1338::/126 fwmark 0x17 lookup 150
102: from 2001:db8:1339::/126 fwmark 0x17 lookup 150
@@ -879,6 +906,9 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
103: from 2001:db8:1338::/126 to 2001:db8:13::/48 fwmark 0x17 lookup 150
103: from 2001:db8:1338::/126 to 2001:db8:16::/48 fwmark 0x17 lookup 150
@@ -917,17 +947,20 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
+ # Check generated configuration
+
+ # Expected values
original = """
- 103: from 203.0.113.0/24 to 203.0.116.5 fwmark 0x17 lookup 150
- 103: from 203.0.114.5 to 203.0.112.0/24 fwmark 0x17 lookup 150
+ 103: from 203.0.113.1/24 to 203.0.112.1/24 fwmark 0x17 lookup 150
+ 103: from 203.0.113.1/24 to 203.0.116.5 fwmark 0x17 lookup 150
+ 103: from 203.0.114.5 to 203.0.112.1/24 fwmark 0x17 lookup 150
103: from 203.0.114.5 to 203.0.116.5 fwmark 0x17 lookup 150
- 103: from 203.0.113.0/24 to 203.0.112.0/24 fwmark 0x17 lookup 150
"""
original_v6 = """
+ 103: from 20016 to 2001:db8:13::/48 fwmark 0x17 lookup 150
103: from 2001:db8:1338::/126 to 2001:db8:16::/48 fwmark 0x17 lookup 150
103: from 2001:db8:1339::/56 to 2001:db8:13::/48 fwmark 0x17 lookup 150
103: from 2001:db8:1339::/56 to 2001:db8:16::/48 fwmark 0x17 lookup 150
- 103: from 2001:db8:1338::/126 to 2001:db8:13::/48 fwmark 0x17 lookup 150
"""
tmp = cmd('ip rule show prio 103')
tmp_v6 = cmd('ip -6 rule show prio 103')
@@ -942,8 +975,11 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
tmp = cmd('ip rule show prio 103')
tmp_v6 = cmd('ip -6 rule show prio 103')
- self.assertEqual(sort_ip(tmp), [])
- self.assertEqual(sort_ip(tmp_v6), [])
+ original = None
+ original_v6 = None
+
+ 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):
@@ -959,6 +995,8 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
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
@@ -981,10 +1019,7 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
def sort_ip(output):
- o = '\n'.join([' '.join(line.strip().split()) for line in output.strip().splitlines()])
- o = o.splitlines()
- o.sort()
- return o
+ return output.splitlines().sort()
if __name__ == '__main__':
unittest.main(verbosity=2)