summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-pseudo-ethernet.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf_mode/interfaces-pseudo-ethernet.py')
-rwxr-xr-xsrc/conf_mode/interfaces-pseudo-ethernet.py52
1 files changed, 20 insertions, 32 deletions
diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py
index 50b5a12a0..655006146 100755
--- a/src/conf_mode/interfaces-pseudo-ethernet.py
+++ b/src/conf_mode/interfaces-pseudo-ethernet.py
@@ -51,8 +51,8 @@ default_config_data = {
'ipv6_forwarding': 1,
'ipv6_dup_addr_detect': 1,
'intf': '',
- 'link': '',
- 'link_changed': False,
+ 'source_interface': '',
+ 'source_interface_changed': False,
'mac': '',
'mode': 'private',
'vif_s': [],
@@ -166,12 +166,12 @@ def get_config():
if conf.exists('ipv6 dup-addr-detect-transmits'):
peth['ipv6_dup_addr_detect'] = int(conf.return_value('ipv6 dup-addr-detect-transmits'))
- # Lower link device
- if conf.exists(['link']):
- peth['link'] = conf.return_value(['link'])
- tmp = conf.return_effective_value(['link'])
- if tmp != peth['link']:
- peth['link_changed'] = True
+ # Physical interface
+ if conf.exists(['source-interface']):
+ peth['source_interface'] = conf.return_value(['source-interface'])
+ tmp = conf.return_effective_value(['source-interface'])
+ if tmp != peth['source_interface']:
+ peth['source_interface_changed'] = True
# Media Access Control (MAC) address
if conf.exists(['mac']):
@@ -227,10 +227,10 @@ def verify(peth):
'is a member of bridge "{1}"!'.format(interface, bridge))
return None
- if not peth['link']:
+ if not peth['source_interface']:
raise ConfigError('Link device must be set for virtual ethernet {}'.format(peth['intf']))
- if not peth['link'] in interfaces():
+ if not peth['source_interface'] in interfaces():
raise ConfigError('Pseudo-ethernet source interface does not exist')
vrf_name = peth['vrf']
@@ -253,12 +253,12 @@ def apply(peth):
p.remove()
return None
- elif peth['link_changed']:
+ elif peth['source_interface_changed']:
# Check if MACVLAN interface already exists. Parameters like the
- # underlaying link device can not be changed on the fly and the
- # interface needs to be recreated from the bottom.
+ # underlaying source-interface device can not be changed on the fly
+ # and the interface needs to be recreated from the bottom.
#
- # link_changed also means - the interface was not present in the
+ # source_interface_changed also means - the interface was not present in the
# beginning and is newly created
if peth['intf'] in interfaces():
p = MACVLANIf(peth['intf'])
@@ -269,7 +269,7 @@ def apply(peth):
conf = deepcopy(MACVLANIf.get_config())
# Assign MACVLAN instance configuration parameters to config dict
- conf['link'] = peth['link']
+ conf['source_interface'] = peth['source_interface']
conf['mode'] = peth['mode']
# It is safe to "re-create" the interface always, there is a sanity check
@@ -281,32 +281,20 @@ def apply(peth):
# update interface description used e.g. within SNMP
p.set_alias(peth['description'])
- # get DHCP config dictionary and update values
- opt = p.get_dhcp_options()
-
if peth['dhcp_client_id']:
- opt['client_id'] = peth['dhcp_client_id']
+ p.dhcp.v4.options['client_id'] = peth['dhcp_client_id']
if peth['dhcp_hostname']:
- opt['hostname'] = peth['dhcp_hostname']
+ p.dhcp.v4.options['hostname'] = peth['dhcp_hostname']
if peth['dhcp_vendor_class_id']:
- opt['vendor_class_id'] = peth['dhcp_vendor_class_id']
-
- # store DHCP config dictionary - used later on when addresses are aquired
- p.set_dhcp_options(opt)
-
- # get DHCPv6 config dictionary and update values
- opt = p.get_dhcpv6_options()
+ p.dhcp.v4.options['vendor_class_id'] = peth['dhcp_vendor_class_id']
if peth['dhcpv6_prm_only']:
- opt['dhcpv6_prm_only'] = True
+ p.dhcp.v6.options['dhcpv6_prm_only'] = True
if peth['dhcpv6_temporary']:
- opt['dhcpv6_temporary'] = True
-
- # store DHCPv6 config dictionary - used later on when addresses are aquired
- p.set_dhcpv6_options(opt)
+ p.dhcp.v6.options['dhcpv6_temporary'] = True
# ignore link state changes
p.set_link_detect(peth['disable_link_detect'])