From bcdf59b5175c931dadde7bff76bbd14bdaac56fe Mon Sep 17 00:00:00 2001 From: n!co <93599629+ccsnw@users.noreply.github.com> Date: Mon, 23 Sep 2024 09:48:34 +0200 Subject: [PATCH] Feat(eos_cli_config_gen): add_hardware_port_group_knob (#4500) --- .../intended/configs/hardware.cfg | 3 +++ .../inventory/host_vars/hardware.yml | 5 +++++ .../eos_cli_config_gen/docs/tables/hardware.md | 8 ++++++++ .../_eos_cli_config_gen/j2templates/eos/hardware.j2 | 8 ++++++++ .../schema/eos_cli_config_gen.schema.yml | 13 +++++++++++++ .../schema/schema_fragments/hardware.schema.yml | 13 +++++++++++++ 6 files changed, 50 insertions(+) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/hardware.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/hardware.cfg index 29da0814697..1526d60b644 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/hardware.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/hardware.cfg @@ -1,4 +1,7 @@ ! +hardware port-group 1 select Et32/1-4 +hardware port-group 2 select Et32/1,Et32/3,Et34 +! hardware access-list mechanism tcam ! hardware speed-group 1 serdes 10g diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/hardware.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/hardware.yml index fc4a2536be1..3f56b6e5f35 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/hardware.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/hardware.yml @@ -9,3 +9,8 @@ hardware: serdes: 25g - speed_group: 3/1 serdes: 25g + port_groups: + - port_group: 1 + select: Et32/1-4 + - port_group: 2 + select: Et32/1,Et32/3,Et34 diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/hardware.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/hardware.md index e1e088af92e..f974e40e5b1 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/hardware.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/hardware.md @@ -13,6 +13,9 @@ | [  speed_groups](## "hardware.speed_groups") | List, items: Dictionary | | | | | | [    - speed_group](## "hardware.speed_groups.[].speed_group") | String | Required, Unique | | | | | [      serdes](## "hardware.speed_groups.[].serdes") | String | | | | Serdes speed like "10g" or "25g". | + | [  port_groups](## "hardware.port_groups") | List, items: Dictionary | | | | | + | [    - port_group](## "hardware.port_groups.[].port_group") | String | Required, Unique | | | | + | [      select](## "hardware.port_groups.[].select") | String | | | | Select Ports to activate | === "YAML" @@ -25,4 +28,9 @@ # Serdes speed like "10g" or "25g". serdes: + port_groups: + - port_group: + + # Select Ports to activate + select: ``` diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/hardware.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/hardware.j2 index c6d8d109d56..854c87b065b 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/hardware.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/hardware.j2 @@ -4,6 +4,14 @@ that can be found in the LICENSE file. #} {# eos - hardware #} +{% if hardware.port_groups is arista.avd.defined %} +! +{% for port_group in hardware.port_groups %} +{% if port_group.select is arista.avd.defined %} +hardware port-group {{ port_group.port_group }} select {{ port_group.select }} +{% endif %} +{% endfor %} +{% endif %} {% if hardware.access_list.mechanism is arista.avd.defined %} ! hardware access-list mechanism {{ hardware.access_list.mechanism }} 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 f37cb7b7417..706a2167b86 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 @@ -4474,6 +4474,19 @@ keys: serdes: type: str description: Serdes speed like "10g" or "25g". + port_groups: + type: list + primary_key: port_group + items: + type: dict + keys: + port_group: + type: str + convert_types: + - int + select: + type: str + description: Select Ports to activate hardware_counters: type: dict keys: diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/hardware.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/hardware.schema.yml index c57fb53c948..78a9bcfb25d 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/hardware.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/hardware.schema.yml @@ -28,3 +28,16 @@ keys: serdes: type: str description: Serdes speed like "10g" or "25g". + port_groups: + type: list + primary_key: port_group + items: + type: dict + keys: + port_group: + type: str + convert_types: + - int + select: + type: str + description: Select Ports to activate