diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-03-24 11:07:14 +0200 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-03-26 15:00:39 +0200 |
| commit | 29625d6081ac27c87dd8ce8e18371c54dc0cabe8 (patch) | |
| tree | 92ab56acd09e99ffac0fc77c4d828917ceb88796 /python | |
| parent | fc06cc45148a42171baf9f4ae01da33c3f0df1aa (diff) | |
| download | vyos-1x-29625d6081ac27c87dd8ce8e18371c54dc0cabe8.tar.gz vyos-1x-29625d6081ac27c87dd8ce8e18371c54dc0cabe8.zip | |
vpp: T8416: Prevent interfaces from being assigned to xconnect and bridge/bonding at the same time
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/vpp/config_verify.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/python/vyos/vpp/config_verify.py b/python/vyos/vpp/config_verify.py index c93a647f9..b32544a40 100644 --- a/python/vyos/vpp/config_verify.py +++ b/python/vyos/vpp/config_verify.py @@ -62,6 +62,35 @@ def verify_vpp_tunnel_source_address(config: dict): ) +def verify_member_conflicts(iface, config, current_type): + """ + Check that a member interface is not already used by another interface type. + + Args: + iface (str): interface name to check + config (dict): configuration dictionary + current_type (str): the membership type being assigned + to the interface ('bridge', 'bond', or 'xconn') + + Raises: + ConfigError: If the interface is already a member of a conflicting interface type. + """ + iface_type_map = { + 'bridge': 'bridge', + 'bond': 'bonding', + 'xconn': 'xconnect', + } + for iface_type, label in iface_type_map.items(): + if iface_type == current_type: + continue + members = config.get(f'{iface_type}_members', {}).get(iface) + if members: + raise ConfigError( + f'Interface {iface} cannot be a member of {iface_type_map[current_type]} ' + f'because it already belongs to {label} interface(s): {", ".join(members)}.' + ) + + def create_cpu_error_message(cpus_required: int, cpus_available: int = None) -> str: cpu_info = get_cpus() logical_cores = sum( |
