From e18dab65d544ae4e2b726cc1cdc801b45ba865fd Mon Sep 17 00:00:00 2001 From: Shivani-gslab <145646625+Shivani-gslab@users.noreply.github.com> Date: Wed, 24 Jan 2024 17:00:14 +0530 Subject: [PATCH] Feat(eos_cli_config_gen): Set BFD neighbor and per-link in port-channel interfaces (#3509) --- .../devices/port-channel-interfaces.md | 2 + .../documentation/devices/router-bfd-1.md | 1 + .../configs/port-channel-interfaces.cfg | 2 + .../intended/configs/router-bfd-1.cfg | 1 + .../host_vars/port-channel-interfaces.yml | 4 ++ .../inventory/host_vars/router-bfd-1.yml | 1 + .../docs/tables/port-channel-interfaces.md | 10 ++++ .../docs/tables/router-bfd.md | 4 ++ .../eos_cli_config_gen.jsonschema.json | 28 +++++++++++ .../schemas/eos_cli_config_gen.schema.yml | 15 ++++++ .../port_channel_interfaces.schema.yml | 10 ++++ .../schema_fragments/router_bfd.schema.yml | 3 ++ .../templates/eos/port-channel-interfaces.j2 | 10 ++++ .../templates/eos/router-bfd.j2 | 3 ++ .../schemas/eos_designs.jsonschema.json | 46 +++++++++++++++++++ 15 files changed, 140 insertions(+) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/port-channel-interfaces.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/port-channel-interfaces.md index 04934150512..8d1d4274bc4 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/port-channel-interfaces.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/port-channel-interfaces.md @@ -389,6 +389,8 @@ interface Port-Channel9 ip address 10.9.2.3/31 bfd interval 500 min-rx 500 multiplier 5 bfd echo + bfd neighbor 10.1.2.4 + bfd per-link rfc-7130 ! interface Port-Channel10 description SRV01_bond0 diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/router-bfd-1.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/router-bfd-1.md index d604007882c..b8f454a09f6 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/router-bfd-1.md +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/router-bfd-1.md @@ -64,6 +64,7 @@ interface Management1 router bfd interval 900 min-rx 900 multiplier 50 default multihop interval 300 min-rx 300 multiplier 3 + local-address 192.168.255.1 session stats snapshot interval 51 ! sbfd diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/port-channel-interfaces.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/port-channel-interfaces.cfg index bae7c177a6f..7ec7422df17 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/port-channel-interfaces.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/port-channel-interfaces.cfg @@ -51,6 +51,8 @@ interface Port-Channel9 ip address 10.9.2.3/31 bfd interval 500 min-rx 500 multiplier 5 bfd echo + bfd neighbor 10.1.2.4 + bfd per-link rfc-7130 ! interface Port-Channel10 description SRV01_bond0 diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/router-bfd-1.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/router-bfd-1.cfg index 5e0027b1d2e..8431288bf96 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/router-bfd-1.cfg +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/router-bfd-1.cfg @@ -15,6 +15,7 @@ interface Management1 router bfd interval 900 min-rx 900 multiplier 50 default multihop interval 300 min-rx 300 multiplier 3 + local-address 192.168.255.1 session stats snapshot interval 51 ! sbfd diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/port-channel-interfaces.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/port-channel-interfaces.yml index 06506030f88..f1bfb610c81 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/port-channel-interfaces.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/port-channel-interfaces.yml @@ -130,6 +130,10 @@ port_channel_interfaces: interval: 500 min_rx: 500 multiplier: 5 + neighbor: 10.1.2.4 + per_link: + enabled: true + rfc_7130: true spanning_tree_guard: root - name: Port-Channel20 diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/router-bfd-1.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/router-bfd-1.yml index fc24aaf5e76..3bb116d67d3 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/router-bfd-1.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/router-bfd-1.yml @@ -2,6 +2,7 @@ router_bfd: interval: 900 + local_address: 192.168.255.1 min_rx: 900 multiplier: 50 multihop: 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 30fcbcc023e..7be6cc36126 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 @@ -62,6 +62,10 @@ | [      interval](## "port_channel_interfaces.[].bfd.interval") | Integer | | | | Interval in milliseconds | | [      min_rx](## "port_channel_interfaces.[].bfd.min_rx") | Integer | | | | Rate in milliseconds | | [      multiplier](## "port_channel_interfaces.[].bfd.multiplier") | Integer | | | Min: 3
Max: 50 | | + | [      neighbor](## "port_channel_interfaces.[].bfd.neighbor") | String | | | | IPv4 or IPv6 address. When the Port-channel is a L2 interface, a local L3 BFD address (router_bfd.local_address) has to be defined globally on the switch. | + | [      per_link](## "port_channel_interfaces.[].bfd.per_link") | Dictionary | | | | | + | [        enabled](## "port_channel_interfaces.[].bfd.per_link.enabled") | Boolean | | | | | + | [        rfc_7130](## "port_channel_interfaces.[].bfd.per_link.rfc_7130") | Boolean | | | | | | [    service_policy](## "port_channel_interfaces.[].service_policy") | Dictionary | | | | | | [      pbr](## "port_channel_interfaces.[].service_policy.pbr") | Dictionary | | | | | | [        input](## "port_channel_interfaces.[].service_policy.pbr.input") | String | | | | Policy Based Routing Policy-map name | @@ -331,6 +335,12 @@ # Rate in milliseconds min_rx: multiplier: + + # IPv4 or IPv6 address. When the Port-channel is a L2 interface, a local L3 BFD address (router_bfd.local_address) has to be defined globally on the switch. + neighbor: + per_link: + enabled: + rfc_7130: service_policy: pbr: diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-bfd.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-bfd.md index 497f36919ed..b187a6d79ea 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-bfd.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-bfd.md @@ -9,6 +9,7 @@ | -------- | ---- | -------- | ------- | ------------------ | ----------- | | [router_bfd](## "router_bfd") | Dictionary | | | | | | [  interval](## "router_bfd.interval") | Integer | | | | Rate in milliseconds | + | [  local_address](## "router_bfd.local_address") | String | | | | Configure BFD local IP/IPv6 address | | [  min_rx](## "router_bfd.min_rx") | Integer | | | | Rate in milliseconds | | [  multiplier](## "router_bfd.multiplier") | Integer | | | Min: 3
Max: 50 | | | [  multihop](## "router_bfd.multihop") | Dictionary | | | | | @@ -38,6 +39,9 @@ # Rate in milliseconds interval: + # Configure BFD local IP/IPv6 address + local_address: + # Rate in milliseconds min_rx: multiplier: 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 81fa17251e7..47a7702766e 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 @@ -12227,6 +12227,29 @@ "minimum": 3, "maximum": 50, "title": "Multiplier" + }, + "neighbor": { + "type": "string", + "description": "IPv4 or IPv6 address. When the Port-channel is a L2 interface, a local L3 BFD address (router_bfd.local_address) has to be defined globally on the switch.", + "title": "Neighbor" + }, + "per_link": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled" + }, + "rfc_7130": { + "type": "boolean", + "title": "Rfc 7130" + } + }, + "additionalProperties": false, + "patternProperties": { + "^_.+$": {} + }, + "title": "Per Link" } }, "additionalProperties": false, @@ -15108,6 +15131,11 @@ "description": "Rate in milliseconds", "title": "Interval" }, + "local_address": { + "type": "string", + "description": "Configure BFD local IP/IPv6 address", + "title": "Local Address" + }, "min_rx": { "type": "integer", "description": "Rate in milliseconds", 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 bc1fb8a6985..66ca3f51284 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 @@ -7255,6 +7255,18 @@ keys: - str min: 3 max: 50 + neighbor: + type: str + description: IPv4 or IPv6 address. When the Port-channel is a L2 interface, + a local L3 BFD address (router_bfd.local_address) has to be defined + globally on the switch. + per_link: + type: dict + keys: + enabled: + type: bool + rfc_7130: + type: bool service_policy: type: dict keys: @@ -8960,6 +8972,9 @@ keys: interval: type: int description: Rate in milliseconds + local_address: + type: str + description: Configure BFD local IP/IPv6 address min_rx: type: int description: Rate in milliseconds diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/port_channel_interfaces.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/port_channel_interfaces.schema.yml index da433420bdb..1a436eb2f3e 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/port_channel_interfaces.schema.yml +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/port_channel_interfaces.schema.yml @@ -255,6 +255,16 @@ keys: - str min: 3 max: 50 + neighbor: + type: str + description: IPv4 or IPv6 address. When the Port-channel is a L2 interface, a local L3 BFD address (router_bfd.local_address) has to be defined globally on the switch. + per_link: + type: dict + keys: + enabled: + type: bool + rfc_7130: + type: bool service_policy: type: dict keys: diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/router_bfd.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/router_bfd.schema.yml index 8ea3c7341a2..e76a96ceb3f 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/router_bfd.schema.yml +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/router_bfd.schema.yml @@ -12,6 +12,9 @@ keys: interval: type: int description: Rate in milliseconds + local_address: + type: str + description: Configure BFD local IP/IPv6 address min_rx: type: int description: Rate in milliseconds diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 index c168a864212..0256ce4b693 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/port-channel-interfaces.j2 @@ -355,6 +355,16 @@ interface {{ port_channel_interface.name }} {% elif port_channel_interface.bfd.echo is arista.avd.defined(false) %} no bfd echo {% endif %} +{% if port_channel_interface.bfd.neighbor is arista.avd.defined %} + bfd neighbor {{ port_channel_interface.bfd.neighbor }} +{% endif %} +{% if port_channel_interface.bfd.per_link.enabled is arista.avd.defined(true) %} +{% if port_channel_interface.bfd.per_link.rfc_7130 is arista.avd.defined(true) %} + bfd per-link rfc-7130 +{% else %} + bfd per-link +{% endif %} +{% endif %} {% for link_tracking_group in port_channel_interface.link_tracking_groups | arista.avd.natural_sort('name') %} {% if link_tracking_group.name is arista.avd.defined and link_tracking_group.direction is arista.avd.defined %} link tracking group {{ link_tracking_group.name }} {{ link_tracking_group.direction }} diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/router-bfd.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/router-bfd.j2 index a81fd2ce539..0a5cae85f01 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/router-bfd.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/router-bfd.j2 @@ -13,6 +13,9 @@ router bfd {% if router_bfd.multihop.interval is arista.avd.defined and router_bfd.multihop.min_rx is arista.avd.defined and router_bfd.multihop.multiplier is arista.avd.defined %} multihop interval {{ router_bfd.multihop.interval }} min-rx {{ router_bfd.multihop.min_rx }} multiplier {{ router_bfd.multihop.multiplier }} {% endif %} +{% if router_bfd.local_address is arista.avd.defined %} + local-address {{ router_bfd.local_address }} +{% endif %} {% if router_bfd.session_snapshot_interval is arista.avd.defined and router_bfd.session_snapshot_interval < 10 and router_bfd.session_snapshot_interval_dangerous is arista.avd.defined(true, fail_action="error", var_name="router_bfd.session_snapshot_interval_dangerous") %} session stats snapshot interval dangerous {{ router_bfd.session_snapshot_interval }} {% elif router_bfd.session_snapshot_interval is arista.avd.defined %} diff --git a/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.jsonschema.json b/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.jsonschema.json index 2509e8f2631..d6c1e8cd788 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.jsonschema.json +++ b/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.jsonschema.json @@ -9626,6 +9626,29 @@ "minimum": 3, "maximum": 50, "title": "Multiplier" + }, + "neighbor": { + "type": "string", + "description": "IPv4 or IPv6 address. When the Port-channel is a L2 interface, a local L3 BFD address (router_bfd.local_address) has to be defined globally on the switch.", + "title": "Neighbor" + }, + "per_link": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled" + }, + "rfc_7130": { + "type": "boolean", + "title": "Rfc 7130" + } + }, + "additionalProperties": false, + "patternProperties": { + "^_.+$": {} + }, + "title": "Per Link" } }, "additionalProperties": false, @@ -15672,6 +15695,29 @@ "minimum": 3, "maximum": 50, "title": "Multiplier" + }, + "neighbor": { + "type": "string", + "description": "IPv4 or IPv6 address. When the Port-channel is a L2 interface, a local L3 BFD address (router_bfd.local_address) has to be defined globally on the switch.", + "title": "Neighbor" + }, + "per_link": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled" + }, + "rfc_7130": { + "type": "boolean", + "title": "Rfc 7130" + } + }, + "additionalProperties": false, + "patternProperties": { + "^_.+$": {} + }, + "title": "Per Link" } }, "additionalProperties": false,