Skip to content

Commit

Permalink
fix(anta.tests): VerifyEVPNType2Route test fails for locally originat…
Browse files Browse the repository at this point in the history
…ed MAC/IP addresses (#969)
  • Loading branch information
vitthalmagadum authored Dec 18, 2024
1 parent c119777 commit c6bfe69
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
17 changes: 9 additions & 8 deletions anta/tests/routing/bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,16 +877,17 @@ def test(self) -> None:
if not evpn_routes:
no_evpn_routes.append((address, vni))
continue
# Verify that each EVPN route has at least one valid and active path
for route, route_data in evpn_routes.items():
has_active_path = False
for path in route_data["evpnRoutePaths"]:
if path["routeType"]["valid"] is True and path["routeType"]["active"] is True:
# At least one path is valid and active, no need to check the other paths

# Verify that at least one EVPN route has at least one active/valid path across all learned routes from all RDs combined
has_active_path = False
for route_data in evpn_routes.values():
for path in route_data.get("evpnRoutePaths", []):
route_type = path.get("routeType", {})
if route_type.get("active") and route_type.get("valid"):
has_active_path = True
break
if not has_active_path:
bad_evpn_routes.append(route)
if not has_active_path:
bad_evpn_routes.extend(list(evpn_routes))

if no_evpn_routes:
self.result.is_failure(f"The following VXLAN endpoint do not have any EVPN Type-2 route: {no_evpn_routes}")
Expand Down
11 changes: 4 additions & 7 deletions tests/units/anta_tests/routing/test_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2815,8 +2815,8 @@ def test_check_bgp_neighbor_capability(input_dict: dict[str, bool], expected: bo
"evpnRoutePaths": [
{
"routeType": {
"active": True,
"valid": True,
"active": False,
"valid": False,
},
},
]
Expand Down Expand Up @@ -3039,7 +3039,7 @@ def test_check_bgp_neighbor_capability(input_dict: dict[str, bool], expected: bo
},
},
{
"name": "failure-multiple-routes-multiple-paths-not-active",
"name": "success-multiple-path-and-have-one-active/valid",
"test": VerifyEVPNType2Route,
"eos_data": [
{
Expand Down Expand Up @@ -3084,10 +3084,7 @@ def test_check_bgp_neighbor_capability(input_dict: dict[str, bool], expected: bo
],
"inputs": {"vxlan_endpoints": [{"address": "192.168.20.102", "vni": 10020}]},
"expected": {
"result": "failure",
"messages": [
"The following EVPN Type-2 routes do not have at least one valid and active path: ['RD: 10.1.0.6:500 mac-ip 10020 aac1.ab4e.bec2 192.168.20.102']"
],
"result": "success",
},
},
{
Expand Down

0 comments on commit c6bfe69

Please sign in to comment.