diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2025-09-29 18:37:12 +0300 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2025-10-02 11:13:03 +0300 |
| commit | cdaab0af3509b99e5ce889ec872123c4574e9d23 (patch) | |
| tree | 96aa268bb24711678f70c2dd51449e4b1a3cb23f /src | |
| parent | 5248f1cebd4ac9cd8bebb62aa08ecc042a082f30 (diff) | |
| download | vyos-1x-cdaab0af3509b99e5ce889ec872123c4574e9d23.tar.gz vyos-1x-cdaab0af3509b99e5ce889ec872123c4574e9d23.zip | |
T7884: VPP: dependency issue when set interface address and NAT44 address translation interface in one commit
Moved dependencies for NAT to be executed after interfaces_ethernet, and
all settings for the interface (including interface address) have
already been applied
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: |
