diff --git a/anta/tests/routing/bgp.py b/anta/tests/routing/bgp.py index fd81113e0..603a8b872 100644 --- a/anta/tests/routing/bgp.py +++ b/anta/tests/routing/bgp.py @@ -155,9 +155,7 @@ def _check_peer_capabilities(bgp_output: dict[str, Any], capabilities: list[Mult ---------- bgp_output: The BGP output from the device. capabilities: List of multiprotocol capabilities to be verified. - strict: Optional check to verifies the only mentioned capabilities should be listed, otherwise test should fail. It defaults to false - - The * indicates that all arguments following it must be provided as keyword arguments. To compensate boolean-type-hint-positional-argument (FBT001). + strict: If True, requires exact matching of provided capabilities. Defaults to False. Returns ------- @@ -734,7 +732,7 @@ def test(self) -> None: class VerifyBGPPeerMPCaps(AntaTest): """Verifies the multiprotocol capabilities of a BGP peer in a specified VRF. - Optionally test verifies the only specified multiprotocol capabilities should be listed. + Supports `strict: True` to verify that only the specified capabilities are configured, requiring an exact match. Expected Results ---------------- @@ -775,7 +773,7 @@ class BgpPeer(BaseModel): vrf: str = "default" """Optional VRF for BGP peer. If not provided, it defaults to `default`.""" strict: bool = False - """Optional check to verifies the only mentioned capabilities should be listed, otherwise test should fail. It defaults to false.""" + """If True, requires exact matching of provided capabilities. Defaults to False.""" capabilities: list[MultiProtocolCaps] """List of multiprotocol capabilities to be verified.""" diff --git a/tests/units/anta_tests/routing/test_bgp.py b/tests/units/anta_tests/routing/test_bgp.py index 74ed0c157..1ccac471d 100644 --- a/tests/units/anta_tests/routing/test_bgp.py +++ b/tests/units/anta_tests/routing/test_bgp.py @@ -2330,7 +2330,7 @@ "peer_address": "172.30.11.10", "vrf": "MGMT", "strict": True, - "capabilities": ["ipv4MplsVpn"], + "capabilities": ["ipv4MplsVpn", "L2vpnEVPN"], }, ] }, @@ -2342,7 +2342,7 @@ "'Other than mentioned BGP peer multiprotocol capabilities following capability(s) are listed: ipv4MplsLabels'}}, " "'172.30.11.10': {'MGMT': {'strict': " "'Other than mentioned BGP peer multiprotocol capabilities following capability(s) are listed: ipv4Unicast', " - "'ipv4MplsVpn': {'advertised': False, 'received': True, 'enabled': True}}}}}" + "'ipv4MplsVpn': {'advertised': False, 'received': True, 'enabled': True}, 'l2VpnEvpn': 'not found'}}}}" ], }, },