diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-03-26 16:20:41 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-26 16:20:41 +0100 |
| commit | 1e694a1997ccc2a7267e25eb9c2cdfe29b0e9ce8 (patch) | |
| tree | dcfe044722abb5c6eae9490c8bc3ef034e961928 /python | |
| parent | 9ed6c0c2ab164cbd3ed05a5b559135435841dd03 (diff) | |
| parent | 29625d6081ac27c87dd8ce8e18371c54dc0cabe8 (diff) | |
| download | vyos-1x-1e694a1997ccc2a7267e25eb9c2cdfe29b0e9ce8.tar.gz vyos-1x-1e694a1997ccc2a7267e25eb9c2cdfe29b0e9ce8.zip | |
Merge pull request #5080 from natali-rs1985/T8416
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( |
