From 82b96dbe1ac3295aa31a442bc6ea9e78079be869 Mon Sep 17 00:00:00 2001 From: Mahesh Kumar Date: Wed, 18 Dec 2024 22:20:04 -0800 Subject: [PATCH 1/3] added support for metric bandwidth --- .../documentation/devices/host1.md | 21 +++++ .../intended/configs/host1.cfg | 12 +++ .../host_vars/host1/router-path-selection.yml | 12 +++ .../docs/tables/router-path-selection.md | 16 ++++ .../documentation/router-path-selection.j2 | 10 +++ .../j2templates/eos/router-path-selection.j2 | 10 +++ .../_eos_cli_config_gen/schema/__init__.py | 82 +++++++++++++++++++ .../schema/eos_cli_config_gen.schema.yml | 26 ++++++ .../router_path_selection.schema.yml | 26 ++++++ 9 files changed, 215 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 d84487ab92c..b370a660e03 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 @@ -10826,6 +10826,15 @@ router segment-security | ----------------- | --------- | | 200 | ingress | +#### Interfaces metric bandwidth + +| Interface name | Transmit Bandwidth (Mbps) | Receive Bandwidth (Mbps) | +| -------------- | ------------------------- | ------------------------ | +| Ethernet1 | - | 100 | +| Ethernet2 | - | - | +| Ethernet3 | 200 | - | +| Port-Channel4 | 200 | 100 | + #### Path Groups ##### Path Group PG-1 @@ -10944,6 +10953,18 @@ router path-selection peer dynamic source stun tcp mss ceiling ipv4 200 ingress ! + interface Ethernet1 + metric bandwidth receive 100 Mbps + ! + interface Ethernet2 + ! + interface Ethernet3 + metric bandwidth transmit 200 Mbps + ! + interface Port-Channel4 + metric bandwidth transmit 200 Mbps + metric bandwidth receive 100 Mbps + ! path-group PG-1 id 666 keepalive interval 200 milliseconds failure-threshold 3 intervals ! 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 e213b30b800..4f790e274ed 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 @@ -805,6 +805,18 @@ router path-selection peer dynamic source stun tcp mss ceiling ipv4 200 ingress ! + interface Ethernet1 + metric bandwidth receive 100 Mbps + ! + interface Ethernet2 + ! + interface Ethernet3 + metric bandwidth transmit 200 Mbps + ! + interface Port-Channel4 + metric bandwidth transmit 200 Mbps + metric bandwidth receive 100 Mbps + ! path-group PG-1 id 666 keepalive interval 200 milliseconds failure-threshold 3 intervals ! diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/router-path-selection.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/router-path-selection.yml index 85235f4f670..3c6c0f5abbd 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/router-path-selection.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/host1/router-path-selection.yml @@ -139,3 +139,15 @@ router_path_selection: - name: VRF-3 tcp_mss_ceiling: ipv4_segment_size: 200 + interfaces: + - name: Ethernet2 + - name: Port-Channel4 + metric_bandwidth: + receive: 100 + transmit: 200 + - name: Ethernet3 + metric_bandwidth: + transmit: 200 + - name: Ethernet1 + metric_bandwidth: + receive: 100 diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md index 38d1fb39ca0..1bc31b292f9 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md @@ -62,6 +62,11 @@ | [  tcp_mss_ceiling](## "router_path_selection.tcp_mss_ceiling") | Dictionary | | | | | | [    ipv4_segment_size](## "router_path_selection.tcp_mss_ceiling.ipv4_segment_size") | String | | | | Segment Size for IPv4.
Can be an integer in the range 64-65515 or "auto".
"auto" will enable auto-discovery which clamps the TCP MSS value to the minimum of all the direct paths
and multi-hop path MTU towards a remote VTEP (minus 40bytes to account for IP + TCP header). | | [    direction](## "router_path_selection.tcp_mss_ceiling.direction") | String | | `ingress` | Valid Values:
- ingress | Enforce on packets through DPS tunnel for a specific direction.
Only 'ingress' direction is supported. | + | [  interfaces](## "router_path_selection.interfaces") | List, items: Dictionary | | | | | + | [    - name](## "router_path_selection.interfaces.[].name") | String | Required, Unique | | | | + | [      metric_bandwidth](## "router_path_selection.interfaces.[].metric_bandwidth") | Dictionary | | | | Allow maximum metric bandwidth. | + | [        receive](## "router_path_selection.interfaces.[].metric_bandwidth.receive") | Integer | | | Min: 1
Max: 4294967295 | Maximum receive bandwidth in Mbps. | + | [        transmit](## "router_path_selection.interfaces.[].metric_bandwidth.transmit") | Integer | | | Min: 1
Max: 4294967295 | Maximum transmit bandwidth in Mbps. | === "YAML" @@ -200,4 +205,15 @@ # Enforce on packets through DPS tunnel for a specific direction. # Only 'ingress' direction is supported. direction: + interfaces: + - name: + + # Allow maximum metric bandwidth. + metric_bandwidth: + + # Maximum receive bandwidth in Mbps. + receive: + + # Maximum transmit bandwidth in Mbps. + transmit: ``` diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-path-selection.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-path-selection.j2 index 8d58d95a12a..d60f4e40cf2 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-path-selection.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-path-selection.j2 @@ -23,6 +23,16 @@ | ----------------- | --------- | | {{ router_path_selection.tcp_mss_ceiling.ipv4_segment_size }} | {{ router_path_selection.tcp_mss_ceiling.direction | arista.avd.default("ingress") }} | {% endif %} +{% if router_path_selection.interfaces is arista.avd.defined %} + +#### Interfaces metric bandwidth + +| Interface name | Transmit Bandwidth (Mbps) | Receive Bandwidth (Mbps) | +| -------------- | ------------------------- | ------------------------ | +{% for interface_data in router_path_selection.interfaces | arista.avd.natural_sort('name') %} +| {{ interface_data.name }} | {{ interface_data.metric_bandwidth.transmit | arista.avd.default("-") }} | {{ interface_data.metric_bandwidth.receive | arista.avd.default("-") }} | +{% endfor %} +{% endif %} {% if router_path_selection.path_groups is arista.avd.defined %} #### Path Groups diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/router-path-selection.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/router-path-selection.j2 index f3521e3ba53..f50b78616ab 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/router-path-selection.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/router-path-selection.j2 @@ -17,6 +17,16 @@ router path-selection {% endif %} {{ tcp_mss_ceiling_cli }} {{ router_path_selection.tcp_mss_ceiling.direction | arista.avd.default("ingress") }} {% endif %} +{% for interface_data in router_path_selection.interfaces | arista.avd.natural_sort('name') %} + ! + interface {{ interface_data.name }} +{% if interface_data.metric_bandwidth.transmit is arista.avd.defined %} + metric bandwidth transmit {{ interface_data.metric_bandwidth.transmit }} Mbps +{% endif %} +{% if interface_data.metric_bandwidth.receive is arista.avd.defined %} + metric bandwidth receive {{ interface_data.metric_bandwidth.receive }} Mbps +{% endif %} +{% endfor %} {# path group #} {% for path_group in router_path_selection.path_groups | arista.avd.natural_sort('name') %} {% set path_group_def = "path-group " ~ path_group.name %} 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 6614afafb4c..55385e81e7b 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py @@ -61171,6 +61171,83 @@ def __init__( """ + class InterfacesItem(AvdModel): + """Subclass of AvdModel.""" + + class MetricBandwidth(AvdModel): + """Subclass of AvdModel.""" + + _fields: ClassVar[dict] = {"receive": {"type": int}, "transmit": {"type": int}, "_custom_data": {"type": dict}} + receive: int | None + """Maximum receive bandwidth in Mbps.""" + transmit: int | None + """Maximum transmit bandwidth in Mbps.""" + _custom_data: dict[str, Any] + + if TYPE_CHECKING: + + def __init__( + self, + *, + receive: int | None | UndefinedType = Undefined, + transmit: int | None | UndefinedType = Undefined, + _custom_data: dict[str, Any] | UndefinedType = Undefined, + ) -> None: + """ + MetricBandwidth. + + + Subclass of AvdModel. + + Args: + receive: Maximum receive bandwidth in Mbps. + transmit: Maximum transmit bandwidth in Mbps. + _custom_data: _custom_data + + """ + + _fields: ClassVar[dict] = {"name": {"type": str}, "metric_bandwidth": {"type": MetricBandwidth}, "_custom_data": {"type": dict}} + name: str + metric_bandwidth: MetricBandwidth + """ + Allow maximum metric bandwidth. + + Subclass of AvdModel. + """ + _custom_data: dict[str, Any] + + if TYPE_CHECKING: + + def __init__( + self, + *, + name: str | UndefinedType = Undefined, + metric_bandwidth: MetricBandwidth | UndefinedType = Undefined, + _custom_data: dict[str, Any] | UndefinedType = Undefined, + ) -> None: + """ + InterfacesItem. + + + Subclass of AvdModel. + + Args: + name: name + metric_bandwidth: + Allow maximum metric bandwidth. + + Subclass of AvdModel. + _custom_data: _custom_data + + """ + + class Interfaces(AvdIndexedList[str, InterfacesItem]): + """Subclass of AvdIndexedList with `InterfacesItem` items. Primary key is `name` (`str`).""" + + _primary_key: ClassVar[str] = "name" + + Interfaces._item_type = InterfacesItem + _fields: ClassVar[dict] = { "peer_dynamic_source": {"type": str}, "path_groups": {"type": PathGroups}, @@ -61178,6 +61255,7 @@ def __init__( "policies": {"type": Policies}, "vrfs": {"type": Vrfs}, "tcp_mss_ceiling": {"type": TcpMssCeiling}, + "interfaces": {"type": Interfaces}, "_custom_data": {"type": dict}, } peer_dynamic_source: Literal["stun"] | None @@ -61192,6 +61270,8 @@ def __init__( """Subclass of AvdIndexedList with `VrfsItem` items. Primary key is `name` (`str`).""" tcp_mss_ceiling: TcpMssCeiling """Subclass of AvdModel.""" + interfaces: Interfaces + """Subclass of AvdIndexedList with `InterfacesItem` items. Primary key is `name` (`str`).""" _custom_data: dict[str, Any] if TYPE_CHECKING: @@ -61205,6 +61285,7 @@ def __init__( policies: Policies | UndefinedType = Undefined, vrfs: Vrfs | UndefinedType = Undefined, tcp_mss_ceiling: TcpMssCeiling | UndefinedType = Undefined, + interfaces: Interfaces | UndefinedType = Undefined, _custom_data: dict[str, Any] | UndefinedType = Undefined, ) -> None: """ @@ -61220,6 +61301,7 @@ def __init__( policies: Subclass of AvdIndexedList with `PoliciesItem` items. Primary key is `name` (`str`). vrfs: Subclass of AvdIndexedList with `VrfsItem` items. Primary key is `name` (`str`). tcp_mss_ceiling: Subclass of AvdModel. + interfaces: Subclass of AvdIndexedList with `InterfacesItem` items. Primary key is `name` (`str`). _custom_data: _custom_data """ 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 54b86f4b634..e4d5c257a52 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 @@ -20069,6 +20069,32 @@ keys: description: 'Enforce on packets through DPS tunnel for a specific direction. Only ''ingress'' direction is supported.' + interfaces: + type: list + primary_key: name + items: + type: dict + keys: + name: + type: str + metric_bandwidth: + description: Allow maximum metric bandwidth. + type: dict + keys: + receive: + description: Maximum receive bandwidth in Mbps. + type: int + min: 1 + max: 4294967295 + convert_types: + - str + transmit: + description: Maximum transmit bandwidth in Mbps. + type: int + min: 1 + max: 4294967295 + convert_types: + - str router_pim_sparse_mode: type: dict keys: diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_path_selection.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_path_selection.schema.yml index 07be1c8bad3..67980c79bdd 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_path_selection.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_path_selection.schema.yml @@ -256,3 +256,29 @@ keys: description: |- Enforce on packets through DPS tunnel for a specific direction. Only 'ingress' direction is supported. + interfaces: + type: list + primary_key: name + items: + type: dict + keys: + name: + type: str + metric_bandwidth: + description: Allow maximum metric bandwidth. + type: dict + keys: + receive: + description: Maximum receive bandwidth in Mbps. + type: int + min: 1 + max: 4294967295 + convert_types: + - str + transmit: + description: Maximum transmit bandwidth in Mbps. + type: int + min: 1 + max: 4294967295 + convert_types: + - str From 81243320e5a8e2e58d9cc02c8a87995562f067a4 Mon Sep 17 00:00:00 2001 From: Mahesh Kumar Date: Tue, 31 Dec 2024 12:43:44 +0530 Subject: [PATCH 2/3] updated doc heading --- .../molecule/eos_cli_config_gen/documentation/devices/host1.md | 2 +- .../j2templates/documentation/router-path-selection.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 b370a660e03..c2c0410d661 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 @@ -10826,7 +10826,7 @@ router segment-security | ----------------- | --------- | | 200 | ingress | -#### Interfaces metric bandwidth +#### Interfaces Metric Bandwidth | Interface name | Transmit Bandwidth (Mbps) | Receive Bandwidth (Mbps) | | -------------- | ------------------------- | ------------------------ | diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-path-selection.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-path-selection.j2 index d60f4e40cf2..f6ef1e23a62 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-path-selection.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/router-path-selection.j2 @@ -25,7 +25,7 @@ {% endif %} {% if router_path_selection.interfaces is arista.avd.defined %} -#### Interfaces metric bandwidth +#### Interfaces Metric Bandwidth | Interface name | Transmit Bandwidth (Mbps) | Receive Bandwidth (Mbps) | | -------------- | ------------------------- | ------------------------ | From f5fd915027356f9e29451b7f8d0075253369cbf7 Mon Sep 17 00:00:00 2001 From: Mahesh Kumar Date: Mon, 6 Jan 2025 13:06:21 +0530 Subject: [PATCH 3/3] remove description for metric_bandwidth --- .../docs/tables/router-path-selection.md | 4 +--- .../pyavd/_eos_cli_config_gen/schema/__init__.py | 11 ++--------- .../schema/eos_cli_config_gen.schema.yml | 1 - .../schema_fragments/router_path_selection.schema.yml | 1 - 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md index 1bc31b292f9..d6f445f6d58 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md @@ -64,7 +64,7 @@ | [    direction](## "router_path_selection.tcp_mss_ceiling.direction") | String | | `ingress` | Valid Values:
- ingress | Enforce on packets through DPS tunnel for a specific direction.
Only 'ingress' direction is supported. | | [  interfaces](## "router_path_selection.interfaces") | List, items: Dictionary | | | | | | [    - name](## "router_path_selection.interfaces.[].name") | String | Required, Unique | | | | - | [      metric_bandwidth](## "router_path_selection.interfaces.[].metric_bandwidth") | Dictionary | | | | Allow maximum metric bandwidth. | + | [      metric_bandwidth](## "router_path_selection.interfaces.[].metric_bandwidth") | Dictionary | | | | | | [        receive](## "router_path_selection.interfaces.[].metric_bandwidth.receive") | Integer | | | Min: 1
Max: 4294967295 | Maximum receive bandwidth in Mbps. | | [        transmit](## "router_path_selection.interfaces.[].metric_bandwidth.transmit") | Integer | | | Min: 1
Max: 4294967295 | Maximum transmit bandwidth in Mbps. | @@ -207,8 +207,6 @@ direction: interfaces: - name: - - # Allow maximum metric bandwidth. metric_bandwidth: # Maximum receive bandwidth in Mbps. 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 55385e81e7b..1a4fa827c84 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py @@ -61209,11 +61209,7 @@ def __init__( _fields: ClassVar[dict] = {"name": {"type": str}, "metric_bandwidth": {"type": MetricBandwidth}, "_custom_data": {"type": dict}} name: str metric_bandwidth: MetricBandwidth - """ - Allow maximum metric bandwidth. - - Subclass of AvdModel. - """ + """Subclass of AvdModel.""" _custom_data: dict[str, Any] if TYPE_CHECKING: @@ -61233,10 +61229,7 @@ def __init__( Args: name: name - metric_bandwidth: - Allow maximum metric bandwidth. - - Subclass of AvdModel. + metric_bandwidth: Subclass of AvdModel. _custom_data: _custom_data """ 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 e4d5c257a52..5d1cd7d9211 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 @@ -20078,7 +20078,6 @@ keys: name: type: str metric_bandwidth: - description: Allow maximum metric bandwidth. type: dict keys: receive: diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_path_selection.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_path_selection.schema.yml index 67980c79bdd..9ff9a5f2062 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_path_selection.schema.yml +++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/router_path_selection.schema.yml @@ -265,7 +265,6 @@ keys: name: type: str metric_bandwidth: - description: Allow maximum metric bandwidth. type: dict keys: receive: