From b4b91fbe0e26e147adf9ae68bf3e5fbbb6690068 Mon Sep 17 00:00:00 2001 From: MaheshGSLAB Date: Mon, 26 May 2025 16:49:17 +0530 Subject: [PATCH 1/3] Feat(eos_designs): Added support of Spanning Tree Port ID Allocation --- .../configs/spanning-tree-mode-rapid-pvst.cfg | 1 + .../spanning-tree-mode-rapid-pvst.yml | 3 ++ .../spanning-tree-mode-rapid-pvst.yml | 4 ++ .../docs/tables/node-type-structure.md | 48 +++++++++++++++++++ .../pyavd/_eos_designs/schema/__init__.py | 48 +++++++++++++++++++ .../schema/eos_designs.schema.yml | 3 ++ .../defs_node_type.schema.yml | 3 ++ .../structured_config/base/__init__.py | 4 ++ 8 files changed, 114 insertions(+) diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/spanning-tree-mode-rapid-pvst.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/spanning-tree-mode-rapid-pvst.cfg index b5b889d0e50..3c00b805b8b 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/spanning-tree-mode-rapid-pvst.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/spanning-tree-mode-rapid-pvst.cfg @@ -11,6 +11,7 @@ service routing protocols model multi-agent hostname spanning-tree-mode-rapid-pvst ! spanning-tree mode rapid-pvst +spanning-tree port-id allocation port-channel range 201 2001 spanning-tree vlan-id 1-10,13-20,23-4093 priority 8192 spanning-tree vlan-id 11,21 priority 16384 spanning-tree vlan-id 12,22 priority 32768 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/spanning-tree-mode-rapid-pvst.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/spanning-tree-mode-rapid-pvst.yml index b2c9e1bc24b..5a045cefe13 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/spanning-tree-mode-rapid-pvst.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/spanning-tree-mode-rapid-pvst.yml @@ -23,6 +23,9 @@ spanning_tree: priority: 32768 - id: 1-10,13-20,23-4093 priority: 8192 + port_id_allocation_port_channel_range: + minimum: 201 + maximum: 2001 transceiver_qsfp_default_mode_4x10: true vlan_internal_order: allocation: ascending diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/spanning-tree-mode-rapid-pvst.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/spanning-tree-mode-rapid-pvst.yml index d9f732c4998..0fd4ab3bf83 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/spanning-tree-mode-rapid-pvst.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/spanning-tree-mode-rapid-pvst.yml @@ -5,6 +5,10 @@ l2leaf: - name: spanning-tree-mode-rapid-pvst spanning_tree_mode: rapid-pvst spanning_tree_priority: 8192 + # Test for spanning_tree_port_id_allocation_port_channel_range + spanning_tree_port_id_allocation_port_channel_range: + minimum: 201 + maximum: 2001 tenants: - name: test diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-structure.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-structure.md index 2c90deb5ca0..e344b44ccfc 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-structure.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-structure.md @@ -9,12 +9,24 @@ | -------- | ---- | -------- | ------- | ------------------ | ----------- | | [<node_type_keys.key>](## "") | Dictionary | | | | | | [  defaults](## ".defaults") | Dictionary | | | | Define variables for all nodes of this type. | + | [    spanning_tree_port_id_allocation_port_channel_range](## ".defaults.spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | + | [      minimum](## ".defaults.spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | + | [      maximum](## ".defaults.spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | | [  node_groups](## ".node_groups") | List, items: Dictionary | | | | Define variables related to all nodes part of this group. | | [    - group](## ".node_groups.[].group") | String | Required, Unique | | | The Node Group Name is used for MLAG domain unless set with 'mlag_domain_id'.
The Node Group Name is also used for peer description on downstream switches' uplinks.
| | [      nodes](## ".node_groups.[].nodes") | List, items: Dictionary | | | | Define variables per node. | | [        - name](## ".node_groups.[].nodes.[].name") | String | Required, Unique | | | The Node Name is used as "hostname". | + | [          spanning_tree_port_id_allocation_port_channel_range](## ".node_groups.[].nodes.[].spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | + | [            minimum](## ".node_groups.[].nodes.[].spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | + | [            maximum](## ".node_groups.[].nodes.[].spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | + | [      spanning_tree_port_id_allocation_port_channel_range](## ".node_groups.[].spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | + | [        minimum](## ".node_groups.[].spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | + | [        maximum](## ".node_groups.[].spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | | [  nodes](## ".nodes") | List, items: Dictionary | | | | Define variables per node. | | [    - name](## ".nodes.[].name") | String | Required, Unique | | | The Node Name is used as "hostname". | + | [      spanning_tree_port_id_allocation_port_channel_range](## ".nodes.[].spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | + | [        minimum](## ".nodes.[].spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | + | [        maximum](## ".nodes.[].spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | === "YAML" @@ -24,6 +36,15 @@ # Define variables for all nodes of this type. defaults: + # Specify range of port-ids to reserve for port-channels. + spanning_tree_port_id_allocation_port_channel_range: + + # Specify minimum value for reserved range. + minimum: + + # Specify maximum value for reserved range. + maximum: + # Define variables related to all nodes part of this group. node_groups: @@ -37,9 +58,36 @@ # The Node Name is used as "hostname". - name: + # Specify range of port-ids to reserve for port-channels. + spanning_tree_port_id_allocation_port_channel_range: + + # Specify minimum value for reserved range. + minimum: + + # Specify maximum value for reserved range. + maximum: + + # Specify range of port-ids to reserve for port-channels. + spanning_tree_port_id_allocation_port_channel_range: + + # Specify minimum value for reserved range. + minimum: + + # Specify maximum value for reserved range. + maximum: + # Define variables per node. nodes: # The Node Name is used as "hostname". - name: + + # Specify range of port-ids to reserve for port-channels. + spanning_tree_port_id_allocation_port_channel_range: + + # Specify minimum value for reserved range. + minimum: + + # Specify maximum value for reserved range. + maximum: ``` diff --git a/python-avd/pyavd/_eos_designs/schema/__init__.py b/python-avd/pyavd/_eos_designs/schema/__init__.py index 92b2a38b83c..96b6bdb4658 100644 --- a/python-avd/pyavd/_eos_designs/schema/__init__.py +++ b/python-avd/pyavd/_eos_designs/schema/__init__.py @@ -20958,6 +20958,7 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): "spanning_tree_priority": {"type": int, "default": 32768}, "spanning_tree_root_super": {"type": bool, "default": False}, "spanning_tree_mst_pvst_boundary": {"type": bool}, + "spanning_tree_port_id_allocation_port_channel_range": {"type": EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange}, "virtual_router_mac_address": {"type": str}, "inband_mgmt_interface": {"type": str}, "inband_mgmt_vlan": {"type": int, "default": 4092}, @@ -21501,6 +21502,8 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): """Default value: `False`""" spanning_tree_mst_pvst_boundary: bool | None """Enable MST PVST border ports.""" + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + """Specify range of port-ids to reserve for port-channels.""" virtual_router_mac_address: str | None """Virtual router mac address for anycast gateway.""" inband_mgmt_interface: str | None @@ -21859,6 +21862,8 @@ def __init__( spanning_tree_priority: int | UndefinedType = Undefined, spanning_tree_root_super: bool | UndefinedType = Undefined, spanning_tree_mst_pvst_boundary: bool | None | UndefinedType = Undefined, + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + | UndefinedType = Undefined, virtual_router_mac_address: str | None | UndefinedType = Undefined, inband_mgmt_interface: str | None | UndefinedType = Undefined, inband_mgmt_vlan: int | UndefinedType = Undefined, @@ -22244,6 +22249,7 @@ def __init__( set per VLAN under network services. spanning_tree_root_super: spanning_tree_root_super spanning_tree_mst_pvst_boundary: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: Specify range of port-ids to reserve for port-channels. virtual_router_mac_address: Virtual router mac address for anycast gateway. inband_mgmt_interface: Pointer to interface used for inband management. @@ -25047,6 +25053,7 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): "spanning_tree_priority": {"type": int, "default": 32768}, "spanning_tree_root_super": {"type": bool, "default": False}, "spanning_tree_mst_pvst_boundary": {"type": bool}, + "spanning_tree_port_id_allocation_port_channel_range": {"type": EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange}, "virtual_router_mac_address": {"type": str}, "inband_mgmt_interface": {"type": str}, "inband_mgmt_vlan": {"type": int, "default": 4092}, @@ -25600,6 +25607,8 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): """Default value: `False`""" spanning_tree_mst_pvst_boundary: bool | None """Enable MST PVST border ports.""" + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + """Specify range of port-ids to reserve for port-channels.""" virtual_router_mac_address: str | None """Virtual router mac address for anycast gateway.""" inband_mgmt_interface: str | None @@ -25960,6 +25969,8 @@ def __init__( spanning_tree_priority: int | UndefinedType = Undefined, spanning_tree_root_super: bool | UndefinedType = Undefined, spanning_tree_mst_pvst_boundary: bool | None | UndefinedType = Undefined, + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + | UndefinedType = Undefined, virtual_router_mac_address: str | None | UndefinedType = Undefined, inband_mgmt_interface: str | None | UndefinedType = Undefined, inband_mgmt_vlan: int | UndefinedType = Undefined, @@ -26352,6 +26363,7 @@ def __init__( set per VLAN under network services. spanning_tree_root_super: spanning_tree_root_super spanning_tree_mst_pvst_boundary: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: Specify range of port-ids to reserve for port-channels. virtual_router_mac_address: Virtual router mac address for anycast gateway. inband_mgmt_interface: Pointer to interface used for inband management. @@ -29080,6 +29092,7 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): "spanning_tree_priority": {"type": int, "default": 32768}, "spanning_tree_root_super": {"type": bool, "default": False}, "spanning_tree_mst_pvst_boundary": {"type": bool}, + "spanning_tree_port_id_allocation_port_channel_range": {"type": EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange}, "virtual_router_mac_address": {"type": str}, "inband_mgmt_interface": {"type": str}, "inband_mgmt_vlan": {"type": int, "default": 4092}, @@ -29636,6 +29649,8 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): """Default value: `False`""" spanning_tree_mst_pvst_boundary: bool | None """Enable MST PVST border ports.""" + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + """Specify range of port-ids to reserve for port-channels.""" virtual_router_mac_address: str | None """Virtual router mac address for anycast gateway.""" inband_mgmt_interface: str | None @@ -29996,6 +30011,8 @@ def __init__( spanning_tree_priority: int | UndefinedType = Undefined, spanning_tree_root_super: bool | UndefinedType = Undefined, spanning_tree_mst_pvst_boundary: bool | None | UndefinedType = Undefined, + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + | UndefinedType = Undefined, virtual_router_mac_address: str | None | UndefinedType = Undefined, inband_mgmt_interface: str | None | UndefinedType = Undefined, inband_mgmt_vlan: int | UndefinedType = Undefined, @@ -30390,6 +30407,7 @@ def __init__( set per VLAN under network services. spanning_tree_root_super: spanning_tree_root_super spanning_tree_mst_pvst_boundary: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: Specify range of port-ids to reserve for port-channels. virtual_router_mac_address: Virtual router mac address for anycast gateway. inband_mgmt_interface: Pointer to interface used for inband management. @@ -33177,6 +33195,7 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): "spanning_tree_priority": {"type": int, "default": 32768}, "spanning_tree_root_super": {"type": bool, "default": False}, "spanning_tree_mst_pvst_boundary": {"type": bool}, + "spanning_tree_port_id_allocation_port_channel_range": {"type": EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange}, "virtual_router_mac_address": {"type": str}, "inband_mgmt_interface": {"type": str}, "inband_mgmt_vlan": {"type": int, "default": 4092}, @@ -33730,6 +33749,8 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): """Default value: `False`""" spanning_tree_mst_pvst_boundary: bool | None """Enable MST PVST border ports.""" + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + """Specify range of port-ids to reserve for port-channels.""" virtual_router_mac_address: str | None """Virtual router mac address for anycast gateway.""" inband_mgmt_interface: str | None @@ -34090,6 +34111,8 @@ def __init__( spanning_tree_priority: int | UndefinedType = Undefined, spanning_tree_root_super: bool | UndefinedType = Undefined, spanning_tree_mst_pvst_boundary: bool | None | UndefinedType = Undefined, + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + | UndefinedType = Undefined, virtual_router_mac_address: str | None | UndefinedType = Undefined, inband_mgmt_interface: str | None | UndefinedType = Undefined, inband_mgmt_vlan: int | UndefinedType = Undefined, @@ -34482,6 +34505,7 @@ def __init__( set per VLAN under network services. spanning_tree_root_super: spanning_tree_root_super spanning_tree_mst_pvst_boundary: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: Specify range of port-ids to reserve for port-channels. virtual_router_mac_address: Virtual router mac address for anycast gateway. inband_mgmt_interface: Pointer to interface used for inband management. @@ -44212,6 +44236,7 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): "spanning_tree_priority": {"type": int, "default": 32768}, "spanning_tree_root_super": {"type": bool, "default": False}, "spanning_tree_mst_pvst_boundary": {"type": bool}, + "spanning_tree_port_id_allocation_port_channel_range": {"type": EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange}, "virtual_router_mac_address": {"type": str}, "inband_mgmt_interface": {"type": str}, "inband_mgmt_vlan": {"type": int, "default": 4092}, @@ -44755,6 +44780,8 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): """Default value: `False`""" spanning_tree_mst_pvst_boundary: bool | None """Enable MST PVST border ports.""" + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + """Specify range of port-ids to reserve for port-channels.""" virtual_router_mac_address: str | None """Virtual router mac address for anycast gateway.""" inband_mgmt_interface: str | None @@ -45113,6 +45140,8 @@ def __init__( spanning_tree_priority: int | UndefinedType = Undefined, spanning_tree_root_super: bool | UndefinedType = Undefined, spanning_tree_mst_pvst_boundary: bool | None | UndefinedType = Undefined, + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + | UndefinedType = Undefined, virtual_router_mac_address: str | None | UndefinedType = Undefined, inband_mgmt_interface: str | None | UndefinedType = Undefined, inband_mgmt_vlan: int | UndefinedType = Undefined, @@ -45498,6 +45527,7 @@ def __init__( set per VLAN under network services. spanning_tree_root_super: spanning_tree_root_super spanning_tree_mst_pvst_boundary: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: Specify range of port-ids to reserve for port-channels. virtual_router_mac_address: Virtual router mac address for anycast gateway. inband_mgmt_interface: Pointer to interface used for inband management. @@ -48301,6 +48331,7 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): "spanning_tree_priority": {"type": int, "default": 32768}, "spanning_tree_root_super": {"type": bool, "default": False}, "spanning_tree_mst_pvst_boundary": {"type": bool}, + "spanning_tree_port_id_allocation_port_channel_range": {"type": EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange}, "virtual_router_mac_address": {"type": str}, "inband_mgmt_interface": {"type": str}, "inband_mgmt_vlan": {"type": int, "default": 4092}, @@ -48854,6 +48885,8 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): """Default value: `False`""" spanning_tree_mst_pvst_boundary: bool | None """Enable MST PVST border ports.""" + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + """Specify range of port-ids to reserve for port-channels.""" virtual_router_mac_address: str | None """Virtual router mac address for anycast gateway.""" inband_mgmt_interface: str | None @@ -49214,6 +49247,8 @@ def __init__( spanning_tree_priority: int | UndefinedType = Undefined, spanning_tree_root_super: bool | UndefinedType = Undefined, spanning_tree_mst_pvst_boundary: bool | None | UndefinedType = Undefined, + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + | UndefinedType = Undefined, virtual_router_mac_address: str | None | UndefinedType = Undefined, inband_mgmt_interface: str | None | UndefinedType = Undefined, inband_mgmt_vlan: int | UndefinedType = Undefined, @@ -49606,6 +49641,7 @@ def __init__( set per VLAN under network services. spanning_tree_root_super: spanning_tree_root_super spanning_tree_mst_pvst_boundary: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: Specify range of port-ids to reserve for port-channels. virtual_router_mac_address: Virtual router mac address for anycast gateway. inband_mgmt_interface: Pointer to interface used for inband management. @@ -52334,6 +52370,7 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): "spanning_tree_priority": {"type": int, "default": 32768}, "spanning_tree_root_super": {"type": bool, "default": False}, "spanning_tree_mst_pvst_boundary": {"type": bool}, + "spanning_tree_port_id_allocation_port_channel_range": {"type": EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange}, "virtual_router_mac_address": {"type": str}, "inband_mgmt_interface": {"type": str}, "inband_mgmt_vlan": {"type": int, "default": 4092}, @@ -52890,6 +52927,8 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): """Default value: `False`""" spanning_tree_mst_pvst_boundary: bool | None """Enable MST PVST border ports.""" + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + """Specify range of port-ids to reserve for port-channels.""" virtual_router_mac_address: str | None """Virtual router mac address for anycast gateway.""" inband_mgmt_interface: str | None @@ -53250,6 +53289,8 @@ def __init__( spanning_tree_priority: int | UndefinedType = Undefined, spanning_tree_root_super: bool | UndefinedType = Undefined, spanning_tree_mst_pvst_boundary: bool | None | UndefinedType = Undefined, + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + | UndefinedType = Undefined, virtual_router_mac_address: str | None | UndefinedType = Undefined, inband_mgmt_interface: str | None | UndefinedType = Undefined, inband_mgmt_vlan: int | UndefinedType = Undefined, @@ -53644,6 +53685,7 @@ def __init__( set per VLAN under network services. spanning_tree_root_super: spanning_tree_root_super spanning_tree_mst_pvst_boundary: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: Specify range of port-ids to reserve for port-channels. virtual_router_mac_address: Virtual router mac address for anycast gateway. inband_mgmt_interface: Pointer to interface used for inband management. @@ -56431,6 +56473,7 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): "spanning_tree_priority": {"type": int, "default": 32768}, "spanning_tree_root_super": {"type": bool, "default": False}, "spanning_tree_mst_pvst_boundary": {"type": bool}, + "spanning_tree_port_id_allocation_port_channel_range": {"type": EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange}, "virtual_router_mac_address": {"type": str}, "inband_mgmt_interface": {"type": str}, "inband_mgmt_vlan": {"type": int, "default": 4092}, @@ -56984,6 +57027,8 @@ class L3PortChannels(AvdIndexedList[str, L3PortChannelsItem]): """Default value: `False`""" spanning_tree_mst_pvst_boundary: bool | None """Enable MST PVST border ports.""" + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + """Specify range of port-ids to reserve for port-channels.""" virtual_router_mac_address: str | None """Virtual router mac address for anycast gateway.""" inband_mgmt_interface: str | None @@ -57344,6 +57389,8 @@ def __init__( spanning_tree_priority: int | UndefinedType = Undefined, spanning_tree_root_super: bool | UndefinedType = Undefined, spanning_tree_mst_pvst_boundary: bool | None | UndefinedType = Undefined, + spanning_tree_port_id_allocation_port_channel_range: EosCliConfigGen.SpanningTree.PortIdAllocationPortChannelRange + | UndefinedType = Undefined, virtual_router_mac_address: str | None | UndefinedType = Undefined, inband_mgmt_interface: str | None | UndefinedType = Undefined, inband_mgmt_vlan: int | UndefinedType = Undefined, @@ -57736,6 +57783,7 @@ def __init__( set per VLAN under network services. spanning_tree_root_super: spanning_tree_root_super spanning_tree_mst_pvst_boundary: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: Specify range of port-ids to reserve for port-channels. virtual_router_mac_address: Virtual router mac address for anycast gateway. inband_mgmt_interface: Pointer to interface used for inband management. diff --git a/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml b/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml index 057da0e9ddf..10b78820783 100644 --- a/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml @@ -9211,6 +9211,9 @@ $defs: table: node-type-l2-mlag-configuration type: bool description: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: + type: dict + $ref: eos_cli_config_gen#/keys/spanning_tree/keys/port_id_allocation_port_channel_range virtual_router_mac_address: documentation_options: table: node-type-l2-mlag-configuration diff --git a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type.schema.yml b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type.schema.yml index 2ffaf4ab307..29d2172a0e7 100644 --- a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type.schema.yml @@ -916,6 +916,9 @@ $defs: table: node-type-l2-mlag-configuration type: bool description: Enable MST PVST border ports. + spanning_tree_port_id_allocation_port_channel_range: + type: dict + $ref: "eos_cli_config_gen#/keys/spanning_tree/keys/port_id_allocation_port_channel_range" virtual_router_mac_address: documentation_options: table: node-type-l2-mlag-configuration diff --git a/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py b/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py index 1f6df4feb5c..c87e17b2f11 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py +++ b/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py @@ -331,6 +331,10 @@ def spanning_tree(self) -> None: if self.shared_utils.node_config.spanning_tree_mst_pvst_boundary: self.structured_config.spanning_tree.mst.pvst_border = True + stp_po_range = self.shared_utils.node_config.spanning_tree_port_id_allocation_port_channel_range + if stp_po_range: + self.structured_config.spanning_tree.port_id_allocation_port_channel_range._update(minimum=stp_po_range.minimum, maximum=stp_po_range.maximum) + if spanning_tree_mode is not None: self.structured_config.spanning_tree.mode = spanning_tree_mode priority = self.shared_utils.node_config.spanning_tree_priority From 04254a46a7b3bc76b7ffa4cbf735ecc548fcea2e Mon Sep 17 00:00:00 2001 From: MaheshGSLAB Date: Wed, 28 May 2025 12:21:15 +0530 Subject: [PATCH 2/3] updated the code logic --- .../pyavd/_eos_designs/structured_config/base/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py b/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py index c87e17b2f11..026a8210908 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py +++ b/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py @@ -331,8 +331,7 @@ def spanning_tree(self) -> None: if self.shared_utils.node_config.spanning_tree_mst_pvst_boundary: self.structured_config.spanning_tree.mst.pvst_border = True - stp_po_range = self.shared_utils.node_config.spanning_tree_port_id_allocation_port_channel_range - if stp_po_range: + if stp_po_range := self.shared_utils.node_config.spanning_tree_port_id_allocation_port_channel_range: self.structured_config.spanning_tree.port_id_allocation_port_channel_range._update(minimum=stp_po_range.minimum, maximum=stp_po_range.maximum) if spanning_tree_mode is not None: From bae6ba11f872000d5356cd7dc8e7b1a5cd14ccb4 Mon Sep 17 00:00:00 2001 From: MaheshGSLAB Date: Mon, 2 Jun 2025 14:08:29 +0530 Subject: [PATCH 3/3] updated the documentaion table and code logic --- .../tables/node-type-l2-mlag-configuration.md | 48 +++++++++++++++++++ .../docs/tables/node-type-structure.md | 48 ------------------- .../schema/eos_designs.schema.yml | 2 + .../defs_node_type.schema.yml | 2 + .../structured_config/base/__init__.py | 2 +- 5 files changed, 53 insertions(+), 49 deletions(-) diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-l2-mlag-configuration.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-l2-mlag-configuration.md index 2402b9d5b94..ddbaab1a38b 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-l2-mlag-configuration.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-l2-mlag-configuration.md @@ -31,6 +31,9 @@ | [    spanning_tree_priority](## ".defaults.spanning_tree_priority") | Integer | | `32768` | | Spanning-tree priority configured for the selected mode.
For `rapid-pvst` the priority can also be set per VLAN under network services. | | [    spanning_tree_root_super](## ".defaults.spanning_tree_root_super") | Boolean | | `False` | | | | [    spanning_tree_mst_pvst_boundary](## ".defaults.spanning_tree_mst_pvst_boundary") | Boolean | | | | Enable MST PVST border ports. | + | [    spanning_tree_port_id_allocation_port_channel_range](## ".defaults.spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | + | [      minimum](## ".defaults.spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | + | [      maximum](## ".defaults.spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | | [    virtual_router_mac_address](## ".defaults.virtual_router_mac_address") | String | | | Format: mac | Virtual router mac address for anycast gateway. | | [  node_groups](## ".node_groups") | List, items: Dictionary | | | | Define variables related to all nodes part of this group. | | [    - group](## ".node_groups.[].group") | String | Required, Unique | | | The Node Group Name is used for MLAG domain unless set with 'mlag_domain_id'.
The Node Group Name is also used for peer description on downstream switches' uplinks.
| @@ -58,6 +61,9 @@ | [          spanning_tree_priority](## ".node_groups.[].nodes.[].spanning_tree_priority") | Integer | | `32768` | | Spanning-tree priority configured for the selected mode.
For `rapid-pvst` the priority can also be set per VLAN under network services. | | [          spanning_tree_root_super](## ".node_groups.[].nodes.[].spanning_tree_root_super") | Boolean | | `False` | | | | [          spanning_tree_mst_pvst_boundary](## ".node_groups.[].nodes.[].spanning_tree_mst_pvst_boundary") | Boolean | | | | Enable MST PVST border ports. | + | [          spanning_tree_port_id_allocation_port_channel_range](## ".node_groups.[].nodes.[].spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | + | [            minimum](## ".node_groups.[].nodes.[].spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | + | [            maximum](## ".node_groups.[].nodes.[].spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | | [          virtual_router_mac_address](## ".node_groups.[].nodes.[].virtual_router_mac_address") | String | | | Format: mac | Virtual router mac address for anycast gateway. | | [      mlag_port_channel_structured_config](## ".node_groups.[].mlag_port_channel_structured_config") | Dictionary | | | | Custom structured config applied to MLAG peer link port-channel id.
Added under port_channel_interfaces.[name=] for eos_cli_config_gen.
Overrides the settings on the port-channel interface level.
"mlag_port_channel_structured_config" is applied after "structured_config", so it can override "structured_config" defined on node-level.
| | [      mlag_peer_vlan_structured_config](## ".node_groups.[].mlag_peer_vlan_structured_config") | Dictionary | | | | Custom structured config applied to MLAG Peer Link (control link) SVI interface id.
Added under vlan_interfaces.[name=] for eos_cli_config_gen.
Overrides the settings on the vlan interface level.
"mlag_peer_vlan_structured_config" is applied after "structured_config", so it can override "structured_config" defined on node-level.
| @@ -81,6 +87,9 @@ | [      spanning_tree_priority](## ".node_groups.[].spanning_tree_priority") | Integer | | `32768` | | Spanning-tree priority configured for the selected mode.
For `rapid-pvst` the priority can also be set per VLAN under network services. | | [      spanning_tree_root_super](## ".node_groups.[].spanning_tree_root_super") | Boolean | | `False` | | | | [      spanning_tree_mst_pvst_boundary](## ".node_groups.[].spanning_tree_mst_pvst_boundary") | Boolean | | | | Enable MST PVST border ports. | + | [      spanning_tree_port_id_allocation_port_channel_range](## ".node_groups.[].spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | + | [        minimum](## ".node_groups.[].spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | + | [        maximum](## ".node_groups.[].spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | | [      virtual_router_mac_address](## ".node_groups.[].virtual_router_mac_address") | String | | | Format: mac | Virtual router mac address for anycast gateway. | | [  nodes](## ".nodes") | List, items: Dictionary | | | | Define variables per node. | | [    - name](## ".nodes.[].name") | String | Required, Unique | | | The Node Name is used as "hostname". | @@ -106,6 +115,9 @@ | [      spanning_tree_priority](## ".nodes.[].spanning_tree_priority") | Integer | | `32768` | | Spanning-tree priority configured for the selected mode.
For `rapid-pvst` the priority can also be set per VLAN under network services. | | [      spanning_tree_root_super](## ".nodes.[].spanning_tree_root_super") | Boolean | | `False` | | | | [      spanning_tree_mst_pvst_boundary](## ".nodes.[].spanning_tree_mst_pvst_boundary") | Boolean | | | | Enable MST PVST border ports. | + | [      spanning_tree_port_id_allocation_port_channel_range](## ".nodes.[].spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | + | [        minimum](## ".nodes.[].spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | + | [        maximum](## ".nodes.[].spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | | [      virtual_router_mac_address](## ".nodes.[].virtual_router_mac_address") | String | | | Format: mac | Virtual router mac address for anycast gateway. | === "YAML" @@ -198,6 +210,15 @@ # Enable MST PVST border ports. spanning_tree_mst_pvst_boundary: + # Specify range of port-ids to reserve for port-channels. + spanning_tree_port_id_allocation_port_channel_range: + + # Specify minimum value for reserved range. + minimum: + + # Specify maximum value for reserved range. + maximum: + # Virtual router mac address for anycast gateway. virtual_router_mac_address: @@ -296,6 +317,15 @@ # Enable MST PVST border ports. spanning_tree_mst_pvst_boundary: + # Specify range of port-ids to reserve for port-channels. + spanning_tree_port_id_allocation_port_channel_range: + + # Specify minimum value for reserved range. + minimum: + + # Specify maximum value for reserved range. + maximum: + # Virtual router mac address for anycast gateway. virtual_router_mac_address: @@ -381,6 +411,15 @@ # Enable MST PVST border ports. spanning_tree_mst_pvst_boundary: + # Specify range of port-ids to reserve for port-channels. + spanning_tree_port_id_allocation_port_channel_range: + + # Specify minimum value for reserved range. + minimum: + + # Specify maximum value for reserved range. + maximum: + # Virtual router mac address for anycast gateway. virtual_router_mac_address: @@ -472,6 +511,15 @@ # Enable MST PVST border ports. spanning_tree_mst_pvst_boundary: + # Specify range of port-ids to reserve for port-channels. + spanning_tree_port_id_allocation_port_channel_range: + + # Specify minimum value for reserved range. + minimum: + + # Specify maximum value for reserved range. + maximum: + # Virtual router mac address for anycast gateway. virtual_router_mac_address: ``` diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-structure.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-structure.md index e344b44ccfc..2c90deb5ca0 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-structure.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/node-type-structure.md @@ -9,24 +9,12 @@ | -------- | ---- | -------- | ------- | ------------------ | ----------- | | [<node_type_keys.key>](## "") | Dictionary | | | | | | [  defaults](## ".defaults") | Dictionary | | | | Define variables for all nodes of this type. | - | [    spanning_tree_port_id_allocation_port_channel_range](## ".defaults.spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | - | [      minimum](## ".defaults.spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | - | [      maximum](## ".defaults.spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | | [  node_groups](## ".node_groups") | List, items: Dictionary | | | | Define variables related to all nodes part of this group. | | [    - group](## ".node_groups.[].group") | String | Required, Unique | | | The Node Group Name is used for MLAG domain unless set with 'mlag_domain_id'.
The Node Group Name is also used for peer description on downstream switches' uplinks.
| | [      nodes](## ".node_groups.[].nodes") | List, items: Dictionary | | | | Define variables per node. | | [        - name](## ".node_groups.[].nodes.[].name") | String | Required, Unique | | | The Node Name is used as "hostname". | - | [          spanning_tree_port_id_allocation_port_channel_range](## ".node_groups.[].nodes.[].spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | - | [            minimum](## ".node_groups.[].nodes.[].spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | - | [            maximum](## ".node_groups.[].nodes.[].spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | - | [      spanning_tree_port_id_allocation_port_channel_range](## ".node_groups.[].spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | - | [        minimum](## ".node_groups.[].spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | - | [        maximum](## ".node_groups.[].spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | | [  nodes](## ".nodes") | List, items: Dictionary | | | | Define variables per node. | | [    - name](## ".nodes.[].name") | String | Required, Unique | | | The Node Name is used as "hostname". | - | [      spanning_tree_port_id_allocation_port_channel_range](## ".nodes.[].spanning_tree_port_id_allocation_port_channel_range") | Dictionary | | | | Specify range of port-ids to reserve for port-channels. | - | [        minimum](## ".nodes.[].spanning_tree_port_id_allocation_port_channel_range.minimum") | Integer | Required | | Min: 1
Max: 2048 | Specify minimum value for reserved range. | - | [        maximum](## ".nodes.[].spanning_tree_port_id_allocation_port_channel_range.maximum") | Integer | Required | | Min: 1
Max: 2048 | Specify maximum value for reserved range. | === "YAML" @@ -36,15 +24,6 @@ # Define variables for all nodes of this type. defaults: - # Specify range of port-ids to reserve for port-channels. - spanning_tree_port_id_allocation_port_channel_range: - - # Specify minimum value for reserved range. - minimum: - - # Specify maximum value for reserved range. - maximum: - # Define variables related to all nodes part of this group. node_groups: @@ -58,36 +37,9 @@ # The Node Name is used as "hostname". - name: - # Specify range of port-ids to reserve for port-channels. - spanning_tree_port_id_allocation_port_channel_range: - - # Specify minimum value for reserved range. - minimum: - - # Specify maximum value for reserved range. - maximum: - - # Specify range of port-ids to reserve for port-channels. - spanning_tree_port_id_allocation_port_channel_range: - - # Specify minimum value for reserved range. - minimum: - - # Specify maximum value for reserved range. - maximum: - # Define variables per node. nodes: # The Node Name is used as "hostname". - name: - - # Specify range of port-ids to reserve for port-channels. - spanning_tree_port_id_allocation_port_channel_range: - - # Specify minimum value for reserved range. - minimum: - - # Specify maximum value for reserved range. - maximum: ``` diff --git a/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml b/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml index 10b78820783..7bbd3abc968 100644 --- a/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml @@ -9213,6 +9213,8 @@ $defs: description: Enable MST PVST border ports. spanning_tree_port_id_allocation_port_channel_range: type: dict + documentation_options: + table: node-type-l2-mlag-configuration $ref: eos_cli_config_gen#/keys/spanning_tree/keys/port_id_allocation_port_channel_range virtual_router_mac_address: documentation_options: diff --git a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type.schema.yml b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type.schema.yml index 29d2172a0e7..3e12e58f395 100644 --- a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_node_type.schema.yml @@ -918,6 +918,8 @@ $defs: description: Enable MST PVST border ports. spanning_tree_port_id_allocation_port_channel_range: type: dict + documentation_options: + table: node-type-l2-mlag-configuration $ref: "eos_cli_config_gen#/keys/spanning_tree/keys/port_id_allocation_port_channel_range" virtual_router_mac_address: documentation_options: diff --git a/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py b/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py index 026a8210908..0cf93b4aa32 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py +++ b/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py @@ -332,7 +332,7 @@ def spanning_tree(self) -> None: self.structured_config.spanning_tree.mst.pvst_border = True if stp_po_range := self.shared_utils.node_config.spanning_tree_port_id_allocation_port_channel_range: - self.structured_config.spanning_tree.port_id_allocation_port_channel_range._update(minimum=stp_po_range.minimum, maximum=stp_po_range.maximum) + self.structured_config.spanning_tree.port_id_allocation_port_channel_range = stp_po_range if spanning_tree_mode is not None: self.structured_config.spanning_tree.mode = spanning_tree_mode