summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Royds <github@mnr.cc>2021-05-23 11:20:56 +0100
committerGitHub <noreply@github.com>2021-05-23 12:20:56 +0200
commitc17f259d09abd2bf632d09400fe8deb4c2781d32 (patch)
tree7c612f93696b2947c839aab31e66b35790660f3f /src
parented817477dd418f4b448910e990f38a9a3de5ee73 (diff)
downloadvyos-1x-c17f259d09abd2bf632d09400fe8deb4c2781d32.tar.gz
vyos-1x-c17f259d09abd2bf632d09400fe8deb4c2781d32.zip
router-advert: T3561: add support for specific routes
Co-authored-by: Mark Royds <mark.royds@vitaminit.co.uk>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/service_router-advert.py12
-rwxr-xr-xsrc/migration-scripts/interfaces/5-to-610
2 files changed, 20 insertions, 2 deletions
diff --git a/src/conf_mode/service_router-advert.py b/src/conf_mode/service_router-advert.py
index 65eb11ce3..1f6d90fb4 100755
--- a/src/conf_mode/service_router-advert.py
+++ b/src/conf_mode/service_router-advert.py
@@ -40,11 +40,14 @@ def get_config(config=None):
# We have gathered the dict representation of the CLI, but there are default
# options which we need to update into the dictionary retrived.
default_interface_values = defaults(base + ['interface'])
- # we deal with prefix defaults later on
+ # we deal with prefix, route defaults later on
if 'prefix' in default_interface_values:
del default_interface_values['prefix']
-
+ if 'route' in default_interface_values:
+ del default_interface_values['route']
+
default_prefix_values = defaults(base + ['interface', 'prefix'])
+ default_route_values = defaults(base + ['interface', 'route'])
if 'interface' in rtradv:
for interface in rtradv['interface']:
@@ -55,6 +58,11 @@ def get_config(config=None):
for prefix in rtradv['interface'][interface]['prefix']:
rtradv['interface'][interface]['prefix'][prefix] = dict_merge(
default_prefix_values, rtradv['interface'][interface]['prefix'][prefix])
+
+ if 'route' in rtradv['interface'][interface]:
+ for route in rtradv['interface'][interface]['route']:
+ rtradv['interface'][interface]['route'][route] = dict_merge(
+ default_route_values, rtradv['interface'][interface]['route'][route])
if 'name_server' in rtradv['interface'][interface]:
# always use a list when dealing with nameservers - eases the template generation
diff --git a/src/migration-scripts/interfaces/5-to-6 b/src/migration-scripts/interfaces/5-to-6
index 1291751d8..8ae34c208 100755
--- a/src/migration-scripts/interfaces/5-to-6
+++ b/src/migration-scripts/interfaces/5-to-6
@@ -55,6 +55,16 @@ def copy_rtradv(c, old_base, interface):
min_max = interval.split('-')[0]
c.set(new_base + ['interval', min_max], value=tmp)
+ # cleanup boolean nodes in individual route
+ route_base = new_base + ['route']
+ if c.exists(route_base):
+ for route in config.list_nodes(route_base):
+ if c.exists(route_base + [route, 'remove-route']):
+ tmp = c.return_value(route_base + [route, 'remove-route'])
+ c.delete(route_base + [route, 'remove-route'])
+ if tmp == 'false':
+ c.set(route_base + [route, 'no-remove-route'])
+
# cleanup boolean nodes in individual prefix
prefix_base = new_base + ['prefix']
if c.exists(prefix_base):