From 9b7c9462db3073838b316f26990d60e1dfcb3344 Mon Sep 17 00:00:00 2001 From: vitthalmagadum Date: Thu, 19 Dec 2024 07:00:50 -0500 Subject: [PATCH] Addressed review comment: updated doc, unit test eos data --- anta/tests/routing/bgp.py | 6 +++--- examples/tests.yaml | 2 +- tests/units/anta_tests/routing/test_bgp.py | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/anta/tests/routing/bgp.py b/anta/tests/routing/bgp.py index 994483833..ad7381582 100644 --- a/anta/tests/routing/bgp.py +++ b/anta/tests/routing/bgp.py @@ -1401,7 +1401,7 @@ class VerifyBGPRouteOrigin(AntaTest): """Verifies BGP route origin. This test performs the following checks for each specified bgp route entry: - 1. Checks whether the specified BGP route entries exist. + 1. Checks whether the specified BGP route entry exists. 2. Confirms that the path exists and corresponds to the next-hop address. 3. Verifies that the origin type of the BGP route matches the expected type. @@ -1425,7 +1425,7 @@ class VerifyBGPRouteOrigin(AntaTest): route_entries: - prefix: 10.100.0.128/31 vrf: default - route_paths: + paths: - nexthop: 10.100.0.10 origin: Igp - nexthop: 10.100.4.5 @@ -1463,5 +1463,5 @@ def test(self) -> None: self.result.is_failure(f"{route} {path} - path not found") continue - if (actual_origin := route_path.get("routeDetail", {}).get("origin", "Not Found")) != origin: + if (actual_origin := route_path.get("routeType", {}).get("origin", "Not Found")) != origin: self.result.is_failure(f"{route} {path} - Origin mismatch - Expected: {origin} Actual: {actual_origin}") diff --git a/examples/tests.yaml b/examples/tests.yaml index 390649db4..bfa6def51 100644 --- a/examples/tests.yaml +++ b/examples/tests.yaml @@ -468,7 +468,7 @@ anta.tests.routing.bgp: route_entries: - prefix: 10.100.0.128/31 vrf: default - route_paths: + paths: - nexthop: 10.100.0.10 origin: Igp - nexthop: 10.100.4.5 diff --git a/tests/units/anta_tests/routing/test_bgp.py b/tests/units/anta_tests/routing/test_bgp.py index 2ba27832d..ae398173f 100644 --- a/tests/units/anta_tests/routing/test_bgp.py +++ b/tests/units/anta_tests/routing/test_bgp.py @@ -4509,13 +4509,13 @@ def test_check_bgp_neighbor_capability(input_dict: dict[str, bool], expected: bo "bgpRoutePaths": [ { "nextHop": "10.100.0.10", - "routeDetail": { + "routeType": { "origin": "Igp", }, }, { "nextHop": "10.100.4.5", - "routeDetail": { + "routeType": { "origin": "Incomplete", }, }, @@ -4529,13 +4529,13 @@ def test_check_bgp_neighbor_capability(input_dict: dict[str, bool], expected: bo "bgpRoutePaths": [ { "nextHop": "10.100.0.8", - "routeDetail": { + "routeType": { "origin": "Igp", }, }, { "nextHop": "10.100.0.10", - "routeDetail": { + "routeType": { "origin": "Igp", }, }, @@ -4574,13 +4574,13 @@ def test_check_bgp_neighbor_capability(input_dict: dict[str, bool], expected: bo "bgpRoutePaths": [ { "nextHop": "10.100.0.10", - "routeDetail": { + "routeType": { "origin": "Igp", }, }, { "nextHop": "10.100.4.5", - "routeDetail": { + "routeType": { "origin": "Incomplete", }, }, @@ -4594,13 +4594,13 @@ def test_check_bgp_neighbor_capability(input_dict: dict[str, bool], expected: bo "bgpRoutePaths": [ { "nextHop": "10.100.0.8", - "routeDetail": { + "routeType": { "origin": "Igp", }, }, { "nextHop": "10.100.0.10", - "routeDetail": { + "routeType": { "origin": "Igp", }, }, @@ -4647,7 +4647,7 @@ def test_check_bgp_neighbor_capability(input_dict: dict[str, bool], expected: bo "bgpRoutePaths": [ { "nextHop": "10.100.0.15", - "routeDetail": { + "routeType": { "origin": "Igp", }, }, @@ -4661,7 +4661,7 @@ def test_check_bgp_neighbor_capability(input_dict: dict[str, bool], expected: bo "bgpRoutePaths": [ { "nextHop": "10.100.0.15", - "routeDetail": { + "routeType": { "origin": "Igp", }, },