summaryrefslogtreecommitdiff
path: root/src/op_mode/policy_route.py
diff options
context:
space:
mode:
authorsarthurdev <965089+sarthurdev@users.noreply.github.com>2022-01-11 01:10:59 +0100
committersarthurdev <965089+sarthurdev@users.noreply.github.com>2022-01-11 14:49:12 +0100
commit6cf5767524b8519f86981943ab71ff288bf77d67 (patch)
treeb0fb06a0d51ad6c3ed39bfc631642c62b61d52cf /src/op_mode/policy_route.py
parente389729f4de84ce3f32e1a0cdb471c919d7d7807 (diff)
downloadvyos-1x-6cf5767524b8519f86981943ab71ff288bf77d67.tar.gz
vyos-1x-6cf5767524b8519f86981943ab71ff288bf77d67.zip
policy: T2199: Refactor policy route script for better error handling
* Migrates all policy route references from `ipv6-route` to `route6` * Update test config `dialup-router-medium-vpn` to test migration of `ipv6-route` to `route6`
Diffstat (limited to 'src/op_mode/policy_route.py')
-rwxr-xr-xsrc/op_mode/policy_route.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/op_mode/policy_route.py b/src/op_mode/policy_route.py
index e0b4ac514..95a7eadac 100755
--- a/src/op_mode/policy_route.py
+++ b/src/op_mode/policy_route.py
@@ -26,7 +26,7 @@ def get_policy_interfaces(conf, policy, name=None, ipv6=False):
interfaces = conf.get_config_dict(['interfaces'], key_mangling=('-', '_'),
get_first_key=True, no_tag_node_value_mangle=True)
- routes = ['route', 'ipv6_route']
+ routes = ['route', 'route6']
def parse_if(ifname, if_conf):
if 'policy' in if_conf:
@@ -52,7 +52,7 @@ def get_policy_interfaces(conf, policy, name=None, ipv6=False):
def get_config_policy(conf, name=None, ipv6=False, interfaces=True):
config_path = ['policy']
if name:
- config_path += ['ipv6-route' if ipv6 else 'route', name]
+ config_path += ['route6' if ipv6 else 'route', name]
policy = conf.get_config_dict(config_path, key_mangling=('-', '_'),
get_first_key=True, no_tag_node_value_mangle=True)
@@ -64,7 +64,7 @@ def get_config_policy(conf, name=None, ipv6=False, interfaces=True):
for route_name, route_conf in policy['route'].items():
route_conf['interface'] = []
- if 'ipv6_route' in policy:
+ if 'route6' in policy:
for route_name, route_conf in policy['ipv6_route'].items():
route_conf['interface'] = []
@@ -151,8 +151,8 @@ def show_policy(ipv6=False):
for route, route_conf in policy['route'].items():
output_policy_route(route, route_conf, ipv6=False)
- if ipv6 and 'ipv6_route' in policy:
- for route, route_conf in policy['ipv6_route'].items():
+ if ipv6 and 'route6' in policy:
+ for route, route_conf in policy['route6'].items():
output_policy_route(route, route_conf, ipv6=True)
def show_policy_name(name, ipv6=False):