Skip to content
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

feat(anta): Added the test case to verify the BGP route origin #813

Merged
merged 22 commits into from
Jan 15, 2025
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1f33640
issue_811 Added TC for BGP route origin
Sep 3, 2024
0e0a8d3
Merge branch 'main' into issue_811
Sep 23, 2024
4046dfb
issue_811 Handling review comments: updated the variable name and inp…
Sep 23, 2024
1408772
issue_811 Handling review comments: updated the pylint ignore and doc…
Sep 25, 2024
3fb5245
Merge branch 'main' into issue_811
Sep 27, 2024
b9d1bea
issue_811 fix lintin issue
Sep 27, 2024
07d115f
issue_811 Handling review comments: updated vrf details in failure msg
Sep 30, 2024
2b615d7
Merge branch 'main' into issue_811
vitthalmagadum Sep 30, 2024
5c1a91a
Merge branch 'main' into issue_811
vitthalmagadum Oct 1, 2024
8a7fc6b
Merge branch 'main' into issue_811
vitthalmagadum Oct 7, 2024
18fbaa7
Merge branch 'main' into issue_811
gmuloc Oct 10, 2024
c6b80d5
Merge branch 'main' into issue_811
vitthalmagadum Oct 11, 2024
15d5964
issue_811 Handling review comments: updated the input model for route…
Oct 11, 2024
78c8ce9
Merge branch 'main' into issue_811
vitthalmagadum Dec 18, 2024
224b1e7
Added input models refactoring
vitthalmagadum Dec 18, 2024
b742646
Addressed review comment: updated doc, unit test eos data
vitthalmagadum Dec 19, 2024
c399bd3
Merge branch 'main' into issue_811
vitthalmagadum Dec 30, 2024
3981dd2
pre-commit changes after conflicts resolved
vitthalmagadum Dec 30, 2024
fbad6d7
Merge branch 'main' into issue_811
vitthalmagadum Jan 9, 2025
83ff9c9
Merge branch 'main' into issue_811
vitthalmagadum Jan 15, 2025
ba1d4db
Addressed review comments: updated docs, input model msg
vitthalmagadum Jan 15, 2025
5478535
Merge branch 'main' into issue_811
vitthalmagadum Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
issue_811 Handling review comments: updated the input model for route…
… path
  • Loading branch information
VitthalMagadum committed Oct 11, 2024
commit 15d5964b2d02e32e919371f44fc7a809d439894b
18 changes: 12 additions & 6 deletions anta/tests/routing/bgp.py
Original file line number Diff line number Diff line change
@@ -1677,10 +1677,16 @@ class BgpRoute(BaseModel):
"""IPv4 network address"""
vrf: str = "default"
"""Optional VRF. If not provided, it defaults to `default`."""
route_paths: list[dict[str, IPv4Address | Literal["Igp", "Egp", "Incomplete"]]]
"""A list of dictionaries represents a BGP path.
- `nexthop`: The next-hop IP address for the path.
- `origin`: The origin of the route."""
route_paths: list[RoutePath]
"""List of BGP route path(s)"""

class RoutePath(BaseModel):
"""Model for a BGP route path(s)."""

nexthop: IPv4Address
"""The next-hop IPv4 address for the path."""
origin: Literal["Igp", "Egp", "Incomplete"]
"""The origin of the route."""

def render(self, template: AntaTemplate) -> list[AntaCommand]:
"""Render the template for each BGP peer in the input list."""
@@ -1704,8 +1710,8 @@ def test(self) -> None:
# Iterating over each nexthop.
failure: dict[Any, Any] = {}
for path in paths:
nexthop = str(path["nexthop"])
origin = path["origin"]
nexthop = str(path.nexthop)
origin = path.origin
if not (route_path := get_item(bgp_routes, "nextHop", nexthop)):
failure[nexthop] = "Path not found."
continue
Loading