diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-05-21 11:05:53 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-05-21 11:59:08 +0200 |
commit | 4a0c0b4e041d9f42d0b1fbfa3a259e76707338cb (patch) | |
tree | 93a3c4beff1679f8d20787aa0c275446e4781179 | |
parent | e9c9af90a8eec973e3ebbe54b6530bfcf00e984b (diff) | |
download | vyos-1x-4a0c0b4e041d9f42d0b1fbfa3a259e76707338cb.tar.gz vyos-1x-4a0c0b4e041d9f42d0b1fbfa3a259e76707338cb.zip |
macsec: T2023: use list when working with Config()
-rwxr-xr-x | src/conf_mode/interfaces-macsec.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/conf_mode/interfaces-macsec.py b/src/conf_mode/interfaces-macsec.py index fcf23ed0f..874fd6d62 100755 --- a/src/conf_mode/interfaces-macsec.py +++ b/src/conf_mode/interfaces-macsec.py @@ -49,36 +49,37 @@ def get_config(): raise ConfigError('Interface (VYOS_TAGNODE_VALUE) not specified') macsec['intf'] = os.environ['VYOS_TAGNODE_VALUE'] + base_path = ['interfaces', 'macsec', macsec['intf']] # check if we are a member of any bridge macsec['is_bridge_member'] = is_member(conf, macsec['intf'], 'bridge') # Check if interface has been removed - if not conf.exists('interfaces macsec ' + macsec['intf']): + if not conf.exists(base_path): macsec['deleted'] = True return macsec # set new configuration level - conf.set_level('interfaces macsec ' + macsec['intf']) + conf.set_level(base_path) # retrieve configured interface addresses - if conf.exists('address'): - macsec['address'] = conf.return_values('address') + if conf.exists(['address']): + macsec['address'] = conf.return_values(['address']) # retrieve interface cipher - if conf.exists('cipher'): - macsec['cipher'] = conf.return_value('cipher') + if conf.exists(['cipher']): + macsec['cipher'] = conf.return_value(['cipher']) # retrieve interface description - if conf.exists('description'): - macsec['description'] = conf.return_value('description') + if conf.exists(['description']): + macsec['description'] = conf.return_value(['description']) # Disable this interface - if conf.exists('disable'): + if conf.exists(['disable']): macsec['disable'] = True # Enable optional MACsec encryption - if conf.exists('encrypt'): + if conf.exists(['encrypt']): macsec['encrypt'] = 'on' # Physical interface @@ -87,13 +88,13 @@ def get_config(): # Determine interface addresses (currently effective) - to determine which # address is no longer valid and needs to be removed from the interface - eff_addr = conf.return_effective_values('address') - act_addr = conf.return_values('address') + eff_addr = conf.return_effective_values(['address']) + act_addr = conf.return_values(['address']) macsec['address_remove'] = list_diff(eff_addr, act_addr) # retrieve VRF instance - if conf.exists('vrf'): - macsec['vrf'] = conf.return_value('vrf') + if conf.exists(['vrf']): + macsec['vrf'] = conf.return_value(['vrf']) return macsec |