diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-02-22 07:54:01 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-02-22 07:54:01 +0100 |
commit | c3470d902d0083f3034e103771602650420553bc (patch) | |
tree | 7e582fbc8f3003fea7f8d12d27cbee53f8d47858 /smoketest | |
parent | ff70406e3ba815ccc9c71c10e1be7f36774dac82 (diff) | |
download | vyos-1x-c3470d902d0083f3034e103771602650420553bc.tar.gz vyos-1x-c3470d902d0083f3034e103771602650420553bc.zip |
Revert "backport: policy: T4151: Add policy ipv6-local-route"
This reverts commit e11a7ff1b2817cc8f4b595171fe82a43a209ebc2.
Diffstat (limited to 'smoketest')
-rwxr-xr-x | smoketest/scripts/cli/test_policy.py | 299 |
1 files changed, 3 insertions, 296 deletions
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py index 6acb081dd..f1d195381 100755 --- a/smoketest/scripts/cli/test_policy.py +++ b/smoketest/scripts/cli/test_policy.py @@ -686,303 +686,10 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): 50: from 203.0.113.2 lookup 23 """ tmp = cmd('ip rule show prio 50') + original = original.split() + tmp = tmp.split() - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test set table for fwmark - def test_fwmark_table_id(self): - path = base_path + ['local-route'] - - fwmk = '24' - rule = '101' - table = '154' - - self.cli_set(path + ['rule', rule, 'set', 'table', table]) - self.cli_set(path + ['rule', rule, 'fwmark', fwmk]) - - self.cli_commit() - - # Check generated configuration - - # Expected values - original = """ - 101: from all fwmark 0x18 lookup 154 - """ - tmp = cmd('ip rule show prio 101') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test set table for destination - def test_destination_table_id(self): - path = base_path + ['local-route'] - - dst = '203.0.113.1' - rule = '102' - table = '154' - - self.cli_set(path + ['rule', rule, 'set', 'table', table]) - self.cli_set(path + ['rule', rule, 'destination', dst]) - - self.cli_commit() - - # Check generated configuration - - # Expected values - original = """ - 102: from all to 203.0.113.1 lookup 154 - """ - tmp = cmd('ip rule show prio 102') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test set table for sources with fwmark - def test_fwmark_sources_table_id(self): - path = base_path + ['local-route'] - - sources = ['203.0.113.11', '203.0.113.12'] - fwmk = '23' - rule = '100' - table = '150' - for src in sources: - self.cli_set(path + ['rule', rule, 'set', 'table', table]) - self.cli_set(path + ['rule', rule, 'source', src]) - self.cli_set(path + ['rule', rule, 'fwmark', fwmk]) - - 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 - """ - tmp = cmd('ip rule show prio 100') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test set table for sources and destinations with fwmark - def test_fwmark_sources_destination_table_id(self): - path = base_path + ['local-route'] - - sources = ['203.0.113.11', '203.0.113.12'] - destinations = ['203.0.113.13', '203.0.113.15'] - fwmk = '23' - rule = '103' - table = '150' - for src in sources: - for dst in destinations: - 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() - - # 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 - 103: from 203.0.113.12 to 203.0.113.13 fwmark 0x17 lookup 150 - 103: from 203.0.113.12 to 203.0.113.15 fwmark 0x17 lookup 150 - """ - tmp = cmd('ip rule show prio 103') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test set table ipv6 for some sources ipv6 - def test_ipv6_table_id(self): - path = base_path + ['local-route6'] - - sources = ['2001:db8:123::/48', '2001:db8:126::/48'] - rule = '50' - table = '23' - for src in sources: - self.cli_set(path + ['rule', rule, 'set', 'table', table]) - self.cli_set(path + ['rule', rule, 'source', src]) - - 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 - """ - tmp = cmd('ip -6 rule show prio 50') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test set table for fwmark ipv6 - def test_fwmark_ipv6_table_id(self): - path = base_path + ['local-route6'] - - fwmk = '24' - rule = '100' - table = '154' - - self.cli_set(path + ['rule', rule, 'set', 'table', table]) - self.cli_set(path + ['rule', rule, 'fwmark', fwmk]) - - self.cli_commit() - - # Check generated configuration - - # Expected values - original = """ - 100: from all fwmark 0x18 lookup 154 - """ - tmp = cmd('ip -6 rule show prio 100') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test set table for destination ipv6 - def test_destination_ipv6_table_id(self): - path = base_path + ['local-route6'] - - dst = '2001:db8:1337::/126' - rule = '101' - table = '154' - - self.cli_set(path + ['rule', rule, 'set', 'table', table]) - self.cli_set(path + ['rule', rule, 'destination', dst]) - - self.cli_commit() - - # Check generated configuration - - # Expected values - original = """ - 101: from all to 2001:db8:1337::/126 lookup 154 - """ - tmp = cmd('ip -6 rule show prio 101') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test set table for sources with fwmark ipv6 - def test_fwmark_sources_ipv6_table_id(self): - path = base_path + ['local-route6'] - - sources = ['2001:db8:1338::/126', '2001:db8:1339::/126'] - fwmk = '23' - rule = '102' - table = '150' - for src in sources: - self.cli_set(path + ['rule', rule, 'set', 'table', table]) - self.cli_set(path + ['rule', rule, 'source', src]) - self.cli_set(path + ['rule', rule, 'fwmark', fwmk]) - - 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 - """ - tmp = cmd('ip -6 rule show prio 102') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test set table for sources and destinations with fwmark ipv6 - def test_fwmark_sources_destination_ipv6_table_id(self): - path = base_path + ['local-route6'] - - sources = ['2001:db8:1338::/126', '2001:db8:1339::/56'] - destinations = ['2001:db8:13::/48', '2001:db8:16::/48'] - fwmk = '23' - rule = '103' - table = '150' - for src in sources: - for dst in destinations: - 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() - - # 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 - 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 - """ - tmp = cmd('ip -6 rule show prio 103') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - - # Test delete table for sources and destination with fwmark ipv4/ipv6 - def test_delete_ipv4_ipv6_table_id(self): - path = base_path + ['local-route'] - path_v6 = base_path + ['local-route6'] - - sources = ['203.0.113.1/24', '203.0.114.5'] - destinations = ['203.0.112.1/24', '203.0.116.5'] - sources_v6 = ['2001:db8:1338::/126', '2001:db8:1339::/56'] - destinations_v6 = ['2001:db8:13::/48', '2001:db8:16::/48'] - fwmk = '23' - rule = '103' - table = '150' - for src in sources: - for dst in destinations: - 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]) - - for src in sources_v6: - for dst in destinations_v6: - self.cli_set(path_v6 + ['rule', rule, 'set', 'table', table]) - self.cli_set(path_v6 + ['rule', rule, 'source', src]) - self.cli_set(path_v6 + ['rule', rule, 'destination', dst]) - self.cli_set(path_v6 + ['rule', rule, 'fwmark', fwmk]) - - 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.114.5 to 203.0.116.5 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 - """ - tmp = cmd('ip rule show prio 103') - tmp_v6 = cmd('ip -6 rule show prio 103') - - self.assertEqual(sort_ip(tmp), sort_ip(original)) - self.assertEqual(sort_ip(tmp_v6), sort_ip(original_v6)) - - self.cli_delete(path) - self.cli_delete(path_v6) - self.cli_commit() - - tmp = cmd('ip rule show prio 103') - tmp_v6 = cmd('ip -6 rule show prio 103') - - original = [''] - original_v6 = [''] - - self.assertEqual(sort_ip(tmp), original) - self.assertEqual(sort_ip(tmp_v6), original_v6) - -def sort_ip(output): - return output.splitlines().sort() + self.assertEqual(tmp, original) if __name__ == '__main__': unittest.main(verbosity=2) |