Skip to content

Input Types

anta.custom_types

Module that provides predefined types for AntaTest.Input instances

AAAAuthMethod module-attribute

AAAAuthMethod = Annotated[str, AfterValidator(aaa_group_prefix)]

Afi module-attribute

Afi = Literal['ipv4', 'ipv6', 'vpn-ipv4', 'vpn-ipv6', 'evpn', 'rt-membership']

Interface module-attribute

Interface = Annotated[str, Field(pattern='^(Ethernet|Fabric|Loopback|Management|Port-Channel|Tunnel|Vlan|Vxlan)[0-9]+(\\/[0-9]+)*(\\.[0-9]+)?$')]

Safi module-attribute

Safi = Literal['unicast', 'multicast', 'labeled-unicast']

TestStatus module-attribute

TestStatus = Literal['unset', 'success', 'failure', 'error', 'skipped']

Vlan module-attribute

Vlan = Annotated[int, Field(ge=0, le=4094)]

Vni module-attribute

Vni = Annotated[int, Field(ge=1, le=16777215)]

aaa_group_prefix

aaa_group_prefix(v: str) -> str

Prefix the AAA method with ‘group’ if it is known

Source code in anta/custom_types.py
14
15
16
17
def aaa_group_prefix(v: str) -> str:
    """Prefix the AAA method with 'group' if it is known"""
    built_in_methods = ["local", "none", "logging"]
    return f"group {v}" if v not in built_in_methods and not v.startswith("group ") else v

Last update: September 7, 2023