diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3A.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3A.cfg index 4da846b61c6..1c26eff7e99 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3A.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3A.cfg @@ -354,7 +354,7 @@ interface Port-Channel1007 mlag 1007 ! interface Port-Channel1291 - description server22_port_channel_with_custom_id_server22_port_channel_with_custom_id + description SERVER_server22_port_channel_with_custom_id_server22_port_channel_with_custom_id no shutdown switchport access vlan 110 switchport mode access @@ -531,7 +531,7 @@ interface Ethernet28 switchport ! interface Ethernet29 - description server22_port_channel_with_custom_id_Eth1 + description SERVER_server22_port_channel_with_custom_id_Po1291 no shutdown channel-group 1291 mode active ! diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3B.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3B.cfg index a887eb93f29..ae0e1c3b85a 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3B.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3B.cfg @@ -342,7 +342,7 @@ interface Port-Channel1007 mlag 1007 ! interface Port-Channel1291 - description server22_port_channel_with_custom_id_server22_port_channel_with_custom_id + description SERVER_server22_port_channel_with_custom_id_server22_port_channel_with_custom_id no shutdown switchport access vlan 110 switchport mode access @@ -507,7 +507,7 @@ interface Ethernet27 channel-group 27 mode active ! interface Ethernet29 - description server22_port_channel_with_custom_id_Eth2 + description SERVER_server22_port_channel_with_custom_id_Po1291 no shutdown channel-group 1291 mode active ! diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/network-ports-tests-2.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/network-ports-tests-2.cfg index a557f54badb..c8a739cc50e 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/network-ports-tests-2.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/network-ports-tests-2.cfg @@ -75,12 +75,12 @@ interface Port-Channel101 switchport ! interface Ethernet1 - description AP1 with port_channel + description AP1 with port_channel_Po1 no shutdown channel-group 1 mode active ! interface Ethernet2 - description AP1 with port_channel + description AP1 with port_channel_Po2 no shutdown channel-group 2 mode active ! diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3A.yml index 13690ad85d0..3cfe854346c 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3A.yml @@ -1121,7 +1121,7 @@ port_channel_interfaces: access_vlan: '110' mlag: 42 - name: Port-Channel1291 - description: server22_port_channel_with_custom_id_server22_port_channel_with_custom_id + description: SERVER_server22_port_channel_with_custom_id_server22_port_channel_with_custom_id shutdown: false switchport: enabled: true @@ -1542,7 +1542,7 @@ ethernet_interfaces: peer_interface: Eth1 peer_type: server port_profile: TENANT_A - description: server22_port_channel_with_custom_id_Eth1 + description: SERVER_server22_port_channel_with_custom_id_Po1291 shutdown: false channel_group: id: 1291 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3B.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3B.yml index 61ecff9e5fc..552f4f9aaba 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3B.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3B.yml @@ -1109,7 +1109,7 @@ port_channel_interfaces: access_vlan: '110' mlag: 42 - name: Port-Channel1291 - description: server22_port_channel_with_custom_id_server22_port_channel_with_custom_id + description: SERVER_server22_port_channel_with_custom_id_server22_port_channel_with_custom_id shutdown: false switchport: enabled: true @@ -1501,7 +1501,7 @@ ethernet_interfaces: peer_interface: Eth2 peer_type: server port_profile: TENANT_A - description: server22_port_channel_with_custom_id_Eth2 + description: SERVER_server22_port_channel_with_custom_id_Po1291 shutdown: false channel_group: id: 1291 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/network-ports-tests-2.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/network-ports-tests-2.yml index ed8d045069c..93f1fb3ca16 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/network-ports-tests-2.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/network-ports-tests-2.yml @@ -104,7 +104,7 @@ ethernet_interfaces: peer: AP1 with port_channel peer_type: network_port port_profile: ap_with_port_channel - description: AP1 with port_channel + description: AP1 with port_channel_Po1 shutdown: false channel_group: id: 1 @@ -113,7 +113,7 @@ ethernet_interfaces: peer: AP1 with port_channel peer_type: network_port port_profile: ap_with_port_channel - description: AP1 with port_channel + description: AP1 with port_channel_Po2 shutdown: false channel_group: id: 2 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/DC1_SERVERS.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/DC1_SERVERS.yml index b6539993729..3a4d56e0f98 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/DC1_SERVERS.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/DC1_SERVERS.yml @@ -568,6 +568,8 @@ servers: switch_ports: [ Ethernet29, Ethernet29 ] switches: [ DC1-SVC3A, DC1-SVC3B ] profile: TENANT_A + # testing using port_channel_id for member interface description + description: "{endpoint_type!u}_{endpoint}{port_channel_id?<_Po}" port_channel: endpoint_port_channel: server22_port_channel_with_custom_id mode: active diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/NETWORK_PORTS_TESTS.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/NETWORK_PORTS_TESTS.yml index d4b7555313e..095e7996bea 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/NETWORK_PORTS_TESTS.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/NETWORK_PORTS_TESTS.yml @@ -37,6 +37,8 @@ network_ports: - network-ports-tests-2$ switch_ports: - Ethernet1-2 + # testing using port_channel_id for member interface description + description: "{endpoint}{port_channel_id?<_Po}" profile: ap_with_port_channel endpoint: AP1 with port_channel diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/connected-endpoints.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/connected-endpoints.md index 2e122f788f8..ce78b0dde5b 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/connected-endpoints.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/connected-endpoints.md @@ -17,7 +17,7 @@ | [          - <str>](## ".[].adapters.[].switches.[]") | String | | | | Device. | | [        endpoint_ports](## ".[].adapters.[].endpoint_ports") | List, items: String | | | | Endpoint ports is used for description, required unless `description` or `descriptions` is set.
The lists `endpoint_ports`, `switch_ports`, `descriptions` and `switches` must have the same length.
Each list item is one switchport.
| | [          - <str>](## ".[].adapters.[].endpoint_ports.[]") | String | | | | Port name on the endpoint. | - | [        descriptions](## ".[].adapters.[].descriptions") | List | | | | Unique description per port. When set, takes priority over description.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type` - the `type` from `connected_endpoints_keys` like `server`, `router` etc.
- `endpoint` - The name of the connected endpoint
- `endpoint_port` - The value from `endpoint_ports` for this switch port if set. | + | [        descriptions](## ".[].adapters.[].descriptions") | List | | | | Unique description per port. When set, takes priority over description.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type` - the `type` from `connected_endpoints_keys` like `server`, `router` etc.
- `endpoint` - The name of the connected endpoint
- `endpoint_port` - The value from `endpoint_ports` for this switch port if set.
- `port_channel_id`: The port-channel number for the switch. | | [        speed](## ".[].adapters.[].speed") | String | | | | Set adapter speed in the format `` or `forced ` or `auto `.
If not specified speed will be auto.
| | [        description](## ".[].adapters.[].description") | String | | | | Description or description template to be used on all ports.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type` - the `type` from `connected_endpoints_keys` like `server`, `router` etc.
- `endpoint` - The name of the connected endpoint
- `endpoint_port` - The value from `endpoint_ports` for this switch port if set.

The default description is set by `default_connected_endpoints_description`.
By default the description is templated from the type, name and port of the endpoint if set. | | [        profile](## ".[].adapters.[].profile") | String | | | | Port-profile name to inherit configuration. | @@ -230,6 +230,7 @@ # - `endpoint_type` - the `type` from `connected_endpoints_keys` like `server`, `router` etc. # - `endpoint` - The name of the connected endpoint # - `endpoint_port` - The value from `endpoint_ports` for this switch port if set. + # - `port_channel_id`: The port-channel number for the switch. descriptions: # Set adapter speed in the format `` or `forced ` or `auto `. diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/default-connected-endpoints-description.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/default-connected-endpoints-description.md index 24a7b651c23..69ca7ff5407 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/default-connected-endpoints-description.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/default-connected-endpoints-description.md @@ -7,7 +7,7 @@ | Variable | Type | Required | Default | Value Restrictions | Description | | -------- | ---- | -------- | ------- | ------------------ | ----------- | - | [default_connected_endpoints_description](## "default_connected_endpoints_description") | String | | `{endpoint_type!u}_{endpoint}{endpoint_port?<_}` | | Default description or description template to be used on all ports to connected endpoints.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type`: The `type` from `connected_endpoints_keys` like `server`, `router` etc.
- `endpoint`: The name of the connected endpoint
- `endpoint_port`: The value from `endpoint_ports` for this switch port if set.

By default the description is templated from the type, name and port of the endpoint if set. | + | [default_connected_endpoints_description](## "default_connected_endpoints_description") | String | | `{endpoint_type!u}_{endpoint}{endpoint_port?<_}` | | Default description or description template to be used on all ports to connected endpoints.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type`: The `type` from `connected_endpoints_keys` like `server`, `router` etc.
- `endpoint`: The name of the connected endpoint
- `endpoint_port`: The value from `endpoint_ports` for this switch port if set.
- `port_channel_id`: The port-channel number for the switch.

By default the description is templated from the type, name and port of the endpoint if set. | | [default_connected_endpoints_port_channel_description](## "default_connected_endpoints_port_channel_description") | String | | `{endpoint_type!u}_{endpoint}{endpoint_port_channel?<_}` | | Default description or description template to be used on all port-channels to connected endpoints.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type`: The `type` from `connected_endpoints_keys` like `server`, `router` etc.
- `endpoint`: The name of the connected endpoint
- `endpoint_port_channel`: The value of `endpoint_port_channel` if set.
- `port_channel_id`: The port-channel number for the switch.
- `adapter_description`: The adapter's description if set.
- `adapter_description_or_endpoint`: Helper alias of the adapter_description or endpoint.

By default the description is templated from the type, name and port-channel name of the endpoint if set. | === "YAML" @@ -19,6 +19,7 @@ # - `endpoint_type`: The `type` from `connected_endpoints_keys` like `server`, `router` etc. # - `endpoint`: The name of the connected endpoint # - `endpoint_port`: The value from `endpoint_ports` for this switch port if set. + # - `port_channel_id`: The port-channel number for the switch. # # By default the description is templated from the type, name and port of the endpoint if set. default_connected_endpoints_description: diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/default-network-ports-description.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/default-network-ports-description.md index df69d84372c..ad30aa892bb 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/default-network-ports-description.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/default-network-ports-description.md @@ -7,7 +7,7 @@ | Variable | Type | Required | Default | Value Restrictions | Description | | -------- | ---- | -------- | ------- | ------------------ | ----------- | - | [default_network_ports_description](## "default_network_ports_description") | String | | `{endpoint?}` | | Default description or description template to be used on all ports defined under `network_ports`.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type`: Always set to `network_port`.
- `endpoint`: The value of the `endpoint` key if set.

By default the description is templated from the `endpoint` key if set. | + | [default_network_ports_description](## "default_network_ports_description") | String | | `{endpoint?}` | | Default description or description template to be used on all ports defined under `network_ports`.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type`: Always set to `network_port`.
- `endpoint`: The value of the `endpoint` key if set.
- `port_channel_id`: The port-channel number for the switch.

By default the description is templated from the `endpoint` key if set. | | [default_network_ports_port_channel_description](## "default_network_ports_port_channel_description") | String | | `{endpoint?}{endpoint_port_channel?<_}` | | Default description or description template to be used on all port-channels defined under `network_ports`.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type`: Always set to `network_port`.
- `endpoint`: The value of the `endpoint` key if set.
- `endpoint_port_channel`: The value of `endpoint_port_channel` if set.
- `port_channel_id`: The port-channel number for the switch.
- `adapter_description`: The adapter's description if set.
- `adapter_description_or_endpoint`: Helper alias of the adapter_description or endpoint.

By default the description is templated from the `endpoint` key if set. | === "YAML" @@ -18,6 +18,7 @@ # The available template fields are: # - `endpoint_type`: Always set to `network_port`. # - `endpoint`: The value of the `endpoint` key if set. + # - `port_channel_id`: The port-channel number for the switch. # # By default the description is templated from the `endpoint` key if set. default_network_ports_description: diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-ports.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-ports.md index 55fef548e12..0972531bcc2 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-ports.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-ports.md @@ -12,7 +12,7 @@ | [      - <str>](## "network_ports.[].switches.[]") | String | | | | | | [    switch_ports](## "network_ports.[].switch_ports") | List, items: String | | | | List of ranges using AVD range_expand syntax.
For example:

switch_ports:
- Ethernet1
- Ethernet2-48

All switch_ports ranges are expanded into individual port configurations.

For more details and examples of the `range_expand` syntax, see the [`arista.avd.range_expand` documentation](../../../docs/plugins/Filter_plugins/range_expand.md).
| | [      - <str>](## "network_ports.[].switch_ports.[]") | String | | | | | - | [    description](## "network_ports.[].description") | String | | | | Description or description template to be used on all ports.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type` - always set to `network_port`.
- `endpoint` - content of the `endpoint` key if set.

The default description is set by `default_network_ports_description`.
By default the description is templated from the `endpoint` key if set. | + | [    description](## "network_ports.[].description") | String | | | | Description or description template to be used on all ports.
This can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.
The available template fields are:
- `endpoint_type` - always set to `network_port`.
- `endpoint` - content of the `endpoint` key if set.
- `port_channel_id`: The port-channel number for the switch.

The default description is set by `default_network_ports_description`.
By default the description is templated from the `endpoint` key if set. | | [    endpoint](## "network_ports.[].endpoint") | String | | | | Name or description of the endpoints connected to these ports. | | [    speed](## "network_ports.[].speed") | String | | | | Set adapter speed in the format `` or `forced ` or `auto `.
If not specified speed will be auto.
| | [    profile](## "network_ports.[].profile") | String | | | | Port-profile name to inherit configuration. | @@ -209,6 +209,7 @@ # The available template fields are: # - `endpoint_type` - always set to `network_port`. # - `endpoint` - content of the `endpoint` key if set. + # - `port_channel_id`: The port-channel number for the switch. # # The default description is set by `default_network_ports_description`. # By default the description is templated from the `endpoint` key if set. 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 52704e3d59e..55f266ba64e 100644 --- a/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml @@ -888,8 +888,9 @@ keys: available template fields are:\n - `endpoint_type`: The `type` from `connected_endpoints_keys` like `server`, `router` etc.\n - `endpoint`: The name of the connected endpoint\n \ - `endpoint_port`: The value from `endpoint_ports` for this switch port if - set.\n\nBy default the description is templated from the type, name and port - of the endpoint if set." + set.\n - `port_channel_id`: The port-channel number for the switch.\n\nBy default + the description is templated from the type, name and port of the endpoint if + set." default: '{endpoint_type!u}_{endpoint}{endpoint_port?<_}' default_connected_endpoints_port_channel_description: type: str @@ -1001,8 +1002,9 @@ keys: defined under `network_ports`.\nThis can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.\nThe available template fields are:\n - `endpoint_type`: Always set to `network_port`.\n - \ - `endpoint`: The value of the `endpoint` key if set.\n\nBy default the description - is templated from the `endpoint` key if set." + \ - `endpoint`: The value of the `endpoint` key if set.\n - `port_channel_id`: + The port-channel number for the switch.\n\nBy default the description is templated + from the `endpoint` key if set." default: '{endpoint?}' default_network_ports_port_channel_description: type: str @@ -2291,9 +2293,10 @@ keys: description: "Description or description template to be used on all ports.\nThis can be a template using the AVD string formatter syntax: https://avd.arista.com/devel/roles/eos_designs/docs/how-to/custom-descriptions-names.html#avd-string-formatter-syntax.\nThe available template fields are:\n - `endpoint_type` - always set to `network_port`.\n - \ - `endpoint` - content of the `endpoint` key if set.\n\nThe default - description is set by `default_network_ports_description`.\nBy default - the description is templated from the `endpoint` key if set." + \ - `endpoint` - content of the `endpoint` key if set.\n - `port_channel_id`: + The port-channel number for the switch.\n\nThe default description is + set by `default_network_ports_description`.\nBy default the description + is templated from the `endpoint` key if set." endpoint: type: str description: Name or description of the endpoints connected to these ports. @@ -5691,7 +5694,8 @@ $defs: available template fields are:\n - `endpoint_type` - the `type` from `connected_endpoints_keys` like `server`, `router` etc.\n - `endpoint` - The name of the connected endpoint\n - `endpoint_port` - - The value from `endpoint_ports` for this switch port if set." + - The value from `endpoint_ports` for this switch port if set.\n + \ - `port_channel_id`: The port-channel number for the switch." flow_tracking_link: type: dict keys: diff --git a/python-avd/pyavd/_eos_designs/schema/schema_fragments/default_connected_endpoints_description.yml b/python-avd/pyavd/_eos_designs/schema/schema_fragments/default_connected_endpoints_description.yml index d3a42c5ca1c..ebd7e3a0f01 100644 --- a/python-avd/pyavd/_eos_designs/schema/schema_fragments/default_connected_endpoints_description.yml +++ b/python-avd/pyavd/_eos_designs/schema/schema_fragments/default_connected_endpoints_description.yml @@ -17,6 +17,7 @@ keys: - `endpoint_type`: The `type` from `connected_endpoints_keys` like `server`, `router` etc. - `endpoint`: The name of the connected endpoint - `endpoint_port`: The value from `endpoint_ports` for this switch port if set. + - `port_channel_id`: The port-channel number for the switch. By default the description is templated from the type, name and port of the endpoint if set. default: "{endpoint_type!u}_{endpoint}{endpoint_port?<_}" diff --git a/python-avd/pyavd/_eos_designs/schema/schema_fragments/default_network_ports_description.yml b/python-avd/pyavd/_eos_designs/schema/schema_fragments/default_network_ports_description.yml index 055f0c8bef4..4074d7de96e 100644 --- a/python-avd/pyavd/_eos_designs/schema/schema_fragments/default_network_ports_description.yml +++ b/python-avd/pyavd/_eos_designs/schema/schema_fragments/default_network_ports_description.yml @@ -16,6 +16,7 @@ keys: The available template fields are: - `endpoint_type`: Always set to `network_port`. - `endpoint`: The value of the `endpoint` key if set. + - `port_channel_id`: The port-channel number for the switch. By default the description is templated from the `endpoint` key if set. default: "{endpoint?}" diff --git a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_connected_endpoints.schema.yml b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_connected_endpoints.schema.yml index 17284af2f44..b32ea30446a 100644 --- a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_connected_endpoints.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_connected_endpoints.schema.yml @@ -64,3 +64,4 @@ $defs: - `endpoint_type` - the `type` from `connected_endpoints_keys` like `server`, `router` etc. - `endpoint` - The name of the connected endpoint - `endpoint_port` - The value from `endpoint_ports` for this switch port if set. + - `port_channel_id`: The port-channel number for the switch. diff --git a/python-avd/pyavd/_eos_designs/schema/schema_fragments/network_ports.schema.yml b/python-avd/pyavd/_eos_designs/schema/schema_fragments/network_ports.schema.yml index e49304d96cd..3c1ce0ce1ed 100644 --- a/python-avd/pyavd/_eos_designs/schema/schema_fragments/network_ports.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/schema_fragments/network_ports.schema.yml @@ -43,6 +43,7 @@ keys: The available template fields are: - `endpoint_type` - always set to `network_port`. - `endpoint` - content of the `endpoint` key if set. + - `port_channel_id`: The port-channel number for the switch. The default description is set by `default_network_ports_description`. By default the description is templated from the `endpoint` key if set. diff --git a/python-avd/pyavd/_eos_designs/structured_config/connected_endpoints/ethernet_interfaces.py b/python-avd/pyavd/_eos_designs/structured_config/connected_endpoints/ethernet_interfaces.py index 0dd26003cbd..bf372a46d6e 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/connected_endpoints/ethernet_interfaces.py +++ b/python-avd/pyavd/_eos_designs/structured_config/connected_endpoints/ethernet_interfaces.py @@ -125,6 +125,7 @@ def _get_ethernet_interface_cfg(self: AvdStructuredConfigConnectedEndpoints, ada default_channel_group_id = int("".join(re.findall(r"\d", adapter["switch_ports"][0]))) channel_group_id = get(adapter, "port_channel.channel_id", default=default_channel_group_id) short_esi = self._get_short_esi(adapter, channel_group_id) + port_channel_mode = get(adapter, "port_channel.mode") # check lengths of lists nodes_length = len(adapter["switches"]) @@ -158,6 +159,7 @@ def _get_ethernet_interface_cfg(self: AvdStructuredConfigConnectedEndpoints, ada peer_interface=peer_interface, peer_type=connected_endpoint["type"], description=interface_description, + port_channel_id=channel_group_id if port_channel_mode is not None else None, ), ) or None, @@ -171,11 +173,12 @@ def _get_ethernet_interface_cfg(self: AvdStructuredConfigConnectedEndpoints, ada } # Port-channel member - if (port_channel_mode := get(adapter, "port_channel.mode")) is not None: + if port_channel_mode is not None: ethernet_interface["channel_group"] = { "id": channel_group_id, "mode": port_channel_mode, } + if get(adapter, "port_channel.lacp_fallback.mode") == "static": ethernet_interface["lacp_port_priority"] = 8192 if node_index == 0 else 32768 diff --git a/python-avd/pyavd/api/interface_descriptions/__init__.py b/python-avd/pyavd/api/interface_descriptions/__init__.py index 1dc23223a80..4c9ce2aef3d 100644 --- a/python-avd/pyavd/api/interface_descriptions/__init__.py +++ b/python-avd/pyavd/api/interface_descriptions/__init__.py @@ -335,6 +335,7 @@ def connected_endpoints_ethernet_interface(self, data: InterfaceDescriptionData) "endpoint": data.peer, "endpoint_port": data.peer_interface, "endpoint_type": data.peer_type, + "port_channel_id": data.port_channel_id, } ), )