From b9bb353f561229cc1f2ef595a6c1dcf7e1f2781a Mon Sep 17 00:00:00 2001 From: gmuloc Date: Mon, 18 Dec 2023 10:47:52 +0100 Subject: [PATCH] Feat: Add flow-tracking on WAN interfaces --- .../intended/configs/cv-pathfinder-edge.cfg | 1 + .../intended/configs/cv-pathfinder-pathfinder.cfg | 2 ++ .../intended/configs/cv-pathfinder-pathfinder1.cfg | 1 + .../intended/configs/cv-pathfinder-pathfinder2.cfg | 1 + .../intended/configs/cv-pathfinder-transit.cfg | 2 ++ .../intended/structured_configs/cv-pathfinder-edge.yml | 2 ++ .../intended/structured_configs/cv-pathfinder-pathfinder.yml | 4 ++++ .../intended/structured_configs/cv-pathfinder-pathfinder1.yml | 2 ++ .../intended/structured_configs/cv-pathfinder-pathfinder2.yml | 2 ++ .../intended/structured_configs/cv-pathfinder-transit.yml | 4 ++++ .../python_modules/core_interfaces_and_l3_edge/utils.py | 3 +++ 11 files changed, 24 insertions(+) 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 90f6d4660ce..829ef8c7aaa 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 @@ -90,6 +90,7 @@ interface Dps1 interface Ethernet1 no shutdown no switchport + flow tracker hardware WAN-FLOW-TRACKER ip address dhcp ! interface Loopback0 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 d46be584a46..bb128853632 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 @@ -83,11 +83,13 @@ interface Dps1 interface Ethernet1 no shutdown no switchport + flow tracker hardware WAN-FLOW-TRACKER ip address 10.7.7.7/31 ! interface Ethernet2 no shutdown no switchport + flow tracker hardware WAN-FLOW-TRACKER ip address 172.16.0.1/31 ! interface Loopback0 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 87c7244e3bd..79dc7d4803e 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 @@ -78,6 +78,7 @@ interface Dps1 interface Ethernet1 no shutdown no switchport + flow tracker hardware WAN-FLOW-TRACKER ip address 10.8.8.8/31 ! interface Loopback0 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 f5fc770d4fe..1ece436a44a 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 @@ -78,6 +78,7 @@ interface Dps1 interface Ethernet1 no shutdown no switchport + flow tracker hardware WAN-FLOW-TRACKER ip address 10.9.9.9/31 ! interface Loopback0 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 a81f193ab1d..86bcc03f891 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 @@ -102,11 +102,13 @@ interface Dps1 interface Ethernet1 no shutdown no switchport + flow tracker hardware WAN-FLOW-TRACKER ip address dhcp ! interface Ethernet2 no shutdown no switchport + flow tracker hardware WAN-FLOW-TRACKER ip address 172.16.6.6/31 ! interface Loopback0 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 5d7b5ade5d6..86f6a1355d9 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 @@ -173,6 +173,8 @@ ethernet_interfaces: ip_address: dhcp shutdown: false type: routed + flow_tracker: + hardware: WAN-FLOW-TRACKER dps_interfaces: - name: Dps1 description: DPS Interface 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 0c3e684e56e..5fa0a3d32b2 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 @@ -167,11 +167,15 @@ ethernet_interfaces: ip_address: 10.7.7.7/31 shutdown: false type: routed + flow_tracker: + hardware: WAN-FLOW-TRACKER - name: Ethernet2 peer_type: l3_interface ip_address: 172.16.0.1/31 shutdown: false type: routed + flow_tracker: + hardware: WAN-FLOW-TRACKER dps_interfaces: - name: Dps1 description: DPS Interface 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 44735c0bb3e..97211606a89 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 @@ -187,6 +187,8 @@ ethernet_interfaces: ip_address: 10.8.8.8/31 shutdown: false type: routed + flow_tracker: + hardware: WAN-FLOW-TRACKER dps_interfaces: - name: Dps1 description: DPS Interface 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 9a2a589e157..a95be6e8623 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 @@ -187,6 +187,8 @@ ethernet_interfaces: ip_address: 10.9.9.9/31 shutdown: false type: routed + flow_tracker: + hardware: WAN-FLOW-TRACKER dps_interfaces: - name: Dps1 description: DPS Interface 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 8c0ed174b0e..042661d922d 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 @@ -190,11 +190,15 @@ ethernet_interfaces: ip_address: dhcp shutdown: false type: routed + flow_tracker: + hardware: WAN-FLOW-TRACKER - name: Ethernet2 peer_type: l3_interface ip_address: 172.16.6.6/31 shutdown: false type: routed + flow_tracker: + hardware: WAN-FLOW-TRACKER dps_interfaces: - name: Dps1 description: DPS Interface diff --git a/ansible_collections/arista/avd/roles/eos_designs/python_modules/core_interfaces_and_l3_edge/utils.py b/ansible_collections/arista/avd/roles/eos_designs/python_modules/core_interfaces_and_l3_edge/utils.py index c51c918a3d3..75c80e62302 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/python_modules/core_interfaces_and_l3_edge/utils.py +++ b/ansible_collections/arista/avd/roles/eos_designs/python_modules/core_interfaces_and_l3_edge/utils.py @@ -401,4 +401,7 @@ def _get_l3_interface_cfg(self, l3_interface: dict) -> dict | None: if ip_address == "dhcp" and l3_interface.get("dhcp_client_accept_default_route", False): interface["dhcp_client_accept_default_route"] = True + if self.shared_utils.cv_pathfinder_role: + interface["flow_tracker"] = {"hardware": "WAN-FLOW-TRACKER"} + return strip_empties_from_dict(interface)