Input Types
anta.custom_types ¶
Module that provides predefined types for AntaTest.Input instances.
Afi
module-attribute
¶
Afi = Literal[
"ipv4",
"ipv6",
"vpn-ipv4",
"vpn-ipv6",
"evpn",
"rt-membership",
"path-selection",
"link-state",
]
BfdProtocol
module-attribute
¶
BfdProtocol = Literal[
"bgp",
"isis",
"lag",
"ospf",
"ospfv3",
"pim",
"route-input",
"static-bfd",
"static-route",
"vrrp",
"vxlan",
]
BgpDropStats
module-attribute
¶
BgpDropStats = Literal[
"inDropAsloop",
"inDropClusterIdLoop",
"inDropMalformedMpbgp",
"inDropOrigId",
"inDropNhLocal",
"inDropNhAfV6",
"prefixDroppedMartianV4",
"prefixDroppedMaxRouteLimitViolatedV4",
"prefixDroppedMartianV6",
"prefixDroppedMaxRouteLimitViolatedV6",
"prefixLuDroppedV4",
"prefixLuDroppedMartianV4",
"prefixLuDroppedMaxRouteLimitViolatedV4",
"prefixLuDroppedV6",
"prefixLuDroppedMartianV6",
"prefixLuDroppedMaxRouteLimitViolatedV6",
"prefixEvpnDroppedUnsupportedRouteType",
"prefixBgpLsDroppedReceptionUnsupported",
"outDropV4LocalAddr",
"outDropV6LocalAddr",
"prefixVpnIpv4DroppedImportMatchFailure",
"prefixVpnIpv4DroppedMaxRouteLimitViolated",
"prefixVpnIpv6DroppedImportMatchFailure",
"prefixVpnIpv6DroppedMaxRouteLimitViolated",
"prefixEvpnDroppedImportMatchFailure",
"prefixEvpnDroppedMaxRouteLimitViolated",
"prefixRtMembershipDroppedLocalAsReject",
"prefixRtMembershipDroppedMaxRouteLimitViolated",
]
BgpUpdateError
module-attribute
¶
BgpUpdateError = Literal[
"inUpdErrWithdraw",
"inUpdErrIgnore",
"inUpdErrDisableAfiSafi",
"disabledAfiSafi",
"lastUpdErrTime",
]
ErrDisableReasons
module-attribute
¶
ErrDisableReasons = Literal[
"acl",
"arp-inspection",
"bpduguard",
"dot1x-session-replace",
"hitless-reload-down",
"lacp-rate-limit",
"link-flap",
"no-internal-vlan",
"portchannelguard",
"portsec",
"tapagg",
"uplink-failure-detection",
]
EthernetInterface
module-attribute
¶
EthernetInterface = Annotated[
str,
Field(pattern="^Ethernet[0-9]+(\\/[0-9]+)*$"),
BeforeValidator(interface_autocomplete),
BeforeValidator(interface_case_sensitivity),
]
IPv4RouteType
module-attribute
¶
IPv4RouteType = Literal[
"connected",
"static",
"kernel",
"OSPF",
"OSPF inter area",
"OSPF external type 1",
"OSPF external type 2",
"OSPF NSSA external type 1",
"OSPF NSSA external type2",
"Other BGP Routes",
"iBGP",
"eBGP",
"RIP",
"IS-IS level 1",
"IS-IS level 2",
"OSPFv3",
"BGP Aggregate",
"OSPF Summary",
"Nexthop Group Static Route",
"VXLAN Control Service",
"Martian",
"DHCP client installed default route",
"Dynamic Policy Route",
"VRF Leaked",
"gRIBI",
"Route Cache Route",
"CBF Leaked Route",
]
Interface
module-attribute
¶
Interface = Annotated[
str,
Field(pattern=REGEXP_TYPE_EOS_INTERFACE),
BeforeValidator(interface_autocomplete),
BeforeValidator(interface_case_sensitivity),
]
MultiProtocolCaps
module-attribute
¶
MultiProtocolCaps = Annotated[
str,
BeforeValidator(
bgp_multiprotocol_capabilities_abbreviations
),
]
PortChannelInterface
module-attribute
¶
PortChannelInterface = Annotated[
str,
Field(pattern=REGEX_TYPE_PORTCHANNEL),
BeforeValidator(interface_autocomplete),
BeforeValidator(interface_case_sensitivity),
]
REGEXP_BGP_IPV4_MPLS_LABELS
module-attribute
¶
REGEXP_BGP_IPV4_MPLS_LABELS = (
"\\b(ipv4[\\s\\-]?mpls[\\s\\-]?label(s)?)\\b"
)
Match IPv4 MPLS Labels.
REGEXP_BGP_L2VPN_AFI
module-attribute
¶
REGEXP_BGP_L2VPN_AFI = "\\b(l2[\\s\\-]?vpn[\\s\\-]?evpn)\\b"
Match L2VPN EVPN AFI.
REGEXP_EOS_BLACKLIST_CMDS
module-attribute
¶
REGEXP_EOS_BLACKLIST_CMDS = [
"^reload.*",
"^conf\\w*\\s*(terminal|session)*",
"^wr\\w*\\s*\\w+",
]
List of regular expressions to blacklist from eos commands.
REGEXP_INTERFACE_ID
module-attribute
¶
REGEXP_INTERFACE_ID = '\\d+(\\/\\d+)*(\\.\\d+)?'
Match Interface ID lilke 1/1.1.
REGEXP_PATH_MARKERS
module-attribute
¶
REGEXP_PATH_MARKERS = '[\\\\\\/\\s]'
Match directory path from string.
REGEXP_TYPE_EOS_INTERFACE
module-attribute
¶
REGEXP_TYPE_EOS_INTERFACE = "^(Dps|Ethernet|Fabric|Loopback|Management|Port-Channel|Tunnel|Vlan|Vxlan)[0-9]+(\\/[0-9]+)*(\\.[0-9]+)?$"
Match EOS interface types like Ethernet1/1, Vlan1, Loopback1, etc.
REGEXP_TYPE_HOSTNAME
module-attribute
¶
REGEXP_TYPE_HOSTNAME = "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$"
Match hostname like my-hostname
, my-hostname-1
, my-hostname-1-2
.
REGEXP_TYPE_VXLAN_SRC_INTERFACE
module-attribute
¶
REGEXP_TYPE_VXLAN_SRC_INTERFACE = "^(Loopback)([0-9]|[1-9][0-9]{1,2}|[1-7][0-9]{3}|8[01][0-9]{2}|819[01])$"
Match Vxlan source interface like Loopback10.
REGEX_BGP_IPV4_MPLS_VPN
module-attribute
¶
REGEX_BGP_IPV4_MPLS_VPN = (
"\\b(ipv4[\\s\\-]?mpls[\\s\\-]?vpn)\\b"
)
Match IPv4 MPLS VPN.
REGEX_BGP_IPV4_UNICAST
module-attribute
¶
REGEX_BGP_IPV4_UNICAST = (
"\\b(ipv4[\\s\\-]?uni[\\s\\-]?cast)\\b"
)
Match IPv4 Unicast.
REGEX_TYPE_PORTCHANNEL
module-attribute
¶
REGEX_TYPE_PORTCHANNEL = '^Port-Channel[0-9]{1,6}$'
Match Port Channel interface like Port-Channel5.
SnmpErrorCounter
module-attribute
¶
SnmpErrorCounter = Literal[
"inVersionErrs",
"inBadCommunityNames",
"inBadCommunityUses",
"inParseErrs",
"outTooBigErrs",
"outNoSuchNameErrs",
"outBadValueErrs",
"outGeneralErrs",
]
SnmpPdu
module-attribute
¶
SnmpPdu = Literal[
"inGetPdus",
"inGetNextPdus",
"inSetPdus",
"outGetResponsePdus",
"outTrapPdus",
]
VxlanSrcIntf
module-attribute
¶
VxlanSrcIntf = Annotated[
str,
Field(pattern=REGEXP_TYPE_VXLAN_SRC_INTERFACE),
BeforeValidator(interface_autocomplete),
BeforeValidator(interface_case_sensitivity),
]
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
40 41 42 43 |
|
bgp_multiprotocol_capabilities_abbreviations ¶
bgp_multiprotocol_capabilities_abbreviations(
value: str,
) -> str
Abbreviations for different BGP multiprotocol capabilities.
Examples
- IPv4 Unicast
- L2vpnEVPN
- ipv4 MPLS Labels
- ipv4Mplsvpn
Source code in anta/custom_types.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
interface_autocomplete ¶
interface_autocomplete(v: str) -> str
Allow the user to only provide the beginning of an interface name.
Supported alias:
- et
, eth
will be changed to Ethernet
- po
will be changed to Port-Channel
- lo
will be changed to Loopback
Source code in anta/custom_types.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
|
interface_case_sensitivity ¶
interface_case_sensitivity(v: str) -> str
Reformat interface name to match expected case sensitivity.
Examples
- ethernet -> Ethernet
- vlan -> Vlan
- loopback -> Loopback
Source code in anta/custom_types.py
66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
validate_regex ¶
validate_regex(value: str) -> str
Validate that the input value is a valid regex format.
Source code in anta/custom_types.py
107 108 109 110 111 112 113 114 |
|