Skip to content

Inventory models

AntaInventoryInput

Bases: BaseModel

Device inventory input model.

yaml

yaml() -> str

Return a YAML representation string of this model.

Returns:

Type Description
The YAML representation string of this model.
Source code in anta/inventory/models.py
88
89
90
91
92
93
94
95
96
97
98
99
def yaml(self) -> str:
    """Return a YAML representation string of this model.

    Returns
    -------
        The YAML representation string of this model.
    """
    # TODO: Pydantic and YAML serialization/deserialization is not supported natively.
    # This could be improved.
    # https://github.com/pydantic/pydantic/issues/1043
    # Explore if this worth using this: https://github.com/NowanIlfideme/pydantic-yaml
    return yaml.safe_dump(yaml.safe_load(self.model_dump_json(serialize_as_any=True, exclude_unset=True)), indent=2, width=math.inf)

AntaInventoryHost

Bases: BaseModel

Host entry of AntaInventoryInput.

Attributes:

Name Type Description
host IP Address or FQDN of the device.

port: Custom eAPI port to use. name: Custom name of the device. tags: Tags of the device. disable_cache: Disable cache for this device.

AntaInventoryNetwork

Bases: BaseModel

Network entry of AntaInventoryInput.

Attributes:

Name Type Description
network Subnet to use for scanning.

tags: Tags of the devices in this network. disable_cache: Disable cache for all devices in this network.

AntaInventoryRange

Bases: BaseModel

IP Range entry of AntaInventoryInput.

Attributes:

Name Type Description
start IPv4 or IPv6 address for the beginning of the range.

stop: IPv4 or IPv6 address for the end of the range. tags: Tags of the devices in this IP range. disable_cache: Disable cache for all devices in this IP range.