-
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
1 parent
9d375a9
commit 212f99b
Showing
4 changed files
with
85 additions
and
59 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
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 ClientAddress(BaseModel): | ||
"""STUN (Session Traversal Utilities for NAT) model represents the configuration of an IPv4-based client.""" | ||
|
||
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 ClientAddress for reporting. | ||
Examples | ||
-------- | ||
Client 10.0.0.1 Port: 4500 | ||
""" | ||
return f"Client {self.source_address} Port: {self.source_port}" |
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