-
Notifications
You must be signed in to change notification settings - Fork 31
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
refactor(anta.tests): Refactor VerifyISISSegmentRoutingTunnels test case #1037
base: main
Are you sure you want to change the base?
refactor(anta.tests): Refactor VerifyISISSegmentRoutingTunnels test case #1037
Conversation
CodSpeed Performance ReportMerging #1037 will not alter performanceComparing Summary
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -122,3 +122,63 @@ def __init__(self, **data: Any) -> None: # noqa: ANN401 | |||
stacklevel=2, | |||
) | |||
super().__init__(**data) | |||
|
|||
|
|||
class SRTunnelEntry(BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are already using Segment
+ TunnelPath
so I think Tunnel
makes sense.
class SRTunnelEntry(BaseModel): | |
class Tunnel(BaseModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also need to add a ClassVar for the deprecated Vias
model for backward compatibility.
endpoint: IPv4Network | ||
"""Endpoint of the tunnel.""" | ||
vias: list[TunnelPath] | None = None | ||
"""Optional list of path to reach endpoint.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Optional list of path to reach endpoint.""" | |
"""Optional list of paths to reach the endpoint.""" |
"""Optional list of path to reach endpoint.""" | ||
|
||
def __str__(self) -> str: | ||
"""Return a human-readable string representation of the SRTunnelEntry for reporting.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Return a human-readable string representation of the SRTunnelEntry for reporting.""" | |
"""Return a human-readable string representation of the Tunnel for reporting.""" |
if self.interface: | ||
base_string += f" Interface: {self.interface}" | ||
if self.tunnel_id: | ||
base_string += f" TunnelID: {self.tunnel_id}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base_string += f" TunnelID: {self.tunnel_id}" | |
base_string += f" Tunnel ID: {self.tunnel_id}" |
"""Computation method of the tunnel. If None, then it is not tested. Default: None""" | ||
|
||
def _eos_entry_lookup(self, search_value: IPv4Network, entries: dict[str, Any], search_key: str = "endpoint") -> dict[str, Any] | None: | ||
def _eos_entry_lookup(self, search_value: str, entries: dict[str, Any], search_key: str = "endpoint") -> dict[str, Any] | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need that function? Can we use get_item
from our tools module instead?
@@ -1922,7 +1922,7 @@ | |||
}, | |||
"expected": { | |||
"result": "failure", | |||
"messages": ["Tunnel to 1.0.0.13/32 is incorrect."], | |||
"messages": ["Endpoint: 1.0.0.13/32 Type: tunnel - Tunnel is incorrect"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is incorrect here?
@@ -2010,7 +2010,7 @@ | |||
}, | |||
"expected": { | |||
"result": "failure", | |||
"messages": ["Tunnel to 1.0.0.122/32 is incorrect."], | |||
"messages": ["Endpoint: 1.0.0.122/32 Next-hop: 10.0.1.2 Type: ip Interface: Ethernet1 - Tunnel is incorrect"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here. The user doesn't know what is incorrect about the tunnel.
Description
Refactor VerifyISISSegmentRoutingTunnels test case
Fixes #388
Checklist:
pre-commit run
)tox -e testenv
)