summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_policy.py
diff options
context:
space:
mode:
authorHenning Surmeier <me@hensur.de>2022-01-29 13:15:15 +0100
committerHenning Surmeier <me@hensur.de>2022-01-29 13:15:15 +0100
commit87d93efc27d8e7a0ddd1dffe33eb7ada6e83fabc (patch)
treefcc838050370c5affd6c6a1f1de5c70430139d87 /smoketest/scripts/cli/test_policy.py
parentc501ae0fdc5de3c24c998891f78c8bb05ffb35c7 (diff)
downloadvyos-1x-87d93efc27d8e7a0ddd1dffe33eb7ada6e83fabc.tar.gz
vyos-1x-87d93efc27d8e7a0ddd1dffe33eb7ada6e83fabc.zip
policy: T4151: bugfix smoketest
.sort() is an inplace operation and return None...
Diffstat (limited to 'smoketest/scripts/cli/test_policy.py')
-rwxr-xr-xsmoketest/scripts/cli/test_policy.py55
1 files changed, 10 insertions, 45 deletions
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py
index 6dac28a0f..73d93c986 100755
--- a/smoketest/scripts/cli/test_policy.py
+++ b/smoketest/scripts/cli/test_policy.py
@@ -1135,9 +1135,6 @@ 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
@@ -1159,9 +1156,6 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
- # Check generated configuration
-
- # Expected values
original = """
101: from all fwmark 0x18 lookup 154
"""
@@ -1182,9 +1176,6 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
- # Check generated configuration
-
- # Expected values
original = """
102: from all to 203.0.113.1 lookup 154
"""
@@ -1207,9 +1198,6 @@ 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
@@ -1236,9 +1224,6 @@ 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
@@ -1262,9 +1247,6 @@ 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
@@ -1286,9 +1268,6 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
- # Check generated configuration
-
- # Expected values
original = """
100: from all fwmark 0x18 lookup 154
"""
@@ -1309,9 +1288,6 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
- # Check generated configuration
-
- # Expected values
original = """
101: from all to 2001:db8:1337::/126 lookup 154
"""
@@ -1334,9 +1310,6 @@ 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
@@ -1363,9 +1336,6 @@ 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
@@ -1404,20 +1374,17 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
- # Check generated configuration
-
- # Expected values
original = """
- 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.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.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')
@@ -1432,11 +1399,8 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
tmp = cmd('ip rule show prio 103')
tmp_v6 = cmd('ip -6 rule show prio 103')
- original = None
- original_v6 = None
-
- self.assertEqual(sort_ip(tmp), original)
- self.assertEqual(sort_ip(tmp_v6), original_v6)
+ self.assertEqual(sort_ip(tmp), [])
+ self.assertEqual(sort_ip(tmp_v6), [])
# Test multiple commits ipv4
def test_multiple_commit_ipv4_table_id(self):
@@ -1452,8 +1416,6 @@ 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
@@ -1476,7 +1438,10 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
def sort_ip(output):
- return output.splitlines().sort()
+ 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)