-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
2,340 additions
and
686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright (c) 2023-2024 Arista Networks, Inc. | ||
# Use of this source code is governed by the Apache License 2.0 | ||
# that can be found in the LICENSE file. | ||
"""Module containing input models for AVT tests.""" | ||
|
||
from __future__ import annotations | ||
|
||
from ipaddress import IPv4Address | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
|
||
class AVTPath(BaseModel): | ||
"""AVT (Adaptive Virtual Topology) model representing path details and associated information.""" | ||
|
||
model_config = ConfigDict(extra="forbid") | ||
vrf: str = "default" | ||
"""VRF context. Defaults to `default`.""" | ||
avt_name: str | ||
"""The name of the Adaptive Virtual Topology (AVT).""" | ||
destination: IPv4Address | ||
"""The IPv4 address of the destination peer in the AVT.""" | ||
next_hop: IPv4Address | ||
"""The IPv4 address of the next hop used to reach the AVT peer.""" | ||
path_type: str | None = None | ||
"""Specifies the type of path for the AVT. If not specified, both types 'direct' and 'multihop' are considered.""" | ||
|
||
def __str__(self) -> str: | ||
"""Return a human-readable string representation of the AVTPath for reporting. | ||
Examples | ||
-------- | ||
AVT CONTROL-PLANE-PROFILE VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.1) | ||
""" | ||
return f"AVT {self.avt_name} VRF: {self.vrf} (Destination: {self.destination}, Next-hop: {self.next_hop})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) 2023-2024 Arista Networks, Inc. | ||
# Use of this source code is governed by the Apache License 2.0 | ||
# that can be found in the LICENSE file. | ||
"""Module containing input models for CVX tests.""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import Literal | ||
|
||
from pydantic import BaseModel | ||
|
||
from anta.custom_types import Hostname | ||
|
||
|
||
class CVXPeers(BaseModel): | ||
"""Model for a CVX Cluster Peer.""" | ||
|
||
peer_name: Hostname | ||
registration_state: Literal["Connecting", "Connected", "Registration error", "Registration complete", "Unexpected peer state"] = "Registration complete" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Copyright (c) 2023-2024 Arista Networks, Inc. | ||
# Use of this source code is governed by the Apache License 2.0 | ||
# that can be found in the LICENSE file. | ||
"""Module containing input models for security tests.""" | ||
|
||
from __future__ import annotations | ||
|
||
from ipaddress import IPv4Address | ||
from typing import Any | ||
from warnings import warn | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
|
||
class IPSecPeer(BaseModel): | ||
"""IPSec (Internet Protocol Security) model represents the details of an IPv4 security peer.""" | ||
|
||
model_config = ConfigDict(extra="forbid") | ||
peer: IPv4Address | ||
"""The IPv4 address of the security peer.""" | ||
vrf: str = "default" | ||
"""VRF context. Defaults to `default`.""" | ||
connections: list[IPSecConn] | None = None | ||
"""A list of IPv4 security connections associated with the peer. Defaults to None.""" | ||
|
||
def __str__(self) -> str: | ||
"""Return a string representation of the IPSecPeer model. Used in failure messages. | ||
Examples | ||
-------- | ||
- Peer: 1.1.1.1 VRF: default | ||
""" | ||
return f"Peer: {self.peer} VRF: {self.vrf}" | ||
|
||
|
||
class IPSecConn(BaseModel): | ||
"""Details of an IPv4 security connection for a peer.""" | ||
|
||
model_config = ConfigDict(extra="forbid") | ||
source_address: IPv4Address | ||
"""The IPv4 address of the source in the security connection.""" | ||
destination_address: IPv4Address | ||
"""The IPv4 address of the destination in the security connection.""" | ||
|
||
|
||
class IPSecPeers(IPSecPeer): # pragma: no cover | ||
"""Alias for the IPSecPeers model to maintain backward compatibility. | ||
When initialized, it will emit a deprecation warning and call the IPSecPeer model. | ||
TODO: Remove this class in ANTA v2.0.0. | ||
""" | ||
|
||
def __init__(self, **data: Any) -> None: # noqa: ANN401 | ||
"""Initialize the IPSecPeer class, emitting a deprecation warning.""" | ||
warn( | ||
message="IPSecPeers model is deprecated and will be removed in ANTA v2.0.0. Use the IPSecPeer model instead.", | ||
category=DeprecationWarning, | ||
stacklevel=2, | ||
) | ||
super().__init__(**data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright (c) 2023-2024 Arista Networks, Inc. | ||
# Use of this source code is governed by the Apache License 2.0 | ||
# that can be found in the LICENSE file. | ||
"""Module containing input models for services tests.""" | ||
|
||
from __future__ import annotations | ||
|
||
from ipaddress import IPv4Address | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
from anta.custom_types import Port | ||
|
||
|
||
class StunClientTranslation(BaseModel): | ||
"""STUN (Session Traversal Utilities for NAT) model represents the configuration of an IPv4-based client translations.""" | ||
|
||
model_config = ConfigDict(extra="forbid") | ||
source_address: IPv4Address | ||
"""The IPv4 address of the STUN client""" | ||
source_port: Port = 4500 | ||
"""The port number used by the STUN client for communication. Defaults to 4500.""" | ||
public_address: IPv4Address | None = None | ||
"""The public-facing IPv4 address of the STUN client, discovered via the STUN server.""" | ||
public_port: Port | None = None | ||
"""The public-facing port number of the STUN client, discovered via the STUN server.""" | ||
|
||
def __str__(self) -> str: | ||
"""Return a human-readable string representation of the StunClientTranslation for reporting. | ||
Examples | ||
-------- | ||
Client 10.0.0.1 Port: 4500 | ||
""" | ||
return f"Client {self.source_address} Port: {self.source_port}" |
Oops, something went wrong.