diff --git a/anta/tests/routing/bgp.py b/anta/tests/routing/bgp.py index cefb02b5b..b18aa81ee 100644 --- a/anta/tests/routing/bgp.py +++ b/anta/tests/routing/bgp.py @@ -1491,8 +1491,8 @@ def test(self) -> None: failures: dict[Any, Any] = {} for command, input_entry in zip(self.instance_commands, self.inputs.bgp_peers): - peer = command.params.peer - vrf = command.params.vrf + peer = str(input_entry.peer_address) + vrf = input_entry.vrf peer_group = input_entry.peer_group # Verify BGP peer. @@ -1504,7 +1504,7 @@ def test(self) -> None: failure_log = f"Expected `{peer_group}` as the configured peer-group, but found `{actual_peer_group}` instead." if not actual_peer_group: failure_log = "Peer-group not configured." - failures[peer] = failure_log + failures[peer] = {vrf: failure_log} # Check if any failures if not failures: diff --git a/tests/units/anta_tests/routing/test_bgp.py b/tests/units/anta_tests/routing/test_bgp.py index 859865873..94bace16d 100644 --- a/tests/units/anta_tests/routing/test_bgp.py +++ b/tests/units/anta_tests/routing/test_bgp.py @@ -4658,11 +4658,11 @@ "result": "failure", "messages": [ "The following BGP peer(s) are not configured or have incorrect peer-group configured:\n" - "{'10.100.0.8': 'Expected `IPv4-UNDERLAY-PEERS` as the configured peer-group, but found `UNDERLAY-PEERS` instead.', " - "'10.100.0.10': 'Expected `IPv4-UNDERLAY-PEERS` as the configured peer-group, but found `UNDERLAY-PEERS` instead.', " - "'10.100.1.1': 'Expected `EVPN-OVERLAY-PEERS` as the configured peer-group, but found `OVERLAY-PEERS` instead.', " - "'10.100.1.2': 'Expected `EVPN-OVERLAY-PEERS` as the configured peer-group, but found `OVERLAY-PEERS` instead.', " - "'10.100.4.5': 'Expected `MLAG-IPv4-UNDERLAY-PEER` as the configured peer-group, but found `UNDERLAY-PEER` instead.'}" + "{'10.100.0.8': {'default': 'Expected `IPv4-UNDERLAY-PEERS` as the configured peer-group, but found `UNDERLAY-PEERS` instead.'}, " + "'10.100.0.10': {'MGMT': 'Expected `IPv4-UNDERLAY-PEERS` as the configured peer-group, but found `UNDERLAY-PEERS` instead.'}, " + "'10.100.1.1': {'default': 'Expected `EVPN-OVERLAY-PEERS` as the configured peer-group, but found `OVERLAY-PEERS` instead.'}, " + "'10.100.1.2': {'MGMT': 'Expected `EVPN-OVERLAY-PEERS` as the configured peer-group, but found `OVERLAY-PEERS` instead.'}, " + "'10.100.4.5': {'default': 'Expected `MLAG-IPv4-UNDERLAY-PEER` as the configured peer-group, but found `UNDERLAY-PEER` instead.'}}" ], }, }, @@ -4787,8 +4787,9 @@ "result": "failure", "messages": [ "The following BGP peer(s) are not configured or have incorrect peer-group configured:\n" - "{'10.100.0.8': 'Peer-group not configured.', '10.100.0.10': 'Peer-group not configured.', '10.100.1.1': " - "'Peer-group not configured.', '10.100.1.2': 'Peer-group not configured.', '10.100.4.5': 'Peer-group not configured.'}" + "{'10.100.0.8': {'default': 'Peer-group not configured.'}, '10.100.0.10': {'MGMT': 'Peer-group not configured.'}, '10.100.1.1': " + "{'default': 'Peer-group not configured.'}, '10.100.1.2': {'MGMT': 'Peer-group not configured.'}, " + "'10.100.4.5': {'default': 'Peer-group not configured.'}}" ], }, },