Skip to content

User Inventory data model

Data models for anta.inventory

Bases: BaseModel

User’s inventory model.

Attributes:

Name Type Description
networks List[AntaInventoryNetwork], Optional

List of AntaInventoryNetwork objects for networks.

hosts List[AntaInventoryHost], Optional

List of AntaInventoryHost objects for hosts.

range List[AntaInventoryRange], Optional

List of AntaInventoryRange objects for ranges.

Source code in anta/inventory/models.py
67
68
69
70
71
72
73
74
75
76
77
78
79
class AntaInventoryInput(BaseModel):
    """
    User's inventory model.

    Attributes:
        networks (List[AntaInventoryNetwork],Optional): List of AntaInventoryNetwork objects for networks.
        hosts (List[AntaInventoryHost],Optional): List of AntaInventoryHost objects for hosts.
        range (List[AntaInventoryRange],Optional): List of AntaInventoryRange objects for ranges.
    """

    networks: Optional[List[AntaInventoryNetwork]]
    hosts: Optional[List[AntaInventoryHost]]
    ranges: Optional[List[AntaInventoryRange]]

User inventory components

Bases: BaseModel

Host definition for user’s inventory.

Attributes:

Name Type Description
host IPvAnyAddress

IPv4 or IPv6 address of the device

port int

(Optional) eAPI port to use Default is 443.

name str

(Optional) Name to display during tests report. Default is hostname:port

tags List[str]

List of attached tags read from inventory file.

Source code in anta/inventory/models.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class AntaInventoryHost(BaseModel):
    """
    Host definition for user's inventory.

    Attributes:
        host (IPvAnyAddress): IPv4 or IPv6 address of the device
        port (int): (Optional) eAPI port to use Default is 443.
        name (str): (Optional) Name to display during tests report. Default is hostname:port
        tags (List[str]): List of attached tags read from inventory file.
    """

    name: Optional[str]
    host: Union[constr(regex=RFC_1123_REGEX), IPvAnyAddress]  # type: ignore
    port: Optional[conint(gt=1, lt=65535)]  # type: ignore
    tags: List[str] = [DEFAULT_TAG]

Bases: BaseModel

Network definition for user’s inventory.

Attributes:

Name Type Description
network IPvAnyNetwork

Subnet to use for testing.

tags List[str]

List of attached tags read from inventory file.

Source code in anta/inventory/models.py
39
40
41
42
43
44
45
46
47
48
49
class AntaInventoryNetwork(BaseModel):
    """
    Network definition for user's inventory.

    Attributes:
        network (IPvAnyNetwork): Subnet to use for testing.
        tags (List[str]): List of attached tags read from inventory file.
    """

    network: IPvAnyNetwork
    tags: List[str] = [DEFAULT_TAG]

Bases: BaseModel

IP Range definition for user’s inventory.

Attributes:

Name Type Description
start IPvAnyAddress

IPv4 or IPv6 address for the begining of the range.

stop IPvAnyAddress

IPv4 or IPv6 address for the end of the range.

tags List[str]

List of attached tags read from inventory file.

Source code in anta/inventory/models.py
52
53
54
55
56
57
58
59
60
61
62
63
64
class AntaInventoryRange(BaseModel):
    """
    IP Range definition for user's inventory.

    Attributes:
        start (IPvAnyAddress): IPv4 or IPv6 address for the begining of the range.
        stop (IPvAnyAddress): IPv4 or IPv6 address for the end of the range.
        tags (List[str]): List of attached tags read from inventory file.
    """

    start: IPvAnyAddress
    end: IPvAnyAddress
    tags: List[str] = [DEFAULT_TAG]

Last update: September 5, 2022