ANTA 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",
]
DynamicVlanSource
module-attribute
¶
DynamicVlanSource = Literal[
"dmf",
"dot1x",
"dynvtep",
"evpn",
"mlag",
"mlagsync",
"mvpn",
"swfwd",
"vccbfd",
]
ErrDisableReasons
module-attribute
¶
ErrDisableReasons = Literal[
"acl",
"arp-inspection",
"bgp-session-tracking",
"bpduguard",
"dot1x",
"dot1x-coa",
"dot1x-session-replace",
"evpn-sa-mh",
"fabric-link-failure",
"fabric-link-flap",
"hitless-reload-down",
"lacp-no-portid",
"lacp-rate-limit",
"license-enforce",
"link-flap",
"mlagasu",
"mlagdualprimary",
"mlagissu",
"mlagmaintdown",
"no-internal-vlan",
"out-of-voqs",
"portchannelguard",
"portgroup-disabled",
"portsec",
"speed-misconfigured",
"storm-control",
"stp-no-portid",
"stuck-queue",
"tapagg",
"uplink-failure-detection",
"xcvr-misconfigured",
"xcvr-overheat",
"xcvr-power-unsupported",
"xcvr-unsupported",
]
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),
]
LogSeverityLevel
module-attribute
¶
LogSeverityLevel = Literal[
"alerts",
"critical",
"debugging",
"emergencies",
"errors",
"informational",
"notifications",
"warnings",
]
MultiProtocolCaps
module-attribute
¶
MultiProtocolCaps = Annotated[
Literal[
"dps",
"ipv4Unicast",
"ipv6Unicast",
"ipv4Multicast",
"ipv6Multicast",
"ipv4MplsLabels",
"ipv6MplsLabels",
"ipv4SrTe",
"ipv6SrTe",
"ipv4MplsVpn",
"ipv6MplsVpn",
"ipv4FlowSpec",
"ipv6FlowSpec",
"ipv4FlowSpecVpn",
"ipv6FlowSpecVpn",
"l2VpnVpls",
"l2VpnEvpn",
"linkState",
"rtMembership",
"ipv4Mvpn",
],
BeforeValidator(
bgp_multiprotocol_capabilities_abbreviations
),
]
PortChannelInterface
module-attribute
¶
PortChannelInterface = Annotated[
str,
Field(pattern=REGEX_TYPE_PORTCHANNEL),
BeforeValidator(interface_autocomplete),
BeforeValidator(interface_case_sensitivity),
]
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_TYPE_PORTCHANNEL
module-attribute
¶
REGEX_TYPE_PORTCHANNEL = '^Port-Channel[0-9]{1,6}$'
Match Port Channel interface like Port-Channel5.
RedistributedAfiSafi
module-attribute
¶
RedistributedAfiSafi = Annotated[
Literal["v4u", "v4m", "v6u", "v6m"],
BeforeValidator(
bgp_redistributed_route_proto_abbreviations
),
]
RedistributedProtocol
module-attribute
¶
RedistributedProtocol = Annotated[
Literal[
"AttachedHost",
"Bgp",
"Connected",
"DHCP",
"Dynamic",
"IS-IS",
"OSPF Internal",
"OSPF External",
"OSPF Nssa-External",
"OSPFv3 Internal",
"OSPFv3 External",
"OSPFv3 Nssa-External",
"RIP",
"Static",
"User",
],
AfterValidator(update_bgp_redistributed_proto_user),
]
SnmpEncryptionAlgorithm
module-attribute
¶
SnmpEncryptionAlgorithm = Literal[
"AES-128", "AES-192", "AES-256", "DES"
]
SnmpErrorCounter
module-attribute
¶
SnmpErrorCounter = Literal[
"inVersionErrs",
"inBadCommunityNames",
"inBadCommunityUses",
"inParseErrs",
"outTooBigErrs",
"outNoSuchNameErrs",
"outBadValueErrs",
"outGeneralErrs",
]
SnmpHashingAlgorithm
module-attribute
¶
SnmpHashingAlgorithm = Literal[
"MD5", "SHA", "SHA-224", "SHA-256", "SHA-384", "SHA-512"
]
SnmpPdu
module-attribute
¶
SnmpPdu = Literal[
"inGetPdus",
"inGetNextPdus",
"inSetPdus",
"outGetResponsePdus",
"outTrapPdus",
]
SnmpVersionV3AuthType
module-attribute
¶
SnmpVersionV3AuthType = Annotated[
Literal["auth", "priv", "noauth"],
AfterValidator(snmp_v3_prefix),
]
VxlanSrcIntf
module-attribute
¶
VxlanSrcIntf = Annotated[
str,
Field(pattern=REGEXP_TYPE_VXLAN_SRC_INTERFACE),
BeforeValidator(interface_autocomplete),
BeforeValidator(interface_case_sensitivity),
]
aaa_group_prefix
¶
Prefix the AAA method with ‘group’ if it is known.
Source code in anta/custom_types.py
34 35 36 37 |
|
bgp_multiprotocol_capabilities_abbreviations
¶
Abbreviations for different BGP multiprotocol capabilities.
Handles different separators (hyphen, underscore, space) and case sensitivity.
Examples
>>> bgp_multiprotocol_capabilities_abbreviations("IPv4 Unicast")
'ipv4Unicast'
>>> bgp_multiprotocol_capabilities_abbreviations("ipv4-Flow_Spec Vpn")
'ipv4FlowSpecVpn'
>>> bgp_multiprotocol_capabilities_abbreviations("ipv6_labeled-unicast")
'ipv6MplsLabels'
>>> bgp_multiprotocol_capabilities_abbreviations("ipv4_mpls_vpn")
'ipv4MplsVpn'
>>> bgp_multiprotocol_capabilities_abbreviations("ipv4 mpls labels")
'ipv4MplsLabels'
>>> bgp_multiprotocol_capabilities_abbreviations("rt-membership")
'rtMembership'
>>> bgp_multiprotocol_capabilities_abbreviations("dynamic-path-selection")
'dps'
Source code in anta/custom_types.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
bgp_redistributed_route_proto_abbreviations
¶
Abbreviations for different BGP redistributed route protocols.
Handles different separators (hyphen, underscore, space) and case sensitivity.
Examples
>>> bgp_redistributed_route_proto_abbreviations("IPv4 Unicast")
'v4u'
>>> bgp_redistributed_route_proto_abbreviations("IPv4-multicast")
'v4m'
>>> bgp_redistributed_route_proto_abbreviations("IPv6_multicast")
'v6m'
>>> bgp_redistributed_route_proto_abbreviations("ipv6unicast")
'v6u'
Source code in anta/custom_types.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
interface_autocomplete
¶
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
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
interface_case_sensitivity
¶
Reformat interface name to match expected case sensitivity.
Examples
- ethernet -> Ethernet
- vlan -> Vlan
- loopback -> Loopback
Source code in anta/custom_types.py
60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
snmp_v3_prefix
¶
Prefix the SNMP authentication type with ‘v3’.
Source code in anta/custom_types.py
362 363 364 365 366 |
|
update_bgp_redistributed_proto_user
¶
Update BGP redistributed route User
proto with EOS SDK.
Examples
>>> update_bgp_redistributed_proto_user("User")
'EOS SDK'
>>> update_bgp_redistributed_proto_user("Bgp")
'Bgp'
>>> update_bgp_redistributed_proto_user("RIP")
'RIP'
Source code in anta/custom_types.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
validate_regex
¶
Validate that the input value is a valid regex format.
Source code in anta/custom_types.py
132 133 134 135 136 137 138 139 |
|