From a5426496a471ebb353d409a692cd5b4d3e7f8a34 Mon Sep 17 00:00:00 2001 From: gmuloc Date: Tue, 10 Oct 2023 15:40:03 +0200 Subject: [PATCH] Refactor: Address PR comments --- .../documentation/devices/dps-interfaces.md | 2 +- .../docs/tables/dps-interfaces.md | 14 +++++++------- .../eos_cli_config_gen.jsonschema.json | 14 +++++++------- .../schemas/eos_cli_config_gen.schema.yml | 17 +++++++---------- .../dps-interfaces.schema.yml | 19 ++++++++++--------- .../templates/documentation/dps-interfaces.j2 | 11 +++++------ .../templates/eos/dps-interfaces.j2 | 3 +-- 7 files changed, 38 insertions(+), 42 deletions(-) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/dps-interfaces.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/dps-interfaces.md index cf929f4afc7..e802e96d7b7 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/dps-interfaces.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/dps-interfaces.md @@ -43,7 +43,7 @@ interface Management1 | Interface | IP address | Shutdown | Flow tracker(s) | TCP MSS Ceiling | | --------- | ---------- | -------- | --------------- | --------------- | -| Dps1 | 192.168.42.42/24 | True | * Hardware: FT-HW
* Sampled: FT-S | * IPv4: 666
* IPv6: 666
* Direction: ingress | +| Dps1 | 192.168.42.42/24 | True | Hardware: FT-HW
Sampled: FT-S | IPv4: 666
IPv6: 666
Direction: ingress | #### DPS Interfaces Device Configuration diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/dps-interfaces.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/dps-interfaces.md index 7f906406e8f..d6b1364669a 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/dps-interfaces.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/dps-interfaces.md @@ -8,17 +8,17 @@ | Variable | Type | Required | Default | Value Restrictions | Description | | -------- | ---- | -------- | ------- | ------------------ | ----------- | | [dps_interfaces](## "dps_interfaces") | List, items: Dictionary | | | Min Length: 1
Max Length: 1 | | - | [  - name](## "dps_interfaces.[].name") | String | Required, Unique | | Valid Values:
- Dps1 | Only Dps1 is configurabled. | + | [  - name](## "dps_interfaces.[].name") | String | Required, Unique | | Valid Values:
- Dps1 | "Dps1" is currently the only supported interface. | | [    description](## "dps_interfaces.[].description") | String | | | | | | [    shutdown](## "dps_interfaces.[].shutdown") | Boolean | | | | | - | [    ip_address](## "dps_interfaces.[].ip_address") | String | | | | IPv4 address/mask | + | [    ip_address](## "dps_interfaces.[].ip_address") | String | | | | IPv4 address/mask. | | [    flow_tracker](## "dps_interfaces.[].flow_tracker") | Dictionary | | | | | - | [      sampled](## "dps_interfaces.[].flow_tracker.sampled") | String | | | | Sampled flow tracker name | - | [      hardware](## "dps_interfaces.[].flow_tracker.hardware") | String | | | | Hardware flow tracker name | + | [      sampled](## "dps_interfaces.[].flow_tracker.sampled") | String | | | | Sampled flow tracker name. | + | [      hardware](## "dps_interfaces.[].flow_tracker.hardware") | String | | | | Hardware flow tracker name, | | [    tcp_mss_ceiling](## "dps_interfaces.[].tcp_mss_ceiling") | Dictionary | | | | | - | [      ipv4](## "dps_interfaces.[].tcp_mss_ceiling.ipv4") | Integer | | | Min: 64
Max: 65495 | Segment Size for IPv4 | - | [      ipv6](## "dps_interfaces.[].tcp_mss_ceiling.ipv6") | Integer | | | Min: 64
Max: 65475 | Segment Size for IPv6 | - | [      direction](## "dps_interfaces.[].tcp_mss_ceiling.direction") | String | | | Valid Values:
- ingress
- egress | Optional direction ('ingress', 'egress') for tcp mss ceiling
| + | [      ipv4](## "dps_interfaces.[].tcp_mss_ceiling.ipv4") | Integer | | | Min: 64
Max: 65495 | Segment Size for IPv4. | + | [      ipv6](## "dps_interfaces.[].tcp_mss_ceiling.ipv6") | Integer | | | Min: 64
Max: 65475 | Segment Size for IPv6. | + | [      direction](## "dps_interfaces.[].tcp_mss_ceiling.direction") | String | | | Valid Values:
- ingress
- egress | Optional direction ('ingress', 'egress') for tcp mss ceiling. | | [    eos_cli](## "dps_interfaces.[].eos_cli") | String | | | | Multiline String with EOS CLI rendered directly on the Dps interface in the final EOS configuration. | === "YAML" diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json index 184b2df2a53..77eeed54957 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json @@ -1537,7 +1537,7 @@ "properties": { "name": { "type": "string", - "description": "Only Dps1 is configurabled.", + "description": "\"Dps1\" is currently the only supported interface.", "enum": [ "Dps1" ], @@ -1553,7 +1553,7 @@ }, "ip_address": { "type": "string", - "description": "IPv4 address/mask", + "description": "IPv4 address/mask.", "title": "IP Address" }, "flow_tracker": { @@ -1561,12 +1561,12 @@ "properties": { "sampled": { "type": "string", - "description": "Sampled flow tracker name", + "description": "Sampled flow tracker name.", "title": "Sampled" }, "hardware": { "type": "string", - "description": "Hardware flow tracker name", + "description": "Hardware flow tracker name,", "title": "Hardware" } }, @@ -1581,14 +1581,14 @@ "properties": { "ipv4": { "type": "integer", - "description": "Segment Size for IPv4", + "description": "Segment Size for IPv4.", "minimum": 64, "maximum": 65495, "title": "IPv4" }, "ipv6": { "type": "integer", - "description": "Segment Size for IPv6", + "description": "Segment Size for IPv6.", "minimum": 64, "maximum": 65475, "title": "IPv6" @@ -1599,7 +1599,7 @@ "ingress", "egress" ], - "description": "Optional direction ('ingress', 'egress') for tcp mss ceiling\n", + "description": "Optional direction ('ingress', 'egress') for tcp mss ceiling.", "title": "Direction" } }, diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml index 136ba77671f..3b3009f392f 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml @@ -1067,7 +1067,7 @@ keys: keys: name: type: str - description: Only Dps1 is configurabled. + description: '"Dps1" is currently the only supported interface.' valid_values: - Dps1 description: @@ -1076,29 +1076,29 @@ keys: type: bool ip_address: type: str - description: IPv4 address/mask + description: IPv4 address/mask. flow_tracker: type: dict keys: sampled: type: str - description: Sampled flow tracker name + description: Sampled flow tracker name. hardware: type: str - description: Hardware flow tracker name + description: Hardware flow tracker name, tcp_mss_ceiling: type: dict keys: ipv4: type: int - description: Segment Size for IPv4 + description: Segment Size for IPv4. min: 64 max: 65495 convert_types: - str ipv6: type: int - description: Segment Size for IPv6 + description: Segment Size for IPv6. min: 64 max: 65475 convert_types: @@ -1108,10 +1108,7 @@ keys: valid_values: - ingress - egress - description: 'Optional direction (''ingress'', ''egress'') for tcp - mss ceiling - - ' + description: Optional direction ('ingress', 'egress') for tcp mss ceiling. eos_cli: type: str description: Multiline String with EOS CLI rendered directly on the Dps diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/dps-interfaces.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/dps-interfaces.schema.yml index 0a60d6675dc..6a056bc68dc 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/dps-interfaces.schema.yml +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/dps-interfaces.schema.yml @@ -16,7 +16,8 @@ keys: keys: name: type: str - description: Only Dps1 is configurabled. + description: |- + "Dps1" is currently the only supported interface. valid_values: - Dps1 description: @@ -25,29 +26,29 @@ keys: type: bool ip_address: type: str - description: IPv4 address/mask + description: IPv4 address/mask. flow_tracker: type: dict keys: sampled: type: str - description: Sampled flow tracker name + description: Sampled flow tracker name. hardware: type: str - description: Hardware flow tracker name + description: Hardware flow tracker name, tcp_mss_ceiling: type: dict keys: ipv4: type: int - description: Segment Size for IPv4 + description: Segment Size for IPv4. min: 64 max: 65495 convert_types: - str ipv6: type: int - description: Segment Size for IPv6 + description: Segment Size for IPv6. min: 64 max: 65475 convert_types: @@ -55,9 +56,9 @@ keys: direction: type: str valid_values: ["ingress", "egress"] - description: | - Optional direction ('ingress', 'egress') for tcp mss ceiling + description: |- + Optional direction ('ingress', 'egress') for tcp mss ceiling. eos_cli: type: str - description: | + description: |- Multiline String with EOS CLI rendered directly on the Dps interface in the final EOS configuration. diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/dps-interfaces.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/dps-interfaces.j2 index 5a583e530b1..dbe01c0bdfa 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/dps-interfaces.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/dps-interfaces.j2 @@ -3,7 +3,6 @@ Use of this source code is governed by the Apache License 2.0 that can be found in the LICENSE file. #} -{# j2lint: disable=V1 #} {# doc - dps interfaces #} {% if dps_interfaces is arista.avd.defined %} @@ -17,21 +16,21 @@ {% set ip_address = dps_interface.ip_address | arista.avd.default("-") %} {% set flow_trackers = [] %} {% if dps_interface.flow_tracker.hardware is arista.avd.defined %} -{% do flow_trackers.append("* Hardware: " ~ dps_interface.flow_tracker.hardware) %} +{% do flow_trackers.append("Hardware: " ~ dps_interface.flow_tracker.hardware) %} {% endif %} {% set shutdown = dps_interface.shutdown | arista.avd.default("-") %} {% if dps_interface.flow_tracker.sampled is arista.avd.defined %} -{% do flow_trackers.append("* Sampled: " ~ dps_interface.flow_tracker.sampled) %} +{% do flow_trackers.append("Sampled: " ~ dps_interface.flow_tracker.sampled) %} {% endif %} {% set tcp_mss_settings = [] %} {% if dps_interface.tcp_mss_ceiling.ipv4 is arista.avd.defined %} -{% do tcp_mss_settings.append("* IPv4: " ~ dps_interface.tcp_mss_ceiling.ipv4) %} +{% do tcp_mss_settings.append("IPv4: " ~ dps_interface.tcp_mss_ceiling.ipv4) %} {% endif %} {% if dps_interface.tcp_mss_ceiling.ipv6 is arista.avd.defined %} -{% do tcp_mss_settings.append("* IPv6: " ~ dps_interface.tcp_mss_ceiling.ipv6) %} +{% do tcp_mss_settings.append("IPv6: " ~ dps_interface.tcp_mss_ceiling.ipv6) %} {% endif %} {% if dps_interface.tcp_mss_ceiling.direction is arista.avd.defined %} -{% do tcp_mss_settings.append("* Direction: " ~ dps_interface.tcp_mss_ceiling.direction) %} +{% do tcp_mss_settings.append("Direction: " ~ dps_interface.tcp_mss_ceiling.direction) %} {% endif %} | {{ dps_interface.name }} | {{ ip_address }} | {{ shutdown }} | {{ flow_trackers | join("
") }} | {{ tcp_mss_settings | join("
") }} | {% endfor %} diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/dps-interfaces.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/dps-interfaces.j2 index f31bc4fa772..02c801bf22e 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/dps-interfaces.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/dps-interfaces.j2 @@ -3,7 +3,6 @@ Use of this source code is governed by the Apache License 2.0 that can be found in the LICENSE file. #} -{# j2lint: disable=V1 #} {# eos - dps interfaces #} {% for dps_interface in dps_interfaces | arista.avd.natural_sort('name') %} ! @@ -25,7 +24,7 @@ interface {{ dps_interface.name }} {% if dps_interface.ip_address is arista.avd.defined %} ip address {{ dps_interface.ip_address }} {% endif %} -{% if dps_interface.tcp_mss_ceiling is arista.avd.defined %} +{% if dps_interface.tcp_mss_ceiling.ipv4 is arista.avd.defined or dps_interface.tcp_mss_ceiling.ipv6 is arista.avd.defined %} {% set tcp_mss_ceiling_cli = "tcp mss ceiling" %} {% if dps_interface.tcp_mss_ceiling.ipv4 is arista.avd.defined %} {% set tcp_mss_ceiling_cli = tcp_mss_ceiling_cli ~ " ipv4 " ~ dps_interface.tcp_mss_ceiling.ipv4 %}