diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2026-01-13 16:38:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-13 16:38:47 +0200 |
| commit | 5f233638951238afe55621dda9fce83b7d8bc209 (patch) | |
| tree | 3177b51e77c96cf2a36f10d31066f5c19dd1fc41 /smoketest/scripts/cli | |
| parent | c576ed3bf15676dc5b1543a7a25f96cca8903f6e (diff) | |
| parent | a2f54d4bf139fa15e47df9422be7dc5edb8be279 (diff) | |
| download | vyos-1x-5f233638951238afe55621dda9fce83b7d8bc209.tar.gz vyos-1x-5f233638951238afe55621dda9fce83b7d8bc209.zip | |
Merge pull request #4939 from c-po/vrf-pbr
vrf: T8169: prevent deletion if instance referenced in policy based routing
Diffstat (limited to 'smoketest/scripts/cli')
| -rwxr-xr-x | smoketest/scripts/cli/test_vrf.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_vrf.py b/smoketest/scripts/cli/test_vrf.py index 468b859c3..9349f43c6 100755 --- a/smoketest/scripts/cli/test_vrf.py +++ b/smoketest/scripts/cli/test_vrf.py @@ -684,6 +684,51 @@ class VRFTest(VyOSUnitTestSHIM.TestCase): self.cli_delete(['nat']) + def test_vrf_policy_based_route(self): + vrf_name = 'test-pbr_123' + + self.cli_set(base_path + ['name', vrf_name, 'table', '17563']) + + policy_path = ['policy', 'route', 'pbr_smoke4', 'rule', '10'] + self.cli_set(policy_path + ['action', 'accept']) + self.cli_set(policy_path + ['set', 'vrf', vrf_name]) + self.cli_set(policy_path + ['source', 'address', '192.0.2.1/32']) + + policy6_path = ['policy', 'route6', 'pbr_smoke6', 'rule', '10'] + self.cli_set(policy6_path + ['action', 'accept']) + self.cli_set(policy6_path + ['set', 'vrf', vrf_name]) + self.cli_set(policy6_path + ['source', 'address', '2001:db8::/56']) + + local_policy_path = ['policy', 'local-route', 'rule', '10'] + self.cli_set(local_policy_path + ['set', 'vrf', vrf_name]) + self.cli_set(local_policy_path + ['source', 'address', '192.0.2.1/32']) + + local_policy6_path = ['policy', 'local-route6', 'rule', '10'] + self.cli_set(local_policy6_path + ['set', 'vrf', vrf_name]) + self.cli_set(local_policy6_path + ['source', 'address', '2001:db8::/56']) + + self.cli_commit() + + self.cli_delete(base_path) + # check validate() - VRF referenced in policy based routing + with self.assertRaises(ConfigSessionError): + self.cli_commit() + self.cli_delete(['policy', 'route']) + # check validate() - VRF referenced in policy based routing + with self.assertRaises(ConfigSessionError): + self.cli_commit() + self.cli_delete(['policy', 'route6']) + # check validate() - VRF referenced in policy based routing + with self.assertRaises(ConfigSessionError): + self.cli_commit() + self.cli_delete(['policy', 'local-route']) + # check validate() - VRF referenced in policy based routing + with self.assertRaises(ConfigSessionError): + self.cli_commit() + self.cli_delete(['policy', 'local-route6']) + + self.cli_commit() + def test_dhcp_single_pool(self): # Prepare the vrf and options table = '100' |
