diff options
| author | l0crian1 <ryan.claridge13@gmail.com> | 2025-04-10 11:03:33 -0400 |
|---|---|---|
| committer | l0crian1 <ryan.claridge13@gmail.com> | 2025-04-10 11:03:33 -0400 |
| commit | ad5f14c783c18d48f678d8ab89afc02b6d5d215c (patch) | |
| tree | 6dedae24fbd0c4f96a177af58ab06962a4374357 /python/vyos/configdict.py | |
| parent | d25fa39b1c055e3f44c70504e89455b496a775ce (diff) | |
| download | veeos-1x-ad5f14c783c18d48f678d8ab89afc02b6d5d215c.tar.gz veeos-1x-ad5f14c783c18d48f678d8ab89afc02b6d5d215c.zip | |
bridge:T7322: Fix bridge allowed-vlan handling
Allowed VLAN ranges are unnecessarily deconstructed into individual vlans, and then added one by one to the bridge. This can take a long time if a large range like 1-4084 is used.
- python/vyos/configdict.py - Added get_vlans_ids_and_range function to return configured ranges
- python/vyos/ifconfig/bridge.py - Modified add and delete vlan section to not loop unnecessarily
Diffstat (limited to 'python/vyos/configdict.py')
| -rw-r--r-- | python/vyos/configdict.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index 78b98a3eb..73372022b 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -626,6 +626,23 @@ def get_vlan_ids(interface): return vlan_ids +def get_vlans_ids_and_range(interface): + vlan_ids = set() + + vlan_filter_status = json.loads(cmd(f'bridge -j -d vlan show dev {interface}')) + + if vlan_filter_status is not None: + for interface_status in vlan_filter_status: + for vlan_entry in iface.get("vlans", []): + start = vlan_entry["vlan"] + end = vlan_entry.get("vlanEnd") + if end: + vlan_ids.add(f"{start}-{end}") + else: + vlan_ids.add(str(start)) + + return vlan_ids + def get_accel_dict(config, base, chap_secrets, with_pki=False): """ Common utility function to retrieve and mangle the Accel-PPP configuration |
