Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(eos_validate_state): Added the validation for AVT path for static peers and role of device #4200

Open
wants to merge 20 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
36cde25
issue-4811: Added the testcase for AVT
MaheshGSLAB Jul 9, 2024
fe926d4
issue-4188: Added testcases for AVT path and role
MaheshGSLAB Jul 11, 2024
aa9f73f
Merge branch 'aristanetworks:devel' into issue-4188
MaheshGSLAB Jul 11, 2024
98d584b
issue-4188: fixed the CI failure
MaheshGSLAB Jul 11, 2024
61e3fa4
issue-4188: fix the diff on catalog files
MaheshGSLAB Jul 11, 2024
ca8a86d
issue-4188: fix thre order change of tests using sorted method
MaheshGSLAB Jul 11, 2024
101e095
Merge branch 'devel' into issue-4188
MaheshGSLAB Jul 15, 2024
d50f007
Merge branch 'devel' into issue-4188
gmuloc Jul 17, 2024
c83817f
Merge branch 'aristanetworks:devel' into issue-4188
MaheshGSLAB Jul 19, 2024
cbff96a
issue-4188: updated the variable names
MaheshGSLAB Jul 19, 2024
229d4cd
Merge branch 'devel' into issue-4188
gmuloc Jul 25, 2024
6faf2c0
Merge branch 'devel' into issue-4188
MaheshGSLAB Jul 29, 2024
322899b
Update ansible_collections/arista/avd/roles/eos_validate_state/python…
MaheshGSLAB Jul 29, 2024
fb45bb6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 29, 2024
ff24f8e
Merge branch 'devel' into issue-4188
MaheshGSLAB Aug 5, 2024
a1cf25b
issue-4188: fix the ruff ccheck failure
MaheshGSLAB Aug 5, 2024
51c5588
Merge branch 'devel' into issue-4188
ClausHolbechArista Aug 8, 2024
9f69bf6
Merge branch 'devel' into issue-4188
MaheshGSLAB Aug 12, 2024
02eb1dc
updated the doc for validate_state role
MaheshGSLAB Aug 12, 2024
89e4196
Merge branch 'devel' into issue-4188
MaheshGSLAB Aug 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ wan_virtual_topologies:
| AvdTestBGP | VerifyBGPSpecificPeers | Validate the state of BGP Address Family sessions, including `Path-Selection` for AutoVPN, `Link-State` and `IPv4/IPv6 SR-TE` for CV Pathfinder. |
| AvdTestIPSecurity | VerifySpecificIPSecConn | Validate the establishment of IP security connections for each static peer under the `router path-selection` section of the configuration. |
| AvdTestStun | VerifyStunClient | Validate the presence of a STUN client translation for a given source IPv4 address and port. The list of expected translations for each device is built by searching local interfaces in each path-group. |
| AvdTestAvtPath | VerifyAVTSpecificPath | Validate that the status is active and the type is direct for an Adaptive Virtual Topology (AVT) path in a specified VRF. |
| AvdTestAvtPath | VerifyAVTSpecificPath | Validate that the status is active and the type is direct for an Adaptive Virtual Topology (AVT) path in a specified VRF for the static peers. |
| AvdTestAvtRole | VerifyAVTRole | Validate the Adaptive Virtual Topology (AVT) role of a device. |

!!! note
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,31 @@ class AvdTestAvtPath(AvdTestBase):

anta_module = "anta.tests.avt"

def _get_static_peers(self, path_groups):
"""Extract static peers from path groups after validation.

Parameters
----------
path_groups : list
A list of path group dictionaries.

Returns
-------
set
A set of sorted static peer router IP addresses.
"""
static_peers = set()

for group_idx, path_group in enumerate(path_groups):
if self.validate_data(data=path_group, data_path=f"router_path_selection.path_groups.[{group_idx}]", required_keys="static_peers"):
for peer_idx, peers_data in enumerate(path_group["static_peers"]):
if self.validate_data(
data=peers_data, data_path=f"router_path_selection.path_groups.[{group_idx}].static_peers.[{peer_idx}]", required_keys="router_ip"
):
static_peers.add(peers_data["router_ip"])
MaheshGSLAB marked this conversation as resolved.
Show resolved Hide resolved

return sorted(static_peers)

@cached_property
def test_definition(self) -> dict | None:
"""
Expand All @@ -36,24 +61,14 @@ def test_definition(self) -> dict | None:
LOGGER.info("Path groups are not configured to collect AVT peer information. %s is skipped.", self.__class__.__name__)
return None

# Retrieve AVT profiles from the structured configuration
avt_profiles = get(self.structured_config, "router_adaptive_virtual_topology.vrfs")
if not avt_profiles:
# Retrieve AVT vrfs from the structured configuration
avt_vrfs = get(self.structured_config, "router_adaptive_virtual_topology.vrfs")
if not avt_vrfs:
LOGGER.info("AVT profiles are not configured for any VRF. %s is skipped.", self.__class__.__name__)
return None

# Build a set of static peers
static_peers = sorted(
{
peers_data["router_ip"]
for group_idx, path_group in enumerate(path_groups)
if self.validate_data(data=path_group, data_path=f"router_path_selection.path_groups.[{group_idx}]", required_keys="static_peers")
for peer_idx, peers_data in enumerate(path_group["static_peers"])
if self.validate_data(
data=peers_data, data_path=f"router_path_selection.path_groups.[{group_idx}].static_peers.[{peer_idx}]", required_keys="router_ip"
)
}
)
static_peers = self._get_static_peers(path_groups)
if not static_peers:
LOGGER.info("No static peers are configured under router path selection. %s is skipped.", self.__class__.__name__)
return None
Expand All @@ -76,7 +91,7 @@ def test_definition(self) -> dict | None:
},
}
}
for vrf in avt_profiles
for vrf in avt_vrfs
for avt_profile in vrf["profiles"]
for dst_address in static_peers
]
Expand Down
Loading