diff options
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/vpp.py | 28 | ||||
| -rw-r--r-- | src/conf_mode/vpp_nat.py | 22 |
2 files changed, 26 insertions, 24 deletions
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py index 03f16b573..81502c0b4 100755 --- a/src/conf_mode/vpp.py +++ b/src/conf_mode/vpp.py @@ -216,20 +216,6 @@ def get_config(config=None): # to be reinitialized after the commit set_dependents('ethernet', conf, removed_iface) - # NAT dependency - if conf.exists(['vpp', 'nat44']): - set_dependents('vpp_nat', conf) - if conf.exists(['vpp', 'nat', 'cgnat']): - set_dependents('vpp_nat_cgnat', conf) - - # sFlow dependency - if conf.exists(['vpp', 'sflow']): - set_dependents('vpp_sflow', conf) - - # ACL dependency - if conf.exists(['vpp', 'acl']): - set_dependents('vpp_acl', conf) - # Get interfaces that are used in PPPoe for control-plane integration pppoe_conf = conf.get_config_dict( ['service', 'pppoe-server'], @@ -387,6 +373,20 @@ def get_config(config=None): eth_ifaces_persist[iface]['bus_id'] = control_host.get_bus_name(iface) eth_ifaces_persist[iface]['dev_id'] = control_host.get_dev_id(iface) + # NAT dependency + if conf.exists(['vpp', 'nat44']): + set_dependents('vpp_nat', conf) + if conf.exists(['vpp', 'nat', 'cgnat']): + set_dependents('vpp_nat_cgnat', conf) + + # sFlow dependency + if conf.exists(['vpp', 'sflow']): + set_dependents('vpp_sflow', conf) + + # ACL dependency + if conf.exists(['vpp', 'acl']): + set_dependents('vpp_acl', conf) + # PPPoE dependency if pppoe_map_ifaces: config['pppoe_ifaces'] = pppoe_map_ifaces diff --git a/src/conf_mode/vpp_nat.py b/src/conf_mode/vpp_nat.py index 8d18aa1fe..ad82b53b4 100644 --- a/src/conf_mode/vpp_nat.py +++ b/src/conf_mode/vpp_nat.py @@ -198,11 +198,12 @@ def verify(config): raise ConfigError( f'{interface} must be a VPP interface for "address-pool translation interface"' ) - iface_address = ( - get_interface_address(interface) - .get('addr_info', [])[0] - .get('local') - ) + address_info = get_interface_address(interface).get('addr_info') + if not address_info: + raise ConfigError( + f'{interface} should have an address to be used for "address-pool translation interface"' + ) + iface_address = address_info[0].get('local') addresses_translation.append(iface_address) if 'twice_nat' in address_pool: @@ -227,11 +228,12 @@ def verify(config): raise ConfigError( f'{interface} must be a VPP interface for "address-pool twice-nat interface"' ) - iface_address = ( - get_interface_address(interface) - .get('addr_info', [])[0] - .get('local') - ) + address_info = get_interface_address(interface).get('addr_info') + if not address_info: + raise ConfigError( + f'{interface} should have an address to be used for "address-pool twice-nat interface"' + ) + iface_address = address_info[0].get('local') addresses_twice_nat.append(iface_address) if 'static' in config: |
