From 0d6f835393aafc850949492313769ed01921f062 Mon Sep 17 00:00:00 2001 From: Claus Holbech Date: Wed, 21 Feb 2024 11:19:12 +0100 Subject: [PATCH 1/3] Refactor(eos_designs): Remove switch-focused config from WAN Routers (#3644) --- .../configs/autovpn-edge-no-default-policy.cfg | 4 ---- .../intended/configs/autovpn-edge.cfg | 4 ---- .../intended/configs/autovpn-rr1.cfg | 4 ---- .../intended/configs/autovpn-rr2.cfg | 4 ---- .../cv-pathfinder-edge-no-common-path-group.cfg | 4 ---- .../cv-pathfinder-edge-no-default-policy.cfg | 4 ---- .../intended/configs/cv-pathfinder-edge.cfg | 4 ---- .../intended/configs/cv-pathfinder-pathfinder.cfg | 4 ---- .../configs/cv-pathfinder-pathfinder1.cfg | 4 ---- .../configs/cv-pathfinder-pathfinder2.cfg | 4 ---- .../intended/configs/cv-pathfinder-transit.cfg | 4 ---- .../autovpn-edge-no-default-policy.yml | 6 +----- .../intended/structured_configs/autovpn-edge.yml | 6 +----- .../intended/structured_configs/autovpn-rr1.yml | 6 +----- .../intended/structured_configs/autovpn-rr2.yml | 6 +----- .../cv-pathfinder-edge-no-common-path-group.yml | 6 +----- .../cv-pathfinder-edge-no-default-policy.yml | 6 +----- .../structured_configs/cv-pathfinder-edge.yml | 6 +----- .../cv-pathfinder-pathfinder.yml | 6 +----- .../cv-pathfinder-pathfinder1.yml | 6 +----- .../cv-pathfinder-pathfinder2.yml | 6 +----- .../structured_configs/cv-pathfinder-transit.yml | 6 +----- .../python_modules/base/avdstructuredconfig.py | 15 ++++++++++++++- 23 files changed, 25 insertions(+), 100 deletions(-) diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge-no-default-policy.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge-no-default-policy.cfg index 1afaa772920..ed35a16abc2 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge-no-default-policy.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge-no-default-policy.cfg @@ -1,9 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! hostname autovpn-edge-no-default-policy diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge.cfg index 535167a2b46..8b6b1cc7029 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge.cfg @@ -1,9 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! hostname autovpn-edge diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr1.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr1.cfg index 27433ada7a9..a0b8c68c65d 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr1.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr1.cfg @@ -1,9 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! hostname autovpn-rr1 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr2.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr2.cfg index f7d72f1ad9a..1d034ddc4a2 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr2.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr2.cfg @@ -1,9 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! hostname autovpn-rr2 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-common-path-group.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-common-path-group.cfg index a68ac484034..c62e4506e23 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-common-path-group.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-common-path-group.cfg @@ -1,7 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! flow tracking hardware tracker WAN-FLOW-TRACKER record export on inactive timeout 70000 @@ -12,8 +10,6 @@ flow tracking hardware template interval 5000 no shutdown ! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! ip as-path access-list ASPATH-WAN permit 65000 any diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-default-policy.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-default-policy.cfg index 4d075bb4762..576710eb3d8 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-default-policy.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-default-policy.cfg @@ -1,7 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! flow tracking hardware tracker WAN-FLOW-TRACKER record export on inactive timeout 70000 @@ -12,8 +10,6 @@ flow tracking hardware template interval 5000 no shutdown ! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! hostname cv-pathfinder-edge-no-default-policy diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge.cfg index 9c07e52fc82..f00ded9e984 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge.cfg @@ -1,7 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! flow tracking hardware tracker WAN-FLOW-TRACKER record export on inactive timeout 70000 @@ -12,8 +10,6 @@ flow tracking hardware template interval 5000 no shutdown ! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! ip as-path access-list ASPATH-WAN permit 65000 any diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder.cfg index 83050de528d..2ed874fc0fc 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder.cfg @@ -1,7 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! flow tracking hardware tracker WAN-FLOW-TRACKER record export on inactive timeout 70000 @@ -12,8 +10,6 @@ flow tracking hardware template interval 5000 no shutdown ! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! hostname cv-pathfinder-pathfinder diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder1.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder1.cfg index ec8816dd656..a6d56780edd 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder1.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder1.cfg @@ -1,7 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! flow tracking hardware tracker WAN-FLOW-TRACKER record export on inactive timeout 70000 @@ -12,8 +10,6 @@ flow tracking hardware template interval 5000 no shutdown ! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! hostname cv-pathfinder-pathfinder1 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder2.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder2.cfg index 3c3c9ed5031..90d69f2becc 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder2.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder2.cfg @@ -1,7 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! flow tracking hardware tracker WAN-FLOW-TRACKER record export on inactive timeout 70000 @@ -12,8 +10,6 @@ flow tracking hardware template interval 5000 no shutdown ! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! hostname cv-pathfinder-pathfinder2 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-transit.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-transit.cfg index e17d1bb1a2d..221e2ea1b6e 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-transit.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-transit.cfg @@ -1,7 +1,5 @@ !RANCID-CONTENT-TYPE: arista ! -vlan internal order ascending range 1006 1199 -! flow tracking hardware tracker WAN-FLOW-TRACKER record export on inactive timeout 70000 @@ -12,8 +10,6 @@ flow tracking hardware template interval 5000 no shutdown ! -transceiver qsfp default-mode 4x10G -! service routing protocols model multi-agent ! ip as-path access-list ASPATH-WAN permit 65000 any diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge-no-default-policy.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge-no-default-policy.yml index 97e489e9744..188cfaa15da 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge-no-default-policy.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge-no-default-policy.yml @@ -90,11 +90,7 @@ router_bgp: - source_protocol: connected service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge.yml index f849638862b..173e2e110d1 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge.yml @@ -94,11 +94,7 @@ router_bgp: - source_protocol: connected service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr1.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr1.yml index a57d1b1e0ce..9710dd4f605 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr1.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr1.yml @@ -82,11 +82,7 @@ router_bgp: - route-map RM-EVPN-EXPORT-VRF-DEFAULT service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr2.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr2.yml index 7ac551e5da5..ccba259d60e 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr2.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr2.yml @@ -82,11 +82,7 @@ router_bgp: - route-map RM-EVPN-EXPORT-VRF-DEFAULT service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-common-path-group.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-common-path-group.yml index 4fd75dbe016..36c51736c77 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-common-path-group.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-common-path-group.yml @@ -120,11 +120,7 @@ router_bgp: any: true service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-default-policy.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-default-policy.yml index ebb5939ee03..98e0eab960f 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-default-policy.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-default-policy.yml @@ -101,11 +101,7 @@ router_bgp: - source_protocol: connected service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge.yml index f0d9fe3f667..492d177d4bd 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge.yml @@ -126,11 +126,7 @@ router_bgp: any: true service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder.yml index 47e32aa0193..5f11d0178a2 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder.yml @@ -88,11 +88,7 @@ router_bgp: - route-map RM-EVPN-EXPORT-VRF-DEFAULT service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder1.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder1.yml index 140b421ecb6..97c0e676ed7 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder1.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder1.yml @@ -115,11 +115,7 @@ router_bgp: - route-map RM-EVPN-EXPORT-VRF-DEFAULT service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder2.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder2.yml index c06ff65339e..11b308f986f 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder2.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder2.yml @@ -115,11 +115,7 @@ router_bgp: - route-map RM-EVPN-EXPORT-VRF-DEFAULT service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-transit.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-transit.yml index 28fcf4937c8..a595a42c568 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-transit.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-transit.yml @@ -123,11 +123,7 @@ router_bgp: - source_protocol: connected service_routing_protocols_model: multi-agent ip_routing: true -vlan_internal_order: - allocation: ascending - range: - beginning: 1006 - ending: 1199 +transceiver_qsfp_default_mode_4x10: false spanning_tree: mode: none vrfs: diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/base/avdstructuredconfig.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/base/avdstructuredconfig.py index 99fe783ffee..fad9f5f51b6 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/base/avdstructuredconfig.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/base/avdstructuredconfig.py @@ -304,10 +304,13 @@ def daemon_terminattr(self) -> dict | None: return daemon_terminattr @cached_property - def vlan_internal_order(self) -> dict: + def vlan_internal_order(self) -> dict | None: """ vlan_internal_order set based on internal_vlan_order data-model """ + if self.shared_utils.wan_role: + return None + DEFAULT_INTERNAL_VLAN_ORDER = { "allocation": "ascending", "range": { @@ -317,6 +320,16 @@ def vlan_internal_order(self) -> dict: } return get(self._hostvars, "internal_vlan_order", default=DEFAULT_INTERNAL_VLAN_ORDER) + @cached_property + def transceiver_qsfp_default_mode_4x10(self) -> bool | None: + """ + transceiver_qsfp_default_mode_4x10 is on by default in eos_cli_config_gen. + + Set to false for WAN routers. + TODO: Add platform_setting to control this. + """ + return False if self.shared_utils.wan_role else None + @cached_property def event_monitor(self) -> dict | None: """ From f599e3a9cabf7f40e7fc1a466b6b1d95569dce5b Mon Sep 17 00:00:00 2001 From: amitsagar-arsita <150772604+amitsagar-arsita@users.noreply.github.com> Date: Wed, 21 Feb 2024 20:33:16 +0530 Subject: [PATCH 2/3] Feat(eos_designs): Configure BFD timers higher than DPS timeouts for WAN BGP neighbors (#3586) --- .../autovpn-edge-no-default-policy.cfg | 1 + .../intended/configs/autovpn-edge.cfg | 1 + .../intended/configs/autovpn-rr1.cfg | 2 + .../intended/configs/autovpn-rr2.cfg | 2 + ...v-pathfinder-edge-no-common-path-group.cfg | 1 - .../cv-pathfinder-edge-no-default-policy.cfg | 1 + .../intended/configs/cv-pathfinder-edge.cfg | 1 + .../configs/cv-pathfinder-pathfinder.cfg | 1 + .../configs/cv-pathfinder-pathfinder1.cfg | 2 + .../configs/cv-pathfinder-pathfinder2.cfg | 2 + .../configs/cv-pathfinder-transit.cfg | 1 + .../autovpn-edge-no-default-policy.yml | 4 + .../structured_configs/autovpn-edge.yml | 4 + .../structured_configs/autovpn-rr1.yml | 8 ++ .../structured_configs/autovpn-rr2.yml | 8 ++ ...v-pathfinder-edge-no-common-path-group.yml | 2 +- .../cv-pathfinder-edge-no-default-policy.yml | 4 + .../structured_configs/cv-pathfinder-edge.yml | 4 + .../cv-pathfinder-pathfinder.yml | 4 + .../cv-pathfinder-pathfinder1.yml | 8 ++ .../cv-pathfinder-pathfinder2.yml | 8 ++ .../cv-pathfinder-transit.yml | 4 + .../CV_PATHFINDER_MULTI_RR_TESTS.yml | 4 + ...v-pathfinder-edge-no-common-path-group.yml | 7 ++ .../bgp_peer_groups.py | 11 ++- .../docs/tables/wan-bgp-peer-groups.md | 36 ++++++++- .../python_modules/overlay/router_bgp.py | 2 + .../schemas/eos_designs.jsonschema.json | 80 ++++++++++++++++++- .../schemas/eos_designs.schema.yml | 40 +++++++++- .../bgp_peer_groups.schema.yml | 36 ++++++++- 30 files changed, 281 insertions(+), 8 deletions(-) create mode 100644 ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/cv-pathfinder-edge-no-common-path-group.yml diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge-no-default-policy.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge-no-default-policy.cfg index ed35a16abc2..d825fdb921c 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge-no-default-policy.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge-no-default-policy.cfg @@ -135,6 +135,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS remote-as 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge.cfg index 8b6b1cc7029..3d469bee206 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-edge.cfg @@ -165,6 +165,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS remote-as 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr1.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr1.cfg index a0b8c68c65d..c5950b75935 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr1.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr1.cfg @@ -150,6 +150,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS route-reflector-client neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community @@ -158,6 +159,7 @@ router bgp 65000 neighbor WAN-RR-OVERLAY-PEERS remote-as 65000 neighbor WAN-RR-OVERLAY-PEERS update-source Dps1 neighbor WAN-RR-OVERLAY-PEERS bfd + neighbor WAN-RR-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-RR-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-RR-OVERLAY-PEERS send-community neighbor WAN-RR-OVERLAY-PEERS maximum-routes 0 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr2.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr2.cfg index 1d034ddc4a2..a09fe714fe6 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr2.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/autovpn-rr2.cfg @@ -151,6 +151,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS route-reflector-client neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community @@ -159,6 +160,7 @@ router bgp 65000 neighbor WAN-RR-OVERLAY-PEERS remote-as 65000 neighbor WAN-RR-OVERLAY-PEERS update-source Dps1 neighbor WAN-RR-OVERLAY-PEERS bfd + neighbor WAN-RR-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-RR-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-RR-OVERLAY-PEERS send-community neighbor WAN-RR-OVERLAY-PEERS maximum-routes 0 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-common-path-group.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-common-path-group.cfg index c62e4506e23..8c057a6bc8f 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-common-path-group.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-common-path-group.cfg @@ -303,7 +303,6 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS peer group neighbor WAN-OVERLAY-PEERS remote-as 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 - neighbor WAN-OVERLAY-PEERS bfd neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-default-policy.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-default-policy.cfg index 576710eb3d8..b5acaaff67c 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-default-policy.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge-no-default-policy.cfg @@ -210,6 +210,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS remote-as 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 42 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge.cfg index f00ded9e984..024f80a0aea 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-edge.cfg @@ -363,6 +363,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS remote-as 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder.cfg index 2ed874fc0fc..3db6c6ddd92 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder.cfg @@ -300,6 +300,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS route-reflector-client neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder1.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder1.cfg index a6d56780edd..ad7d201a57b 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder1.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder1.cfg @@ -289,6 +289,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS route-reflector-client neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community @@ -297,6 +298,7 @@ router bgp 65000 neighbor WAN-RR-OVERLAY-PEERS remote-as 65000 neighbor WAN-RR-OVERLAY-PEERS update-source Dps1 neighbor WAN-RR-OVERLAY-PEERS bfd + neighbor WAN-RR-OVERLAY-PEERS bfd interval 2020 min-rx 2000 multiplier 3 neighbor WAN-RR-OVERLAY-PEERS ttl maximum-hops 42 neighbor WAN-RR-OVERLAY-PEERS send-community neighbor WAN-RR-OVERLAY-PEERS maximum-routes 0 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder2.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder2.cfg index 90d69f2becc..6852bc90ef4 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder2.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-pathfinder2.cfg @@ -302,6 +302,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS route-reflector-client neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community @@ -310,6 +311,7 @@ router bgp 65000 neighbor WAN-RR-OVERLAY-PEERS remote-as 65000 neighbor WAN-RR-OVERLAY-PEERS update-source Dps1 neighbor WAN-RR-OVERLAY-PEERS bfd + neighbor WAN-RR-OVERLAY-PEERS bfd interval 2020 min-rx 2000 multiplier 3 neighbor WAN-RR-OVERLAY-PEERS ttl maximum-hops 42 neighbor WAN-RR-OVERLAY-PEERS send-community neighbor WAN-RR-OVERLAY-PEERS maximum-routes 0 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-transit.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-transit.cfg index 221e2ea1b6e..15212bfdfe5 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-transit.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/cv-pathfinder-transit.cfg @@ -354,6 +354,7 @@ router bgp 65000 neighbor WAN-OVERLAY-PEERS remote-as 65000 neighbor WAN-OVERLAY-PEERS update-source Dps1 neighbor WAN-OVERLAY-PEERS bfd + neighbor WAN-OVERLAY-PEERS bfd interval 1000 min-rx 1000 multiplier 10 neighbor WAN-OVERLAY-PEERS ttl maximum-hops 1 neighbor WAN-OVERLAY-PEERS password 7 htm4AZe9mIQOO1uiMuGgYQ== neighbor WAN-OVERLAY-PEERS send-community diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge-no-default-policy.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge-no-default-policy.yml index 188cfaa15da..feecb7d555e 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge-no-default-policy.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge-no-default-policy.yml @@ -23,6 +23,10 @@ router_bgp: maximum_routes: 0 remote_as: '65000' ttl_maximum_hops: 1 + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 address_family_evpn: peer_groups: - name: WAN-OVERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge.yml index 173e2e110d1..85e8d9a0c28 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-edge.yml @@ -23,6 +23,10 @@ router_bgp: maximum_routes: 0 remote_as: '65000' ttl_maximum_hops: 1 + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 address_family_evpn: peer_groups: - name: WAN-OVERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr1.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr1.yml index 9710dd4f605..c22906e19b1 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr1.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr1.yml @@ -29,6 +29,10 @@ router_bgp: remote_as: '65000' ttl_maximum_hops: 1 route_reflector_client: true + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 - name: WAN-RR-OVERLAY-PEERS type: wan update_source: Dps1 @@ -37,6 +41,10 @@ router_bgp: maximum_routes: 0 remote_as: '65000' ttl_maximum_hops: 1 + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 address_family_evpn: peer_groups: - name: WAN-OVERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr2.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr2.yml index ccba259d60e..371e69060b1 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr2.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/autovpn-rr2.yml @@ -29,6 +29,10 @@ router_bgp: remote_as: '65000' ttl_maximum_hops: 1 route_reflector_client: true + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 - name: WAN-RR-OVERLAY-PEERS type: wan update_source: Dps1 @@ -37,6 +41,10 @@ router_bgp: maximum_routes: 0 remote_as: '65000' ttl_maximum_hops: 1 + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 address_family_evpn: peer_groups: - name: WAN-OVERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-common-path-group.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-common-path-group.yml index 36c51736c77..0b7d19a7b90 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-common-path-group.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-common-path-group.yml @@ -20,7 +20,7 @@ router_bgp: - name: WAN-OVERLAY-PEERS type: wan update_source: Dps1 - bfd: true + bfd: false password: htm4AZe9mIQOO1uiMuGgYQ== send_community: all maximum_routes: 0 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-default-policy.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-default-policy.yml index 98e0eab960f..76167c1ad3c 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-default-policy.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge-no-default-policy.yml @@ -23,6 +23,10 @@ router_bgp: maximum_routes: 0 remote_as: '65000' ttl_maximum_hops: 42 + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 address_family_evpn: peer_groups: - name: WAN-OVERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge.yml index 492d177d4bd..f987f0faae8 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-edge.yml @@ -26,6 +26,10 @@ router_bgp: maximum_routes: 0 remote_as: '65000' ttl_maximum_hops: 1 + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 address_family_ipv4: peer_groups: - name: IPv4-UNDERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder.yml index 5f11d0178a2..7acc88cf1cb 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder.yml @@ -27,6 +27,10 @@ router_bgp: remote_as: '65000' ttl_maximum_hops: 1 route_reflector_client: true + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 address_family_ipv4: peer_groups: - name: IPv4-UNDERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder1.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder1.yml index 97c0e676ed7..d1ddd0a1567 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder1.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder1.yml @@ -27,6 +27,10 @@ router_bgp: remote_as: '65000' ttl_maximum_hops: 1 route_reflector_client: true + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 - name: WAN-RR-OVERLAY-PEERS type: wan update_source: Dps1 @@ -35,6 +39,10 @@ router_bgp: maximum_routes: 0 remote_as: '65000' ttl_maximum_hops: 42 + bfd_timers: + interval: 2020 + min_rx: 2000 + multiplier: 3 address_family_ipv4: peer_groups: - name: IPv4-UNDERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder2.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder2.yml index 11b308f986f..32ec4a94f1f 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder2.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-pathfinder2.yml @@ -27,6 +27,10 @@ router_bgp: remote_as: '65000' ttl_maximum_hops: 1 route_reflector_client: true + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 - name: WAN-RR-OVERLAY-PEERS type: wan update_source: Dps1 @@ -35,6 +39,10 @@ router_bgp: maximum_routes: 0 remote_as: '65000' ttl_maximum_hops: 42 + bfd_timers: + interval: 2020 + min_rx: 2000 + multiplier: 3 address_family_ipv4: peer_groups: - name: IPv4-UNDERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-transit.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-transit.yml index a595a42c568..9a3a9a45535 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-transit.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/cv-pathfinder-transit.yml @@ -26,6 +26,10 @@ router_bgp: maximum_routes: 0 remote_as: '65000' ttl_maximum_hops: 1 + bfd_timers: + interval: 1000 + min_rx: 1000 + multiplier: 10 address_family_ipv4: peer_groups: - name: IPv4-UNDERLAY-PEERS diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/CV_PATHFINDER_MULTI_RR_TESTS.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/CV_PATHFINDER_MULTI_RR_TESTS.yml index b01da70aa22..41a9ffa5885 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/CV_PATHFINDER_MULTI_RR_TESTS.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/CV_PATHFINDER_MULTI_RR_TESTS.yml @@ -27,3 +27,7 @@ bgp_peer_groups: - 192.168.143.0/24 wan_rr_overlay_peers: ttl_maximum_hops: 42 + bfd_timers: + interval: 2020 + min_rx: 2000 + multiplier: 3 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/cv-pathfinder-edge-no-common-path-group.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/cv-pathfinder-edge-no-common-path-group.yml new file mode 100644 index 00000000000..8b20bd83825 --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/cv-pathfinder-edge-no-common-path-group.yml @@ -0,0 +1,7 @@ +bgp_peer_groups: + wan_overlay_peers: + password: "htm4AZe9mIQOO1uiMuGgYQ==" + listen_range_prefixes: + - 192.168.142.0/24 + - 192.168.143.0/24 + bfd: false diff --git a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/bgp_peer_groups.py b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/bgp_peer_groups.py index 13714ea621a..b17d3dcac52 100644 --- a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/bgp_peer_groups.py +++ b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/bgp_peer_groups.py @@ -51,8 +51,17 @@ def bgp_peer_groups(self: SharedUtils): "bfd": get(self.hostvars, f"bgp_peer_groups.{key}.bfd", default=default_bfd), "structured_config": get(self.hostvars, f"bgp_peer_groups.{key}.structured_config"), } + if key == "wan_overlay_peers" and get(self.hostvars, f"bgp_peer_groups.{key}") is not None: bgp_peer_groups[key]["listen_range_prefixes"] = get(self.hostvars, f"bgp_peer_groups.{key}.listen_range_prefixes", required=True) - if key == "wan_overlay_peers" or key == "wan_rr_overlay_peers": + + if key in ["wan_overlay_peers", "wan_rr_overlay_peers"]: + # For WAN peerings, set the TTL for maximum hops and use defaut timers for BFD bgp_peer_groups[key]["ttl_maximum_hops"] = get(self.hostvars, f"bgp_peer_groups.{key}.ttl_maximum_hops", default=1) + + if get(self.hostvars, f"bgp_peer_groups.{key}.bfd", default=default_bfd): + bgp_peer_groups[key]["bfd_timers"] = get( + self.hostvars, f"bgp_peer_groups.{key}.bfd_timers", default={"interval": 1000, "min_rx": 1000, "multiplier": 10} + ) + return bgp_peer_groups diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/wan-bgp-peer-groups.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/wan-bgp-peer-groups.md index 2a35a482dbb..8d90eabd55e 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/wan-bgp-peer-groups.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/wan-bgp-peer-groups.md @@ -11,7 +11,11 @@ | [  wan_overlay_peers](## "bgp_peer_groups.wan_overlay_peers") | Dictionary | | | | PREVIEW: This key is currently not supported | | [    name](## "bgp_peer_groups.wan_overlay_peers.name") | String | | `WAN-OVERLAY-PEERS` | | Name of peer group. | | [    password](## "bgp_peer_groups.wan_overlay_peers.password") | String | | | | Type 7 encrypted password. | - | [    bfd](## "bgp_peer_groups.wan_overlay_peers.bfd") | Boolean | | `False` | | | + | [    bfd](## "bgp_peer_groups.wan_overlay_peers.bfd") | Boolean | | `True` | | | + | [    bfd_timers](## "bgp_peer_groups.wan_overlay_peers.bfd_timers") | Dictionary | | | | Specify the BFD timers to override the default values.
It is recommended to keep BFD total timeout longer than the DPS timeout.
The Default BFD timeout is 10 x 1 seconds and the default DPS timeout is 5 x 1 seconds. | + | [      interval](## "bgp_peer_groups.wan_overlay_peers.bfd_timers.interval") | Integer | Required | `1000` | Min: 50
Max: 60000 | Interval in milliseconds. | + | [      min_rx](## "bgp_peer_groups.wan_overlay_peers.bfd_timers.min_rx") | Integer | Required | `1000` | Min: 50
Max: 60000 | Rate in milliseconds. | + | [      multiplier](## "bgp_peer_groups.wan_overlay_peers.bfd_timers.multiplier") | Integer | Required | `10` | Min: 3
Max: 50 | | | [    listen_range_prefixes](## "bgp_peer_groups.wan_overlay_peers.listen_range_prefixes") | List, items: String | | | | Only used for nodes where `wan_role` is `server` like AutoVPN RRs and Pathfinders.
For clients, AVD will raise an error if the Loopback0 IP is not in any listen range. | | [      - <str>](## "bgp_peer_groups.wan_overlay_peers.listen_range_prefixes.[]") | String | | | | The prefixes to use in listen_range. | | [    structured_config](## "bgp_peer_groups.wan_overlay_peers.structured_config") | Dictionary | | | | Custom structured config added under router_bgp.peer_groups.[name=] for eos_cli_config_gen. | @@ -20,6 +24,10 @@ | [    name](## "bgp_peer_groups.wan_rr_overlay_peers.name") | String | | `WAN-RR-OVERLAY-PEERS` | | Name of peer group. | | [    password](## "bgp_peer_groups.wan_rr_overlay_peers.password") | String | | | | Type 7 encrypted password. | | [    bfd](## "bgp_peer_groups.wan_rr_overlay_peers.bfd") | Boolean | | `True` | | | + | [    bfd_timers](## "bgp_peer_groups.wan_rr_overlay_peers.bfd_timers") | Dictionary | | | | Specify the BFD timers to override the default values.
It is recommended to keep BFD total timeout longer than the DPS timeout.
The Default BFD timeout is 10 x 1 seconds and the default DPS timeout is 5 x 1 seconds. | + | [      interval](## "bgp_peer_groups.wan_rr_overlay_peers.bfd_timers.interval") | Integer | Required | `1000` | Min: 50
Max: 60000 | Interval in milliseconds. | + | [      min_rx](## "bgp_peer_groups.wan_rr_overlay_peers.bfd_timers.min_rx") | Integer | Required | `1000` | Min: 50
Max: 60000 | Rate in milliseconds. | + | [      multiplier](## "bgp_peer_groups.wan_rr_overlay_peers.bfd_timers.multiplier") | Integer | Required | `10` | Min: 3
Max: 50 | | | [    structured_config](## "bgp_peer_groups.wan_rr_overlay_peers.structured_config") | Dictionary | | | | Custom structured config added under router_bgp.peer_groups.[name=] for eos_cli_config_gen. | | [    ttl_maximum_hops](## "bgp_peer_groups.wan_rr_overlay_peers.ttl_maximum_hops") | Integer | | `1` | | | @@ -38,7 +46,19 @@ # Type 7 encrypted password. password: - bfd: + bfd: + + # Specify the BFD timers to override the default values. + # It is recommended to keep BFD total timeout longer than the DPS timeout. + # The Default BFD timeout is 10 x 1 seconds and the default DPS timeout is 5 x 1 seconds. + bfd_timers: + + # Interval in milliseconds. + interval: + + # Rate in milliseconds. + min_rx: + multiplier: # Only used for nodes where `wan_role` is `server` like AutoVPN RRs and Pathfinders. # For clients, AVD will raise an error if the Loopback0 IP is not in any listen range. @@ -63,6 +83,18 @@ password: bfd: + # Specify the BFD timers to override the default values. + # It is recommended to keep BFD total timeout longer than the DPS timeout. + # The Default BFD timeout is 10 x 1 seconds and the default DPS timeout is 5 x 1 seconds. + bfd_timers: + + # Interval in milliseconds. + interval: + + # Rate in milliseconds. + min_rx: + multiplier: + # Custom structured config added under router_bgp.peer_groups.[name=] for eos_cli_config_gen. structured_config: ttl_maximum_hops: diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_bgp.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_bgp.py index 8644c92e7fd..d8871539982 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_bgp.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_bgp.py @@ -125,6 +125,7 @@ def _peer_groups(self) -> list | None: peer_group_config["ttl_maximum_hops"] = self.shared_utils.bgp_peer_groups["wan_overlay_peers"]["ttl_maximum_hops"] if self.shared_utils.wan_role == "server": peer_group_config["route_reflector_client"] = True + peer_group_config["bfd_timers"] = get(self.shared_utils.bgp_peer_groups["wan_overlay_peers"], "bfd_timers") peer_groups.append( { **self._generate_base_peer_group("wan", "wan_overlay_peers", update_source=self.shared_utils.vtep_loopback), @@ -151,6 +152,7 @@ def _peer_groups(self) -> list | None: wan_rr_overlay_peer_group.update( {"remote_as": self.shared_utils.bgp_as, "ttl_maximum_hops": self.shared_utils.bgp_peer_groups["wan_rr_overlay_peers"]["ttl_maximum_hops"]} ) + wan_rr_overlay_peer_group["bfd_timers"] = get(self.shared_utils.bgp_peer_groups["wan_rr_overlay_peers"], "bfd_timers") peer_groups.append(wan_rr_overlay_peer_group) # same for ebgp and ibgp 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 ae413707b2f..1375d737b79 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 @@ -2932,9 +2932,48 @@ }, "bfd": { "type": "boolean", - "default": false, + "default": true, "title": "BFD" }, + "bfd_timers": { + "type": "object", + "description": "Specify the BFD timers to override the default values.\nIt is recommended to keep BFD total timeout longer than the DPS timeout.\nThe Default BFD timeout is 10 x 1 seconds and the default DPS timeout is 5 x 1 seconds.", + "properties": { + "interval": { + "type": "integer", + "default": 1000, + "minimum": 50, + "maximum": 60000, + "description": "Interval in milliseconds.", + "title": "Interval" + }, + "min_rx": { + "type": "integer", + "default": 1000, + "minimum": 50, + "maximum": 60000, + "description": "Rate in milliseconds.", + "title": "Min RX" + }, + "multiplier": { + "type": "integer", + "default": 10, + "minimum": 3, + "maximum": 50, + "title": "Multiplier" + } + }, + "required": [ + "interval", + "min_rx", + "multiplier" + ], + "additionalProperties": false, + "patternProperties": { + "^_.+$": {} + }, + "title": "BFD Timers" + }, "listen_range_prefixes": { "type": "array", "description": "Only used for nodes where `wan_role` is `server` like AutoVPN RRs and Pathfinders.\nFor clients, AVD will raise an error if the Loopback0 IP is not in any listen range.", @@ -3296,6 +3335,45 @@ "default": true, "title": "BFD" }, + "bfd_timers": { + "type": "object", + "description": "Specify the BFD timers to override the default values.\nIt is recommended to keep BFD total timeout longer than the DPS timeout.\nThe Default BFD timeout is 10 x 1 seconds and the default DPS timeout is 5 x 1 seconds.", + "properties": { + "interval": { + "type": "integer", + "default": 1000, + "minimum": 50, + "maximum": 60000, + "description": "Interval in milliseconds.", + "title": "Interval" + }, + "min_rx": { + "type": "integer", + "default": 1000, + "minimum": 50, + "maximum": 60000, + "description": "Rate in milliseconds.", + "title": "Min RX" + }, + "multiplier": { + "type": "integer", + "default": 10, + "minimum": 3, + "maximum": 50, + "title": "Multiplier" + } + }, + "required": [ + "interval", + "min_rx", + "multiplier" + ], + "additionalProperties": false, + "patternProperties": { + "^_.+$": {} + }, + "title": "BFD Timers" + }, "structured_config": { "type": "object", "description": "Custom structured config added under router_bgp.peer_groups.[name=] for eos_cli_config_gen.", diff --git a/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.schema.yml b/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.schema.yml index 7b91821746a..e568dc3c1e8 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.schema.yml +++ b/ansible_collections/arista/avd/roles/eos_designs/schemas/eos_designs.schema.yml @@ -357,7 +357,26 @@ keys: description: Type 7 encrypted password. bfd: type: bool - default: false + default: true + bfd_timers: + type: dict + description: 'Specify the BFD timers to override the default values. + + It is recommended to keep BFD total timeout longer than the DPS timeout. + + The Default BFD timeout is 10 x 1 seconds and the default DPS timeout + is 5 x 1 seconds.' + $ref: eos_cli_config_gen#/keys/router_bgp/keys/peer_groups/items/keys/bfd_timers + keys: + interval: + type: int + default: 1000 + min_rx: + type: int + default: 1000 + multiplier: + type: int + default: 10 listen_range_prefixes: type: list description: 'Only used for nodes where `wan_role` is `server` like AutoVPN @@ -400,6 +419,25 @@ keys: bfd: type: bool default: true + bfd_timers: + type: dict + description: 'Specify the BFD timers to override the default values. + + It is recommended to keep BFD total timeout longer than the DPS timeout. + + The Default BFD timeout is 10 x 1 seconds and the default DPS timeout + is 5 x 1 seconds.' + $ref: eos_cli_config_gen#/keys/router_bgp/keys/peer_groups/items/keys/bfd_timers + keys: + interval: + type: int + default: 1000 + min_rx: + type: int + default: 1000 + multiplier: + type: int + default: 10 structured_config: type: dict description: Custom structured config added under router_bgp.peer_groups.[name=] diff --git a/ansible_collections/arista/avd/roles/eos_designs/schemas/schema_fragments/bgp_peer_groups.schema.yml b/ansible_collections/arista/avd/roles/eos_designs/schemas/schema_fragments/bgp_peer_groups.schema.yml index 074d7bf7cc7..0b107f6aa50 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/schemas/schema_fragments/bgp_peer_groups.schema.yml +++ b/ansible_collections/arista/avd/roles/eos_designs/schemas/schema_fragments/bgp_peer_groups.schema.yml @@ -163,7 +163,24 @@ keys: description: Type 7 encrypted password. bfd: type: bool - default: False + default: True + bfd_timers: + type: dict + description: |- + Specify the BFD timers to override the default values. + It is recommended to keep BFD total timeout longer than the DPS timeout. + The Default BFD timeout is 10 x 1 seconds and the default DPS timeout is 5 x 1 seconds. + $ref: "eos_cli_config_gen#/keys/router_bgp/keys/peer_groups/items/keys/bfd_timers" + keys: + interval: + type: int + default: 1000 + min_rx: + type: int + default: 1000 + multiplier: + type: int + default: 10 listen_range_prefixes: type: list description: |- @@ -202,6 +219,23 @@ keys: bfd: type: bool default: True + bfd_timers: + type: dict + description: |- + Specify the BFD timers to override the default values. + It is recommended to keep BFD total timeout longer than the DPS timeout. + The Default BFD timeout is 10 x 1 seconds and the default DPS timeout is 5 x 1 seconds. + $ref: "eos_cli_config_gen#/keys/router_bgp/keys/peer_groups/items/keys/bfd_timers" + keys: + interval: + type: int + default: 1000 + min_rx: + type: int + default: 1000 + multiplier: + type: int + default: 10 structured_config: type: dict description: Custom structured config added under router_bgp.peer_groups.[name=] for eos_cli_config_gen. From 95301e08da333c3a037602a272b3901d18227342 Mon Sep 17 00:00:00 2001 From: ayushmittal-arista <94678581+ayushmittal-arista@users.noreply.github.com> Date: Thu, 22 Feb 2024 01:10:43 +0530 Subject: [PATCH 3/3] Feat(eos_designs): Replace wan_role checks with helper cached_property utils (#3639) Co-authored-by: Guillaume Mulocher Co-authored-by: Claus Holbech --- .../plugin_utils/eos_designs_facts/wan.py | 2 +- .../filtered_tenants.py | 4 +-- .../eos_designs_shared_utils/overlay.py | 4 +-- .../eos_designs_shared_utils/wan.py | 26 ++++++++++++++----- .../base/avdstructuredconfig.py | 4 +-- .../avdinterfacedescriptions.py | 2 +- .../application_traffic_recognition.py | 8 +++--- .../network_services/dps_interfaces.py | 2 +- .../network_services/route_maps.py | 6 ++--- .../network_services/router_path_selection.py | 2 +- .../python_modules/network_services/utils.py | 6 ++--- .../network_services/vxlan_interface.py | 4 +-- .../overlay/avdstructuredconfig.py | 2 +- .../overlay/ip_extcommunity_lists.py | 2 +- .../python_modules/overlay/ip_security.py | 6 ++--- .../python_modules/overlay/router_bgp.py | 18 ++++++------- .../overlay/router_path_selection.py | 12 ++++----- .../python_modules/overlay/stun.py | 6 ++--- .../python_modules/overlay/utils.py | 2 +- .../python_modules/underlay/prefix_lists.py | 8 +++--- .../python_modules/underlay/route_maps.py | 2 +- .../python_modules/underlay/router_bgp.py | 2 +- 22 files changed, 71 insertions(+), 59 deletions(-) diff --git a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_facts/wan.py b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_facts/wan.py index 94270c7df44..684fa81d8e4 100644 --- a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_facts/wan.py +++ b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_facts/wan.py @@ -26,7 +26,7 @@ def wan_path_groups(self: EosDesignsFacts) -> list | None: Return the list of WAN path_groups directly connected to this router, with a list of dictionaries containing the (interface, ip_address) in the path_group. """ - if self.shared_utils.wan_role != "server": + if not self.shared_utils.is_wan_server: return None return self.shared_utils.wan_local_path_groups diff --git a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/filtered_tenants.py b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/filtered_tenants.py index 7a6b551d523..e43ed3cc695 100644 --- a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/filtered_tenants.py +++ b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/filtered_tenants.py @@ -50,7 +50,7 @@ def filtered_tenants(self: SharedUtils) -> list[dict]: ) no_vrf_default = all(vrf["name"] != "default" for tenant in filtered_tenants for vrf in tenant["vrfs"]) - if self.wan_role is not None and no_vrf_default: + if self.is_wan_router and no_vrf_default: filtered_tenants.append( { "name": "WAN_DEFAULT", @@ -70,7 +70,7 @@ def filtered_tenants(self: SharedUtils) -> list[dict]: "l2vlans": [], } ) - elif self.wan_role: + elif self.is_wan_router: # It is enough to check only the first occurence of default VRF as some other piece of code # checks that if the VRF is in multiple tenants, the configuration is consistent. for tenant in filtered_tenants: diff --git a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/overlay.py b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/overlay.py index 6f798976994..509de8788e0 100644 --- a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/overlay.py +++ b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/overlay.py @@ -27,7 +27,7 @@ def vtep_loopback(self: SharedUtils) -> str: """ The default is Loopback1 except for WAN devices where the default is Dps1. """ - default_vtep_loopback = "Dps1" if self.wan_role is not None else "Loopback1" + default_vtep_loopback = "Dps1" if self.is_wan_router else "Loopback1" return get(self.switch_data_combined, "vtep_loopback", default=default_vtep_loopback) @cached_property @@ -145,7 +145,7 @@ def evpn_soo(self: SharedUtils) -> str: TODO: Implement HA logic for WAN TODO: Reconsider if suffix should just be :1 for all WAN routers. """ - if self.wan_role: + if self.is_wan_router: if self.is_cv_pathfinder_edge_or_transit: return f"{self.router_id}:{self.wan_site['id']}" return f"{self.router_id}:0" diff --git a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/wan.py b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/wan.py index a724a0e8fff..c3bf299a24f 100644 --- a/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/wan.py +++ b/ansible_collections/arista/avd/plugins/plugin_utils/eos_designs_shared_utils/wan.py @@ -28,7 +28,7 @@ def wan_mode(self: SharedUtils) -> str: @cached_property def wan_role(self: SharedUtils) -> str | None: - if self.underlay_router is False or self.wan_mode is None: + if self.underlay_router is False: return None default_wan_role = get(self.node_type_key_data, "default_wan_role", default=None) @@ -41,6 +41,18 @@ def wan_role(self: SharedUtils) -> str | None: raise AristaAvdError("'wan_role' client requires 'evpn_role' client.") return wan_role + @cached_property + def is_wan_router(self) -> bool: + return bool(self.wan_role) + + @cached_property + def is_wan_server(self) -> bool: + return self.wan_role == "server" + + @cached_property + def is_wan_client(self) -> bool: + return self.wan_role == "client" + @cached_property def wan_listen_ranges(self: SharedUtils) -> list: return get( @@ -57,9 +69,9 @@ def cv_pathfinder_role(self: SharedUtils) -> str | None: default_cv_pathfinder_role = get(self.node_type_key_data, "default_cv_pathfinder_role", default=None) cv_pathfinder_role = get(self.switch_data_combined, "cv_pathfinder_role", default=default_cv_pathfinder_role) - if cv_pathfinder_role == "pathfinder" and self.wan_role != "server": + if cv_pathfinder_role == "pathfinder" and not self.is_wan_server: raise AristaAvdError("'wan_role' must be 'server' when 'cv_pathfinder_role' is set to 'pathfinder'") - if cv_pathfinder_role in ["transit", "edge"] and self.wan_role != "client": + if cv_pathfinder_role in ["transit", "edge"] and not self.is_wan_client: raise AristaAvdError("'wan_role' must be 'client' when 'cv_pathfinder_role' is set to 'transit' or 'edge'") return cv_pathfinder_role @@ -71,7 +83,7 @@ def wan_interfaces(self: SharedUtils) -> list: This may need to be made wider. This also may require a different format for the dictionaries inside the list. """ - if self.wan_role is None: + if not self.is_wan_router: return [] wan_interfaces = [] @@ -93,7 +105,7 @@ def wan_local_carriers(self: SharedUtils) -> list: - name: ... ip: ... (for route-servers the IP may come from wan_route_servers) """ - if not self.wan_role: + if not self.is_wan_router: return [] local_carriers_dict = {} @@ -135,7 +147,7 @@ def wan_local_path_groups(self: SharedUtils) -> list: - name: ... ip: ... """ - if self.wan_role is None: + if not self.is_wan_router: return [] local_path_groups_dict = {} @@ -176,7 +188,7 @@ def get_public_ip_for_wan_interface(self: SharedUtils, interface: dict) -> str: For WAN route-servers we try to find the IP under wan_route_servers.path_groups.interfaces. If not found we use the IP under the interface, unless it is "dhcp" where we raise. """ - if self.wan_role != "server": + if not self.is_wan_server: return interface["ip_address"] for path_group in self.this_wan_route_server.get("path_groups", []): diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/base/avdstructuredconfig.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/base/avdstructuredconfig.py index fad9f5f51b6..f7275a09c39 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/base/avdstructuredconfig.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/base/avdstructuredconfig.py @@ -59,7 +59,7 @@ def router_bgp(self) -> dict | None: ) platform_bgp_update_wait_install = get(self.shared_utils.platform_settings, "feature_support.bgp_update_wait_install", default=True) is True - if self.shared_utils.wan_role is not None: + if self.shared_utils.is_wan_router: # Special defaults for WAN routers default_maximum_paths = 16 default_ecmp = None @@ -545,7 +545,7 @@ def platform(self) -> dict | None: if (cpu_max_allocation := get(self.shared_utils.switch_data_combined, "data_plane_cpu_allocation_max")) is not None: platform["sfe"] = {"data_plane_cpu_allocation_max": cpu_max_allocation} - elif self.shared_utils.wan_role == "server": + elif self.shared_utils.is_wan_server: # For AutoVPN Route Reflectors and Pathfinders, running on CloudEOS, setting # this value is required for the solution to work. raise AristaAvdMissingVariableError("For AutoVPN RRs and Pathfinders, 'data_plane_cpu_allocation_max' must be set") diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/interface_descriptions/avdinterfacedescriptions.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/interface_descriptions/avdinterfacedescriptions.py index 3ed0ca7ff9c..6318164ecec 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/interface_descriptions/avdinterfacedescriptions.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/interface_descriptions/avdinterfacedescriptions.py @@ -228,7 +228,7 @@ def overlay_loopback_interface(self, overlay_loopback_description: str = None) - if self._mpls_lsr is True: return "LSR_Router_ID" - if self.shared_utils.wan_role is not None: + if self.shared_utils.is_wan_router: return "Router_ID" # Covers L2LS diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/application_traffic_recognition.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/application_traffic_recognition.py index d8fa98780f7..2071e29e8ab 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/application_traffic_recognition.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/application_traffic_recognition.py @@ -20,9 +20,9 @@ class ApplicationTrafficRecognitionMixin(UtilsMixin): @cached_property def application_traffic_recognition(self) -> dict | None: """ - Return structured config for application_traffic_recognition if `wan_role` is not None + Return structured config for application_traffic_recognition if wan router """ - if not self.shared_utils.wan_role: + if not self.shared_utils.is_wan_router: return None filtered_application_classification = self._filtered_application_classification() @@ -102,7 +102,7 @@ def _generate_control_plane_application_profile(self, app_dict: dict) -> None: ipv4_applications = get(app_dict, "applications.ipv4_applications", []) if get_item(ipv4_applications, "name", self._wan_control_plane_application) is not None: return - if self.shared_utils.wan_role == "client": + if self.shared_utils.is_wan_client: app_dict.setdefault("applications", {}).setdefault("ipv4_applications", []).append( { "name": self._wan_control_plane_application, @@ -120,7 +120,7 @@ def _generate_control_plane_application_profile(self, app_dict: dict) -> None: "prefix_values": pathfinder_vtep_ips, } ) - elif self.shared_utils.wan_role == "server": + elif self.shared_utils.is_wan_server: app_dict.setdefault("applications", {}).setdefault("ipv4_applications", []).append( { "name": self._wan_control_plane_application, diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/dps_interfaces.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/dps_interfaces.py index c4ff915f8c1..0b91f3fd1c6 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/dps_interfaces.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/dps_interfaces.py @@ -21,7 +21,7 @@ def dps_interfaces(self) -> list | None: Only used for WAN devices """ - if not self.shared_utils.wan_role: + if not self.shared_utils.is_wan_router: return None dps1 = { diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/route_maps.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/route_maps.py index 45b2eadb94c..b0c7fdfdfe3 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/route_maps.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/route_maps.py @@ -92,7 +92,7 @@ def _route_maps_vrf_default(self) -> list | None: if not self._vrf_default_evpn: return None - if not any([self._vrf_default_ipv4_subnets, self._vrf_default_ipv4_static_routes["static_routes"], self.shared_utils.wan_role]): + if not any([self._vrf_default_ipv4_subnets, self._vrf_default_ipv4_static_routes["static_routes"], self.shared_utils.is_wan_router]): return None route_maps = strip_empties_from_list( @@ -154,7 +154,7 @@ def _evpn_export_vrf_default_route_map(self) -> dict | None: * for WAN routers, all the routes matching the SOO (which includes the two above) """ sequence_numbers = [] - if self.shared_utils.wan_role: + if self.shared_utils.is_wan_router: sequence_numbers.append( { "sequence": 10, @@ -196,7 +196,7 @@ def _bgp_underlay_peers_route_map(self) -> dict | None: """ sequence_numbers = [] - if self.shared_utils.wan_role: + if self.shared_utils.is_wan_router: return None if self._vrf_default_ipv4_subnets: diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/router_path_selection.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/router_path_selection.py index d692d2e3046..c6443c9741e 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/router_path_selection.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/router_path_selection.py @@ -23,7 +23,7 @@ def router_path_selection(self) -> dict | None: Return structured config for router path-selection (DPS) """ - if not self.shared_utils.wan_role: + if not self.shared_utils.is_wan_router: return None router_path_selection = { diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/utils.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/utils.py index 92bffe495fc..8bc67b3e8f5 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/utils.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/utils.py @@ -242,7 +242,7 @@ def _generate_wan_load_balance_policy(self, name: str, input_dict: dict, context at_least_one_priority_1_found = True for path_group_name in policy_entry.get("names"): # Skip path-group on this device if not present on the router except for pathfinders - if path_group_name not in wan_local_path_group_names and self.shared_utils.wan_role != "server": + if path_group_name not in wan_local_path_group_names and not self.shared_utils.is_wan_server: continue path_group = { @@ -294,7 +294,7 @@ def _wan_load_balance_policies(self) -> list: """ Return a list of WAN router path-selection load-balance policies based on the local path-groups. """ - if not self.shared_utils.wan_role: + if not self.shared_utils.is_wan_router: return [] # Control plane Load Balancing policy - if not configured, render the default one. @@ -356,7 +356,7 @@ def _filtered_wan_vrfs(self) -> list: for avt_vrf in get(self._hostvars, "wan_virtual_topologies.vrfs", []): vrf_name = avt_vrf["name"] - if vrf_name in self.shared_utils.vrfs or self.shared_utils.wan_role == "server": + if vrf_name in self.shared_utils.vrfs or self.shared_utils.is_wan_server: # TODO check that the policy exists or raise wan_vrf = { "name": vrf_name, diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/vxlan_interface.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/vxlan_interface.py index 84de6b22b6f..42e40136987 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/vxlan_interface.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/network_services/vxlan_interface.py @@ -33,7 +33,7 @@ def vxlan_interface(self) -> dict | None: This function also detects duplicate VNIs and raise an error in case of duplicates between all Network Services deployed on this device. """ - if not (self.shared_utils.overlay_vtep or self.shared_utils.wan_role): + if not (self.shared_utils.overlay_vtep or self.shared_utils.is_wan_router): return None vxlan = { @@ -146,7 +146,7 @@ def _get_vxlan_interface_config_for_vrf(self, vrf: dict, tenant: dict, vrfs: lis vrf_data = {"name": vrf_name, "vni": vni} # TODO need to handle this better from a design point of view - if self.shared_utils.wan_role and vni > 255: + if self.shared_utils.is_wan_router and vni > 255: raise AristaAvdError("VNI for WAN with DPS use cases cannot be > 255, got '{vni}' for vrf '{vrf_name}' in tenant '{tenant['name']}'.") if get(vrf, "_evpn_l3_multicast_enabled"): diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/avdstructuredconfig.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/avdstructuredconfig.py index f55ddf33ed2..66ffe4201bc 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/avdstructuredconfig.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/avdstructuredconfig.py @@ -59,7 +59,7 @@ def render(self) -> dict: self.shared_utils.overlay_evpn, self.shared_utils.overlay_vpn_ipv4, self.shared_utils.overlay_vpn_ipv6, - self.shared_utils.wan_role, + self.shared_utils.is_wan_router, ] ): return super().render() diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/ip_extcommunity_lists.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/ip_extcommunity_lists.py index 633bf35abfb..0d1ea693337 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/ip_extcommunity_lists.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/ip_extcommunity_lists.py @@ -22,7 +22,7 @@ def ip_extcommunity_lists(self) -> list | None: if self.shared_utils.overlay_routing_protocol != "ibgp": return None - if self.shared_utils.evpn_role == "server" and not self.shared_utils.wan_role: + if self.shared_utils.evpn_role == "server" and not self.shared_utils.is_wan_router: return None if self.shared_utils.overlay_vtep: diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/ip_security.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/ip_security.py index e4bd6c2476f..407741ba00c 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/ip_security.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/ip_security.py @@ -27,7 +27,7 @@ def ip_security(self) -> dict | None: """ # TODO - in future, the default algo/dh groups value must be clarified - if not self.shared_utils.wan_role: + if not self.shared_utils.is_wan_router: return None wan_ipsec_profiles = get(self._hostvars, "wan_ipsec_profiles", required=True) @@ -35,7 +35,7 @@ def ip_security(self) -> dict | None: # Structure initialization ip_security = {"ike_policies": [], "sa_policies": [], "profiles": []} - if self.shared_utils.wan_role == "client" and (data_plane := get(wan_ipsec_profiles, "data_plane")) is not None: + if self.shared_utils.is_wan_client and (data_plane := get(wan_ipsec_profiles, "data_plane")) is not None: self._append_data_plane(ip_security, data_plane) control_plane = get(wan_ipsec_profiles, "control_plane", required=True) self._append_control_plane(ip_security, control_plane) @@ -116,7 +116,7 @@ def _key_controller(self, profile_name: str) -> dict | None: """ Return a key_controller structure if the device is not a RR or pathfinder """ - if self.shared_utils.wan_role != "client": + if self.shared_utils.is_wan_server: return None return {"profile": profile_name} diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_bgp.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_bgp.py index d8871539982..5da51069156 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_bgp.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_bgp.py @@ -57,7 +57,7 @@ def _bgp_listen_ranges(self) -> list | None: """ Generate listen-ranges. Currently only supported for WAN RR. """ - if self.shared_utils.wan_role != "server": + if not self.shared_utils.is_wan_server: return None return [ @@ -120,10 +120,10 @@ def _peer_groups(self) -> list | None: if self.shared_utils.overlay_evpn_vxlan is True: peer_group_config = {"remote_as": self.shared_utils.bgp_as} - if self.shared_utils.wan_role: + if self.shared_utils.is_wan_router: # WAN OVERLAY peer group peer_group_config["ttl_maximum_hops"] = self.shared_utils.bgp_peer_groups["wan_overlay_peers"]["ttl_maximum_hops"] - if self.shared_utils.wan_role == "server": + if self.shared_utils.is_wan_server: peer_group_config["route_reflector_client"] = True peer_group_config["bfd_timers"] = get(self.shared_utils.bgp_peer_groups["wan_overlay_peers"], "bfd_timers") peer_groups.append( @@ -173,7 +173,7 @@ def _address_family_ipv4(self) -> dict: """ peer_groups = [] - if self.shared_utils.wan_role is not None: + if self.shared_utils.is_wan_router: peer_groups.append({"name": self.shared_utils.bgp_peer_groups["wan_overlay_peers"]["name"], "activate": False}) # TODO no elif @@ -206,7 +206,7 @@ def _address_family_evpn(self) -> dict: peer_groups = [] if self.shared_utils.overlay_evpn_vxlan is True: - if self.shared_utils.wan_role is not None: + if self.shared_utils.is_wan_router: overlay_peer_group_name = self.shared_utils.bgp_peer_groups["wan_overlay_peers"]["name"] else: overlay_peer_group_name = self.shared_utils.bgp_peer_groups["evpn_overlay_peers"]["name"] @@ -274,7 +274,7 @@ def _address_family_evpn(self) -> dict: if self.shared_utils.overlay_dpath is True: address_family_evpn["domain_identifier"] = get(self.shared_utils.switch_data_combined, "ipvpn_gateway.evpn_domain_id", default="65535:1") - if self.shared_utils.wan_role == "server": + if self.shared_utils.is_wan_server: address_family_evpn["next_hop"] = {"resolution_disabled": True} return address_family_evpn @@ -330,7 +330,7 @@ def _address_family_link_state(self) -> dict | None: def _address_family_path_selection(self) -> dict | None: """ """ - if not self.shared_utils.wan_role: + if not self.shared_utils.is_wan_router: return None address_family_path_selection = { @@ -492,7 +492,7 @@ def _neighbors(self) -> list | None: neighbor = self._create_neighbor(data["ip_address"], route_client, self.shared_utils.bgp_peer_groups["evpn_overlay_peers"]["name"]) neighbors.append(neighbor) - if self.shared_utils.wan_role == "client": + if self.shared_utils.is_wan_client: if not self._ip_in_listen_ranges(self.shared_utils.vtep_ip, self.shared_utils.wan_listen_ranges): raise AristaAvdError( f"{self.shared_utils.vtep_loopback} IP {self.shared_utils.vtep_ip} is not in the Route Reflector listen range prefixes" @@ -501,7 +501,7 @@ def _neighbors(self) -> list | None: for wan_route_server, data in self.shared_utils.filtered_wan_route_servers.items(): neighbor = self._create_neighbor(data["vtep_ip"], wan_route_server, self.shared_utils.bgp_peer_groups["wan_overlay_peers"]["name"]) neighbors.append(neighbor) - if self.shared_utils.wan_role == "server": + if self.shared_utils.is_wan_server: # No neighbor configured on the `wan_overlay_peers` peer group as it is covered by listen ranges for wan_route_server, data in self.shared_utils.filtered_wan_route_servers.items(): neighbor = self._create_neighbor(data["vtep_ip"], wan_route_server, self.shared_utils.bgp_peer_groups["wan_rr_overlay_peers"]["name"]) diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_path_selection.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_path_selection.py index 059cdb6132d..d7458a85bbc 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_path_selection.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/router_path_selection.py @@ -23,7 +23,7 @@ def router_path_selection(self) -> dict | None: Return structured config for router path-selection (DPS) """ - if not self.shared_utils.wan_role: + if not self.shared_utils.is_wan_router: return None router_path_selection = { @@ -31,7 +31,7 @@ def router_path_selection(self) -> dict | None: "path_groups": self._get_path_groups(), } - if self.shared_utils.wan_role == "server": + if self.shared_utils.is_wan_server: router_path_selection["peer_dynamic_source"] = "stun" return strip_empties_from_dict(router_path_selection) @@ -57,7 +57,7 @@ def _get_path_groups(self) -> list: """ path_groups = [] - if self.shared_utils.wan_role == "server": + if self.shared_utils.is_wan_server: # Configure all path-groups on Pathfinders and AutoVPN RRs path_groups_to_configure = self.shared_utils.wan_path_groups else: @@ -110,7 +110,7 @@ def _get_local_interfaces_for_path_group(self, path_group_name: str) -> list | N for interface in path_group.get("interfaces", []): local_interface = {"name": get(interface, "name", required=True)} - if self.shared_utils.wan_role == "client" and self.shared_utils.should_connect_to_wan_rs([path_group_name]): + if self.shared_utils.is_wan_client and self.shared_utils.should_connect_to_wan_rs([path_group_name]): stun_server_profiles = self._stun_server_profiles.get(path_group_name, []) if stun_server_profiles: local_interface["stun"] = {"server_profiles": [profile["name"] for profile in stun_server_profiles]} @@ -123,7 +123,7 @@ def _get_dynamic_peers(self) -> dict | None: """ TODO support ip_local and ipsec ? """ - if self.shared_utils.wan_role != "client": + if not self.shared_utils.is_wan_client: return None return {"enabled": True} @@ -131,7 +131,7 @@ def _get_static_peers_for_path_group(self, path_group_name: str) -> list | None: """ Retrieves the static peers to configure for a given path-group based on the connected nodes. """ - if not self.shared_utils.wan_role: + if not self.shared_utils.is_wan_router: return None static_peers = [] diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/stun.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/stun.py index f1738db7e69..b10315a4a86 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/stun.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/stun.py @@ -21,15 +21,15 @@ def stun(self) -> dict | None: Return structured config for stun """ - if not self.shared_utils.wan_role: + if not self.shared_utils.is_wan_router: return None stun = {} - if self.shared_utils.wan_role == "server": + if self.shared_utils.is_wan_server: local_interfaces = [wan_interface["name"] for wan_interface in self.shared_utils.wan_interfaces] stun["server"] = {"local_interfaces": local_interfaces} - if self.shared_utils.wan_role == "client": + if self.shared_utils.is_wan_client: if server_profiles := list(itertools.chain.from_iterable(self._stun_server_profiles.values())): stun["client"] = {"server_profiles": server_profiles} diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/utils.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/utils.py index f9d8644d4a7..c3fbd46f192 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/utils.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/overlay/utils.py @@ -260,7 +260,7 @@ def _append_peer(self, peers_dict: dict, peer_name: str, peer_facts: dict) -> No @cached_property def _is_wan_server_with_peers(self) -> bool: - return self.shared_utils.wan_role == "server" and len(self.shared_utils.filtered_wan_route_servers) > 0 + return self.shared_utils.is_wan_server and len(self.shared_utils.filtered_wan_route_servers) > 0 def _stun_server_profile_name(self, wan_route_server_name: str, path_group_name: str, interface_name: str) -> str: """ diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/prefix_lists.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/prefix_lists.py index b71346a68a6..125f467230a 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/prefix_lists.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/prefix_lists.py @@ -19,7 +19,7 @@ def prefix_lists(self) -> list | None: """ Return structured config for prefix_lists """ - if self.shared_utils.underlay_bgp is not True and not self.shared_utils.wan_role: + if self.shared_utils.underlay_bgp is not True and not self.shared_utils.is_wan_router: return None if self.shared_utils.overlay_routing_protocol == "none": @@ -31,10 +31,10 @@ def prefix_lists(self) -> list | None: # IPv4 - PL-LOOPBACKS-EVPN-OVERLAY sequence_numbers = [{"sequence": 10, "action": f"permit {self.shared_utils.loopback_ipv4_pool} eq 32"}] - if self.shared_utils.overlay_vtep and self.shared_utils.vtep_loopback.lower() != "loopback0" and not self.shared_utils.wan_role: + if self.shared_utils.overlay_vtep and self.shared_utils.vtep_loopback.lower() != "loopback0" and not self.shared_utils.is_wan_router: sequence_numbers.append({"sequence": 20, "action": f"permit {self.shared_utils.vtep_loopback_ipv4_pool} eq 32"}) - if self.shared_utils.vtep_vvtep_ip is not None and self.shared_utils.network_services_l3 is True and not self.shared_utils.wan_role: + if self.shared_utils.vtep_vvtep_ip is not None and self.shared_utils.network_services_l3 is True and not self.shared_utils.is_wan_router: sequence_numbers.append({"sequence": 30, "action": f"permit {self.shared_utils.vtep_vvtep_ip}"}) prefix_lists = [{"name": "PL-LOOPBACKS-EVPN-OVERLAY", "sequence_numbers": sequence_numbers}] @@ -59,7 +59,7 @@ def ipv6_prefix_lists(self) -> dict | None: if self.shared_utils.underlay_ipv6 is not True: return None - if self.shared_utils.overlay_routing_protocol == "none" and not self.shared_utils.wan_role: + if self.shared_utils.overlay_routing_protocol == "none" and not self.shared_utils.is_wan_router: return None if not self.shared_utils.underlay_filter_redistribute_connected: diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/route_maps.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/route_maps.py index 68b11a08eec..453bedaa31e 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/route_maps.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/route_maps.py @@ -23,7 +23,7 @@ def route_maps(self) -> list | None: - Route map for connected routes redistribution in BGP - Route map to filter peer AS in underlay """ - if not self.shared_utils.underlay_bgp and not self.shared_utils.wan_role: + if not self.shared_utils.underlay_bgp and not self.shared_utils.is_wan_router: return None route_maps = [] diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/router_bgp.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/router_bgp.py index e48816f73e2..dc85ccfee1c 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/router_bgp.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/underlay/router_bgp.py @@ -23,7 +23,7 @@ def router_bgp(self) -> dict | None: """ if not self.shared_utils.underlay_bgp: - if self.shared_utils.wan_role: + if self.shared_utils.is_wan_router: # Configure redistribute connected with or without route-map in case it the underlay is not BGP. # TODO: Currently only implemented for WAN routers but should probably be # implemented for anything with EVPN services in default VRF.