From 0d60a0ee3631ffd7bd8a2998a01d74b73a07fc2a Mon Sep 17 00:00:00 2001 From: Vibhu-gslab <109593615+Vibhu-gslab@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:00:27 +0530 Subject: [PATCH] Feat(eos_cli_config_gen): Add min-links in port-channel-interfaces (#4790) Co-authored-by: laxmikantchintakindi <159624484+laxmikantchintakindi@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Guillaume Mulocher --- .../documentation/devices/host1.md | 1 + .../eos_cli_config_gen/intended/configs/host1.cfg | 1 + .../host_vars/host1/port-channel-interfaces.yml | 1 + .../docs/tables/port-channel-interfaces.md | 5 +++++ .../j2templates/eos/port-channel-interfaces.j2 | 3 +++ .../pyavd/_eos_cli_config_gen/schema/__init__.py | 12 ++++++++++++ .../schema/eos_cli_config_gen.schema.yml | 9 +++++++++ .../port_channel_interfaces.schema.yml | 9 +++++++++ 8 files changed, 41 insertions(+) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md index 8599505bcaa..114bdbf8f92 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/host1.md @@ -5256,6 +5256,7 @@ interface Port-Channel104 switchport trunk allowed vlan 112 switchport mode trunk switchport + port-channel min-links 3 port-channel lacp fallback individual port-channel lacp fallback timeout 300 ! diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg index f928e285ac5..fc2c628e272 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg @@ -1926,6 +1926,7 @@ interface Port-Channel104 switchport trunk allowed vlan 112 switchport mode trunk switchport + port-channel min-links 3 port-channel lacp fallback individual port-channel lacp fallback timeout 300 ! diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml index a22d54de188..f0e20267983 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/port-channel-interfaces.yml @@ -591,6 +591,7 @@ port_channel_interfaces: allowed_vlan: 112 lacp_fallback_timeout: 300 lacp_fallback_mode: individual + min_links: 3 - name: Port-Channel105 switchport: diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md index 22525dddad7..2966bf18859 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/port-channel-interfaces.md @@ -71,6 +71,7 @@ | [    trunk_groups](## "port_channel_interfaces.[].trunk_groups") deprecated | List, items: String | | | | This key is deprecated. Support will be removed in AVD version 6.0.0. Use switchport.trunk.groups instead. | | [      - <str>](## "port_channel_interfaces.[].trunk_groups.[]") | String | | | | | | [    lacp_fallback_timeout](## "port_channel_interfaces.[].lacp_fallback_timeout") | Integer | | | Min: 0
Max: 300 | Timeout in seconds. EOS default is 90 seconds. | + | [    min_links](## "port_channel_interfaces.[].min_links") | Integer | | | Min: 0
Max: 120 | Minimum number of ports required up before bringing up a port-channel.
Maximum in `min_links` is hardware dependent. | | [    lacp_fallback_mode](## "port_channel_interfaces.[].lacp_fallback_mode") | String | | | Valid Values:
- individual
- static | | | [    qos](## "port_channel_interfaces.[].qos") | Dictionary | | | | | | [      trust](## "port_channel_interfaces.[].qos.trust") | String | | | Valid Values:
- dscp
- cos
- disabled | | @@ -557,6 +558,10 @@ # Timeout in seconds. EOS default is 90 seconds. lacp_fallback_timeout: + + # Minimum number of ports required up before bringing up a port-channel. + # Maximum in `min_links` is hardware dependent. + min_links: lacp_fallback_mode: qos: trust: diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 index 29323ffacaa..2184b778ab4 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/port-channel-interfaces.j2 @@ -435,6 +435,9 @@ interface {{ port_channel_interface.name }} {% if port_channel_interface.mac_access_group_out is arista.avd.defined %} mac access-group {{ port_channel_interface.mac_access_group_out }} out {% endif %} +{% if port_channel_interface.min_links is arista.avd.defined %} + port-channel min-links {{ port_channel_interface.min_links }} +{% endif %} {% if port_channel_interface.lacp_fallback_mode is arista.avd.defined %} port-channel lacp fallback {{ port_channel_interface.lacp_fallback_mode }} {% endif %} diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py index 7338f1b5ec2..9e682c295d7 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py @@ -30515,6 +30515,7 @@ def __init__( "mlag": {"type": int}, "trunk_groups": {"type": TrunkGroups}, "lacp_fallback_timeout": {"type": int}, + "min_links": {"type": int}, "lacp_fallback_mode": {"type": str}, "qos": {"type": Qos}, "bfd": {"type": Bfd}, @@ -30650,6 +30651,12 @@ def __init__( """Subclass of AvdList with `str` items.""" lacp_fallback_timeout: int | None """Timeout in seconds. EOS default is 90 seconds.""" + min_links: int | None + """ + Minimum number of ports required up before bringing up a port-channel. + Maximum in `min_links` is + hardware dependent. + """ lacp_fallback_mode: Literal["individual", "static"] | None qos: Qos """Subclass of AvdModel.""" @@ -30799,6 +30806,7 @@ def __init__( mlag: int | None | UndefinedType = Undefined, trunk_groups: TrunkGroups | UndefinedType = Undefined, lacp_fallback_timeout: int | None | UndefinedType = Undefined, + min_links: int | None | UndefinedType = Undefined, lacp_fallback_mode: Literal["individual", "static"] | None | UndefinedType = Undefined, qos: Qos | UndefinedType = Undefined, bfd: Bfd | UndefinedType = Undefined, @@ -30916,6 +30924,10 @@ def __init__( mlag: MLAG ID. trunk_groups: Subclass of AvdList with `str` items. lacp_fallback_timeout: Timeout in seconds. EOS default is 90 seconds. + min_links: + Minimum number of ports required up before bringing up a port-channel. + Maximum in `min_links` is + hardware dependent. lacp_fallback_mode: lacp_fallback_mode qos: Subclass of AvdModel. bfd: Subclass of AvdModel. diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml index cb84fec1b76..a2e5ee3227d 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml @@ -9675,6 +9675,15 @@ keys: - str min: 0 max: 300 + min_links: + type: int + convert_types: + - str + min: 0 + max: 120 + description: 'Minimum number of ports required up before bringing up a port-channel. + + Maximum in `min_links` is hardware dependent.' lacp_fallback_mode: type: str valid_values: diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml index a5f69d5218d..368d819d5f1 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/port_channel_interfaces.schema.yml @@ -392,6 +392,15 @@ keys: - str min: 0 max: 300 + min_links: + type: int + convert_types: + - str + min: 0 + max: 120 + description: |- + Minimum number of ports required up before bringing up a port-channel. + Maximum in `min_links` is hardware dependent. lacp_fallback_mode: type: str valid_values: