summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_vrf.py45
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'