summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-05-25 21:02:35 +0200
committerChristian Poessinger <christian@poessinger.com>2020-05-26 17:09:33 +0200
commitd5b58517f88358c686e6c8ea039a7a9a64d6c6ee (patch)
tree416632fd648499c40b8f4b8975c1da568af5401f /src/conf_mode
parent0cdfa72d5ccd8a2d382164a1ec39865802d1be7c (diff)
downloadvyos-1x-d5b58517f88358c686e6c8ea039a7a9a64d6c6ee.tar.gz
vyos-1x-d5b58517f88358c686e6c8ea039a7a9a64d6c6ee.zip
dhcpv6-pd: pppoe: T2506: restructure CLI
Rename the CLI nodes for prefix delegation from "dhcpv6-options delegate <interface>" to "dhcpv6-options prefix-delegation interface <interface>". The change is required to add the possibility to request for specific prefix sized via the CLI. That option was not possible with the old configuration tree.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py4
-rwxr-xr-xsrc/conf_mode/interfaces-bridge.py4
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py4
-rwxr-xr-xsrc/conf_mode/interfaces-pppoe.py20
-rwxr-xr-xsrc/conf_mode/interfaces-pseudo-ethernet.py4
-rwxr-xr-xsrc/conf_mode/interfaces-wireless.py4
6 files changed, 22 insertions, 18 deletions
diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py
index bdca9d170..b531e97fc 100755
--- a/src/conf_mode/interfaces-bonding.py
+++ b/src/conf_mode/interfaces-bonding.py
@@ -299,8 +299,8 @@ def apply(bond):
if bond['dhcpv6_temporary']:
b.dhcp.v6.options['dhcpv6_temporary'] = True
- if bond['dhcpv6_pd']:
- b.dhcp.v6.options['dhcpv6_pd'] = bond['dhcpv6_pd']
+ if bond['dhcpv6_pd_interfaces']:
+ b.dhcp.v6.options['dhcpv6_pd_interfaces'] = bond['dhcpv6_pd_interfaces']
# ignore link state changes
b.set_link_detect(bond['disable_link_detect'])
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py
index 3ff339f0f..865d8a999 100755
--- a/src/conf_mode/interfaces-bridge.py
+++ b/src/conf_mode/interfaces-bridge.py
@@ -321,8 +321,8 @@ def apply(bridge):
if bridge['dhcpv6_temporary']:
br.dhcp.v6.options['dhcpv6_temporary'] = True
- if bridge['dhcpv6_pd']:
- br.dhcp.v6.options['dhcpv6_pd'] = br['dhcpv6_pd']
+ if bridge['dhcpv6_pd_interfaces']:
+ br.dhcp.v6.options['dhcpv6_pd_interfaces'] = br['dhcpv6_pd_interfaces']
# assign/remove VRF
br.set_vrf(bridge['vrf'])
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index 0d73a30f1..8ffefc7cf 100755
--- a/src/conf_mode/interfaces-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -201,8 +201,8 @@ def apply(eth):
if eth['dhcpv6_temporary']:
e.dhcp.v6.options['dhcpv6_temporary'] = True
- if eth['dhcpv6_pd']:
- e.dhcp.v6.options['dhcpv6_pd'] = eth['dhcpv6_pd']
+ if eth['dhcpv6_pd_interfaces']:
+ e.dhcp.v6.options['dhcpv6_pd_interfaces'] = eth['dhcpv6_pd_interfaces']
# ignore link state changes
e.set_link_detect(eth['disable_link_detect'])
diff --git a/src/conf_mode/interfaces-pppoe.py b/src/conf_mode/interfaces-pppoe.py
index 6cde850c9..e8aeb810f 100755
--- a/src/conf_mode/interfaces-pppoe.py
+++ b/src/conf_mode/interfaces-pppoe.py
@@ -36,7 +36,7 @@ default_config_data = {
'deleted': False,
'description': '\0',
'disable': False,
- 'dhcpv6_pd': [],
+ 'dhcpv6_pd_interfaces': [],
'intf': '',
'idle_timeout': '',
'ipv6_autoconf': False,
@@ -137,15 +137,19 @@ def get_config():
if conf.exists('vrf'):
pppoe['vrf'] = conf.return_value(['vrf'])
- if conf.exists(['dhcpv6-options', 'delegate']):
- for interface in conf.list_nodes(['dhcpv6-options', 'delegate']):
+ if conf.exists(['dhcpv6-options', 'prefix-delegation']):
+ dhcpv6_pd_path = base_path + [pppoe['intf'],
+ 'dhcpv6-options', 'prefix-delegation']
+ conf.set_level(dhcpv6_pd_path)
+
+ for interface in conf.list_nodes(['interface']):
+ conf.set_level(dhcpv6_pd_path + ['interface', interface])
pd = {
'ifname': interface,
'sla_id': '',
'sla_len': '',
'if_id': ''
}
- conf.set_level(base_path + [pppoe['intf'], 'dhcpv6-options', 'delegate', interface])
if conf.exists(['sla-id']):
pd['sla_id'] = conf.return_value(['sla-id'])
@@ -153,10 +157,10 @@ def get_config():
if conf.exists(['sla-len']):
pd['sla_len'] = conf.return_value(['sla-len'])
- if conf.exists(['interface-id']):
- pd['if_id'] = conf.return_value(['interface-id'])
+ if conf.exists(['address']):
+ pd['if_id'] = conf.return_value(['address'])
- pppoe['dhcpv6_pd'].append(pd)
+ pppoe['dhcpv6_pd_interfaces'].append(pd)
return pppoe
@@ -223,7 +227,7 @@ def generate(pppoe):
render(script_pppoe_ipv6_up, 'pppoe/ipv6-up.script.tmpl',
pppoe, trim_blocks=True, permission=0o755)
- if len(pppoe['dhcpv6_pd']) > 0:
+ if len(pppoe['dhcpv6_pd_interfaces']) > 0:
# ipv6.tmpl relies on ifname - this should be made consitent in the
# future better then double key-ing the same value
pppoe['ifname'] = intf
diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py
index 3e036a753..c1f52d42c 100755
--- a/src/conf_mode/interfaces-pseudo-ethernet.py
+++ b/src/conf_mode/interfaces-pseudo-ethernet.py
@@ -171,8 +171,8 @@ def apply(peth):
if peth['dhcpv6_temporary']:
p.dhcp.v6.options['dhcpv6_temporary'] = True
- if peth['dhcpv6_pd']:
- p.dhcp.v6.options['dhcpv6_pd'] = peth['dhcpv6_pd']
+ if peth['dhcpv6_pd_interfaces']:
+ p.dhcp.v6.options['dhcpv6_pd_interfaces'] = peth['dhcpv6_pd_interfaces']
# ignore link state changes
p.set_link_detect(peth['disable_link_detect'])
diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py
index 0fa20c5f4..54420acd1 100755
--- a/src/conf_mode/interfaces-wireless.py
+++ b/src/conf_mode/interfaces-wireless.py
@@ -591,8 +591,8 @@ def apply(wifi):
if wifi['dhcpv6_temporary']:
w.dhcp.v6.options['dhcpv6_temporary'] = True
- if wifi['dhcpv6_pd']:
- w.dhcp.v6.options['dhcpv6_pd'] = wifi['dhcpv6_pd']
+ if wifi['dhcpv6_pd_interfaces']:
+ w.dhcp.v6.options['dhcpv6_pd_interfaces'] = wifi['dhcpv6_pd_interfaces']
# ignore link state changes
w.set_link_detect(wifi['disable_link_detect'])