Adding upstream version 1.3.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-03-17 07:33:45 +01:00
parent 6fd6eb426a
commit dc7df702ea
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
337 changed files with 16571 additions and 4891 deletions

View file

@ -1,5 +1,5 @@
<!--
~ Copyright (c) 2023-2024 Arista Networks, Inc.
~ Copyright (c) 2023-2025 Arista Networks, Inc.
~ Use of this source code is governed by the Apache License 2.0
~ that can be found in the LICENSE file.
-->

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests module."""

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""See https://docs.pytest.org/en/stable/reference/fixtures.html#conftest-py-sharing-fixtures-across-multiple-files."""

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Test for anta.tests.routing submodule."""

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.routing.generic.py."""
@ -11,7 +11,7 @@ from typing import Any
import pytest
from pydantic import ValidationError
from anta.tests.routing.generic import VerifyIPv4RouteType, VerifyRoutingProtocolModel, VerifyRoutingTableEntry, VerifyRoutingTableSize
from anta.tests.routing.generic import VerifyIPv4RouteNextHops, VerifyIPv4RouteType, VerifyRoutingProtocolModel, VerifyRoutingTableEntry, VerifyRoutingTableSize
from tests.units.anta_tests import test
DATA: list[dict[str, Any]] = [
@ -27,14 +27,14 @@ DATA: list[dict[str, Any]] = [
"test": VerifyRoutingProtocolModel,
"eos_data": [{"vrfs": {"default": {}}, "protoModelStatus": {"configuredProtoModel": "ribd", "operatingProtoModel": "ribd"}}],
"inputs": {"model": "multi-agent"},
"expected": {"result": "failure", "messages": ["routing model is misconfigured: configured: ribd - operating: ribd - expected: multi-agent"]},
"expected": {"result": "failure", "messages": ["Routing model is misconfigured - Expected: multi-agent Actual: ribd"]},
},
{
"name": "failure-mismatch-operating-model",
"test": VerifyRoutingProtocolModel,
"eos_data": [{"vrfs": {"default": {}}, "protoModelStatus": {"configuredProtoModel": "multi-agent", "operatingProtoModel": "ribd"}}],
"inputs": {"model": "multi-agent"},
"expected": {"result": "failure", "messages": ["routing model is misconfigured: configured: multi-agent - operating: ribd - expected: multi-agent"]},
"expected": {"result": "failure", "messages": ["Routing model is misconfigured - Expected: multi-agent Actual: ribd"]},
},
{
"name": "success",
@ -68,7 +68,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"minimum": 42, "maximum": 666},
"expected": {"result": "failure", "messages": ["routing-table has 1000 routes and not between min (42) and maximum (666)"]},
"expected": {"result": "failure", "messages": ["Routing table routes are outside the routes range - Expected: 42 <= to >= 666 Actual: 1000"]},
},
{
"name": "success",
@ -204,9 +204,20 @@ DATA: list[dict[str, Any]] = [
},
},
},
{
"vrfs": {
"default": {
"routingDisabled": False,
"allRoutesProgrammedHardware": True,
"allRoutesProgrammedKernel": True,
"defaultRouteState": "notSet",
"routes": {},
},
},
},
],
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2"]},
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: ['10.1.0.1']"]},
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2", "10.1.0.3"]},
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: 10.1.0.1, 10.1.0.3"]},
},
{
"name": "failure-wrong-route",
@ -260,7 +271,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2"]},
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: ['10.1.0.2']"]},
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: 10.1.0.2"]},
},
{
"name": "failure-wrong-route-collect-all",
@ -302,7 +313,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2"], "collect": "all"},
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: ['10.1.0.2']"]},
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: 10.1.0.2"]},
},
{
"name": "success-valid-route-type",
@ -348,6 +359,164 @@ DATA: list[dict[str, Any]] = [
"inputs": {"routes_entries": [{"vrf": "default", "prefix": "10.10.0.1/32", "route_type": "eBGP"}]},
"expected": {"result": "failure", "messages": ["Prefix: 10.10.0.1/32 VRF: default - VRF not configured"]},
},
{
"name": "success",
"test": VerifyIPv4RouteNextHops,
"eos_data": [
{
"vrfs": {
"default": {
"routes": {
"10.10.0.1/32": {
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
}
}
},
"MGMT": {
"routes": {
"10.100.0.128/31": {
"vias": [
{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"},
{"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"},
{"nexthopAddr": "10.100.0.101", "interface": "Ethernet4"},
],
}
}
},
}
},
],
"inputs": {
"route_entries": [
{"prefix": "10.10.0.1/32", "vrf": "default", "nexthops": ["10.100.0.10", "10.100.0.8"]},
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "nexthops": ["10.100.0.8", "10.100.0.10"]},
]
},
"expected": {"result": "success"},
},
{
"name": "success-strict-true",
"test": VerifyIPv4RouteNextHops,
"eos_data": [
{
"vrfs": {
"default": {
"routes": {
"10.10.0.1/32": {
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
}
}
},
"MGMT": {
"routes": {
"10.100.0.128/31": {
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
}
}
},
}
},
],
"inputs": {
"route_entries": [
{"prefix": "10.10.0.1/32", "vrf": "default", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
]
},
"expected": {"result": "success"},
},
{
"name": "failure-not-configured",
"test": VerifyIPv4RouteNextHops,
"eos_data": [
{"vrfs": {"default": {"routes": {}}, "MGMT": {"routes": {}}}},
],
"inputs": {
"route_entries": [
{"prefix": "10.10.0.1/32", "vrf": "default", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
]
},
"expected": {
"result": "failure",
"messages": ["Prefix: 10.10.0.1/32 VRF: default - prefix not found", "Prefix: 10.100.0.128/31 VRF: MGMT - prefix not found"],
},
},
{
"name": "failure-strict-failed",
"test": VerifyIPv4RouteNextHops,
"eos_data": [
{
"vrfs": {
"default": {
"routes": {
"10.10.0.1/32": {
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
}
}
},
"MGMT": {
"routes": {
"10.100.0.128/31": {
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.11", "interface": "Ethernet2"}],
}
}
},
}
},
],
"inputs": {
"route_entries": [
{"prefix": "10.10.0.1/32", "vrf": "default", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10", "10.100.0.11"]},
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
]
},
"expected": {
"result": "failure",
"messages": [
"Prefix: 10.10.0.1/32 VRF: default - List of next-hops not matching - Expected: 10.100.0.10, 10.100.0.11, 10.100.0.8 "
"Actual: 10.100.0.10, 10.100.0.8",
"Prefix: 10.100.0.128/31 VRF: MGMT - List of next-hops not matching - Expected: 10.100.0.10, 10.100.0.8 Actual: 10.100.0.11, 10.100.0.8",
],
},
},
{
"name": "failure",
"test": VerifyIPv4RouteNextHops,
"eos_data": [
{
"vrfs": {
"default": {
"routes": {
"10.10.0.1/32": {
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
}
}
},
"MGMT": {
"routes": {
"10.100.0.128/31": {
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
}
}
},
}
},
],
"inputs": {
"route_entries": [
{"prefix": "10.10.0.1/32", "vrf": "default", "nexthops": ["10.100.0.8", "10.100.0.10", "10.100.0.11"]},
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "nexthops": ["10.100.0.8", "10.100.0.10", "10.100.0.11"]},
]
},
"expected": {
"result": "failure",
"messages": [
"Prefix: 10.10.0.1/32 VRF: default Nexthop: 10.100.0.11 - Route not found",
"Prefix: 10.100.0.128/31 VRF: MGMT Nexthop: 10.100.0.11 - Route not found",
],
},
},
]

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.routing.ospf.py."""
@ -122,13 +122,13 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Some neighbors are not correctly configured: [{'vrf': 'default', 'instance': '666', 'neighbor': '7.7.7.7', 'state': '2-way'},"
" {'vrf': 'BLAH', 'instance': '777', 'neighbor': '8.8.8.8', 'state': 'down'}].",
"Instance: 666 VRF: default Interface: 7.7.7.7 - Incorrect adjacency state - Expected: Full Actual: 2-way",
"Instance: 777 VRF: BLAH Interface: 8.8.8.8 - Incorrect adjacency state - Expected: Full Actual: down",
],
},
},
{
"name": "skipped",
"name": "skipped-ospf-not-configured",
"test": VerifyOSPFNeighborState,
"eos_data": [
{
@ -136,7 +136,33 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "skipped", "messages": ["no OSPF neighbor found"]},
"expected": {"result": "skipped", "messages": ["OSPF not configured"]},
},
{
"name": "skipped-neighbor-not-found",
"test": VerifyOSPFNeighborState,
"eos_data": [
{
"vrfs": {
"default": {
"instList": {
"666": {
"ospfNeighborEntries": [],
},
},
},
"BLAH": {
"instList": {
"777": {
"ospfNeighborEntries": [],
},
},
},
},
},
],
"inputs": None,
"expected": {"result": "skipped", "messages": ["No OSPF neighbor detected"]},
},
{
"name": "success",
@ -193,35 +219,6 @@ DATA: list[dict[str, Any]] = [
"inputs": {"number": 3},
"expected": {"result": "success"},
},
{
"name": "failure-wrong-number",
"test": VerifyOSPFNeighborCount,
"eos_data": [
{
"vrfs": {
"default": {
"instList": {
"666": {
"ospfNeighborEntries": [
{
"routerId": "7.7.7.7",
"priority": 1,
"drState": "DR",
"interfaceName": "Ethernet1",
"adjacencyState": "full",
"inactivity": 1683298014.844345,
"interfaceAddress": "10.3.0.1",
},
],
},
},
},
},
},
],
"inputs": {"number": 3},
"expected": {"result": "failure", "messages": ["device has 1 neighbors (expected 3)"]},
},
{
"name": "failure-good-number-wrong-state",
"test": VerifyOSPFNeighborCount,
@ -277,14 +274,11 @@ DATA: list[dict[str, Any]] = [
"inputs": {"number": 3},
"expected": {
"result": "failure",
"messages": [
"Some neighbors are not correctly configured: [{'vrf': 'default', 'instance': '666', 'neighbor': '7.7.7.7', 'state': '2-way'},"
" {'vrf': 'BLAH', 'instance': '777', 'neighbor': '8.8.8.8', 'state': 'down'}].",
],
"messages": ["Neighbor count mismatch - Expected: 3 Actual: 1"],
},
},
{
"name": "skipped",
"name": "skipped-ospf-not-configured",
"test": VerifyOSPFNeighborCount,
"eos_data": [
{
@ -292,7 +286,38 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"number": 3},
"expected": {"result": "skipped", "messages": ["no OSPF neighbor found"]},
"expected": {"result": "skipped", "messages": ["OSPF not configured"]},
},
{
"name": "skipped-no-neighbor-detected",
"test": VerifyOSPFNeighborCount,
"eos_data": [
{
"vrfs": {
"default": {
"instList": {
"666": {
"ospfNeighborEntries": [],
},
},
},
"BLAH": {
"instList": {
"777": {
"ospfNeighborEntries": [],
},
},
},
},
},
],
"inputs": {"number": 3},
"expected": {
"result": "skipped",
"messages": [
"No OSPF neighbor detected",
],
},
},
{
"name": "success",
@ -394,7 +419,10 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": ["OSPF Instances ['1', '10'] crossed the maximum LSA threshold."],
"messages": [
"Instance: 1 - Crossed the maximum LSA threshold - Expected: < 9000 Actual: 11500",
"Instance: 10 - Crossed the maximum LSA threshold - Expected: < 750 Actual: 1500",
],
},
},
{
@ -406,6 +434,6 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "skipped", "messages": ["No OSPF instance found."]},
"expected": {"result": "skipped", "messages": ["OSPF not configured"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.aaa.py."""
@ -47,7 +47,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"intf": "Management0", "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Source-interface Management0 is not configured in VRF MGMT"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]},
},
{
"name": "failure-wrong-intf",
@ -64,7 +64,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"intf": "Management0", "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Wrong source-interface configured in VRF MGMT"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - Source interface mismatch - Expected: Management0 Actual: Management1"]},
},
{
"name": "failure-wrong-vrf",
@ -81,7 +81,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"intf": "Management0", "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Source-interface Management0 is not configured in VRF MGMT"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]},
},
{
"name": "success",
@ -128,7 +128,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"servers": ["10.22.10.91", "10.22.10.92"], "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["TACACS servers ['10.22.10.92'] are not configured in VRF MGMT"]},
"expected": {"result": "failure", "messages": ["TACACS servers 10.22.10.92 are not configured in VRF MGMT"]},
},
{
"name": "failure-wrong-vrf",
@ -145,7 +145,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["TACACS servers ['10.22.10.91'] are not configured in VRF MGMT"]},
"expected": {"result": "failure", "messages": ["TACACS servers 10.22.10.91 are not configured in VRF MGMT"]},
},
{
"name": "success",
@ -192,7 +192,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"groups": ["GROUP1"]},
"expected": {"result": "failure", "messages": ["TACACS server group(s) ['GROUP1'] are not configured"]},
"expected": {"result": "failure", "messages": ["TACACS server group(s) GROUP1 are not configured"]},
},
{
"name": "success-login-enable",
@ -244,7 +244,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
"expected": {"result": "failure", "messages": ["AAA authentication methods ['group tacacs+', 'local'] are not matching for login console"]},
"expected": {"result": "failure", "messages": ["AAA authentication methods group tacacs+, local are not matching for login console"]},
},
{
"name": "failure-login-default",
@ -257,7 +257,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
"expected": {"result": "failure", "messages": ["AAA authentication methods ['group tacacs+', 'local'] are not matching for ['login']"]},
"expected": {"result": "failure", "messages": ["AAA authentication methods group tacacs+, local are not matching for login"]},
},
{
"name": "success",
@ -293,7 +293,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
"expected": {"result": "failure", "messages": ["AAA authorization methods ['group tacacs+', 'local'] are not matching for ['commands']"]},
"expected": {"result": "failure", "messages": ["AAA authorization methods group tacacs+, local are not matching for commands"]},
},
{
"name": "failure-exec",
@ -305,7 +305,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
"expected": {"result": "failure", "messages": ["AAA authorization methods ['group tacacs+', 'local'] are not matching for ['exec']"]},
"expected": {"result": "failure", "messages": ["AAA authorization methods group tacacs+, local are not matching for exec"]},
},
{
"name": "success-commands-exec-system",
@ -347,7 +347,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
"expected": {"result": "failure", "messages": ["AAA default accounting is not configured for ['commands']"]},
"expected": {"result": "failure", "messages": ["AAA default accounting is not configured for commands"]},
},
{
"name": "failure-not-configured-empty",
@ -361,7 +361,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
"expected": {"result": "failure", "messages": ["AAA default accounting is not configured for ['system', 'exec', 'commands']"]},
"expected": {"result": "failure", "messages": ["AAA default accounting is not configured for system, exec, commands"]},
},
{
"name": "failure-not-matching",
@ -375,7 +375,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
"expected": {"result": "failure", "messages": ["AAA accounting default methods ['group tacacs+', 'logging'] are not matching for ['commands']"]},
"expected": {"result": "failure", "messages": ["AAA accounting default methods group tacacs+, logging are not matching for commands"]},
},
{
"name": "success-commands-exec-system",
@ -476,7 +476,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
"expected": {"result": "failure", "messages": ["AAA console accounting is not configured for ['commands']"]},
"expected": {"result": "failure", "messages": ["AAA console accounting is not configured for commands"]},
},
{
"name": "failure-not-configured-empty",
@ -490,7 +490,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
"expected": {"result": "failure", "messages": ["AAA console accounting is not configured for ['system', 'exec', 'commands']"]},
"expected": {"result": "failure", "messages": ["AAA console accounting is not configured for system, exec, commands"]},
},
{
"name": "failure-not-matching",
@ -522,6 +522,6 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
"expected": {"result": "failure", "messages": ["AAA accounting console methods ['group tacacs+', 'logging'] are not matching for ['commands']"]},
"expected": {"result": "failure", "messages": ["AAA accounting console methods group tacacs+, logging are not matching for commands"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.avt.py."""
@ -94,7 +94,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {},
"expected": {
"result": "failure",
"messages": ["Adaptive virtual topology paths are not configured."],
"messages": ["Adaptive virtual topology paths are not configured"],
},
},
{
@ -174,9 +174,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"AVT path direct:10 for profile GUEST-AVT-POLICY-DEFAULT in VRF guest is not active.",
"AVT path direct:1 for profile CONTROL-PLANE-PROFILE in VRF default is not active.",
"AVT path direct:10 for profile DEFAULT-AVT-POLICY-DEFAULT in VRF default is not active.",
"VRF: guest Profile: GUEST-AVT-POLICY-DEFAULT AVT path: direct:10 - Not active",
"VRF: default Profile: CONTROL-PLANE-PROFILE AVT path: direct:1 - Not active",
"VRF: default Profile: DEFAULT-AVT-POLICY-DEFAULT AVT path: direct:10 - Not active",
],
},
},
@ -257,10 +257,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"AVT path direct:10 for profile DATA-AVT-POLICY-DEFAULT in VRF data is invalid.",
"AVT path direct:8 for profile GUEST-AVT-POLICY-DEFAULT in VRF guest is invalid.",
"AVT path direct:10 for profile CONTROL-PLANE-PROFILE in VRF default is invalid.",
"AVT path direct:8 for profile DEFAULT-AVT-POLICY-DEFAULT in VRF default is invalid.",
"VRF: data Profile: DATA-AVT-POLICY-DEFAULT AVT path: direct:10 - Invalid",
"VRF: guest Profile: GUEST-AVT-POLICY-DEFAULT AVT path: direct:8 - Invalid",
"VRF: default Profile: CONTROL-PLANE-PROFILE AVT path: direct:10 - Invalid",
"VRF: default Profile: DEFAULT-AVT-POLICY-DEFAULT AVT path: direct:8 - Invalid",
],
},
},
@ -341,13 +341,13 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"AVT path direct:10 for profile DATA-AVT-POLICY-DEFAULT in VRF data is invalid and not active.",
"AVT path direct:1 for profile DATA-AVT-POLICY-DEFAULT in VRF data is not active.",
"AVT path direct:10 for profile GUEST-AVT-POLICY-DEFAULT in VRF guest is invalid.",
"AVT path direct:8 for profile GUEST-AVT-POLICY-DEFAULT in VRF guest is invalid and not active.",
"AVT path direct:10 for profile CONTROL-PLANE-PROFILE in VRF default is invalid and not active.",
"AVT path direct:10 for profile DEFAULT-AVT-POLICY-DEFAULT in VRF default is not active.",
"AVT path direct:8 for profile DEFAULT-AVT-POLICY-DEFAULT in VRF default is invalid and not active.",
"VRF: data Profile: DATA-AVT-POLICY-DEFAULT AVT path: direct:10 - Invalid and not active",
"VRF: data Profile: DATA-AVT-POLICY-DEFAULT AVT path: direct:1 - Not active",
"VRF: guest Profile: GUEST-AVT-POLICY-DEFAULT AVT path: direct:10 - Invalid",
"VRF: guest Profile: GUEST-AVT-POLICY-DEFAULT AVT path: direct:8 - Invalid and not active",
"VRF: default Profile: CONTROL-PLANE-PROFILE AVT path: direct:10 - Invalid and not active",
"VRF: default Profile: DEFAULT-AVT-POLICY-DEFAULT AVT path: direct:10 - Not active",
"VRF: default Profile: DEFAULT-AVT-POLICY-DEFAULT AVT path: direct:8 - Invalid and not active",
],
},
},
@ -444,7 +444,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["AVT MGMT-AVT-POLICY-DEFAULT VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.1) - No AVT path configured"],
"messages": ["AVT: MGMT-AVT-POLICY-DEFAULT VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.1 - No AVT path configured"],
},
},
{
@ -507,8 +507,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"AVT DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.11) Path Type: multihop - Path not found",
"AVT DATA-AVT-POLICY-CONTROL-PLANE VRF: data (Destination: 10.101.255.1, Next-hop: 10.101.255.21) Path Type: direct - Path not found",
"AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.11 Path Type: multihop - Path not found",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.21 Path Type: direct - Path not found",
],
},
},
@ -571,8 +571,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"AVT DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.11) - Path not found",
"AVT DATA-AVT-POLICY-CONTROL-PLANE VRF: data (Destination: 10.101.255.1, Next-hop: 10.101.255.21) - Path not found",
"AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.11 - Path not found",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.21 - Path not found",
],
},
},
@ -646,12 +646,12 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"AVT DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default (Destination: 10.101.255.2, Next-hop: 10.101.255.1) - "
"Incorrect path multihop:3 - Valid: False, Active: True",
"AVT DATA-AVT-POLICY-CONTROL-PLANE VRF: data (Destination: 10.101.255.1, Next-hop: 10.101.255.1) - "
"Incorrect path direct:10 - Valid: False, Active: True",
"AVT DATA-AVT-POLICY-CONTROL-PLANE VRF: data (Destination: 10.101.255.1, Next-hop: 10.101.255.1) - "
"Incorrect path direct:9 - Valid: True, Active: False",
"AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.1 - "
"Incorrect path multihop:3 - Valid: False Active: True",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.1 - "
"Incorrect path direct:10 - Valid: False Active: True",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.1 - "
"Incorrect path direct:9 - Valid: True Active: False",
],
},
},
@ -667,6 +667,6 @@ DATA: list[dict[str, Any]] = [
"test": VerifyAVTRole,
"eos_data": [{"role": "transit"}],
"inputs": {"role": "edge"},
"expected": {"result": "failure", "messages": ["Expected AVT role as `edge`, but found `transit` instead."]},
"expected": {"result": "failure", "messages": ["AVT role mismatch - Expected: edge Actual: transit"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.bfd.py."""
@ -27,6 +27,7 @@ DATA: list[dict[str, Any]] = [
"operTxInterval": 1200000,
"operRxInterval": 1200000,
"detectMult": 3,
"detectTime": 3600000,
}
}
}
@ -42,6 +43,7 @@ DATA: list[dict[str, Any]] = [
"operTxInterval": 1200000,
"operRxInterval": 1200000,
"detectMult": 3,
"detectTime": 3600000,
}
}
}
@ -59,6 +61,55 @@ DATA: list[dict[str, Any]] = [
},
"expected": {"result": "success"},
},
{
"name": "success-detection-time",
"test": VerifyBFDPeersIntervals,
"eos_data": [
{
"vrfs": {
"default": {
"ipv4Neighbors": {
"192.0.255.7": {
"peerStats": {
"": {
"peerStatsDetail": {
"operTxInterval": 1200000,
"operRxInterval": 1200000,
"detectMult": 3,
"detectTime": 3600000,
}
}
}
}
}
},
"MGMT": {
"ipv4Neighbors": {
"192.0.255.70": {
"peerStats": {
"": {
"peerStatsDetail": {
"operTxInterval": 1200000,
"operRxInterval": 1200000,
"detectMult": 3,
"detectTime": 3600000,
}
}
}
}
}
},
}
}
],
"inputs": {
"bfd_peers": [
{"peer_address": "192.0.255.7", "vrf": "default", "tx_interval": 1200, "rx_interval": 1200, "multiplier": 3, "detection_time": 3600},
{"peer_address": "192.0.255.70", "vrf": "MGMT", "tx_interval": 1200, "rx_interval": 1200, "multiplier": 3, "detection_time": 3600},
]
},
"expected": {"result": "success"},
},
{
"name": "failure-no-peer",
"test": VerifyBFDPeersIntervals,
@ -74,6 +125,7 @@ DATA: list[dict[str, Any]] = [
"operTxInterval": 1200000,
"operRxInterval": 1200000,
"detectMult": 3,
"detectTime": 3600000,
}
}
}
@ -89,6 +141,7 @@ DATA: list[dict[str, Any]] = [
"operTxInterval": 1200000,
"operRxInterval": 1200000,
"detectMult": 3,
"detectTime": 3600000,
}
}
}
@ -100,8 +153,8 @@ DATA: list[dict[str, Any]] = [
],
"inputs": {
"bfd_peers": [
{"peer_address": "192.0.255.7", "vrf": "CS", "tx_interval": 1200, "rx_interval": 1200, "multiplier": 3},
{"peer_address": "192.0.255.70", "vrf": "MGMT", "tx_interval": 1200, "rx_interval": 1200, "multiplier": 3},
{"peer_address": "192.0.255.7", "vrf": "CS", "tx_interval": 1200, "rx_interval": 1200, "multiplier": 3, "detection_time": 3600},
{"peer_address": "192.0.255.70", "vrf": "MGMT", "tx_interval": 1200, "rx_interval": 1200, "multiplier": 3, "detection_time": 3600},
]
},
"expected": {
@ -127,6 +180,7 @@ DATA: list[dict[str, Any]] = [
"operTxInterval": 1300000,
"operRxInterval": 1200000,
"detectMult": 4,
"detectTime": 4000000,
}
}
}
@ -142,6 +196,7 @@ DATA: list[dict[str, Any]] = [
"operTxInterval": 120000,
"operRxInterval": 120000,
"detectMult": 5,
"detectTime": 4000000,
}
}
}
@ -168,6 +223,66 @@ DATA: list[dict[str, Any]] = [
],
},
},
{
"name": "failure-incorrect-timers-with-detection-time",
"test": VerifyBFDPeersIntervals,
"eos_data": [
{
"vrfs": {
"default": {
"ipv4Neighbors": {
"192.0.255.7": {
"peerStats": {
"": {
"peerStatsDetail": {
"operTxInterval": 1300000,
"operRxInterval": 1200000,
"detectMult": 4,
"detectTime": 4000000,
}
}
}
}
}
},
"MGMT": {
"ipv4Neighbors": {
"192.0.255.70": {
"peerStats": {
"": {
"peerStatsDetail": {
"operTxInterval": 120000,
"operRxInterval": 120000,
"detectMult": 5,
"detectTime": 4000000,
}
}
}
}
}
},
}
}
],
"inputs": {
"bfd_peers": [
{"peer_address": "192.0.255.7", "vrf": "default", "tx_interval": 1200, "rx_interval": 1200, "multiplier": 3, "detection_time": 3600},
{"peer_address": "192.0.255.70", "vrf": "MGMT", "tx_interval": 1200, "rx_interval": 1200, "multiplier": 3, "detection_time": 3600},
]
},
"expected": {
"result": "failure",
"messages": [
"Peer: 192.0.255.7 VRF: default - Incorrect Transmit interval - Expected: 1200 Actual: 1300",
"Peer: 192.0.255.7 VRF: default - Incorrect Multiplier - Expected: 3 Actual: 4",
"Peer: 192.0.255.7 VRF: default - Incorrect Detection Time - Expected: 3600 Actual: 4000",
"Peer: 192.0.255.70 VRF: MGMT - Incorrect Transmit interval - Expected: 1200 Actual: 120",
"Peer: 192.0.255.70 VRF: MGMT - Incorrect Receive interval - Expected: 1200 Actual: 120",
"Peer: 192.0.255.70 VRF: MGMT - Incorrect Multiplier - Expected: 3 Actual: 5",
"Peer: 192.0.255.70 VRF: MGMT - Incorrect Detection Time - Expected: 3600 Actual: 4000",
],
},
},
{
"name": "success",
"test": VerifyBFDSpecificPeers,
@ -356,7 +471,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": ["No IPv4 BFD peers are configured for any VRF."],
"messages": ["No IPv4 BFD peers are configured for any VRF"],
},
},
{
@ -622,7 +737,7 @@ DATA: list[dict[str, Any]] = [
"result": "failure",
"messages": [
"Peer: 192.0.255.7 VRF: default - `isis` routing protocol(s) not configured",
"Peer: 192.0.255.70 VRF: MGMT - `isis` `ospf` routing protocol(s) not configured",
"Peer: 192.0.255.70 VRF: MGMT - `isis`, `ospf` routing protocol(s) not configured",
],
},
},

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Data for testing anta.tests.configuration."""
@ -58,6 +58,6 @@ DATA: list[dict[str, Any]] = [
"test": VerifyRunningConfigLines,
"eos_data": ["enable password something\nsome other line"],
"inputs": {"regex_patterns": ["bla", "bleh"]},
"expected": {"result": "failure", "messages": ["Following patterns were not found: 'bla','bleh'"]},
"expected": {"result": "failure", "messages": ["Following patterns were not found: 'bla', 'bleh'"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.connectivity.py."""
@ -45,6 +45,63 @@ DATA: list[dict[str, Any]] = [
],
"expected": {"result": "success"},
},
{
"name": "success-expected-unreachable",
"test": VerifyReachability,
"eos_data": [
{
"messages": [
"""PING 10.0.0.1 (10.0.0.1) from 10.0.0.5 : 72(100) bytes of data.
--- 10.0.0.1 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 10ms
""",
],
},
],
"inputs": {"hosts": [{"destination": "10.0.0.1", "source": "10.0.0.5", "reachable": False}]},
"expected": {"result": "success"},
},
{
"name": "success-ipv6",
"test": VerifyReachability,
"eos_data": [
{
"messages": [
"""PING fd12:3456:789a:1::2(fd12:3456:789a:1::2) from fd12:3456:789a:1::1 : 52 data bytes
60 bytes from fd12:3456:789a:1::2: icmp_seq=1 ttl=64 time=0.097 ms
60 bytes from fd12:3456:789a:1::2: icmp_seq=2 ttl=64 time=0.033 ms
--- fd12:3456:789a:1::2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.033/0.065/0.097/0.032 ms, ipg/ewma 0.148/0.089 ms
""",
],
},
],
"inputs": {"hosts": [{"destination": "fd12:3456:789a:1::2", "source": "fd12:3456:789a:1::1"}]},
"expected": {"result": "success"},
},
{
"name": "success-ipv6-vlan",
"test": VerifyReachability,
"eos_data": [
{
"messages": [
"""PING fd12:3456:789a:1::2(fd12:3456:789a:1::2) 52 data bytes
60 bytes from fd12:3456:789a:1::2: icmp_seq=1 ttl=64 time=0.094 ms
60 bytes from fd12:3456:789a:1::2: icmp_seq=2 ttl=64 time=0.027 ms
--- fd12:3456:789a:1::2 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.027/0.060/0.094/0.033 ms, ipg/ewma 0.152/0.085 ms
""",
],
},
],
"inputs": {"hosts": [{"destination": "fd12:3456:789a:1::2", "source": "vl110"}]},
"expected": {"result": "success"},
},
{
"name": "success-interface",
"test": VerifyReachability,
@ -153,7 +210,24 @@ DATA: list[dict[str, Any]] = [
],
},
],
"expected": {"result": "failure", "messages": ["Host 10.0.0.11 (src: 10.0.0.5, vrf: default, size: 100B, repeat: 2) - Unreachable"]},
"expected": {"result": "failure", "messages": ["Host: 10.0.0.11 Source: 10.0.0.5 VRF: default - Unreachable"]},
},
{
"name": "failure-ipv6",
"test": VerifyReachability,
"eos_data": [
{
"messages": [
"""PING fd12:3456:789a:1::2(fd12:3456:789a:1::2) from fd12:3456:789a:1::1 : 52 data bytes
--- fd12:3456:789a:1::3 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 10ms
""",
],
},
],
"inputs": {"hosts": [{"destination": "fd12:3456:789a:1::2", "source": "fd12:3456:789a:1::1"}]},
"expected": {"result": "failure", "messages": ["Host: fd12:3456:789a:1::2 Source: fd12:3456:789a:1::1 VRF: default - Unreachable"]},
},
{
"name": "failure-interface",
@ -187,7 +261,7 @@ DATA: list[dict[str, Any]] = [
],
},
],
"expected": {"result": "failure", "messages": ["Host 10.0.0.11 (src: Management0, vrf: default, size: 100B, repeat: 2) - Unreachable"]},
"expected": {"result": "failure", "messages": ["Host: 10.0.0.11 Source: Management0 VRF: default - Unreachable"]},
},
{
"name": "failure-size",
@ -209,7 +283,31 @@ DATA: list[dict[str, Any]] = [
],
},
],
"expected": {"result": "failure", "messages": ["Host 10.0.0.1 (src: Management0, vrf: default, size: 1501B, repeat: 5, df-bit: enabled) - Unreachable"]},
"expected": {"result": "failure", "messages": ["Host: 10.0.0.1 Source: Management0 VRF: default - Unreachable"]},
},
{
"name": "failure-expected-unreachable",
"test": VerifyReachability,
"eos_data": [
{
"messages": [
"""PING 10.0.0.1 (10.0.0.1) from 10.0.0.5 : 72(100) bytes of data.
80 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.247 ms
80 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.072 ms
--- 10.0.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.072/0.159/0.247/0.088 ms, ipg/ewma 0.370/0.225 ms
""",
],
},
],
"inputs": {"hosts": [{"destination": "10.0.0.1", "source": "10.0.0.5", "reachable": False}]},
"expected": {
"result": "failure",
"messages": ["Host: 10.0.0.1 Source: 10.0.0.5 VRF: default - Destination is expected to be unreachable but found reachable"],
},
},
{
"name": "success",
@ -330,7 +428,7 @@ DATA: list[dict[str, Any]] = [
{"port": "Ethernet2", "neighbor_device": "DC1-SPINE2", "neighbor_port": "Ethernet1"},
],
},
"expected": {"result": "failure", "messages": ["Port Ethernet2 (Neighbor: DC1-SPINE2, Neighbor Port: Ethernet1) - Port not found"]},
"expected": {"result": "failure", "messages": ["Port: Ethernet2 Neighbor: DC1-SPINE2 Neighbor Port: Ethernet1 - Port not found"]},
},
{
"name": "failure-no-neighbor",
@ -363,7 +461,7 @@ DATA: list[dict[str, Any]] = [
{"port": "Ethernet2", "neighbor_device": "DC1-SPINE2", "neighbor_port": "Ethernet1"},
],
},
"expected": {"result": "failure", "messages": ["Port Ethernet2 (Neighbor: DC1-SPINE2, Neighbor Port: Ethernet1) - No LLDP neighbors"]},
"expected": {"result": "failure", "messages": ["Port: Ethernet2 Neighbor: DC1-SPINE2 Neighbor Port: Ethernet1 - No LLDP neighbors"]},
},
{
"name": "failure-wrong-neighbor",
@ -412,7 +510,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["Port Ethernet2 (Neighbor: DC1-SPINE2, Neighbor Port: Ethernet1) - Wrong LLDP neighbors: DC1-SPINE2/Ethernet2"],
"messages": ["Port: Ethernet2 Neighbor: DC1-SPINE2 Neighbor Port: Ethernet1 - Wrong LLDP neighbors: DC1-SPINE2/Ethernet2"],
},
},
{
@ -450,9 +548,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Port Ethernet1 (Neighbor: DC1-SPINE1, Neighbor Port: Ethernet1) - Wrong LLDP neighbors: DC1-SPINE1/Ethernet2",
"Port Ethernet2 (Neighbor: DC1-SPINE2, Neighbor Port: Ethernet1) - No LLDP neighbors",
"Port Ethernet3 (Neighbor: DC1-SPINE3, Neighbor Port: Ethernet1) - Port not found",
"Port: Ethernet1 Neighbor: DC1-SPINE1 Neighbor Port: Ethernet1 - Wrong LLDP neighbors: DC1-SPINE1/Ethernet2",
"Port: Ethernet2 Neighbor: DC1-SPINE2 Neighbor Port: Ethernet1 - No LLDP neighbors",
"Port: Ethernet3 Neighbor: DC1-SPINE3 Neighbor Port: Ethernet1 - Port not found",
],
},
},
@ -498,7 +596,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["Port Ethernet1 (Neighbor: DC1-SPINE3, Neighbor Port: Ethernet1) - Wrong LLDP neighbors: DC1-SPINE1/Ethernet1, DC1-SPINE2/Ethernet1"],
"messages": ["Port: Ethernet1 Neighbor: DC1-SPINE3 Neighbor Port: Ethernet1 - Wrong LLDP neighbors: DC1-SPINE1/Ethernet1, DC1-SPINE2/Ethernet1"],
},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Data for testing anta.tests.cvx."""
@ -60,7 +60,10 @@ DATA: list[dict[str, Any]] = [
"test": VerifyMcsClientMounts,
"eos_data": [{"mountStates": [{"path": "mcs/v1/toSwitch/28-99-3a-8f-93-7b", "type": "Mcs::DeviceConfigV1", "state": "mountStatePreservedUnmounted"}]}],
"inputs": None,
"expected": {"result": "failure", "messages": ["MCS Client mount states are not valid: mountStatePreservedUnmounted"]},
"expected": {
"result": "failure",
"messages": ["MCS Client mount states are not valid - Expected: mountStateMountComplete Actual: mountStatePreservedUnmounted"],
},
},
{
"name": "failure-partial-haclient",
@ -74,7 +77,10 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["MCS Client mount states are not valid: mountStatePreservedUnmounted"]},
"expected": {
"result": "failure",
"messages": ["MCS Client mount states are not valid - Expected: mountStateMountComplete Actual: mountStatePreservedUnmounted"],
},
},
{
"name": "failure-full-haclient",
@ -88,7 +94,10 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["MCS Client mount states are not valid: mountStatePreservedUnmounted"]},
"expected": {
"result": "failure",
"messages": ["MCS Client mount states are not valid - Expected: mountStateMountComplete Actual: mountStatePreservedUnmounted"],
},
},
{
"name": "failure-non-mcs-client",
@ -111,7 +120,10 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["MCS Client mount states are not valid: mountStatePreservedUnmounted"]},
"expected": {
"result": "failure",
"messages": ["MCS Client mount states are not valid - Expected: mountStateMountComplete Actual: mountStatePreservedUnmounted"],
},
},
{
"name": "success-enabled",
@ -140,18 +152,31 @@ DATA: list[dict[str, Any]] = [
"expected": {"result": "success"},
},
{
"name": "failure - no enabled state",
"name": "failure-invalid-state",
"test": VerifyManagementCVX,
"eos_data": [
{
"clusterStatus": {
"enabled": False,
}
}
],
"inputs": {"enabled": True},
"expected": {"result": "failure", "messages": ["Management CVX status is not valid: Expected: enabled Actual: disabled"]},
},
{
"name": "failure-no-enabled state",
"test": VerifyManagementCVX,
"eos_data": [{"clusterStatus": {}}],
"inputs": {"enabled": False},
"expected": {"result": "failure", "messages": ["Management CVX status is not valid: None"]},
"expected": {"result": "failure", "messages": ["Management CVX status - Not configured"]},
},
{
"name": "failure - no clusterStatus",
"test": VerifyManagementCVX,
"eos_data": [{}],
"inputs": {"enabled": False},
"expected": {"result": "failure", "messages": ["Management CVX status is not valid: None"]},
"expected": {"result": "failure", "messages": ["Management CVX status - Not configured"]},
},
{
"name": "success",
@ -189,7 +214,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"connections_count": 1},
"expected": {
"result": "failure",
"messages": ["No mount status for media-leaf-1", "Incorrect CVX successful connections count. Expected: 1, Actual : 0"],
"messages": ["Host: media-leaf-1 - No mount status found", "Incorrect CVX successful connections count - Expected: 1 Actual: 0"],
},
},
{
@ -221,8 +246,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Incorrect number of mount path states for media-leaf-1 - Expected: 3, Actual: 2",
"Unexpected MCS path type for media-leaf-1: 'Mcs::ApiStatus'.",
"Host: media-leaf-1 - Incorrect number of mount path states - Expected: 3 Actual: 2",
"Host: media-leaf-1 - Unexpected MCS path type - Expected: Mcs::ApiConfigRedundancyStatus, Mcs::ActiveFlows, "
"Mcs::Client::Status Actual: Mcs::ApiStatus",
],
},
},
@ -253,7 +279,13 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": {"connections_count": 1},
"expected": {"result": "failure", "messages": ["Unexpected MCS path type for media-leaf-1: 'Mcs::ApiStatus'"]},
"expected": {
"result": "failure",
"messages": [
"Host: media-leaf-1 - Unexpected MCS path type - Expected: Mcs::ApiConfigRedundancyStatus, Mcs::ActiveFlows, Mcs::Client::Status"
" Actual: Mcs::ApiStatus"
],
},
},
{
"name": "failure-invalid-mount-state",
@ -284,7 +316,10 @@ DATA: list[dict[str, Any]] = [
"inputs": {"connections_count": 1},
"expected": {
"result": "failure",
"messages": ["MCS server mount state for path 'Mcs::ApiConfigRedundancyStatus' is not valid is for media-leaf-1: 'mountStateMountFailed'"],
"messages": [
"Host: media-leaf-1 Path Type: Mcs::ApiConfigRedundancyStatus - MCS server mount state is not valid - Expected: mountStateMountComplete"
" Actual:mountStateMountFailed"
],
},
},
{
@ -306,14 +341,14 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": {"connections_count": 1},
"expected": {"result": "failure", "messages": ["MCS mount state not detected", "Incorrect CVX successful connections count. Expected: 1, Actual : 0"]},
"expected": {"result": "failure", "messages": ["MCS mount state not detected", "Incorrect CVX successful connections count - Expected: 1 Actual: 0"]},
},
{
"name": "failure-connections",
"test": VerifyMcsServerMounts,
"eos_data": [{}],
"inputs": {"connections_count": 1},
"expected": {"result": "failure", "messages": ["CVX connections are not available."]},
"expected": {"result": "failure", "messages": ["CVX connections are not available"]},
},
{
"name": "success",
@ -357,7 +392,7 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": {"connections_count": 2},
"expected": {"result": "failure", "messages": ["CVX active connections count. Expected: 2, Actual : 1"]},
"expected": {"result": "failure", "messages": ["CVX active connections count - Expected: 2 Actual: 1"]},
},
{
"name": "failure-no-connections",
@ -414,7 +449,7 @@ DATA: list[dict[str, Any]] = [
{"peer_name": "cvx-red-3", "registrationState": "Registration complete"},
],
},
"expected": {"result": "failure", "messages": ["CVX Role is not valid: Standby"]},
"expected": {"result": "failure", "messages": ["CVX Role is not valid: Expected: Master Actual: Standby"]},
},
{
"name": "failure-cvx-enabled",
@ -473,7 +508,7 @@ DATA: list[dict[str, Any]] = [
{"peer_name": "cvx-red-3", "registrationState": "Registration complete"},
],
},
"expected": {"result": "failure", "messages": ["Unexpected number of peers 1 vs 2", "cvx-red-3 is not present"]},
"expected": {"result": "failure", "messages": ["Unexpected number of peers - Expected: 2 Actual: 1", "cvx-red-3 - Not present"]},
},
{
"name": "failure-invalid-peers",
@ -495,7 +530,7 @@ DATA: list[dict[str, Any]] = [
{"peer_name": "cvx-red-3", "registrationState": "Registration complete"},
],
},
"expected": {"result": "failure", "messages": ["Unexpected number of peers 0 vs 2", "cvx-red-2 is not present", "cvx-red-3 is not present"]},
"expected": {"result": "failure", "messages": ["Unexpected number of peers - Expected: 2 Actual: 0", "cvx-red-2 - Not present", "cvx-red-3 - Not present"]},
},
{
"name": "failure-registration-error",
@ -520,6 +555,6 @@ DATA: list[dict[str, Any]] = [
{"peer_name": "cvx-red-3", "registrationState": "Registration complete"},
],
},
"expected": {"result": "failure", "messages": ["cvx-red-2 registration state is not complete: Registration error"]},
"expected": {"result": "failure", "messages": ["cvx-red-2 - Invalid registration state - Expected: Registration complete Actual: Registration error"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Test inputs for anta.tests.field_notices."""
@ -45,7 +45,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": ["device is running incorrect version of aboot (4.0.1)"],
"messages": ["Device is running incorrect version of aboot 4.0.1"],
},
},
{
@ -65,7 +65,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": ["device is running incorrect version of aboot (4.1.0)"],
"messages": ["Device is running incorrect version of aboot 4.1.0"],
},
},
{
@ -85,7 +85,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": ["device is running incorrect version of aboot (6.0.1)"],
"messages": ["Device is running incorrect version of aboot 6.0.1"],
},
},
{
@ -105,7 +105,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": ["device is running incorrect version of aboot (6.1.1)"],
"messages": ["Device is running incorrect version of aboot 6.1.1"],
},
},
{
@ -125,7 +125,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "skipped",
"messages": ["device is not impacted by FN044"],
"messages": ["Device is not impacted by FN044"],
},
},
{

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Test inputs for anta.tests.flow_tracking."""
@ -22,18 +22,13 @@ DATA: list[dict[str, Any]] = [
"inactiveTimeout": 60000,
"activeInterval": 300000,
"exporters": {"CV-TELEMETRY": {"localIntf": "Loopback0", "templateInterval": 3600000}},
}
},
"running": True,
},
{
"trackers": {
},
"HARDWARE-TRACKER": {
"active": True,
"inactiveTimeout": 60000,
"activeInterval": 300000,
"exporters": {"CV-TELEMETRY": {"localIntf": "Loopback0", "templateInterval": 3600000}},
}
},
},
"running": True,
},
@ -52,18 +47,13 @@ DATA: list[dict[str, Any]] = [
"inactiveTimeout": 60000,
"activeInterval": 300000,
"exporters": {"CV-TELEMETRY": {"localIntf": "Loopback0", "templateInterval": 3600000}},
}
},
"running": True,
},
{
"trackers": {
},
"HARDWARE-TRACKER": {
"active": True,
"inactiveTimeout": 60000,
"activeInterval": 300000,
"exporters": {"CVP-TELEMETRY": {"localIntf": "Loopback10", "templateInterval": 3600000}},
}
},
},
"running": True,
},
@ -113,7 +103,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"trackers": [{"name": "FLOW-Sample"}]},
"expected": {
"result": "failure",
"messages": ["Hardware flow tracker `FLOW-Sample` is not configured."],
"messages": ["Flow Tracker: FLOW-Sample - Not found"],
},
},
{
@ -127,18 +117,13 @@ DATA: list[dict[str, Any]] = [
"inactiveTimeout": 60000,
"activeInterval": 300000,
"exporters": {"CV-TELEMETRY": {"localIntf": "Loopback0", "templateInterval": 3600000}},
}
},
"running": True,
},
{
"trackers": {
},
"HARDWARE-TRACKER": {
"active": False,
"inactiveTimeout": 60000,
"activeInterval": 300000,
"exporters": {"CVP-TELEMETRY": {"localIntf": "Loopback10", "templateInterval": 3600000}},
}
},
},
"running": True,
},
@ -159,7 +144,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["Hardware flow tracker `FLOW-TRACKER` is not active.", "Hardware flow tracker `HARDWARE-TRACKER` is not active."],
"messages": ["Flow Tracker: FLOW-TRACKER - Disabled", "Flow Tracker: HARDWARE-TRACKER - Disabled"],
},
},
{
@ -173,18 +158,13 @@ DATA: list[dict[str, Any]] = [
"inactiveTimeout": 60000,
"activeInterval": 300000,
"exporters": {"CV-TELEMETRY": {"localIntf": "Loopback0", "templateInterval": 3600000}},
}
},
"running": True,
},
{
"trackers": {
},
"HARDWARE-TRACKER": {
"active": True,
"inactiveTimeout": 6000,
"activeInterval": 30000,
"exporters": {"CVP-TELEMETRY": {"localIntf": "Loopback10", "templateInterval": 3600000}},
}
},
},
"running": True,
},
@ -204,10 +184,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"FLOW-TRACKER: \n"
"Expected `6000` as the inactive timeout, but found `60000` instead.\nExpected `30000` as the interval, but found `300000` instead.\n",
"HARDWARE-TRACKER: \n"
"Expected `60000` as the inactive timeout, but found `6000` instead.\nExpected `300000` as the interval, but found `30000` instead.\n",
"Flow Tracker: FLOW-TRACKER Inactive Timeout: 6000 Active Interval: 30000 - Incorrect timers - Inactive Timeout: 60000 OnActive Interval: 300000",
"Flow Tracker: HARDWARE-TRACKER Inactive Timeout: 60000 Active Interval: 300000 - Incorrect timers - "
"Inactive Timeout: 6000 OnActive Interval: 30000",
],
},
},
@ -225,12 +204,7 @@ DATA: list[dict[str, Any]] = [
"CV-TELEMETRY": {"localIntf": "Loopback0", "templateInterval": 3600000},
"CVP-FLOW": {"localIntf": "Loopback0", "templateInterval": 3600000},
},
}
},
"running": True,
},
{
"trackers": {
},
"HARDWARE-TRACKER": {
"active": True,
"inactiveTimeout": 6000,
@ -239,7 +213,7 @@ DATA: list[dict[str, Any]] = [
"CVP-TELEMETRY": {"localIntf": "Loopback10", "templateInterval": 3600000},
"Hardware-flow": {"localIntf": "Loopback10", "templateInterval": 3600000},
},
}
},
},
"running": True,
},
@ -265,15 +239,11 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"FLOW-TRACKER: \n"
"Exporter `CVP-FLOW`: \n"
"Expected `Loopback10` as the local interface, but found `Loopback0` instead.\n"
"Expected `3500000` as the template interval, but found `3600000` instead.\n",
"HARDWARE-TRACKER: \n"
"Exporter `Hardware-flow`: \n"
"Expected `Loopback99` as the local interface, but found `Loopback10` instead.\n"
"Expected `3000000` as the template interval, but found `3600000` instead.\n"
"Exporter `Reverse-flow` is not configured.\n",
"Flow Tracker: FLOW-TRACKER Exporter: CVP-FLOW - Incorrect local interface - Expected: Loopback10 Actual: Loopback0",
"Flow Tracker: FLOW-TRACKER Exporter: CVP-FLOW - Incorrect template interval - Expected: 3500000 Actual: 3600000",
"Flow Tracker: HARDWARE-TRACKER Exporter: Hardware-flow - Incorrect local interface - Expected: Loopback99 Actual: Loopback10",
"Flow Tracker: HARDWARE-TRACKER Exporter: Hardware-flow - Incorrect template interval - Expected: 3000000 Actual: 3600000",
"Flow Tracker: HARDWARE-TRACKER Exporter: Reverse-flow - Not configured",
],
},
},
@ -288,34 +258,19 @@ DATA: list[dict[str, Any]] = [
"inactiveTimeout": 60000,
"activeInterval": 300000,
"exporters": {"CVP-TELEMETRY": {"localIntf": "Loopback10", "templateInterval": 3600000}},
}
},
"running": True,
},
{
"trackers": {
},
"FLOW-TRIGGER": {
"active": False,
"inactiveTimeout": 60000,
"activeInterval": 300000,
"exporters": {"CV-TELEMETRY": {"localIntf": "Loopback0", "templateInterval": 3600000}},
}
},
"running": True,
},
{
"trackers": {
},
"HARDWARE-FLOW": {
"active": True,
"inactiveTimeout": 6000,
"activeInterval": 30000,
"exporters": {"CVP-TELEMETRY": {"localIntf": "Loopback10", "templateInterval": 3600000}},
}
},
"running": True,
},
{
"trackers": {
},
"FLOW-TRACKER2": {
"active": True,
"inactiveTimeout": 60000,
@ -324,12 +279,7 @@ DATA: list[dict[str, Any]] = [
"CV-TELEMETRY": {"localIntf": "Loopback0", "templateInterval": 3600000},
"CVP-FLOW": {"localIntf": "Loopback0", "templateInterval": 3600000},
},
}
},
"running": True,
},
{
"trackers": {
},
"HARDWARE-TRACKER2": {
"active": True,
"inactiveTimeout": 6000,
@ -338,7 +288,7 @@ DATA: list[dict[str, Any]] = [
"CVP-TELEMETRY": {"localIntf": "Loopback10", "templateInterval": 3600000},
"Hardware-flow": {"localIntf": "Loopback10", "templateInterval": 3600000},
},
}
},
},
"running": True,
},
@ -374,17 +324,14 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Hardware flow tracker `FLOW-Sample` is not configured.",
"Hardware flow tracker `FLOW-TRIGGER` is not active.",
"HARDWARE-FLOW: \n"
"Expected `60000` as the inactive timeout, but found `6000` instead.\nExpected `300000` as the interval, but found `30000` instead.\n",
"FLOW-TRACKER2: \nExporter `CVP-FLOW`: \n"
"Expected `Loopback10` as the local interface, but found `Loopback0` instead.\n"
"Expected `3500000` as the template interval, but found `3600000` instead.\n",
"HARDWARE-TRACKER2: \nExporter `Hardware-flow`: \n"
"Expected `Loopback99` as the local interface, but found `Loopback10` instead.\n"
"Expected `3000000` as the template interval, but found `3600000` instead.\n"
"Exporter `Reverse-flow` is not configured.\n",
"Flow Tracker: FLOW-Sample - Not found",
"Flow Tracker: FLOW-TRIGGER - Disabled",
"Flow Tracker: HARDWARE-FLOW Inactive Timeout: 60000 Active Interval: 300000 - Incorrect timers - Inactive Timeout: 6000 OnActive Interval: 30000",
"Flow Tracker: FLOW-TRACKER2 Exporter: CVP-FLOW - Incorrect local interface - Expected: Loopback10 Actual: Loopback0",
"Flow Tracker: FLOW-TRACKER2 Exporter: CVP-FLOW - Incorrect template interval - Expected: 3500000 Actual: 3600000",
"Flow Tracker: HARDWARE-TRACKER2 Exporter: Hardware-flow - Incorrect local interface - Expected: Loopback99 Actual: Loopback10",
"Flow Tracker: HARDWARE-TRACKER2 Exporter: Hardware-flow - Incorrect template interval - Expected: 3000000 Actual: 3600000",
"Flow Tracker: HARDWARE-TRACKER2 Exporter: Reverse-flow - Not configured",
],
},
},

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Data for testing anta.tests.configuration."""

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Test inputs for anta.tests.hardware."""
@ -45,7 +45,13 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"manufacturers": ["Arista"]},
"expected": {"result": "failure", "messages": ["Some transceivers are from unapproved manufacturers: {'1': 'Arista Networks', '2': 'Arista Networks'}"]},
"expected": {
"result": "failure",
"messages": [
"Interface: 1 - Transceiver is from unapproved manufacturers - Expected: Arista Actual: Arista Networks",
"Interface: 2 - Transceiver is from unapproved manufacturers - Expected: Arista Actual: Arista Networks",
],
},
},
{
"name": "success",
@ -72,12 +78,12 @@ DATA: list[dict[str, Any]] = [
"ambientThreshold": 45,
"cardSlots": [],
"shutdownOnOverheat": "True",
"systemStatus": "temperatureKO",
"systemStatus": "temperatureCritical",
"recoveryModeOnOverheat": "recoveryModeNA",
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["Device temperature exceeds acceptable limits. Current system status: 'temperatureKO'"]},
"expected": {"result": "failure", "messages": ["Device temperature exceeds acceptable limits - Expected: temperatureOk Actual: temperatureCritical"]},
},
{
"name": "success",
@ -139,11 +145,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"The following sensors are operating outside the acceptable temperature range or have raised alerts: "
"{'DomTemperatureSensor54': "
"{'hwStatus': 'ko', 'alertCount': 0}}",
],
"messages": ["Sensor: DomTemperatureSensor54 - Invalid hardware state - Expected: ok Actual: ko"],
},
},
{
@ -176,11 +178,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"The following sensors are operating outside the acceptable temperature range or have raised alerts: "
"{'DomTemperatureSensor54': "
"{'hwStatus': 'ok', 'alertCount': 1}}",
],
"messages": ["Sensor: DomTemperatureSensor54 - Incorrect alert counter - Expected: 0 Actual: 1"],
},
},
{
@ -227,7 +225,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["Device system cooling is not OK: 'coolingKo'"]},
"expected": {"result": "failure", "messages": ["Device system cooling status invalid - Expected: coolingOk Actual: coolingKo"]},
},
{
"name": "success",
@ -626,7 +624,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"states": ["ok", "Not Inserted"]},
"expected": {"result": "failure", "messages": ["Fan 1/1 on Fan Tray 1 is: 'down'"]},
"expected": {"result": "failure", "messages": ["Fan Tray: 1 Fan: 1/1 - Invalid state - Expected: ok, Not Inserted Actual: down"]},
},
{
"name": "failure-power-supply",
@ -759,7 +757,12 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"states": ["ok", "Not Inserted"]},
"expected": {"result": "failure", "messages": ["Fan PowerSupply1/1 on PowerSupply PowerSupply1 is: 'down'"]},
"expected": {
"result": "failure",
"messages": [
"Power Slot: PowerSupply1 Fan: PowerSupply1/1 - Invalid state - Expected: ok, Not Inserted Actual: down",
],
},
},
{
"name": "success",
@ -900,7 +903,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"states": ["ok"]},
"expected": {"result": "failure", "messages": ["The following power supplies status are not in the accepted states list: {'1': {'state': 'powerLoss'}}"]},
"expected": {"result": "failure", "messages": ["Power Slot: 1 - Invalid power supplies state - Expected: ok Actual: powerLoss"]},
},
{
"name": "success",
@ -914,6 +917,6 @@ DATA: list[dict[str, Any]] = [
"test": VerifyAdverseDrops,
"eos_data": [{"totalAdverseDrops": 10}],
"inputs": None,
"expected": {"result": "failure", "messages": ["Device totalAdverseDrops counter is: '10'"]},
"expected": {"result": "failure", "messages": ["Incorrect total adverse drops counter - Expected: 0 Actual: 10"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Test inputs for anta.tests.interfaces."""
@ -508,7 +508,10 @@ DATA: list[dict[str, Any]] = [
"inputs": {"threshold": 3.0},
"expected": {
"result": "failure",
"messages": ["The following interfaces have a usage > 3.0%: {'Ethernet1/1': {'inBpsRate': 10.0}, 'Port-Channel31': {'outBpsRate': 5.0}}"],
"messages": [
"Interface: Ethernet1/1 BPS Rate: inBpsRate - Usage exceeds the threshold - Expected: < 3.0% Actual: 10.0%",
"Interface: Port-Channel31 BPS Rate: outBpsRate - Usage exceeds the threshold - Expected: < 3.0% Actual: 5.0%",
],
},
},
{
@ -653,7 +656,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"threshold": 70.0},
"expected": {
"result": "failure",
"messages": ["Interface Ethernet1/1 or one of its member interfaces is not Full-Duplex. VerifyInterfaceUtilization has not been implemented."],
"messages": ["Interface Ethernet1/1 or one of its member interfaces is not Full-Duplex. VerifyInterfaceUtilization has not been implemented"],
},
},
{
@ -787,7 +790,7 @@ DATA: list[dict[str, Any]] = [
},
"memberInterfaces": {
"Ethernet3/1": {"bandwidth": 1000000000, "duplex": "duplexHalf"},
"Ethernet4/1": {"bandwidth": 1000000000, "duplex": "duplexFull"},
"Ethernet4/1": {"bandwidth": 1000000000, "duplex": "duplexHalf"},
},
"fallbackEnabled": False,
"fallbackEnabledType": "fallbackNone",
@ -798,7 +801,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"threshold": 70.0},
"expected": {
"result": "failure",
"messages": ["Interface Port-Channel31 or one of its member interfaces is not Full-Duplex. VerifyInterfaceUtilization has not been implemented."],
"messages": ["Interface Port-Channel31 or one of its member interfaces is not Full-Duplex. VerifyInterfaceUtilization has not been implemented"],
},
},
{
@ -830,9 +833,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"The following interface(s) have non-zero error counters: [{'Ethernet1': {'inErrors': 42, 'frameTooLongs': 0, 'outErrors': 0, 'frameTooShorts': 0,"
" 'fcsErrors': 0, 'alignmentErrors': 0, 'symbolErrors': 0}}, {'Ethernet6': {'inErrors': 0, 'frameTooLongs': 0, 'outErrors': 0, 'frameTooShorts':"
" 0, 'fcsErrors': 0, 'alignmentErrors': 666, 'symbolErrors': 0}}]",
"Interface: Ethernet1 - Non-zero error counter(s) - inErrors: 42",
"Interface: Ethernet6 - Non-zero error counter(s) - alignmentErrors: 666",
],
},
},
@ -851,9 +853,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"The following interface(s) have non-zero error counters: [{'Ethernet1': {'inErrors': 42, 'frameTooLongs': 0, 'outErrors': 10, 'frameTooShorts': 0,"
" 'fcsErrors': 0, 'alignmentErrors': 0, 'symbolErrors': 0}}, {'Ethernet6': {'inErrors': 0, 'frameTooLongs': 0, 'outErrors': 0, 'frameTooShorts':"
" 0, 'fcsErrors': 0, 'alignmentErrors': 6, 'symbolErrors': 10}}]",
"Interface: Ethernet1 - Non-zero error counter(s) - inErrors: 42, outErrors: 10",
"Interface: Ethernet6 - Non-zero error counter(s) - alignmentErrors: 6, symbolErrors: 10",
],
},
},
@ -870,10 +871,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"The following interface(s) have non-zero error counters: [{'Ethernet1': {'inErrors': 42, 'frameTooLongs': 0, 'outErrors': 2, 'frameTooShorts': 0,"
" 'fcsErrors': 0, 'alignmentErrors': 0, 'symbolErrors': 0}}]",
],
"messages": ["Interface: Ethernet1 - Non-zero error counter(s) - inErrors: 42, outErrors: 2"],
},
},
{
@ -909,8 +907,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"The following interfaces have non 0 discard counter(s): [{'Ethernet2': {'outDiscards': 42, 'inDiscards': 0}},"
" {'Ethernet1': {'outDiscards': 0, 'inDiscards': 42}}]",
"Interface: Ethernet2 - Non-zero discard counter(s): outDiscards: 42",
"Interface: Ethernet1 - Non-zero discard counter(s): inDiscards: 42",
],
},
},
@ -948,7 +946,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["The following interfaces are in error disabled state: ['Management1', 'Ethernet8']"]},
"expected": {"result": "failure", "messages": ["Interface: Management1 - Link status Error disabled", "Interface: Ethernet8 - Link status Error disabled"]},
},
{
"name": "success",
@ -1126,7 +1124,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"interfaces": [{"name": "Ethernet2", "status": "up"}, {"name": "Ethernet8", "status": "up"}, {"name": "Ethernet3", "status": "up"}]},
"expected": {
"result": "failure",
"messages": ["Ethernet8 - Expected: up/up, Actual: down/down"],
"messages": ["Ethernet8 - Status mismatch - Expected: up/up, Actual: down/down"],
},
},
{
@ -1150,7 +1148,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["Ethernet8 - Expected: up/up, Actual: up/down"],
"messages": ["Ethernet8 - Status mismatch - Expected: up/up, Actual: up/down"],
},
},
{
@ -1166,7 +1164,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"interfaces": [{"name": "PortChannel100", "status": "up"}]},
"expected": {
"result": "failure",
"messages": ["Port-Channel100 - Expected: up/up, Actual: down/lowerLayerDown"],
"messages": ["Port-Channel100 - Status mismatch - Expected: up/up, Actual: down/lowerLayerDown"],
},
},
{
@ -1191,8 +1189,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Ethernet2 - Expected: up/down, Actual: up/unknown",
"Ethernet8 - Expected: up/up, Actual: up/down",
"Ethernet2 - Status mismatch - Expected: up/down, Actual: up/unknown",
"Ethernet8 - Status mismatch - Expected: up/up, Actual: up/down",
],
},
},
@ -1218,9 +1216,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Ethernet2 - Expected: down, Actual: up",
"Ethernet8 - Expected: down, Actual: up",
"Ethernet3 - Expected: down, Actual: up",
"Ethernet2 - Status mismatch - Expected: down, Actual: up",
"Ethernet8 - Status mismatch - Expected: down, Actual: up",
"Ethernet3 - Status mismatch - Expected: down, Actual: up",
],
},
},
@ -1260,7 +1258,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["The following interfaces have none 0 storm-control drop counters {'Ethernet1': {'broadcast': 666}}"]},
"expected": {"result": "failure", "messages": ["Interface: Ethernet1 - Non-zero storm-control drop counter(s) - broadcast: 666"]},
},
{
"name": "success",
@ -1306,7 +1304,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["The following port-channels have inactive port(s): ['Port-Channel42']"]},
"expected": {"result": "failure", "messages": ["Port-Channel42 - Inactive port(s) - Ethernet8"]},
},
{
"name": "success",
@ -1362,7 +1360,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": ["The following port-channels have received illegal LACP packets on the following ports: [{'Port-Channel42': 'Ethernet8'}]"],
"messages": ["Port-Channel42 Interface: Ethernet8 - Illegal LACP packets found"],
},
},
{
@ -1417,7 +1415,7 @@ DATA: list[dict[str, Any]] = [
},
"Loopback666": {
"name": "Loopback666",
"interfaceStatus": "connected",
"interfaceStatus": "notconnect",
"interfaceAddress": {"ipAddr": {"maskLen": 32, "address": "6.6.6.6"}},
"ipv4Routable240": False,
"lineProtocolStatus": "down",
@ -1427,7 +1425,13 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"number": 2},
"expected": {"result": "failure", "messages": ["The following Loopbacks are not up: ['Loopback666']"]},
"expected": {
"result": "failure",
"messages": [
"Interface: Loopback666 - Invalid line protocol status - Expected: up Actual: down",
"Interface: Loopback666 - Invalid interface status - Expected: connected Actual: notconnect",
],
},
},
{
"name": "failure-count-loopback",
@ -1447,7 +1451,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"number": 2},
"expected": {"result": "failure", "messages": ["Found 1 Loopbacks when expecting 2"]},
"expected": {"result": "failure", "messages": ["Loopback interface(s) count mismatch: Expected 2 Actual: 1"]},
},
{
"name": "success",
@ -1487,7 +1491,13 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["The following SVIs are not up: ['Vlan42']"]},
"expected": {
"result": "failure",
"messages": [
"SVI: Vlan42 - Invalid line protocol status - Expected: up Actual: lowerLayerDown",
"SVI: Vlan42 - Invalid interface status - Expected: connected Actual: notconnect",
],
},
},
{
"name": "success",
@ -1703,7 +1713,79 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"mtu": 1500},
"expected": {"result": "failure", "messages": ["Some interfaces do not have correct MTU configured:\n[{'Ethernet2': 1600}]"]},
"expected": {"result": "failure", "messages": ["Interface: Ethernet2 - Incorrect MTU - Expected: 1500 Actual: 1600"]},
},
{
"name": "failure-specified-interface-mtu",
"test": VerifyL3MTU,
"eos_data": [
{
"interfaces": {
"Ethernet2": {
"name": "Ethernet2",
"forwardingModel": "routed",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"hardware": "ethernet",
"mtu": 1500,
"l3MtuConfigured": True,
"l2Mru": 0,
},
"Ethernet10": {
"name": "Ethernet10",
"forwardingModel": "routed",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"hardware": "ethernet",
"mtu": 1502,
"l3MtuConfigured": False,
"l2Mru": 0,
},
"Management0": {
"name": "Management0",
"forwardingModel": "routed",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"hardware": "ethernet",
"mtu": 1500,
"l3MtuConfigured": False,
"l2Mru": 0,
},
"Port-Channel2": {
"name": "Port-Channel2",
"forwardingModel": "bridged",
"lineProtocolStatus": "lowerLayerDown",
"interfaceStatus": "notconnect",
"hardware": "portChannel",
"mtu": 1500,
"l3MtuConfigured": False,
"l2Mru": 0,
},
"Loopback0": {
"name": "Loopback0",
"forwardingModel": "routed",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"hardware": "loopback",
"mtu": 65535,
"l3MtuConfigured": False,
"l2Mru": 0,
},
"Vxlan1": {
"name": "Vxlan1",
"forwardingModel": "bridged",
"lineProtocolStatus": "down",
"interfaceStatus": "notconnect",
"hardware": "vxlan",
"mtu": 0,
"l3MtuConfigured": False,
"l2Mru": 0,
},
},
},
],
"inputs": {"mtu": 1500, "ignored_interfaces": ["Loopback", "Port-Channel", "Management", "Vxlan"], "specific_mtu": [{"Ethernet10": 1501}]},
"expected": {"result": "failure", "messages": ["Interface: Ethernet10 - Incorrect MTU - Expected: 1501 Actual: 1502"]},
},
{
"name": "success",
@ -1847,7 +1929,85 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"mtu": 1500},
"expected": {"result": "failure", "messages": ["Some L2 interfaces do not have correct MTU configured:\n[{'Ethernet10': 9214}, {'Port-Channel2': 9214}]"]},
"expected": {
"result": "failure",
"messages": [
"Interface: Ethernet10 - Incorrect MTU configured - Expected: 1500 Actual: 9214",
"Interface: Port-Channel2 - Incorrect MTU configured - Expected: 1500 Actual: 9214",
],
},
},
{
"name": "failure-specific-interface",
"test": VerifyL2MTU,
"eos_data": [
{
"interfaces": {
"Ethernet2": {
"name": "Ethernet2",
"forwardingModel": "routed",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"hardware": "ethernet",
"mtu": 1600,
"l3MtuConfigured": True,
"l2Mru": 0,
},
"Ethernet10": {
"name": "Ethernet10",
"forwardingModel": "bridged",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"hardware": "ethernet",
"mtu": 9214,
"l3MtuConfigured": False,
"l2Mru": 0,
},
"Management0": {
"name": "Management0",
"forwardingModel": "routed",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"hardware": "ethernet",
"mtu": 1500,
"l3MtuConfigured": False,
"l2Mru": 0,
},
"Port-Channel2": {
"name": "Port-Channel2",
"forwardingModel": "bridged",
"lineProtocolStatus": "lowerLayerDown",
"interfaceStatus": "notconnect",
"hardware": "portChannel",
"mtu": 9214,
"l3MtuConfigured": False,
"l2Mru": 0,
},
"Loopback0": {
"name": "Loopback0",
"forwardingModel": "routed",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"hardware": "loopback",
"mtu": 65535,
"l3MtuConfigured": False,
"l2Mru": 0,
},
"Vxlan1": {
"name": "Vxlan1",
"forwardingModel": "bridged",
"lineProtocolStatus": "down",
"interfaceStatus": "notconnect",
"hardware": "vxlan",
"mtu": 0,
"l3MtuConfigured": False,
"l2Mru": 0,
},
},
},
],
"inputs": {"specific_mtu": [{"Et10": 9214}, {"Port-Channel2": 10000}]},
"expected": {"result": "failure", "messages": ["Interface: Port-Channel2 - Incorrect MTU configured - Expected: 10000 Actual: 9214"]},
},
{
"name": "success",
@ -1859,45 +2019,13 @@ DATA: list[dict[str, Any]] = [
"name": "Ethernet1",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"mtu": 1500,
"interfaceAddressBrief": {"ipAddr": {"address": "10.1.0.0", "maskLen": 31}},
"ipv4Routable240": False,
"ipv4Routable0": False,
"enabled": True,
"description": "P2P_LINK_TO_NW-CORE_Ethernet1",
"proxyArp": True,
"localProxyArp": False,
"gratuitousArp": False,
"vrf": "default",
"urpf": "disable",
"addresslessForwarding": "isInvalid",
"directedBroadcastEnabled": False,
"maxMssIngress": 0,
"maxMssEgress": 0,
},
},
},
{
"interfaces": {
"Ethernet2": {
"name": "Ethernet2",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"mtu": 1500,
"interfaceAddressBrief": {"ipAddr": {"address": "10.1.0.2", "maskLen": 31}},
"ipv4Routable240": False,
"ipv4Routable0": False,
"enabled": True,
"description": "P2P_LINK_TO_SW-CORE_Ethernet1",
"proxyArp": True,
"localProxyArp": False,
"gratuitousArp": False,
"vrf": "default",
"urpf": "disable",
"addresslessForwarding": "isInvalid",
"directedBroadcastEnabled": False,
"maxMssIngress": 0,
"maxMssEgress": 0,
},
},
},
@ -1905,6 +2033,24 @@ DATA: list[dict[str, Any]] = [
"inputs": {"interfaces": ["Ethernet1", "Ethernet2"]},
"expected": {"result": "success"},
},
{
"name": "failure-interface-not-found",
"test": VerifyIPProxyARP,
"eos_data": [
{
"interfaces": {
"Ethernet1": {
"name": "Ethernet1",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"proxyArp": True,
},
},
},
],
"inputs": {"interfaces": ["Ethernet1", "Ethernet2"]},
"expected": {"result": "failure", "messages": ["Interface: Ethernet2 - Not found"]},
},
{
"name": "failure",
"test": VerifyIPProxyARP,
@ -1915,51 +2061,19 @@ DATA: list[dict[str, Any]] = [
"name": "Ethernet1",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"mtu": 1500,
"interfaceAddressBrief": {"ipAddr": {"address": "10.1.0.0", "maskLen": 31}},
"ipv4Routable240": False,
"ipv4Routable0": False,
"enabled": True,
"description": "P2P_LINK_TO_NW-CORE_Ethernet1",
"proxyArp": True,
"localProxyArp": False,
"gratuitousArp": False,
"vrf": "default",
"urpf": "disable",
"addresslessForwarding": "isInvalid",
"directedBroadcastEnabled": False,
"maxMssIngress": 0,
"maxMssEgress": 0,
},
},
},
{
"interfaces": {
"Ethernet2": {
"name": "Ethernet2",
"lineProtocolStatus": "up",
"interfaceStatus": "connected",
"mtu": 1500,
"interfaceAddressBrief": {"ipAddr": {"address": "10.1.0.2", "maskLen": 31}},
"ipv4Routable240": False,
"ipv4Routable0": False,
"enabled": True,
"description": "P2P_LINK_TO_SW-CORE_Ethernet1",
"proxyArp": False,
"localProxyArp": False,
"gratuitousArp": False,
"vrf": "default",
"urpf": "disable",
"addresslessForwarding": "isInvalid",
"directedBroadcastEnabled": False,
"maxMssIngress": 0,
"maxMssEgress": 0,
},
},
},
],
"inputs": {"interfaces": ["Ethernet1", "Ethernet2"]},
"expected": {"result": "failure", "messages": ["The following interface(s) have Proxy-ARP disabled: ['Ethernet2']"]},
"expected": {"result": "failure", "messages": ["Interface: Ethernet2 - Proxy-ARP disabled"]},
},
{
"name": "success",
@ -1972,17 +2086,13 @@ DATA: list[dict[str, Any]] = [
"primaryIp": {"address": "172.30.11.1", "maskLen": 31},
"secondaryIpsOrderedList": [{"address": "10.10.10.1", "maskLen": 31}, {"address": "10.10.10.10", "maskLen": 31}],
}
}
}
},
{
"interfaces": {
},
"Ethernet12": {
"interfaceAddress": {
"primaryIp": {"address": "172.30.11.10", "maskLen": 31},
"secondaryIpsOrderedList": [{"address": "10.10.10.10", "maskLen": 31}, {"address": "10.10.10.20", "maskLen": 31}],
}
}
},
}
},
],
@ -2005,17 +2115,13 @@ DATA: list[dict[str, Any]] = [
"primaryIp": {"address": "172.30.11.0", "maskLen": 31},
"secondaryIpsOrderedList": [],
}
}
}
},
{
"interfaces": {
},
"Ethernet12": {
"interfaceAddress": {
"primaryIp": {"address": "172.30.11.10", "maskLen": 31},
"secondaryIpsOrderedList": [],
}
}
},
}
},
],
@ -2028,9 +2134,20 @@ DATA: list[dict[str, Any]] = [
"expected": {"result": "success"},
},
{
"name": "failure-not-l3-interface",
"name": "failure-interface-not-found",
"test": VerifyInterfaceIPv4,
"eos_data": [{"interfaces": {"Ethernet2": {"interfaceAddress": {}}}}, {"interfaces": {"Ethernet12": {"interfaceAddress": {}}}}],
"eos_data": [
{
"interfaces": {
"Ethernet10": {
"interfaceAddress": {
"primaryIp": {"address": "172.30.11.0", "maskLen": 31},
"secondaryIpsOrderedList": [],
}
}
}
}
],
"inputs": {
"interfaces": [
{"name": "Ethernet2", "primary_ip": "172.30.11.0/31", "secondary_ips": ["10.10.10.0/31", "10.10.10.10/31"]},
@ -2039,7 +2156,22 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["For interface `Ethernet2`, IP address is not configured.", "For interface `Ethernet12`, IP address is not configured."],
"messages": ["Interface: Ethernet2 - Not found", "Interface: Ethernet12 - Not found"],
},
},
{
"name": "failure-not-l3-interface",
"test": VerifyInterfaceIPv4,
"eos_data": [{"interfaces": {"Ethernet2": {"interfaceAddress": {}}, "Ethernet12": {"interfaceAddress": {}}}}],
"inputs": {
"interfaces": [
{"name": "Ethernet2", "primary_ip": "172.30.11.0/31", "secondary_ips": ["10.10.10.0/31", "10.10.10.10/31"]},
{"name": "Ethernet12", "primary_ip": "172.30.11.20/31", "secondary_ips": ["10.10.11.0/31", "10.10.11.10/31"]},
]
},
"expected": {
"result": "failure",
"messages": ["Interface: Ethernet2 - IP address is not configured", "Interface: Ethernet12 - IP address is not configured"],
},
},
{
@ -2053,17 +2185,13 @@ DATA: list[dict[str, Any]] = [
"primaryIp": {"address": "0.0.0.0", "maskLen": 0},
"secondaryIpsOrderedList": [],
}
}
}
},
{
"interfaces": {
},
"Ethernet12": {
"interfaceAddress": {
"primaryIp": {"address": "0.0.0.0", "maskLen": 0},
"secondaryIpsOrderedList": [],
}
}
},
}
},
],
@ -2076,10 +2204,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"For interface `Ethernet2`, The expected primary IP address is `172.30.11.0/31`, but the actual primary IP address is `0.0.0.0/0`. "
"The expected secondary IP addresses are `['10.10.10.0/31', '10.10.10.10/31']`, but the actual secondary IP address is not configured.",
"For interface `Ethernet12`, The expected primary IP address is `172.30.11.10/31`, but the actual primary IP address is `0.0.0.0/0`. "
"The expected secondary IP addresses are `['10.10.11.0/31', '10.10.11.10/31']`, but the actual secondary IP address is not configured.",
"Interface: Ethernet2 - IP address mismatch - Expected: 172.30.11.0/31 Actual: 0.0.0.0/0",
"Interface: Ethernet2 - Secondary IP address is not configured",
"Interface: Ethernet12 - IP address mismatch - Expected: 172.30.11.10/31 Actual: 0.0.0.0/0",
"Interface: Ethernet12 - Secondary IP address is not configured",
],
},
},
@ -2094,17 +2222,13 @@ DATA: list[dict[str, Any]] = [
"primaryIp": {"address": "172.30.11.0", "maskLen": 31},
"secondaryIpsOrderedList": [{"address": "10.10.10.0", "maskLen": 31}, {"address": "10.10.10.10", "maskLen": 31}],
}
}
}
},
{
"interfaces": {
},
"Ethernet3": {
"interfaceAddress": {
"primaryIp": {"address": "172.30.10.10", "maskLen": 31},
"secondaryIpsOrderedList": [{"address": "10.10.11.0", "maskLen": 31}, {"address": "10.11.11.10", "maskLen": 31}],
}
}
},
}
},
],
@ -2117,12 +2241,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"For interface `Ethernet2`, The expected primary IP address is `172.30.11.2/31`, but the actual primary IP address is `172.30.11.0/31`. "
"The expected secondary IP addresses are `['10.10.10.20/31', '10.10.10.30/31']`, but the actual secondary IP addresses are "
"`['10.10.10.0/31', '10.10.10.10/31']`.",
"For interface `Ethernet3`, The expected primary IP address is `172.30.10.2/31`, but the actual primary IP address is `172.30.10.10/31`. "
"The expected secondary IP addresses are `['10.10.11.0/31', '10.10.11.10/31']`, but the actual secondary IP addresses are "
"`['10.10.11.0/31', '10.11.11.10/31']`.",
"Interface: Ethernet2 - IP address mismatch - Expected: 172.30.11.2/31 Actual: 172.30.11.0/31",
"Interface: Ethernet2 - Secondary IP address mismatch - Expected: 10.10.10.20/31, 10.10.10.30/31 Actual: 10.10.10.0/31, 10.10.10.10/31",
"Interface: Ethernet3 - IP address mismatch - Expected: 172.30.10.2/31 Actual: 172.30.10.10/31",
"Interface: Ethernet3 - Secondary IP address mismatch - Expected: 10.10.11.0/31, 10.10.11.10/31 Actual: 10.10.11.0/31, 10.11.11.10/31",
],
},
},
@ -2137,17 +2259,13 @@ DATA: list[dict[str, Any]] = [
"primaryIp": {"address": "172.30.11.0", "maskLen": 31},
"secondaryIpsOrderedList": [],
}
}
}
},
{
"interfaces": {
},
"Ethernet3": {
"interfaceAddress": {
"primaryIp": {"address": "172.30.10.10", "maskLen": 31},
"secondaryIpsOrderedList": [{"address": "10.10.11.0", "maskLen": 31}, {"address": "10.11.11.10", "maskLen": 31}],
}
}
},
}
},
],
@ -2160,11 +2278,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"For interface `Ethernet2`, The expected primary IP address is `172.30.11.2/31`, but the actual primary IP address is `172.30.11.0/31`. "
"The expected secondary IP addresses are `['10.10.10.20/31', '10.10.10.30/31']`, but the actual secondary IP address is not configured.",
"For interface `Ethernet3`, The expected primary IP address is `172.30.10.2/31`, but the actual primary IP address is `172.30.10.10/31`. "
"The expected secondary IP addresses are `['10.10.11.0/31', '10.10.11.10/31']`, but the actual secondary IP addresses are "
"`['10.10.11.0/31', '10.11.11.10/31']`.",
"Interface: Ethernet2 - IP address mismatch - Expected: 172.30.11.2/31 Actual: 172.30.11.0/31",
"Interface: Ethernet2 - Secondary IP address is not configured",
"Interface: Ethernet3 - IP address mismatch - Expected: 172.30.10.2/31 Actual: 172.30.10.10/31",
"Interface: Ethernet3 - Secondary IP address mismatch - Expected: 10.10.11.0/31, 10.10.11.10/31 Actual: 10.10.11.0/31, 10.11.11.10/31",
],
},
},
@ -2196,7 +2313,7 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": {"mac_address": "00:1c:73:00:dc:01"},
"expected": {"result": "failure", "messages": ["IP virtual router MAC address `00:1c:73:00:dc:01` is not configured."]},
"expected": {"result": "failure", "messages": ["IP virtual router MAC address: 00:1c:73:00:dc:01 - Not configured"]},
},
{
"name": "success",
@ -2288,10 +2405,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"For interface Ethernet1:\nExpected `1Gbps` as the speed, but found `100Gbps` instead.",
"For interface Ethernet1/1/1:\nExpected `1Gbps` as the speed, but found `100Gbps` instead.",
"For interface Ethernet3:\nExpected `100Gbps` as the speed, but found `10Gbps` instead.",
"For interface Ethernet4:\nExpected `2.5Gbps` as the speed, but found `25Gbps` instead.",
"Interface: Ethernet1 - Bandwidth mismatch - Expected: 1.0Gbps Actual: 100Gbps",
"Interface: Ethernet1/1/1 - Bandwidth mismatch - Expected: 1.0Gbps Actual: 100Gbps",
"Interface: Ethernet3 - Bandwidth mismatch - Expected: 100.0Gbps Actual: 10Gbps",
"Interface: Ethernet4 - Bandwidth mismatch - Expected: 2.5Gbps Actual: 25Gbps",
],
},
},
@ -2340,11 +2457,11 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"For interface Ethernet1:\nExpected `duplexFull` as the duplex mode, but found `duplexHalf` instead.",
"For interface Ethernet1/2/2:\nExpected `duplexFull` as the duplex mode, but found `duplexHalf` instead.",
"For interface Ethernet3:\nExpected `duplexFull` as the duplex mode, but found `duplexHalf` instead.",
"For interface Ethernet3:\nExpected `duplexFull` as the duplex mode, but found `duplexHalf` instead.",
"For interface Ethernet4:\nExpected `duplexFull` as the duplex mode, but found `duplexHalf` instead.",
"Interface: Ethernet1 - Duplex mode mismatch - Expected: duplexFull Actual: duplexHalf",
"Interface: Ethernet1/2/2 - Duplex mode mismatch - Expected: duplexFull Actual: duplexHalf",
"Interface: Ethernet3 - Duplex mode mismatch - Expected: duplexFull Actual: duplexHalf",
"Interface: Ethernet3 - Duplex mode mismatch - Expected: duplexFull Actual: duplexHalf",
"Interface: Ethernet4 - Duplex mode mismatch - Expected: duplexFull Actual: duplexHalf",
],
},
},
@ -2398,10 +2515,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"For interface Ethernet1:\nExpected `2` as the lanes, but found `4` instead.",
"For interface Ethernet3:\nExpected `8` as the lanes, but found `4` instead.",
"For interface Ethernet4:\nExpected `4` as the lanes, but found `6` instead.",
"For interface Ethernet4/1/1:\nExpected `4` as the lanes, but found `6` instead.",
"Interface: Ethernet1 - Data lanes count mismatch - Expected: 2 Actual: 4",
"Interface: Ethernet3 - Data lanes count mismatch - Expected: 8 Actual: 4",
"Interface: Ethernet4 - Data lanes count mismatch - Expected: 4 Actual: 6",
"Interface: Ethernet4/1/1 - Data lanes count mismatch - Expected: 4 Actual: 6",
],
},
},
@ -2440,36 +2557,26 @@ DATA: list[dict[str, Any]] = [
],
"inputs": {
"interfaces": [
{"name": "Ethernet1", "auto": False, "speed": 1},
{"name": "Ethernet1", "auto": False, "speed": 1, "lanes": 2},
{"name": "Ethernet2/1/2", "auto": False, "speed": 10},
{"name": "Ethernet3", "auto": True, "speed": 1},
{"name": "Ethernet3", "auto": True, "speed": 100, "lanes": 8},
{"name": "Ethernet3", "auto": True, "speed": 100},
{"name": "Ethernet4", "auto": False, "speed": 2.5},
]
},
"expected": {
"result": "failure",
"messages": [
"For interface Ethernet1:\nExpected `duplexFull` as the duplex mode, but found `duplexHalf` instead.\n"
"Expected `1Gbps` as the speed, but found `10Gbps` instead.",
"For interface Ethernet1:\nExpected `duplexFull` as the duplex mode, but found `duplexHalf` instead.\n"
"Expected `1Gbps` as the speed, but found `10Gbps` instead.\n"
"Expected `2` as the lanes, but found `4` instead.",
"For interface Ethernet2/1/2:\nExpected `duplexFull` as the duplex mode, but found `duplexHalf` instead.\n"
"Expected `10Gbps` as the speed, but found `1Gbps` instead.",
"For interface Ethernet3:\nExpected `success` as the auto negotiation, but found `unknown` instead.\n"
"Expected `duplexFull` as the duplex mode, but found `duplexHalf` instead.",
"For interface Ethernet3:\nExpected `success` as the auto negotiation, but found `unknown` instead.\n"
"Expected `duplexFull` as the duplex mode, but found `duplexHalf` instead.\n"
"Expected `100Gbps` as the speed, but found `10Gbps` instead.\n"
"Expected `8` as the lanes, but found `6` instead.",
"For interface Ethernet3:\nExpected `success` as the auto negotiation, but found `unknown` instead.\n"
"Expected `duplexFull` as the duplex mode, but found `duplexHalf` instead.\n"
"Expected `100Gbps` as the speed, but found `10Gbps` instead.",
"For interface Ethernet4:\nExpected `duplexFull` as the duplex mode, but found `duplexHalf` instead.\n"
"Expected `2.5Gbps` as the speed, but found `25Gbps` instead.",
"Interface: Ethernet1 - Bandwidth mismatch - Expected: 1.0Gbps Actual: 10Gbps",
"Interface: Ethernet1 - Duplex mode mismatch - Expected: duplexFull Actual: duplexHalf",
"Interface: Ethernet1 - Data lanes count mismatch - Expected: 2 Actual: 4",
"Interface: Ethernet2/1/2 - Bandwidth mismatch - Expected: 10.0Gbps Actual: 1Gbps",
"Interface: Ethernet2/1/2 - Duplex mode mismatch - Expected: duplexFull Actual: duplexHalf",
"Interface: Ethernet3 - Bandwidth mismatch - Expected: 100.0Gbps Actual: 10Gbps",
"Interface: Ethernet3 - Duplex mode mismatch - Expected: duplexFull Actual: duplexHalf",
"Interface: Ethernet3 - Auto-negotiation mismatch - Expected: success Actual: unknown",
"Interface: Ethernet3 - Data lanes count mismatch - Expected: 8 Actual: 6",
"Interface: Ethernet4 - Bandwidth mismatch - Expected: 2.5Gbps Actual: 25Gbps",
"Interface: Ethernet4 - Duplex mode mismatch - Expected: duplexFull Actual: duplexHalf",
],
},
},

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Data for testing anta.tests.lanz."""

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Data for testing anta.tests.logging."""
@ -9,6 +9,7 @@ from typing import Any
from anta.tests.logging import (
VerifyLoggingAccounting,
VerifyLoggingEntries,
VerifyLoggingErrors,
VerifyLoggingHostname,
VerifyLoggingHosts,
@ -16,6 +17,7 @@ from anta.tests.logging import (
VerifyLoggingPersistent,
VerifyLoggingSourceIntf,
VerifyLoggingTimestamp,
VerifySyslogLogging,
)
from tests.units.anta_tests import test
@ -96,7 +98,7 @@ DATA: list[dict[str, Any]] = [
""",
],
"inputs": {"interface": "Management0", "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Source-interface 'Management0' is not configured in VRF MGMT"]},
"expected": {"result": "failure", "messages": ["Source-interface: Management0 VRF: MGMT - Not configured"]},
},
{
"name": "failure-vrf",
@ -111,7 +113,7 @@ DATA: list[dict[str, Any]] = [
""",
],
"inputs": {"interface": "Management0", "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Source-interface 'Management0' is not configured in VRF MGMT"]},
"expected": {"result": "failure", "messages": ["Source-interface: Management0 VRF: MGMT - Not configured"]},
},
{
"name": "success",
@ -141,7 +143,7 @@ DATA: list[dict[str, Any]] = [
""",
],
"inputs": {"hosts": ["10.22.10.92", "10.22.10.93", "10.22.10.94"], "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Syslog servers ['10.22.10.93', '10.22.10.94'] are not configured in VRF MGMT"]},
"expected": {"result": "failure", "messages": ["Syslog servers 10.22.10.93, 10.22.10.94 are not configured in VRF MGMT"]},
},
{
"name": "failure-vrf",
@ -156,7 +158,7 @@ DATA: list[dict[str, Any]] = [
""",
],
"inputs": {"hosts": ["10.22.10.92", "10.22.10.93", "10.22.10.94"], "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Syslog servers ['10.22.10.93', '10.22.10.94'] are not configured in VRF MGMT"]},
"expected": {"result": "failure", "messages": ["Syslog servers 10.22.10.93, 10.22.10.94 are not configured in VRF MGMT"]},
},
{
"name": "success",
@ -166,14 +168,14 @@ DATA: list[dict[str, Any]] = [
"2023-05-10T13:54:21.463497-05:00 NW-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
"Message from arista on command-api (10.22.1.107): ANTA VerifyLoggingLogsGeneration validation\n",
],
"inputs": None,
"inputs": {"severity_level": "informational"},
"expected": {"result": "success"},
},
{
"name": "failure",
"test": VerifyLoggingLogsGeneration,
"eos_data": ["", "Log Buffer:\n"],
"inputs": None,
"inputs": {"severity_level": "notifications"},
"expected": {"result": "failure", "messages": ["Logs are not generated"]},
},
{
@ -185,7 +187,7 @@ DATA: list[dict[str, Any]] = [
"2023-05-10T15:41:44.701810-05:00 NW-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
"Message from arista on command-api (10.22.1.107): ANTA VerifyLoggingHostname validation\n",
],
"inputs": None,
"inputs": {"severity_level": "informational"},
"expected": {"result": "success"},
},
{
@ -194,10 +196,10 @@ DATA: list[dict[str, Any]] = [
"eos_data": [
{"hostname": "NW-CORE", "fqdn": "NW-CORE.example.org"},
"",
"2023-05-10T13:54:21.463497-05:00 NW-CORE ConfigAgent: %SYS-6-LOGMSG_INFO: "
"2023-05-10T13:54:21.463497-05:00 NW-CORE ConfigAgent: %SYS-6-LOGMSG_NOTICE: "
"Message from arista on command-api (10.22.1.107): ANTA VerifyLoggingLogsHostname validation\n",
],
"inputs": None,
"inputs": {"severity_level": "notifications"},
"expected": {"result": "failure", "messages": ["Logs are not generated with the device FQDN"]},
},
{
@ -210,7 +212,7 @@ DATA: list[dict[str, Any]] = [
"2023-05-10T15:42:44.680813-05:00 NW-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
"Other log\n",
],
"inputs": None,
"inputs": {"severity_level": "informational"},
"expected": {"result": "success"},
},
{
@ -223,7 +225,7 @@ DATA: list[dict[str, Any]] = [
"2023-05-10T15:42:44.680813+05:00 NW-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
"Other log\n",
],
"inputs": None,
"inputs": {"severity_level": "informational"},
"expected": {"result": "success"},
},
{
@ -231,10 +233,10 @@ DATA: list[dict[str, Any]] = [
"test": VerifyLoggingTimestamp,
"eos_data": [
"",
"May 10 13:54:22 NE-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
"May 10 13:54:22 NE-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_ALERT: "
"Message from arista on command-api (10.22.1.107): ANTA VerifyLoggingTimestamp validation\n",
],
"inputs": None,
"inputs": {"severity_level": "alerts"},
"expected": {"result": "failure", "messages": ["Logs are not generated with the appropriate timestamp format"]},
},
{
@ -242,9 +244,9 @@ DATA: list[dict[str, Any]] = [
"test": VerifyLoggingTimestamp,
"eos_data": [
"",
"May 10 13:54:22 NE-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: Message from arista on command-api (10.22.1.107): BLAH\n",
"May 10 13:54:22 NE-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_NOTICE: Message from arista on command-api (10.22.1.107): BLAH\n",
],
"inputs": None,
"inputs": {"severity_level": "notifications"},
"expected": {"result": "failure", "messages": ["Logs are not generated with the appropriate timestamp format"]},
},
{
@ -277,4 +279,85 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {"result": "failure", "messages": ["Device has reported syslog messages with a severity of ERRORS or higher"]},
},
{
"name": "success",
"test": VerifySyslogLogging,
"eos_data": [
"""Syslog logging: enabled
Buffer logging: level debugging
External configuration:
active:
inactive:
Facility Severity Effective Severity
-------------------- ------------- ------------------
aaa debugging debugging
accounting debugging debugging""",
],
"inputs": None,
"expected": {"result": "success"},
},
{
"name": "failure",
"test": VerifySyslogLogging,
"eos_data": [
"""Syslog logging: disabled
Buffer logging: level debugging
Console logging: level errors
Persistent logging: disabled
Monitor logging: level errors
External configuration:
active:
inactive:
Facility Severity Effective Severity
-------------------- ------------- ------------------
aaa debugging debugging
accounting debugging debugging""",
],
"inputs": None,
"expected": {"result": "failure", "messages": ["Syslog logging is disabled"]},
},
{
"name": "success",
"test": VerifyLoggingEntries,
"eos_data": [
"""Mar 13 04:10:45 s1-leaf1 ProcMgr: %PROCMGR-6-TERMINATE_RUNNING_PROCESS: Terminating deconfigured/reconfigured process 'SystemInitMonitor' (PID=859)
Mar 13 04:10:45 s1-leaf1 ProcMgr: %PROCMGR-6-PROCESS_TERMINATED: 'SystemInitMonitor' (PID=859, status=9) has terminated.""",
"""Mar 13 04:10:45 s1-leaf1 ProcMgr: %PROCMGR-7-WORKER_WARMSTART_DONE: ProcMgr worker warm start done. (PID=547)""",
],
"inputs": {
"logging_entries": [
{"regex_match": ".*PROCMGR-6-PROCESS_TERMINATED:.*", "last_number_messages": 3},
{"regex_match": ".*ProcMgr worker warm start.*", "last_number_messages": 2, "severity_level": "debugging"},
]
},
"expected": {"result": "success"},
},
{
"name": "failure-log-str-not-found",
"test": VerifyLoggingEntries,
"eos_data": [
"""Mar 12 04:34:01 s1-leaf1 ProcMgr: %PROCMGR-7-WORKER_WARMSTART_DONE: ProcMgr worker warm start done. (PID=559)
Mar 12 04:34:01 s1-leaf1 ProcMgr: %PROCMGR-6-PROCESS_TERMINATED: 'SystemInitMonitor' (PID=867, status=9) has terminated.""",
"""Mar 13 03:58:12 s1-leaf1 ConfigAgent: %SYS-5-CONFIG_SESSION_ABORTED: User cvpsystem aborted
configuration session capiVerify-612-612b34a2ffbf11ef96ba3a348d538ba0 on TerminAttr (localhost)
Mar 13 04:10:45 s1-leaf1 SystemInitMonitor: %SYS-5-SYSTEM_INITIALIZED: System is initialized""",
],
"inputs": {
"logging_entries": [
{"regex_match": ".ACCOUNTING-5-EXEC: cvpadmin ssh.", "last_number_messages": 3},
{"regex_match": ".*ProcMgr worker warm start.*", "last_number_messages": 10, "severity_level": "debugging"},
]
},
"expected": {
"result": "failure",
"messages": [
"Pattern: .ACCOUNTING-5-EXEC: cvpadmin ssh. - Not found in last 3 informational log entries",
"Pattern: .*ProcMgr worker warm start.* - Not found in last 10 debugging log entries",
],
},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.mlag.py."""
@ -30,13 +30,33 @@ DATA: list[dict[str, Any]] = [
"expected": {"result": "skipped", "messages": ["MLAG is disabled"]},
},
{
"name": "failure",
"name": "failure-negotiation-status",
"test": VerifyMlagStatus,
"eos_data": [{"state": "active", "negStatus": "connecting", "peerLinkStatus": "up", "localIntfStatus": "up"}],
"inputs": None,
"expected": {
"result": "failure",
"messages": ["MLAG negotiation status mismatch - Expected: connected Actual: connecting"],
},
},
{
"name": "failure-local-interface",
"test": VerifyMlagStatus,
"eos_data": [{"state": "active", "negStatus": "connected", "peerLinkStatus": "up", "localIntfStatus": "down"}],
"inputs": None,
"expected": {
"result": "failure",
"messages": ["Operational state of the MLAG local interface is not correct - Expected: up Actual: down"],
},
},
{
"name": "failure-peer-link",
"test": VerifyMlagStatus,
"eos_data": [{"state": "active", "negStatus": "connected", "peerLinkStatus": "down", "localIntfStatus": "up"}],
"inputs": None,
"expected": {
"result": "failure",
"messages": ["MLAG status is not OK: {'state': 'active', 'negStatus': 'connected', 'localIntfStatus': 'up', 'peerLinkStatus': 'down'}"],
"messages": ["Operational state of the MLAG peer link is not correct - Expected: up Actual: down"],
},
},
{
@ -74,7 +94,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": ["MLAG status is not OK: {'Disabled': 0, 'Configured': 0, 'Inactive': 0, 'Active-partial': 1, 'Active-full': 1}"],
"messages": ["MLAG status is not ok - Inactive Ports: 0 Partial Active Ports: 1"],
},
},
{
@ -89,7 +109,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": ["MLAG status is not OK: {'Disabled': 0, 'Configured': 0, 'Inactive': 1, 'Active-partial': 1, 'Active-full': 1}"],
"messages": ["MLAG status is not ok - Inactive Ports: 1 Partial Active Ports: 1"],
},
},
{
@ -124,12 +144,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"MLAG config-sanity returned inconsistencies: "
"{'globalConfiguration': {'mlag': {'globalParameters': "
"{'dual-primary-detection-delay': {'localValue': '0', 'peerValue': '200'}}}}, "
"'interfaceConfiguration': {}}",
],
"messages": ["MLAG config-sanity found in global configuration"],
},
},
{
@ -146,12 +161,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"MLAG config-sanity returned inconsistencies: "
"{'globalConfiguration': {}, "
"'interfaceConfiguration': {'trunk-native-vlan mlag30': "
"{'interface': {'Port-Channel30': {'localValue': '123', 'peerValue': '3700'}}}}}",
],
"messages": ["MLAG config-sanity found in interface configuration"],
},
},
{
@ -177,7 +187,10 @@ DATA: list[dict[str, Any]] = [
"test": VerifyMlagReloadDelay,
"eos_data": [{"state": "active", "reloadDelay": 400, "reloadDelayNonMlag": 430}],
"inputs": {"reload_delay": 300, "reload_delay_non_mlag": 330},
"expected": {"result": "failure", "messages": ["The reload-delay parameters are not configured properly: {'reloadDelay': 400, 'reloadDelayNonMlag': 430}"]},
"expected": {
"result": "failure",
"messages": ["MLAG reload-delay mismatch - Expected: 300s Actual: 400s", "Delay for non-MLAG ports mismatch - Expected: 330s Actual: 430s"],
},
},
{
"name": "success",
@ -236,13 +249,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
(
"The dual-primary parameters are not configured properly: "
"{'detail.dualPrimaryDetectionDelay': 300, "
"'detail.dualPrimaryAction': 'none', "
"'dualPrimaryMlagRecoveryDelay': 160, "
"'dualPrimaryNonMlagRecoveryDelay': 0}"
),
"Dual-primary detection delay mismatch - Expected: 200 Actual: 300",
"Dual-primary MLAG recovery delay mismatch - Expected: 60 Actual: 160",
],
},
},
@ -262,15 +270,26 @@ DATA: list[dict[str, Any]] = [
"inputs": {"detection_delay": 200, "errdisabled": True, "recovery_delay": 60, "recovery_delay_non_mlag": 0},
"expected": {
"result": "failure",
"messages": [
(
"The dual-primary parameters are not configured properly: "
"{'detail.dualPrimaryDetectionDelay': 200, "
"'detail.dualPrimaryAction': 'none', "
"'dualPrimaryMlagRecoveryDelay': 60, "
"'dualPrimaryNonMlagRecoveryDelay': 0}"
),
],
"messages": ["Dual-primary action mismatch - Expected: errdisableAllInterfaces Actual: none"],
},
},
{
"name": "failure-wrong-non-mlag-delay",
"test": VerifyMlagDualPrimary,
"eos_data": [
{
"state": "active",
"dualPrimaryDetectionState": "configured",
"dualPrimaryPortsErrdisabled": False,
"dualPrimaryMlagRecoveryDelay": 60,
"dualPrimaryNonMlagRecoveryDelay": 120,
"detail": {"dualPrimaryDetectionDelay": 200, "dualPrimaryAction": "errdisableAllInterfaces"},
},
],
"inputs": {"detection_delay": 200, "errdisabled": True, "recovery_delay": 60, "recovery_delay_non_mlag": 60},
"expected": {
"result": "failure",
"messages": ["Dual-primary non MLAG recovery delay mismatch - Expected: 60 Actual: 120"],
},
},
{
@ -310,7 +329,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"primary_priority": 32767},
"expected": {
"result": "failure",
"messages": ["The device is not set as MLAG primary."],
"messages": ["The device is not set as MLAG primary"],
},
},
{
@ -325,7 +344,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"primary_priority": 1},
"expected": {
"result": "failure",
"messages": ["The device is not set as MLAG primary.", "The primary priority does not match expected. Expected `1`, but found `32767` instead."],
"messages": ["The device is not set as MLAG primary", "MLAG primary priority mismatch - Expected: 1 Actual: 32767"],
},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Test inputs for anta.tests.multicast."""
@ -104,7 +104,10 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"vlans": {1: False, 42: False}},
"expected": {"result": "failure", "messages": ["IGMP state for vlan 1 is enabled", "Supplied vlan 42 is not present on the device."]},
"expected": {
"result": "failure",
"messages": ["VLAN1 - Incorrect IGMP state - Expected: disabled Actual: enabled", "Supplied vlan 42 is not present on the device"],
},
},
{
"name": "failure-wrong-state",
@ -132,7 +135,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"vlans": {1: True}},
"expected": {"result": "failure", "messages": ["IGMP state for vlan 1 is disabled"]},
"expected": {"result": "failure", "messages": ["VLAN1 - Incorrect IGMP state - Expected: enabled Actual: disabled"]},
},
{
"name": "success-enabled",
@ -171,6 +174,6 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"enabled": True},
"expected": {"result": "failure", "messages": ["IGMP state is not valid: disabled"]},
"expected": {"result": "failure", "messages": ["IGMP state is not valid - Expected: enabled Actual: disabled"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.path_selection.py."""
@ -58,7 +58,7 @@ DATA: list[dict[str, Any]] = [
{"dpsPeers": {}},
],
"inputs": {},
"expected": {"result": "failure", "messages": ["No path configured for router path-selection."]},
"expected": {"result": "failure", "messages": ["No path configured for router path-selection"]},
},
{
"name": "failure-not-established",
@ -101,9 +101,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Path state for peer 10.255.0.1 in path-group internet is `ipsecPending`.",
"Path state for peer 10.255.0.1 in path-group mpls is `ipsecPending`.",
"Path state for peer 10.255.0.2 in path-group mpls is `ipsecPending`.",
"Peer: 10.255.0.1 Path Group: internet - Invalid path state - Expected: ipsecEstablished, routeResolved Actual: ipsecPending",
"Peer: 10.255.0.1 Path Group: mpls - Invalid path state - Expected: ipsecEstablished, routeResolved Actual: ipsecPending",
"Peer: 10.255.0.2 Path Group: mpls - Invalid path state - Expected: ipsecEstablished, routeResolved Actual: ipsecPending",
],
},
},
@ -148,9 +148,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Telemetry state for peer 10.255.0.1 in path-group internet is `inactive`.",
"Telemetry state for peer 10.255.0.1 in path-group mpls is `inactive`.",
"Telemetry state for peer 10.255.0.2 in path-group mpls is `inactive`.",
"Peer: 10.255.0.1 Path Group internet - Telemetry state inactive",
"Peer: 10.255.0.1 Path Group mpls - Telemetry state inactive",
"Peer: 10.255.0.2 Path Group mpls - Telemetry state inactive",
],
},
},
@ -158,107 +158,125 @@ DATA: list[dict[str, Any]] = [
"name": "success",
"test": VerifySpecificPath,
"eos_data": [
{
"dpsPeers": {
"10.255.0.1": {
"dpsGroups": {
"internet": {
"dpsPaths": {
"path3": {
"state": "ipsecEstablished",
"source": "172.18.13.2",
"destination": "172.18.15.2",
"dpsSessions": {"0": {"active": True}},
}
}
}
}
}
}
},
{
"dpsPeers": {
"10.255.0.2": {
"dpsGroups": {
"mpls": {
"dpsPaths": {
"path2": {
"path7": {},
"path8": {
"source": "172.18.13.2",
"destination": "172.18.15.2",
"state": "ipsecEstablished",
"dpsSessions": {"0": {"active": True}},
},
}
},
"internet": {},
}
},
"10.255.0.1": {
"dpsGroups": {
"internet": {
"dpsPaths": {
"path6": {
"source": "100.64.3.2",
"destination": "100.64.1.2",
"state": "ipsecEstablished",
"source": "172.18.3.2",
"destination": "172.18.5.2",
"dpsSessions": {"0": {"active": True}},
}
}
}
},
"mpls": {},
}
}
},
}
},
}
],
"inputs": {
"paths": [
{"peer": "10.255.0.1", "path_group": "internet", "source_address": "172.18.3.2", "destination_address": "172.18.5.2"},
{"peer": "10.255.0.1", "path_group": "internet", "source_address": "100.64.3.2", "destination_address": "100.64.1.2"},
{"peer": "10.255.0.2", "path_group": "mpls", "source_address": "172.18.13.2", "destination_address": "172.18.15.2"},
]
},
"expected": {"result": "success"},
},
{
"name": "failure-no-peer",
"name": "failure-expected-path-group-not-found",
"test": VerifySpecificPath,
"eos_data": [
{"dpsPeers": {}},
{"dpsPeers": {}},
{
"dpsPeers": {
"10.255.0.2": {
"dpsGroups": {"internet": {}},
},
"10.255.0.1": {"peerName": "", "dpsGroups": {"mpls": {}}},
}
}
],
"inputs": {
"paths": [
{"peer": "10.255.0.1", "path_group": "internet", "source_address": "172.18.3.2", "destination_address": "172.18.5.2"},
{"peer": "10.255.0.1", "path_group": "internet", "source_address": "100.64.3.2", "destination_address": "100.64.1.2"},
{"peer": "10.255.0.2", "path_group": "mpls", "source_address": "172.18.13.2", "destination_address": "172.18.15.2"},
]
},
"expected": {
"result": "failure",
"messages": [
"Path `peer: 10.255.0.1 source: 172.18.3.2 destination: 172.18.5.2` is not configured for path-group `internet`.",
"Path `peer: 10.255.0.2 source: 172.18.13.2 destination: 172.18.15.2` is not configured for path-group `mpls`.",
"Peer: 10.255.0.1 PathGroup: internet Source: 100.64.3.2 Destination: 100.64.1.2 - No DPS path found for this peer and path group",
"Peer: 10.255.0.2 PathGroup: mpls Source: 172.18.13.2 Destination: 172.18.15.2 - No DPS path found for this peer and path group",
],
},
},
{
"name": "failure-no-router-path-configured",
"test": VerifySpecificPath,
"eos_data": [{"dpsPeers": {}}],
"inputs": {"paths": [{"peer": "10.255.0.1", "path_group": "internet", "source_address": "100.64.3.2", "destination_address": "100.64.1.2"}]},
"expected": {"result": "failure", "messages": ["Router path-selection not configured"]},
},
{
"name": "failure-no-specific-peer-configured",
"test": VerifySpecificPath,
"eos_data": [{"dpsPeers": {"10.255.0.2": {}}}],
"inputs": {"paths": [{"peer": "10.255.0.1", "path_group": "internet", "source_address": "172.18.3.2", "destination_address": "172.18.5.2"}]},
"expected": {"result": "failure", "messages": ["Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - Peer not found"]},
},
{
"name": "failure-not-established",
"test": VerifySpecificPath,
"eos_data": [
{
"dpsPeers": {
"10.255.0.1": {
"dpsGroups": {
"internet": {
"dpsPaths": {
"path3": {"state": "ipsecPending", "source": "172.18.3.2", "destination": "172.18.5.2", "dpsSessions": {"0": {"active": True}}}
}
}
}
}
}
},
{
"dpsPeers": {
"10.255.0.2": {
"dpsGroups": {
"mpls": {
"dpsPaths": {
"path4": {
"state": "ipsecPending",
"path7": {},
"path8": {
"source": "172.18.13.2",
"destination": "172.18.15.2",
"dpsSessions": {"0": {"active": False}},
}
"state": "ipsecPending",
"dpsSessions": {"0": {"active": True}},
},
}
}
},
"internet": {"dpsPaths": {}},
}
}
},
"10.255.0.1": {
"dpsGroups": {
"internet": {
"dpsPaths": {
"path6": {"source": "172.18.3.2", "destination": "172.18.5.2", "state": "ipsecPending", "dpsSessions": {"0": {"active": True}}}
}
},
"mpls": {"dpsPaths": {}},
}
},
}
},
}
],
"inputs": {
"paths": [
@ -269,8 +287,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Path state for `peer: 10.255.0.1 source: 172.18.3.2 destination: 172.18.5.2` in path-group internet is `ipsecPending`.",
"Path state for `peer: 10.255.0.2 source: 172.18.13.2 destination: 172.18.15.2` in path-group mpls is `ipsecPending`.",
"Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - Invalid state path - Expected: ipsecEstablished, routeResolved "
"Actual: ipsecPending",
"Peer: 10.255.0.2 PathGroup: mpls Source: 172.18.13.2 Destination: 172.18.15.2 - Invalid state path - Expected: ipsecEstablished, routeResolved "
"Actual: ipsecPending",
],
},
},
@ -278,37 +298,33 @@ DATA: list[dict[str, Any]] = [
"name": "failure-inactive",
"test": VerifySpecificPath,
"eos_data": [
{
"dpsPeers": {
"10.255.0.1": {
"dpsGroups": {
"internet": {
"dpsPaths": {
"path3": {"state": "routeResolved", "source": "172.18.3.2", "destination": "172.18.5.2", "dpsSessions": {"0": {"active": False}}}
}
}
}
}
}
},
{
"dpsPeers": {
"10.255.0.2": {
"dpsGroups": {
"mpls": {
"dpsPaths": {
"path4": {
"state": "routeResolved",
"path8": {
"source": "172.18.13.2",
"destination": "172.18.15.2",
"state": "routeResolved",
"dpsSessions": {"0": {"active": False}},
}
}
}
}
}
},
"10.255.0.1": {
"dpsGroups": {
"internet": {
"dpsPaths": {
"path6": {"source": "172.18.3.2", "destination": "172.18.5.2", "state": "routeResolved", "dpsSessions": {"0": {"active": False}}}
}
}
}
},
}
},
}
],
"inputs": {
"paths": [
@ -319,8 +335,49 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Telemetry state for path `peer: 10.255.0.1 source: 172.18.3.2 destination: 172.18.5.2` in path-group internet is `inactive`.",
"Telemetry state for path `peer: 10.255.0.2 source: 172.18.13.2 destination: 172.18.15.2` in path-group mpls is `inactive`.",
"Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - Telemetry state inactive for this path",
"Peer: 10.255.0.2 PathGroup: mpls Source: 172.18.13.2 Destination: 172.18.15.2 - Telemetry state inactive for this path",
],
},
},
{
"name": "failure-source-destination-not-configured",
"test": VerifySpecificPath,
"eos_data": [
{
"dpsPeers": {
"10.255.0.2": {
"dpsGroups": {
"mpls": {
"dpsPaths": {
"path8": {"source": "172.18.3.2", "destination": "172.8.15.2", "state": "routeResolved", "dpsSessions": {"0": {"active": False}}}
}
}
}
},
"10.255.0.1": {
"dpsGroups": {
"internet": {
"dpsPaths": {
"path6": {"source": "172.8.3.2", "destination": "172.8.5.2", "state": "routeResolved", "dpsSessions": {"0": {"active": False}}}
}
}
}
},
}
}
],
"inputs": {
"paths": [
{"peer": "10.255.0.1", "path_group": "internet", "source_address": "172.18.3.2", "destination_address": "172.18.5.2"},
{"peer": "10.255.0.2", "path_group": "mpls", "source_address": "172.18.13.2", "destination_address": "172.18.15.2"},
]
},
"expected": {
"result": "failure",
"messages": [
"Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - No path matching the source and destination found",
"Peer: 10.255.0.2 PathGroup: mpls Source: 172.18.13.2 Destination: 172.18.15.2 - No path matching the source and destination found",
],
},
},

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.profiles.py."""
@ -23,7 +23,7 @@ DATA: list[dict[str, Any]] = [
"test": VerifyUnifiedForwardingTableMode,
"eos_data": [{"uftMode": "2", "urpfEnabled": False, "chipModel": "bcm56870", "l2TableSize": 163840, "l3TableSize": 147456, "lpmTableSize": 32768}],
"inputs": {"mode": 3},
"expected": {"result": "failure", "messages": ["Device is not running correct UFT mode (expected: 3 / running: 2)"]},
"expected": {"result": "failure", "messages": ["Not running the correct UFT mode - Expected: 3 Actual: 2"]},
},
{
"name": "success",

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Data for testing anta.tests.ptp."""
@ -39,7 +39,7 @@ DATA: list[dict[str, Any]] = [
"test": VerifyPtpModeStatus,
"eos_data": [{"ptpMode": "ptpDisabled", "ptpIntfSummaries": {}}],
"inputs": None,
"expected": {"result": "failure", "messages": ["The device is not configured as a PTP Boundary Clock: 'ptpDisabled'"]},
"expected": {"result": "failure", "messages": ["Not configured as a PTP Boundary Clock - Actual: ptpDisabled"]},
},
{
"name": "skipped",
@ -99,7 +99,7 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"The device is locked to the following Grandmaster: '0x00:1c:73:ff:ff:0a:00:01', which differ from the expected one.",
"The device is locked to the incorrect Grandmaster - Expected: 0xec:46:70:ff:fe:00:ff:a8 Actual: 0x00:1c:73:ff:ff:0a:00:01",
],
},
},
@ -158,7 +158,7 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": None,
"expected": {"result": "failure", "messages": ["The device lock is more than 60s old: 157s"]},
"expected": {"result": "failure", "messages": ["Lock is more than 60s old - Actual: 157s"]},
},
{
"name": "skipped",
@ -236,7 +236,9 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": [("The device timing offset from master is greater than +/- 1000ns: {'Ethernet27/1': [1200, -1300]}")],
"messages": [
"Interface: Ethernet27/1 - Timing offset from master is greater than +/- 1000ns: Actual: 1200, -1300",
],
},
},
{
@ -335,6 +337,6 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": None,
"expected": {"result": "failure", "messages": ["The following interface(s) are not in a valid PTP state: '['Ethernet53', 'Ethernet1']'"]},
"expected": {"result": "failure", "messages": ["The following interface(s) are not in a valid PTP state: Ethernet53, Ethernet1"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.security.py."""
@ -42,7 +42,7 @@ DATA: list[dict[str, Any]] = [
"test": VerifySSHStatus,
"eos_data": ["SSH per host connection limit is 20\nFIPS status: disabled\n\n"],
"inputs": None,
"expected": {"result": "failure", "messages": ["Could not find SSH status in returned output."]},
"expected": {"result": "failure", "messages": ["Could not find SSH status in returned output"]},
},
{
"name": "failure-ssh-enabled",
@ -83,14 +83,14 @@ DATA: list[dict[str, Any]] = [
"test": VerifySSHIPv4Acl,
"eos_data": [{"ipAclList": {"aclList": []}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Expected 1 SSH IPv4 ACL(s) in vrf MGMT but got 0"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - SSH IPv4 ACL(s) count mismatch - Expected: 1 Actual: 0"]},
},
{
"name": "failure-wrong-vrf",
"test": VerifySSHIPv4Acl,
"eos_data": [{"ipAclList": {"aclList": [{"type": "Ip4Acl", "name": "ACL_IPV4_SSH", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["SSH IPv4 ACL(s) not configured or active in vrf MGMT: ['ACL_IPV4_SSH']"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - Following SSH IPv4 ACL(s) not configured or active: ACL_IPV4_SSH"]},
},
{
"name": "success",
@ -104,14 +104,14 @@ DATA: list[dict[str, Any]] = [
"test": VerifySSHIPv6Acl,
"eos_data": [{"ipv6AclList": {"aclList": []}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Expected 1 SSH IPv6 ACL(s) in vrf MGMT but got 0"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - SSH IPv6 ACL(s) count mismatch - Expected: 1 Actual: 0"]},
},
{
"name": "failure-wrong-vrf",
"test": VerifySSHIPv6Acl,
"eos_data": [{"ipv6AclList": {"aclList": [{"type": "Ip6Acl", "name": "ACL_IPV6_SSH", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["SSH IPv6 ACL(s) not configured or active in vrf MGMT: ['ACL_IPV6_SSH']"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - Following SSH IPv6 ACL(s) not configured or active: ACL_IPV6_SSH"]},
},
{
"name": "success",
@ -192,7 +192,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"profile": "API_SSL_Profile"},
"expected": {"result": "failure", "messages": ["eAPI HTTPS server SSL profile (API_SSL_Profile) is not configured"]},
"expected": {"result": "failure", "messages": ["eAPI HTTPS server SSL profile API_SSL_Profile is not configured"]},
},
{
"name": "failure-misconfigured-invalid",
@ -209,7 +209,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"profile": "API_SSL_Profile"},
"expected": {"result": "failure", "messages": ["eAPI HTTPS server SSL profile (API_SSL_Profile) is misconfigured or invalid"]},
"expected": {"result": "failure", "messages": ["eAPI HTTPS server SSL profile API_SSL_Profile is misconfigured or invalid"]},
},
{
"name": "success",
@ -223,14 +223,14 @@ DATA: list[dict[str, Any]] = [
"test": VerifyAPIIPv4Acl,
"eos_data": [{"ipAclList": {"aclList": []}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Expected 1 eAPI IPv4 ACL(s) in vrf MGMT but got 0"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - eAPI IPv4 ACL(s) count mismatch - Expected: 1 Actual: 0"]},
},
{
"name": "failure-wrong-vrf",
"test": VerifyAPIIPv4Acl,
"eos_data": [{"ipAclList": {"aclList": [{"type": "Ip4Acl", "name": "ACL_IPV4_API", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["eAPI IPv4 ACL(s) not configured or active in vrf MGMT: ['ACL_IPV4_API']"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - Following eAPI IPv4 ACL(s) not configured or active: ACL_IPV4_API"]},
},
{
"name": "success",
@ -244,14 +244,14 @@ DATA: list[dict[str, Any]] = [
"test": VerifyAPIIPv6Acl,
"eos_data": [{"ipv6AclList": {"aclList": []}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Expected 1 eAPI IPv6 ACL(s) in vrf MGMT but got 0"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - eAPI IPv6 ACL(s) count mismatch - Expected: 1 Actual: 0"]},
},
{
"name": "failure-wrong-vrf",
"test": VerifyAPIIPv6Acl,
"eos_data": [{"ipv6AclList": {"aclList": [{"type": "Ip6Acl", "name": "ACL_IPV6_API", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["eAPI IPv6 ACL(s) not configured or active in vrf MGMT: ['ACL_IPV6_API']"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - Following eAPI IPv6 ACL(s) not configured or active: ACL_IPV6_API"]},
},
{
"name": "success",
@ -341,7 +341,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["SSL certificate 'ARISTA_ROOT_CA.crt', is not configured.\n"],
"messages": ["Certificate: ARISTA_ROOT_CA.crt - Not found"],
},
},
{
@ -366,13 +366,6 @@ DATA: list[dict[str, Any]] = [
],
"inputs": {
"certificates": [
{
"certificate_name": "ARISTA_SIGNING_CA.crt",
"expiry_threshold": 30,
"common_name": "AristaIT-ICA ECDSA Issuing Cert Authority",
"encryption_algorithm": "ECDSA",
"key_size": 256,
},
{
"certificate_name": "ARISTA_ROOT_CA.crt",
"expiry_threshold": 30,
@ -384,7 +377,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["SSL certificate 'ARISTA_SIGNING_CA.crt', is not configured.\n", "SSL certificate `ARISTA_ROOT_CA.crt` is expired.\n"],
"messages": ["Certificate: ARISTA_ROOT_CA.crt - certificate expired"],
},
},
{
@ -403,7 +396,7 @@ DATA: list[dict[str, Any]] = [
},
"ARISTA_SIGNING_CA.crt": {
"subject": {"commonName": "AristaIT-ICA ECDSA Issuing Cert Authority"},
"notAfter": 1702533518,
"notAfter": 1705992709,
"publicKey": {
"encryptionAlgorithm": "ECDSA",
"size": 256,
@ -435,7 +428,9 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["SSL certificate `ARISTA_SIGNING_CA.crt` is expired.\n", "SSL certificate `ARISTA_ROOT_CA.crt` is about to expire in 25 days."],
"messages": [
"Certificate: ARISTA_ROOT_CA.crt - set to expire within the threshold - Threshold: 30 days Actual: 25 days",
],
},
},
{
@ -487,12 +482,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"SSL certificate `ARISTA_SIGNING_CA.crt` is not configured properly:\n"
"Expected `AristaIT-ICA ECDSA Issuing Cert Authority` as the subject.commonName, but found "
"`Arista ECDSA Issuing Cert Authority` instead.\n",
"SSL certificate `ARISTA_ROOT_CA.crt` is not configured properly:\n"
"Expected `Arista Networks Internal IT Root Cert Authority` as the subject.commonName, "
"but found `AristaIT-ICA Networks Internal IT Root Cert Authority` instead.\n",
"Certificate: ARISTA_SIGNING_CA.crt - incorrect common name - Expected: AristaIT-ICA ECDSA Issuing Cert Authority "
"Actual: Arista ECDSA Issuing Cert Authority",
"Certificate: ARISTA_ROOT_CA.crt - incorrect common name - Expected: Arista Networks Internal IT Root Cert Authority "
"Actual: AristaIT-ICA Networks Internal IT Root Cert Authority",
],
},
},
@ -545,17 +538,15 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"SSL certificate `ARISTA_SIGNING_CA.crt` is not configured properly:\n"
"Expected `ECDSA` as the publicKey.encryptionAlgorithm, but found `RSA` instead.\n"
"Expected `256` as the publicKey.size, but found `4096` instead.\n",
"SSL certificate `ARISTA_ROOT_CA.crt` is not configured properly:\n"
"Expected `RSA` as the publicKey.encryptionAlgorithm, but found `ECDSA` instead.\n"
"Expected `4096` as the publicKey.size, but found `256` instead.\n",
"Certificate: ARISTA_SIGNING_CA.crt - incorrect encryption algorithm - Expected: ECDSA Actual: RSA",
"Certificate: ARISTA_SIGNING_CA.crt - incorrect public key - Expected: 256 Actual: 4096",
"Certificate: ARISTA_ROOT_CA.crt - incorrect encryption algorithm - Expected: RSA Actual: ECDSA",
"Certificate: ARISTA_ROOT_CA.crt - incorrect public key - Expected: 4096 Actual: 256",
],
},
},
{
"name": "failure-missing-actual-output",
"name": "failure-missing-algorithm-details",
"test": VerifyAPISSLCertificate,
"eos_data": [
{
@ -595,12 +586,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"SSL certificate `ARISTA_SIGNING_CA.crt` is not configured properly:\n"
"Expected `ECDSA` as the publicKey.encryptionAlgorithm, but it was not found in the actual output.\n"
"Expected `256` as the publicKey.size, but it was not found in the actual output.\n",
"SSL certificate `ARISTA_ROOT_CA.crt` is not configured properly:\n"
"Expected `RSA` as the publicKey.encryptionAlgorithm, but it was not found in the actual output.\n"
"Expected `4096` as the publicKey.size, but it was not found in the actual output.\n",
"Certificate: ARISTA_SIGNING_CA.crt - incorrect encryption algorithm - Expected: ECDSA Actual: Not found",
"Certificate: ARISTA_SIGNING_CA.crt - incorrect public key - Expected: 256 Actual: Not found",
"Certificate: ARISTA_ROOT_CA.crt - incorrect encryption algorithm - Expected: RSA Actual: Not found",
"Certificate: ARISTA_ROOT_CA.crt - incorrect public key - Expected: 4096 Actual: Not found",
],
},
},
@ -651,12 +640,26 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Expected `Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n"
"that can be found in the LICENSE file.` as the login banner, but found `Copyright (c) 2023 Arista Networks, Inc.\nUse of this source code is "
"governed by the Apache License 2.0\nthat can be found in the LICENSE file.` instead."
"Incorrect login banner configured - Expected: Copyright (c) 2023-2024 Arista Networks, Inc.\n"
"Use of this source code is governed by the Apache License 2.0\nthat can be found in the LICENSE file. "
"Actual: Copyright (c) 2023 Arista Networks, Inc.\n"
"Use of this source code is governed by the Apache License 2.0\nthat can be found in the LICENSE file."
],
},
},
{
"name": "failure-login-banner-not-configured",
"test": VerifyBannerLogin,
"eos_data": [{"loginBanner": ""}],
"inputs": {
"login_banner": "Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n"
"that can be found in the LICENSE file."
},
"expected": {
"result": "failure",
"messages": ["Login banner is not configured"],
},
},
{
"name": "success",
"test": VerifyBannerMotd,
@ -704,12 +707,26 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Expected `Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n"
"that can be found in the LICENSE file.` as the motd banner, but found `Copyright (c) 2023 Arista Networks, Inc.\nUse of this source code is "
"governed by the Apache License 2.0\nthat can be found in the LICENSE file.` instead."
"Incorrect MOTD banner configured - Expected: Copyright (c) 2023-2024 Arista Networks, Inc.\n"
"Use of this source code is governed by the Apache License 2.0\nthat can be found in the LICENSE file. "
"Actual: Copyright (c) 2023 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n"
"that can be found in the LICENSE file."
],
},
},
{
"name": "failure-login-banner-not-configured",
"test": VerifyBannerMotd,
"eos_data": [{"motd": ""}],
"inputs": {
"motd_banner": "Copyright (c) 2023-2024 Arista Networks, Inc.\nUse of this source code is governed by the Apache License 2.0\n"
"that can be found in the LICENSE file."
},
"expected": {
"result": "failure",
"messages": ["MOTD banner is not configured"],
},
},
{
"name": "success",
"test": VerifyIPv4ACL,
@ -717,22 +734,20 @@ DATA: list[dict[str, Any]] = [
{
"aclList": [
{
"name": "default-control-plane-acl",
"sequence": [
{"text": "permit icmp any any", "sequenceNumber": 10},
{"text": "permit ip any any tracked", "sequenceNumber": 20},
{"text": "permit udp any any eq bfd ttl eq 255", "sequenceNumber": 30},
],
}
]
},
{
"aclList": [
},
{
"name": "LabTest",
"sequence": [
{"text": "permit icmp any any", "sequenceNumber": 10},
{"text": "permit tcp any any range 5900 5910", "sequenceNumber": 20},
],
}
},
]
},
],
@ -754,6 +769,24 @@ DATA: list[dict[str, Any]] = [
},
"expected": {"result": "success"},
},
{
"name": "failure-no-acl-list",
"test": VerifyIPv4ACL,
"eos_data": [
{"aclList": []},
],
"inputs": {
"ipv4_access_lists": [
{
"name": "default-control-plane-acl",
"entries": [
{"sequence": 10, "action": "permit icmp any any"},
],
},
]
},
"expected": {"result": "failure", "messages": ["No Access Control List (ACL) configured"]},
},
{
"name": "failure-acl-not-found",
"test": VerifyIPv4ACL,
@ -761,6 +794,7 @@ DATA: list[dict[str, Any]] = [
{
"aclList": [
{
"name": "default-control-plane-acl",
"sequence": [
{"text": "permit icmp any any", "sequenceNumber": 10},
{"text": "permit ip any any tracked", "sequenceNumber": 20},
@ -769,7 +803,6 @@ DATA: list[dict[str, Any]] = [
}
]
},
{"aclList": []},
],
"inputs": {
"ipv4_access_lists": [
@ -787,7 +820,7 @@ DATA: list[dict[str, Any]] = [
},
]
},
"expected": {"result": "failure", "messages": ["LabTest: Not found"]},
"expected": {"result": "failure", "messages": ["ACL name: LabTest - Not configured"]},
},
{
"name": "failure-sequence-not-found",
@ -796,22 +829,20 @@ DATA: list[dict[str, Any]] = [
{
"aclList": [
{
"name": "default-control-plane-acl",
"sequence": [
{"text": "permit icmp any any", "sequenceNumber": 10},
{"text": "permit ip any any tracked", "sequenceNumber": 20},
{"text": "permit udp any any eq bfd ttl eq 255", "sequenceNumber": 40},
],
}
]
},
{
"aclList": [
},
{
"name": "LabTest",
"sequence": [
{"text": "permit icmp any any", "sequenceNumber": 10},
{"text": "permit tcp any any range 5900 5910", "sequenceNumber": 30},
],
}
},
]
},
],
@ -833,7 +864,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["default-control-plane-acl:\nSequence number `30` is not found.\n", "LabTest:\nSequence number `20` is not found.\n"],
"messages": ["ACL name: default-control-plane-acl Sequence: 30 - Not configured", "ACL name: LabTest Sequence: 20 - Not configured"],
},
},
{
@ -843,22 +874,20 @@ DATA: list[dict[str, Any]] = [
{
"aclList": [
{
"name": "default-control-plane-acl",
"sequence": [
{"text": "permit icmp any any", "sequenceNumber": 10},
{"text": "permit ip any any tracked", "sequenceNumber": 20},
{"text": "permit tcp any any range 5900 5910", "sequenceNumber": 30},
],
}
]
},
{
"aclList": [
},
{
"name": "LabTest",
"sequence": [
{"text": "permit icmp any any", "sequenceNumber": 10},
{"text": "permit udp any any eq bfd ttl eq 255", "sequenceNumber": 20},
],
}
},
]
},
],
@ -881,9 +910,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"default-control-plane-acl:\n"
"Expected `permit udp any any eq bfd ttl eq 255` as sequence number 30 action but found `permit tcp any any range 5900 5910` instead.\n",
"LabTest:\nExpected `permit tcp any any range 5900 5910` as sequence number 20 action but found `permit udp any any eq bfd ttl eq 255` instead.\n",
"ACL name: default-control-plane-acl Sequence: 30 - action mismatch - Expected: permit udp any any eq bfd ttl eq 255 "
"Actual: permit tcp any any range 5900 5910",
"ACL name: LabTest Sequence: 20 - action mismatch - Expected: permit tcp any any range 5900 5910 Actual: permit udp any any eq bfd ttl eq 255",
],
},
},
@ -894,6 +923,7 @@ DATA: list[dict[str, Any]] = [
{
"aclList": [
{
"name": "default-control-plane-acl",
"sequence": [
{"text": "permit icmp any any", "sequenceNumber": 10},
{"text": "permit ip any any tracked", "sequenceNumber": 40},
@ -902,7 +932,6 @@ DATA: list[dict[str, Any]] = [
}
]
},
{"aclList": []},
],
"inputs": {
"ipv4_access_lists": [
@ -923,9 +952,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"default-control-plane-acl:\nSequence number `20` is not found.\n"
"Expected `permit udp any any eq bfd ttl eq 255` as sequence number 30 action but found `permit tcp any any range 5900 5910` instead.\n",
"LabTest: Not found",
"ACL name: default-control-plane-acl Sequence: 20 - Not configured",
"ACL name: default-control-plane-acl Sequence: 30 - action mismatch - Expected: permit udp any any eq bfd ttl eq 255 "
"Actual: permit tcp any any range 5900 5910",
"ACL name: LabTest - Not configured",
],
},
},
@ -952,7 +982,7 @@ DATA: list[dict[str, Any]] = [
"test": VerifyIPSecConnHealth,
"eos_data": [{"connections": {}}],
"inputs": {},
"expected": {"result": "failure", "messages": ["No IPv4 security connection configured."]},
"expected": {"result": "failure", "messages": ["No IPv4 security connection configured"]},
},
{
"name": "failure-not-established",
@ -974,9 +1004,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"The following IPv4 security connections are not established:\n"
"source:172.18.3.2 destination:172.18.2.2 vrf:default\n"
"source:100.64.3.2 destination:100.64.5.2 vrf:Guest."
"Source: 172.18.3.2 Destination: 172.18.2.2 VRF: default - IPv4 security connection not established",
"Source: 100.64.3.2 Destination: 100.64.5.2 VRF: Guest - IPv4 security connection not established",
],
},
},
@ -1127,10 +1156,10 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Peer: 10.255.0.1 VRF: default Source: 172.18.3.2 Destination: 172.18.2.2 - Connection down - Expected: Established, Actual: Idle",
"Peer: 10.255.0.1 VRF: default Source: 100.64.2.2 Destination: 100.64.1.2 - Connection down - Expected: Established, Actual: Idle",
"Peer: 10.255.0.2 VRF: MGMT Source: 100.64.2.2 Destination: 100.64.1.2 - Connection down - Expected: Established, Actual: Idle",
"Peer: 10.255.0.2 VRF: MGMT Source: 172.18.2.2 Destination: 172.18.1.2 - Connection down - Expected: Established, Actual: Idle",
"Peer: 10.255.0.1 VRF: default Source: 172.18.3.2 Destination: 172.18.2.2 - Connection down - Expected: Established Actual: Idle",
"Peer: 10.255.0.1 VRF: default Source: 100.64.2.2 Destination: 100.64.1.2 - Connection down - Expected: Established Actual: Idle",
"Peer: 10.255.0.2 VRF: MGMT Source: 100.64.2.2 Destination: 100.64.1.2 - Connection down - Expected: Established Actual: Idle",
"Peer: 10.255.0.2 VRF: MGMT Source: 172.18.2.2 Destination: 172.18.1.2 - Connection down - Expected: Established Actual: Idle",
],
},
},
@ -1190,8 +1219,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Peer: 10.255.0.1 VRF: default Source: 172.18.3.2 Destination: 172.18.2.2 - Connection down - Expected: Established, Actual: Idle",
"Peer: 10.255.0.1 VRF: default Source: 100.64.3.2 Destination: 100.64.2.2 - Connection down - Expected: Established, Actual: Idle",
"Peer: 10.255.0.1 VRF: default Source: 172.18.3.2 Destination: 172.18.2.2 - Connection down - Expected: Established Actual: Idle",
"Peer: 10.255.0.1 VRF: default Source: 100.64.3.2 Destination: 100.64.2.2 - Connection down - Expected: Established Actual: Idle",
"Peer: 10.255.0.2 VRF: default Source: 100.64.4.2 Destination: 100.64.1.2 - Connection not found.",
"Peer: 10.255.0.2 VRF: default Source: 172.18.4.2 Destination: 172.18.1.2 - Connection not found.",
],
@ -1209,7 +1238,7 @@ DATA: list[dict[str, Any]] = [
"test": VerifyHardwareEntropy,
"eos_data": [{"cpuModel": "2.20GHz", "cryptoModule": "Crypto Module v3.0", "hardwareEntropyEnabled": False, "blockedNetworkProtocols": []}],
"inputs": {},
"expected": {"result": "failure", "messages": ["Hardware entropy generation is disabled."]},
"expected": {"result": "failure", "messages": ["Hardware entropy generation is disabled"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.services.py."""
@ -25,7 +25,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"hostname": "s1-spine1"},
"expected": {
"result": "failure",
"messages": ["Expected `s1-spine1` as the hostname, but found `s1-spine2` instead."],
"messages": ["Incorrect Hostname - Expected: s1-spine1 Actual: s1-spine2"],
},
},
{
@ -88,7 +88,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["Server 10.14.0.10 (VRF: default, Priority: 0) - Not configured", "Server 10.14.0.21 (VRF: MGMT, Priority: 1) - Not configured"],
"messages": ["Server 10.14.0.10 VRF: default Priority: 0 - Not configured", "Server 10.14.0.21 VRF: MGMT Priority: 1 - Not configured"],
},
},
{
@ -109,9 +109,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Server 10.14.0.1 (VRF: CS, Priority: 0) - Incorrect priority - Priority: 1",
"Server 10.14.0.11 (VRF: default, Priority: 0) - Not configured",
"Server 10.14.0.110 (VRF: MGMT, Priority: 0) - Not configured",
"Server 10.14.0.1 VRF: CS Priority: 0 - Incorrect priority - Priority: 1",
"Server 10.14.0.11 VRF: default Priority: 0 - Not configured",
"Server 10.14.0.110 VRF: MGMT Priority: 0 - Not configured",
],
},
},
@ -147,7 +147,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"reasons": [{"reason": "acl", "interval": 300}, {"reason": "arp-inspection", "interval": 30}, {"reason": "tapagg", "interval": 30}]},
"expected": {
"result": "failure",
"messages": ["`tapagg`: Not found."],
"messages": ["Reason: tapagg Status: Enabled Interval: 30 - Not found"],
},
},
{
@ -165,7 +165,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"reasons": [{"reason": "acl", "interval": 300}, {"reason": "arp-inspection", "interval": 30}]},
"expected": {
"result": "failure",
"messages": ["`acl`:\nExpected `Enabled` as the status, but found `Disabled` instead."],
"messages": ["Reason: acl Status: Enabled Interval: 300 - Incorrect configuration - Status: Disabled Interval: 300"],
},
},
{
@ -183,7 +183,9 @@ DATA: list[dict[str, Any]] = [
"inputs": {"reasons": [{"reason": "acl", "interval": 30}, {"reason": "arp-inspection", "interval": 30}]},
"expected": {
"result": "failure",
"messages": ["`acl`:\nExpected `30` as the interval, but found `300` instead."],
"messages": [
"Reason: acl Status: Enabled Interval: 30 - Incorrect configuration - Status: Enabled Interval: 300",
],
},
},
{
@ -202,9 +204,9 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"`acl`:\nExpected `30` as the interval, but found `300` instead.\nExpected `Enabled` as the status, but found `Disabled` instead.",
"`arp-inspection`:\nExpected `300` as the interval, but found `30` instead.",
"`tapagg`: Not found.",
"Reason: acl Status: Enabled Interval: 30 - Incorrect configuration - Status: Disabled Interval: 300",
"Reason: arp-inspection Status: Enabled Interval: 300 - Incorrect configuration - Status: Enabled Interval: 30",
"Reason: tapagg Status: Enabled Interval: 30 - Not found",
],
},
},

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.snmp.py."""
@ -10,11 +10,16 @@ from typing import Any
from anta.tests.snmp import (
VerifySnmpContact,
VerifySnmpErrorCounters,
VerifySnmpGroup,
VerifySnmpHostLogging,
VerifySnmpIPv4Acl,
VerifySnmpIPv6Acl,
VerifySnmpLocation,
VerifySnmpNotificationHost,
VerifySnmpPDUCounters,
VerifySnmpSourceInterface,
VerifySnmpStatus,
VerifySnmpUser,
)
from tests.units.anta_tests import test
@ -31,14 +36,14 @@ DATA: list[dict[str, Any]] = [
"test": VerifySnmpStatus,
"eos_data": [{"vrfs": {"snmpVrfs": ["default"]}, "enabled": True}],
"inputs": {"vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["SNMP agent disabled in vrf MGMT"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - SNMP agent disabled"]},
},
{
"name": "failure-disabled",
"test": VerifySnmpStatus,
"eos_data": [{"vrfs": {"snmpVrfs": ["default"]}, "enabled": False}],
"inputs": {"vrf": "default"},
"expected": {"result": "failure", "messages": ["SNMP agent disabled in vrf default"]},
"expected": {"result": "failure", "messages": ["VRF: default - SNMP agent disabled"]},
},
{
"name": "success",
@ -52,14 +57,14 @@ DATA: list[dict[str, Any]] = [
"test": VerifySnmpIPv4Acl,
"eos_data": [{"ipAclList": {"aclList": []}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Expected 1 SNMP IPv4 ACL(s) in vrf MGMT but got 0"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - Incorrect SNMP IPv4 ACL(s) - Expected: 1 Actual: 0"]},
},
{
"name": "failure-wrong-vrf",
"test": VerifySnmpIPv4Acl,
"eos_data": [{"ipAclList": {"aclList": [{"type": "Ip4Acl", "name": "ACL_IPV4_SNMP", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["SNMP IPv4 ACL(s) not configured or active in vrf MGMT: ['ACL_IPV4_SNMP']"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - Following SNMP IPv4 ACL(s) not configured or active: ACL_IPV4_SNMP"]},
},
{
"name": "success",
@ -73,14 +78,14 @@ DATA: list[dict[str, Any]] = [
"test": VerifySnmpIPv6Acl,
"eos_data": [{"ipv6AclList": {"aclList": []}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["Expected 1 SNMP IPv6 ACL(s) in vrf MGMT but got 0"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - Incorrect SNMP IPv6 ACL(s) - Expected: 1 Actual: 0"]},
},
{
"name": "failure-wrong-vrf",
"test": VerifySnmpIPv6Acl,
"eos_data": [{"ipv6AclList": {"aclList": [{"type": "Ip6Acl", "name": "ACL_IPV6_SNMP", "configuredVrfs": ["default"], "activeVrfs": ["default"]}]}}],
"inputs": {"number": 1, "vrf": "MGMT"},
"expected": {"result": "failure", "messages": ["SNMP IPv6 ACL(s) not configured or active in vrf MGMT: ['ACL_IPV6_SNMP']"]},
"expected": {"result": "failure", "messages": ["VRF: MGMT - Following SNMP IPv6 ACL(s) not configured or active: ACL_IPV6_SNMP"]},
},
{
"name": "success",
@ -104,7 +109,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"location": "New York"},
"expected": {
"result": "failure",
"messages": ["Expected `New York` as the location, but found `Europe` instead."],
"messages": ["Incorrect SNMP location - Expected: New York Actual: Europe"],
},
},
{
@ -118,7 +123,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"location": "New York"},
"expected": {
"result": "failure",
"messages": ["SNMP location is not configured."],
"messages": ["SNMP location is not configured"],
},
},
{
@ -143,7 +148,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"contact": "Bob@example.com"},
"expected": {
"result": "failure",
"messages": ["Expected `Bob@example.com` as the contact, but found `Jon@example.com` instead."],
"messages": ["Incorrect SNMP contact - Expected: Bob@example.com Actual: Jon@example.com"],
},
},
{
@ -157,7 +162,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"contact": "Bob@example.com"},
"expected": {
"result": "failure",
"messages": ["SNMP contact is not configured."],
"messages": ["SNMP contact is not configured"],
},
},
{
@ -203,7 +208,7 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": {},
"expected": {"result": "failure", "messages": ["SNMP counters not found."]},
"expected": {"result": "failure", "messages": ["SNMP counters not found"]},
},
{
"name": "failure-incorrect-counters",
@ -222,7 +227,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {},
"expected": {
"result": "failure",
"messages": ["The following SNMP PDU counters are not found or have zero PDU counters:\n{'inGetPdus': 0, 'inSetPdus': 0}"],
"messages": ["The following SNMP PDU counters are not found or have zero PDU counters: inGetPdus, inSetPdus"],
},
},
{
@ -240,7 +245,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"pdus": ["inGetPdus", "outTrapPdus"]},
"expected": {
"result": "failure",
"messages": ["The following SNMP PDU counters are not found or have zero PDU counters:\n{'inGetPdus': 'Not Found', 'outTrapPdus': 'Not Found'}"],
"messages": ["The following SNMP PDU counters are not found or have zero PDU counters: inGetPdus, outTrapPdus"],
},
},
{
@ -292,7 +297,7 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": {},
"expected": {"result": "failure", "messages": ["SNMP counters not found."]},
"expected": {"result": "failure", "messages": ["SNMP counters not found"]},
},
{
"name": "failure-incorrect-counters",
@ -312,10 +317,796 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": {},
"expected": {
"result": "failure",
"messages": ["The following SNMP error counters are not found or have non-zero error counters: inParseErrs, inVersionErrs, outBadValueErrs"],
},
},
{
"name": "success",
"test": VerifySnmpHostLogging,
"eos_data": [
{
"logging": {
"loggingEnabled": True,
"hosts": {
"192.168.1.100": {"port": 162, "vrf": ""},
"192.168.1.101": {"port": 162, "vrf": "MGMT"},
"snmp-server-01": {"port": 162, "vrf": "default"},
},
}
}
],
"inputs": {
"hosts": [
{"hostname": "192.168.1.100", "vrf": "default"},
{"hostname": "192.168.1.101", "vrf": "MGMT"},
{"hostname": "snmp-server-01", "vrf": "default"},
]
},
"expected": {"result": "success"},
},
{
"name": "failure-logging-disabled",
"test": VerifySnmpHostLogging,
"eos_data": [{"logging": {"loggingEnabled": False}}],
"inputs": {"hosts": [{"hostname": "192.168.1.100", "vrf": "default"}, {"hostname": "192.168.1.101", "vrf": "MGMT"}]},
"expected": {"result": "failure", "messages": ["SNMP logging is disabled"]},
},
{
"name": "failure-mismatch-vrf",
"test": VerifySnmpHostLogging,
"eos_data": [{"logging": {"loggingEnabled": True, "hosts": {"192.168.1.100": {"port": 162, "vrf": "MGMT"}, "192.168.1.101": {"port": 162, "vrf": "Test"}}}}],
"inputs": {"hosts": [{"hostname": "192.168.1.100", "vrf": "default"}, {"hostname": "192.168.1.101", "vrf": "MGMT"}]},
"expected": {
"result": "failure",
"messages": ["Host: 192.168.1.100 VRF: default - Incorrect VRF - Actual: MGMT", "Host: 192.168.1.101 VRF: MGMT - Incorrect VRF - Actual: Test"],
},
},
{
"name": "failure-host-not-configured",
"test": VerifySnmpHostLogging,
"eos_data": [{"logging": {"loggingEnabled": True, "hosts": {"192.168.1.100": {"port": 162, "vrf": "MGMT"}, "192.168.1.103": {"port": 162, "vrf": "Test"}}}}],
"inputs": {"hosts": [{"hostname": "192.168.1.101", "vrf": "default"}, {"hostname": "192.168.1.102", "vrf": "MGMT"}]},
"expected": {
"result": "failure",
"messages": ["Host: 192.168.1.101 VRF: default - Not configured", "Host: 192.168.1.102 VRF: MGMT - Not configured"],
},
},
{
"name": "success",
"test": VerifySnmpUser,
"eos_data": [
{
"usersByVersion": {
"v1": {
"users": {
"Test1": {
"groupName": "TestGroup1",
},
}
},
"v2c": {
"users": {
"Test2": {
"groupName": "TestGroup2",
},
}
},
"v3": {
"users": {
"Test3": {
"groupName": "TestGroup3",
"v3Params": {"authType": "SHA-384", "privType": "AES-128"},
},
"Test4": {"groupName": "TestGroup3", "v3Params": {"authType": "SHA-512", "privType": "AES-192"}},
}
},
}
}
],
"inputs": {
"snmp_users": [
{"username": "Test1", "group_name": "TestGroup1", "version": "v1"},
{"username": "Test2", "group_name": "TestGroup2", "version": "v2c"},
{"username": "Test3", "group_name": "TestGroup3", "version": "v3", "auth_type": "SHA-384", "priv_type": "AES-128"},
{"username": "Test4", "group_name": "TestGroup3", "version": "v3", "auth_type": "SHA-512", "priv_type": "AES-192"},
]
},
"expected": {"result": "success"},
},
{
"name": "failure-not-configured",
"test": VerifySnmpUser,
"eos_data": [
{
"usersByVersion": {
"v3": {
"users": {
"Test3": {
"groupName": "TestGroup3",
"v3Params": {"authType": "SHA-384", "privType": "AES-128"},
},
}
},
}
}
],
"inputs": {
"snmp_users": [
{"username": "Test1", "group_name": "TestGroup1", "version": "v1"},
{"username": "Test2", "group_name": "TestGroup2", "version": "v2c"},
{"username": "Test3", "group_name": "TestGroup3", "version": "v3", "auth_type": "SHA-384", "priv_type": "AES-128"},
{"username": "Test4", "group_name": "TestGroup3", "version": "v3", "auth_type": "SHA-512", "priv_type": "AES-192"},
]
},
"expected": {
"result": "failure",
"messages": [
"The following SNMP error counters are not found or have non-zero error counters:\n{'inVersionErrs': 1, 'inParseErrs': 2, 'outBadValueErrs': 2}"
"User: Test1 Group: TestGroup1 Version: v1 - Not found",
"User: Test2 Group: TestGroup2 Version: v2c - Not found",
"User: Test4 Group: TestGroup3 Version: v3 - Not found",
],
},
},
{
"name": "failure-incorrect-group",
"test": VerifySnmpUser,
"eos_data": [
{
"usersByVersion": {
"v1": {
"users": {
"Test1": {
"groupName": "TestGroup2",
},
}
},
"v2c": {
"users": {
"Test2": {
"groupName": "TestGroup1",
},
}
},
"v3": {},
}
}
],
"inputs": {
"snmp_users": [
{"username": "Test1", "group_name": "TestGroup1", "version": "v1"},
{"username": "Test2", "group_name": "TestGroup2", "version": "v2c"},
]
},
"expected": {
"result": "failure",
"messages": [
"User: Test1 Group: TestGroup1 Version: v1 - Incorrect user group - Actual: TestGroup2",
"User: Test2 Group: TestGroup2 Version: v2c - Incorrect user group - Actual: TestGroup1",
],
},
},
{
"name": "failure-incorrect-auth-encryption",
"test": VerifySnmpUser,
"eos_data": [
{
"usersByVersion": {
"v1": {
"users": {
"Test1": {
"groupName": "TestGroup1",
},
}
},
"v2c": {
"users": {
"Test2": {
"groupName": "TestGroup2",
},
}
},
"v3": {
"users": {
"Test3": {
"groupName": "TestGroup3",
"v3Params": {"authType": "SHA-512", "privType": "AES-192"},
},
"Test4": {"groupName": "TestGroup4", "v3Params": {"authType": "SHA-384", "privType": "AES-128"}},
}
},
}
}
],
"inputs": {
"snmp_users": [
{"username": "Test1", "group_name": "TestGroup1", "version": "v1"},
{"username": "Test2", "group_name": "TestGroup2", "version": "v2c"},
{"username": "Test3", "group_name": "TestGroup3", "version": "v3", "auth_type": "SHA-384", "priv_type": "AES-128"},
{"username": "Test4", "group_name": "TestGroup4", "version": "v3", "auth_type": "SHA-512", "priv_type": "AES-192"},
]
},
"expected": {
"result": "failure",
"messages": [
"User: Test3 Group: TestGroup3 Version: v3 - Incorrect authentication type - Expected: SHA-384 Actual: SHA-512",
"User: Test3 Group: TestGroup3 Version: v3 - Incorrect privacy type - Expected: AES-128 Actual: AES-192",
"User: Test4 Group: TestGroup4 Version: v3 - Incorrect authentication type - Expected: SHA-512 Actual: SHA-384",
"User: Test4 Group: TestGroup4 Version: v3 - Incorrect privacy type - Expected: AES-192 Actual: AES-128",
],
},
},
{
"name": "success",
"test": VerifySnmpNotificationHost,
"eos_data": [
{
"hosts": [
{
"hostname": "192.168.1.100",
"port": 162,
"vrf": "",
"notificationType": "trap",
"protocolVersion": "v3",
"v3Params": {"user": "public", "securityLevel": "authNoPriv"},
},
{
"hostname": "192.168.1.101",
"port": 162,
"vrf": "MGMT",
"notificationType": "trap",
"protocolVersion": "v2c",
"v1v2cParams": {"communityString": "public"},
},
]
}
],
"inputs": {
"notification_hosts": [
{"hostname": "192.168.1.100", "vrf": "default", "notification_type": "trap", "version": "v3", "udp_port": 162, "user": "public"},
{"hostname": "192.168.1.101", "vrf": "MGMT", "notification_type": "trap", "version": "v2c", "udp_port": 162, "community_string": "public"},
]
},
"expected": {"result": "success"},
},
{
"name": "failure-not-configured",
"test": VerifySnmpNotificationHost,
"eos_data": [{"hosts": []}],
"inputs": {
"notification_hosts": [
{"hostname": "192.168.1.100", "vrf": "default", "notification_type": "trap", "version": "v3", "udp_port": 162, "user": "public"},
{"hostname": "192.168.1.101", "vrf": "default", "notification_type": "trap", "version": "v2c", "udp_port": 162, "community_string": "public"},
]
},
"expected": {"result": "failure", "messages": ["No SNMP host is configured"]},
},
{
"name": "failure-details-host-not-found",
"test": VerifySnmpNotificationHost,
"eos_data": [
{
"hosts": [
{
"hostname": "192.168.1.100",
"port": 162,
"vrf": "",
"notificationType": "trap",
"protocolVersion": "v3",
"v3Params": {"user": "public", "securityLevel": "authNoPriv"},
},
]
}
],
"inputs": {
"notification_hosts": [
{"hostname": "192.168.1.100", "vrf": "default", "notification_type": "trap", "version": "v3", "udp_port": 162, "user": "public"},
{"hostname": "192.168.1.101", "vrf": "default", "notification_type": "trap", "version": "v2c", "udp_port": 162, "community_string": "public"},
]
},
"expected": {"result": "failure", "messages": ["Host: 192.168.1.101 VRF: default Version: v2c - Not configured"]},
},
{
"name": "failure-incorrect-notification-type",
"test": VerifySnmpNotificationHost,
"eos_data": [
{
"hosts": [
{
"hostname": "192.168.1.100",
"port": 162,
"vrf": "",
"notificationType": "trap",
"protocolVersion": "v3",
"v3Params": {"user": "public", "securityLevel": "authNoPriv"},
},
{
"hostname": "192.168.1.101",
"port": 162,
"vrf": "",
"notificationType": "inform",
"protocolVersion": "v2c",
"v1v2cParams": {"communityString": "public"},
},
]
}
],
"inputs": {
"notification_hosts": [
{"hostname": "192.168.1.100", "vrf": "default", "notification_type": "inform", "version": "v3", "udp_port": 162, "user": "public"},
{"hostname": "192.168.1.101", "vrf": "default", "notification_type": "trap", "version": "v2c", "udp_port": 162, "community_string": "public"},
]
},
"expected": {
"result": "failure",
"messages": [
"Host: 192.168.1.100 VRF: default - Incorrect notification type - Expected: inform Actual: trap",
"Host: 192.168.1.101 VRF: default - Incorrect notification type - Expected: trap Actual: inform",
],
},
},
{
"name": "failure-incorrect-udp-port",
"test": VerifySnmpNotificationHost,
"eos_data": [
{
"hosts": [
{
"hostname": "192.168.1.100",
"port": 163,
"vrf": "",
"notificationType": "trap",
"protocolVersion": "v3",
"v3Params": {"user": "public", "securityLevel": "authNoPriv"},
},
{
"hostname": "192.168.1.101",
"port": 164,
"vrf": "",
"notificationType": "trap",
"protocolVersion": "v2c",
"v1v2cParams": {"communityString": "public"},
},
]
}
],
"inputs": {
"notification_hosts": [
{"hostname": "192.168.1.100", "vrf": "default", "notification_type": "trap", "version": "v3", "udp_port": 162, "user": "public"},
{"hostname": "192.168.1.101", "vrf": "default", "notification_type": "trap", "version": "v2c", "udp_port": 162, "community_string": "public"},
]
},
"expected": {
"result": "failure",
"messages": [
"Host: 192.168.1.100 VRF: default - Incorrect UDP port - Expected: 162 Actual: 163",
"Host: 192.168.1.101 VRF: default - Incorrect UDP port - Expected: 162 Actual: 164",
],
},
},
{
"name": "failure-incorrect-community-string-version-v1-v2c",
"test": VerifySnmpNotificationHost,
"eos_data": [
{
"hosts": [
{
"hostname": "192.168.1.100",
"port": 162,
"vrf": "",
"notificationType": "trap",
"protocolVersion": "v1",
"v1v2cParams": {"communityString": "private"},
},
{
"hostname": "192.168.1.101",
"port": 162,
"vrf": "",
"notificationType": "trap",
"protocolVersion": "v2c",
"v1v2cParams": {"communityString": "private"},
},
]
}
],
"inputs": {
"notification_hosts": [
{"hostname": "192.168.1.100", "vrf": "default", "notification_type": "trap", "version": "v1", "udp_port": 162, "community_string": "public"},
{"hostname": "192.168.1.101", "vrf": "default", "notification_type": "trap", "version": "v2c", "udp_port": 162, "community_string": "public"},
]
},
"expected": {
"result": "failure",
"messages": [
"Host: 192.168.1.100 VRF: default Version: v1 - Incorrect community string - Expected: public Actual: private",
"Host: 192.168.1.101 VRF: default Version: v2c - Incorrect community string - Expected: public Actual: private",
],
},
},
{
"name": "failure-incorrect-user-for-version-v3",
"test": VerifySnmpNotificationHost,
"eos_data": [
{
"hosts": [
{
"hostname": "192.168.1.100",
"port": 162,
"vrf": "",
"notificationType": "trap",
"protocolVersion": "v3",
"v3Params": {"user": "private", "securityLevel": "authNoPriv"},
}
]
}
],
"inputs": {
"notification_hosts": [
{"hostname": "192.168.1.100", "vrf": "default", "notification_type": "trap", "version": "v3", "udp_port": 162, "user": "public"},
]
},
"expected": {"result": "failure", "messages": ["Host: 192.168.1.100 VRF: default Version: v3 - Incorrect user - Expected: public Actual: private"]},
},
{
"name": "success",
"test": VerifySnmpSourceInterface,
"eos_data": [
{
"srcIntf": {"sourceInterfaces": {"default": "Ethernet1", "MGMT": "Management0"}},
}
],
"inputs": {"interfaces": [{"interface": "Ethernet1", "vrf": "default"}, {"interface": "Management0", "vrf": "MGMT"}]},
"expected": {"result": "success"},
},
{
"name": "failure-not-configured",
"test": VerifySnmpSourceInterface,
"eos_data": [
{
"srcIntf": {},
}
],
"inputs": {"interfaces": [{"interface": "Ethernet1", "vrf": "default"}, {"interface": "Management0", "vrf": "MGMT"}]},
"expected": {"result": "failure", "messages": ["SNMP source interface(s) not configured"]},
},
{
"name": "failure-incorrect-interfaces",
"test": VerifySnmpSourceInterface,
"eos_data": [
{
"srcIntf": {
"sourceInterfaces": {
"default": "Management0",
}
},
}
],
"inputs": {"interfaces": [{"interface": "Ethernet1", "vrf": "default"}, {"interface": "Management0", "vrf": "MGMT"}]},
"expected": {
"result": "failure",
"messages": [
"Source Interface: Ethernet1 VRF: default - Incorrect source interface - Actual: Management0",
"Source Interface: Management0 VRF: MGMT - Not configured",
],
},
},
{
"name": "success",
"test": VerifySnmpGroup,
"eos_data": [
{
"groups": {
"Group1": {
"versions": {
"v1": {
"secModel": "v1",
"readView": "group_read_1",
"readViewConfig": True,
"writeView": "group_write_1",
"writeViewConfig": True,
"notifyView": "group_notify_1",
"notifyViewConfig": True,
}
}
},
"Group2": {
"versions": {
"v2c": {
"secModel": "v2c",
"readView": "group_read_2",
"readViewConfig": True,
"writeView": "group_write_2",
"writeViewConfig": True,
"notifyView": "group_notify_2",
"notifyViewConfig": True,
}
}
},
"Group3": {
"versions": {
"v3": {
"secModel": "v3Auth",
"readView": "group_read_3",
"readViewConfig": True,
"writeView": "group_write_3",
"writeViewConfig": True,
"notifyView": "group_notify_3",
"notifyViewConfig": True,
}
}
},
}
}
],
"inputs": {
"snmp_groups": [
{"group_name": "Group1", "version": "v1", "read_view": "group_read_1", "write_view": "group_write_1", "notify_view": "group_notify_1"},
{"group_name": "Group2", "version": "v2c", "read_view": "group_read_2", "write_view": "group_write_2", "notify_view": "group_notify_2"},
{
"group_name": "Group3",
"version": "v3",
"read_view": "group_read_3",
"write_view": "group_write_3",
"notify_view": "group_notify_3",
"authentication": "auth",
},
]
},
"expected": {"result": "success"},
},
{
"name": "failure-incorrect-view",
"test": VerifySnmpGroup,
"eos_data": [
{
"groups": {
"Group1": {
"versions": {
"v1": {
"secModel": "v1",
"readView": "group_read",
"readViewConfig": True,
"writeView": "group_write",
"writeViewConfig": True,
"notifyView": "group_notify",
"notifyViewConfig": True,
}
}
},
"Group2": {
"versions": {
"v2c": {
"secModel": "v2c",
"readView": "group_read",
"readViewConfig": True,
"writeView": "group_write",
"writeViewConfig": True,
"notifyView": "group_notify",
"notifyViewConfig": True,
}
}
},
"Group3": {
"versions": {
"v3": {
"secModel": "v3NoAuth",
"readView": "group_read",
"readViewConfig": True,
"writeView": "group_write",
"writeViewConfig": True,
"notifyView": "group_notify",
"notifyViewConfig": True,
}
}
},
}
}
],
"inputs": {
"snmp_groups": [
{"group_name": "Group1", "version": "v1", "read_view": "group_read_1", "write_view": "group_write_1", "notify_view": "group_notify_1"},
{"group_name": "Group2", "version": "v2c", "read_view": "group_read_2", "notify_view": "group_notify_2"},
{
"group_name": "Group3",
"version": "v3",
"read_view": "group_read_3",
"write_view": "group_write_3",
"notify_view": "group_notify_3",
"authentication": "noauth",
},
]
},
"expected": {
"result": "failure",
"messages": [
"Group: Group1 Version: v1 - Incorrect Read view - Expected: group_read_1 Actual: group_read",
"Group: Group1 Version: v1 - Incorrect Write view - Expected: group_write_1 Actual: group_write",
"Group: Group1 Version: v1 - Incorrect Notify view - Expected: group_notify_1 Actual: group_notify",
"Group: Group2 Version: v2c - Incorrect Read view - Expected: group_read_2 Actual: group_read",
"Group: Group2 Version: v2c - Incorrect Notify view - Expected: group_notify_2 Actual: group_notify",
"Group: Group3 Version: v3 - Incorrect Read view - Expected: group_read_3 Actual: group_read",
"Group: Group3 Version: v3 - Incorrect Write view - Expected: group_write_3 Actual: group_write",
"Group: Group3 Version: v3 - Incorrect Notify view - Expected: group_notify_3 Actual: group_notify",
],
},
},
{
"name": "failure-view-config-not-found",
"test": VerifySnmpGroup,
"eos_data": [
{
"groups": {
"Group1": {
"versions": {
"v1": {
"secModel": "v1",
"readView": "group_read",
"readViewConfig": False,
"writeView": "group_write",
"writeViewConfig": False,
"notifyView": "group_notify",
"notifyViewConfig": False,
}
}
},
"Group2": {
"versions": {
"v2c": {
"secModel": "v2c",
"readView": "group_read",
"readViewConfig": False,
"writeView": "group_write",
"writeViewConfig": False,
"notifyView": "group_notify",
"notifyViewConfig": False,
}
}
},
"Group3": {
"versions": {
"v3": {
"secModel": "v3Priv",
"readView": "group_read",
"readViewConfig": False,
"writeView": "group_write",
"writeViewConfig": False,
"notifyView": "group_notify",
"notifyViewConfig": False,
}
}
},
}
}
],
"inputs": {
"snmp_groups": [
{"group_name": "Group1", "version": "v1", "read_view": "group_read", "write_view": "group_write", "notify_view": "group_notify"},
{"group_name": "Group2", "version": "v2c", "read_view": "group_read", "write_view": "group_write", "notify_view": "group_notify"},
{
"group_name": "Group3",
"version": "v3",
"write_view": "group_write",
"notify_view": "group_notify",
"authentication": "priv",
},
]
},
"expected": {
"result": "failure",
"messages": [
"Group: Group1 Version: v1 Read View: group_read - Not configured",
"Group: Group1 Version: v1 Write View: group_write - Not configured",
"Group: Group1 Version: v1 Notify View: group_notify - Not configured",
"Group: Group2 Version: v2c Read View: group_read - Not configured",
"Group: Group2 Version: v2c Write View: group_write - Not configured",
"Group: Group2 Version: v2c Notify View: group_notify - Not configured",
"Group: Group3 Version: v3 Write View: group_write - Not configured",
"Group: Group3 Version: v3 Notify View: group_notify - Not configured",
],
},
},
{
"name": "failure-group-version-not-configured",
"test": VerifySnmpGroup,
"eos_data": [
{
"groups": {
"Group1": {"versions": {"v1": {}}},
"Group2": {"versions": {"v2c": {}}},
"Group3": {"versions": {"v3": {}}},
}
}
],
"inputs": {
"snmp_groups": [
{"group_name": "Group1", "version": "v1", "read_view": "group_read_1", "write_view": "group_write_1"},
{"group_name": "Group2", "version": "v2c", "read_view": "group_read_2", "write_view": "group_write_2", "notify_view": "group_notify_2"},
{
"group_name": "Group3",
"version": "v3",
"read_view": "group_read_3",
"write_view": "group_write_3",
"notify_view": "group_notify_3",
"authentication": "auth",
},
]
},
"expected": {
"result": "failure",
"messages": [
"Group: Group1 Version: v1 - Not configured",
"Group: Group2 Version: v2c - Not configured",
"Group: Group3 Version: v3 - Not configured",
],
},
},
{
"name": "failure-incorrect-v3-auth-model",
"test": VerifySnmpGroup,
"eos_data": [
{
"groups": {
"Group3": {
"versions": {
"v3": {
"secModel": "v3Auth",
"readView": "group_read",
"readViewConfig": True,
"writeView": "group_write",
"writeViewConfig": True,
"notifyView": "group_notify",
"notifyViewConfig": True,
}
}
},
}
}
],
"inputs": {
"snmp_groups": [
{
"group_name": "Group3",
"version": "v3",
"read_view": "group_read",
"write_view": "group_write",
"notify_view": "group_notify",
"authentication": "priv",
},
]
},
"expected": {
"result": "failure",
"messages": [
"Group: Group3 Version: v3 - Incorrect security model - Expected: v3Priv Actual: v3Auth",
],
},
},
{
"name": "failure-view-not-configured",
"test": VerifySnmpGroup,
"eos_data": [
{
"groups": {
"Group3": {"versions": {"v3": {"secModel": "v3NoAuth", "readView": "group_read", "readViewConfig": True, "writeView": "", "notifyView": ""}}},
}
}
],
"inputs": {
"snmp_groups": [
{
"group_name": "Group3",
"version": "v3",
"read_view": "group_read",
"write_view": "group_write",
"authentication": "noauth",
},
]
},
"expected": {
"result": "failure",
"messages": [
"Group: Group3 Version: v3 View: write - Not configured",
],
},
},

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Test inputs for anta.tests.hardware."""
@ -35,7 +35,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"versions": ["4.27.1F"]},
"expected": {"result": "failure", "messages": ["device is running version \"4.27.0F\" not in expected versions: ['4.27.1F']"]},
"expected": {"result": "failure", "messages": ["EOS version mismatch - Actual: 4.27.0F not in Expected: 4.27.1F"]},
},
{
"name": "success",
@ -77,9 +77,8 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"versions": ["v1.17.1", "v1.18.1"]},
"expected": {"result": "failure", "messages": ["device is running TerminAttr version v1.17.0 and is not in the allowed list: ['v1.17.1', 'v1.18.1']"]},
"expected": {"result": "failure", "messages": ["TerminAttr version mismatch - Actual: v1.17.0 not in Expected: v1.17.1, v1.18.1"]},
},
# TODO: add a test with a real extension?
{
"name": "success-no-extensions",
"test": VerifyEOSExtensions,
@ -91,11 +90,30 @@ DATA: list[dict[str, Any]] = [
"expected": {"result": "success"},
},
{
"name": "success-empty-extension",
"name": "success-extensions",
"test": VerifyEOSExtensions,
"eos_data": [
{"extensions": {}, "extensionStoredDir": "flash:", "warnings": ["No extensions are available"]},
{"extensions": [""]},
{
"extensions": {
"AristaCloudGateway-1.0.1-1.swix": {
"version": "1.0.1",
"release": "1",
"presence": "present",
"status": "installed",
"boot": True,
"numPackages": 1,
"error": False,
"vendor": "",
"summary": "Arista Cloud Connect",
"installedSize": 60532424,
"packages": {"AristaCloudGateway-1.0.1-1.x86_64.rpm": {"version": "1.0.1", "release": "1"}},
"description": "An extension for Arista Cloud Connect gateway",
"affectedAgents": [],
"agentsToRestart": [],
},
}
},
{"extensions": ["AristaCloudGateway-1.0.1-1.swix"]},
],
"inputs": None,
"expected": {"result": "success"},
@ -104,10 +122,80 @@ DATA: list[dict[str, Any]] = [
"name": "failure",
"test": VerifyEOSExtensions,
"eos_data": [
{"extensions": {}, "extensionStoredDir": "flash:", "warnings": ["No extensions are available"]},
{"extensions": ["dummy"]},
{
"extensions": {
"AristaCloudGateway-1.0.1-1.swix": {
"version": "1.0.1",
"release": "1",
"presence": "present",
"status": "installed",
"boot": False,
"numPackages": 1,
"error": False,
"vendor": "",
"summary": "Arista Cloud Connect",
"installedSize": 60532424,
"packages": {"AristaCloudGateway-1.0.1-1.x86_64.rpm": {"version": "1.0.1", "release": "1"}},
"description": "An extension for Arista Cloud Connect gateway",
"affectedAgents": [],
"agentsToRestart": [],
},
}
},
{"extensions": []},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["Missing EOS extensions: installed [] / configured: ['dummy']"]},
"expected": {"result": "failure", "messages": ["EOS extensions mismatch - Installed: AristaCloudGateway-1.0.1-1.swix Configured: Not found"]},
},
{
"name": "failure-multiple-extensions",
"test": VerifyEOSExtensions,
"eos_data": [
{
"extensions": {
"AristaCloudGateway-1.0.1-1.swix": {
"version": "1.0.1",
"release": "1",
"presence": "present",
"status": "installed",
"boot": False,
"numPackages": 1,
"error": False,
"vendor": "",
"summary": "Arista Cloud Connect",
"installedSize": 60532424,
"packages": {"AristaCloudGateway-1.0.1-1.x86_64.rpm": {"version": "1.0.1", "release": "1"}},
"description": "An extension for Arista Cloud Connect gateway",
"affectedAgents": [],
"agentsToRestart": [],
},
"EOS-4.33.0F-NDRSensor.swix": {
"version": "4.33.0",
"release": "39050855.4330F",
"presence": "present",
"status": "notInstalled",
"boot": True,
"numPackages": 9,
"error": False,
"statusDetail": "No RPMs are compatible with current EOS version.",
"vendor": "",
"summary": "NDR sensor",
"installedSize": 0,
"packages": {},
"description": "NDR sensor provides libraries to generate flow activity records using DPI\nmetadata and IPFIX flow records.",
"affectedAgents": [],
"agentsToRestart": [],
},
}
},
{"extensions": ["AristaCloudGateway-1.0.1-1.swix", "EOS-4.33.0F-NDRSensor.swix"]},
],
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"EOS extensions mismatch - Installed: AristaCloudGateway-1.0.1-1.swix Configured: AristaCloudGateway-1.0.1-1.swix, EOS-4.33.0F-NDRSensor.swix"
],
},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.stp.py."""
@ -7,7 +7,15 @@ from __future__ import annotations
from typing import Any
from anta.tests.stp import VerifySTPBlockedPorts, VerifySTPCounters, VerifySTPForwardingPorts, VerifySTPMode, VerifySTPRootPriority, VerifyStpTopologyChanges
from anta.tests.stp import (
VerifySTPBlockedPorts,
VerifySTPCounters,
VerifySTPDisabledVlans,
VerifySTPForwardingPorts,
VerifySTPMode,
VerifySTPRootPriority,
VerifyStpTopologyChanges,
)
from tests.units.anta_tests import test
DATA: list[dict[str, Any]] = [
@ -29,7 +37,7 @@ DATA: list[dict[str, Any]] = [
{"spanningTreeVlanInstances": {}},
],
"inputs": {"mode": "rstp", "vlans": [10, 20]},
"expected": {"result": "failure", "messages": ["STP mode 'rstp' not configured for the following VLAN(s): [10, 20]"]},
"expected": {"result": "failure", "messages": ["VLAN 10 STP mode: rstp - Not configured", "VLAN 20 STP mode: rstp - Not configured"]},
},
{
"name": "failure-wrong-mode",
@ -39,7 +47,10 @@ DATA: list[dict[str, Any]] = [
{"spanningTreeVlanInstances": {"20": {"spanningTreeVlanInstance": {"protocol": "mstp"}}}},
],
"inputs": {"mode": "rstp", "vlans": [10, 20]},
"expected": {"result": "failure", "messages": ["Wrong STP mode configured for the following VLAN(s): [10, 20]"]},
"expected": {
"result": "failure",
"messages": ["VLAN 10 - Incorrect STP mode - Expected: rstp Actual: mstp", "VLAN 20 - Incorrect STP mode - Expected: rstp Actual: mstp"],
},
},
{
"name": "failure-both",
@ -51,7 +62,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"mode": "rstp", "vlans": [10, 20]},
"expected": {
"result": "failure",
"messages": ["STP mode 'rstp' not configured for the following VLAN(s): [10]", "Wrong STP mode configured for the following VLAN(s): [20]"],
"messages": ["VLAN 10 STP mode: rstp - Not configured", "VLAN 20 - Incorrect STP mode - Expected: rstp Actual: mstp"],
},
},
{
@ -66,7 +77,7 @@ DATA: list[dict[str, Any]] = [
"test": VerifySTPBlockedPorts,
"eos_data": [{"spanningTreeInstances": {"MST0": {"spanningTreeBlockedPorts": ["Ethernet10"]}, "MST10": {"spanningTreeBlockedPorts": ["Ethernet10"]}}}],
"inputs": None,
"expected": {"result": "failure", "messages": ["The following ports are blocked by STP: {'MST0': ['Ethernet10'], 'MST10': ['Ethernet10']}"]},
"expected": {"result": "failure", "messages": ["STP Instance: MST0 - Blocked ports - Ethernet10", "STP Instance: MST10 - Blocked ports - Ethernet10"]},
},
{
"name": "success",
@ -76,18 +87,44 @@ DATA: list[dict[str, Any]] = [
"expected": {"result": "success"},
},
{
"name": "failure",
"name": "failure-bpdu-tagged-error-mismatch",
"test": VerifySTPCounters,
"eos_data": [
{
"interfaces": {
"Ethernet10": {"bpduSent": 201, "bpduReceived": 0, "bpduTaggedError": 3, "bpduOtherError": 0, "bpduRateLimitCount": 0},
"Ethernet11": {"bpduSent": 99, "bpduReceived": 0, "bpduTaggedError": 3, "bpduOtherError": 0, "bpduRateLimitCount": 0},
},
},
],
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"Interface Ethernet10 - STP BPDU packet tagged errors count mismatch - Expected: 0 Actual: 3",
"Interface Ethernet11 - STP BPDU packet tagged errors count mismatch - Expected: 0 Actual: 3",
],
},
},
{
"name": "failure-bpdu-other-error-mismatch",
"test": VerifySTPCounters,
"eos_data": [
{
"interfaces": {
"Ethernet10": {"bpduSent": 201, "bpduReceived": 0, "bpduTaggedError": 0, "bpduOtherError": 3, "bpduRateLimitCount": 0},
"Ethernet11": {"bpduSent": 99, "bpduReceived": 0, "bpduTaggedError": 0, "bpduOtherError": 6, "bpduRateLimitCount": 0},
},
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["The following interfaces have STP BPDU packet errors: ['Ethernet10', 'Ethernet11']"]},
"expected": {
"result": "failure",
"messages": [
"Interface Ethernet10 - STP BPDU packet other errors count mismatch - Expected: 0 Actual: 3",
"Interface Ethernet11 - STP BPDU packet other errors count mismatch - Expected: 0 Actual: 6",
],
},
},
{
"name": "success",
@ -126,7 +163,7 @@ DATA: list[dict[str, Any]] = [
"test": VerifySTPForwardingPorts,
"eos_data": [{"unmappedVlans": [], "topologies": {}}, {"unmappedVlans": [], "topologies": {}}],
"inputs": {"vlans": [10, 20]},
"expected": {"result": "failure", "messages": ["STP instance is not configured for the following VLAN(s): [10, 20]"]},
"expected": {"result": "failure", "messages": ["VLAN 10 - STP instance is not configured", "VLAN 20 - STP instance is not configured"]},
},
{
"name": "failure",
@ -144,7 +181,10 @@ DATA: list[dict[str, Any]] = [
"inputs": {"vlans": [10, 20]},
"expected": {
"result": "failure",
"messages": ["The following VLAN(s) have interface(s) that are not in a forwarding state: [{'VLAN 10': ['Ethernet10']}, {'VLAN 20': ['Ethernet10']}]"],
"messages": [
"VLAN 10 Interface: Ethernet10 - Invalid state - Expected: forwarding Actual: discarding",
"VLAN 20 Interface: Ethernet10 - Invalid state - Expected: forwarding Actual: discarding",
],
},
},
{
@ -253,6 +293,28 @@ DATA: list[dict[str, Any]] = [
"inputs": {"priority": 16384, "instances": [0]},
"expected": {"result": "success"},
},
{
"name": "success-input-instance-none",
"test": VerifySTPRootPriority,
"eos_data": [
{
"instances": {
"MST0": {
"rootBridge": {
"priority": 16384,
"systemIdExtension": 0,
"macAddress": "02:1c:73:8b:93:ac",
"helloTime": 2.0,
"maxAge": 20,
"forwardDelay": 15,
},
},
},
},
],
"inputs": {"priority": 16384},
"expected": {"result": "success"},
},
{
"name": "failure-no-instances",
"test": VerifySTPRootPriority,
@ -273,7 +335,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"priority": 32768, "instances": [0]},
"expected": {"result": "failure", "messages": ["Unsupported STP instance type: WRONG0"]},
"expected": {"result": "failure", "messages": ["STP Instance: WRONG0 - Unsupported STP instance type"]},
},
{
"name": "failure-wrong-instance-type",
@ -282,6 +344,28 @@ DATA: list[dict[str, Any]] = [
"inputs": {"priority": 32768, "instances": [10, 20]},
"expected": {"result": "failure", "messages": ["No STP instances configured"]},
},
{
"name": "failure-instance-not-found",
"test": VerifySTPRootPriority,
"eos_data": [
{
"instances": {
"VL10": {
"rootBridge": {
"priority": 32768,
"systemIdExtension": 10,
"macAddress": "00:1c:73:27:95:a2",
"helloTime": 2.0,
"maxAge": 20,
"forwardDelay": 15,
},
}
}
}
],
"inputs": {"priority": 32768, "instances": [11, 20]},
"expected": {"result": "failure", "messages": ["Instance: VL11 - Not configured", "Instance: VL20 - Not configured"]},
},
{
"name": "failure-wrong-priority",
"test": VerifySTPRootPriority,
@ -322,7 +406,13 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"priority": 32768, "instances": [10, 20, 30]},
"expected": {"result": "failure", "messages": ["The following instance(s) have the wrong STP root priority configured: ['VL20', 'VL30']"]},
"expected": {
"result": "failure",
"messages": [
"STP Instance: VL20 - Incorrect root priority - Expected: 32768 Actual: 8196",
"STP Instance: VL30 - Incorrect root priority - Expected: 32768 Actual: 8196",
],
},
},
{
"name": "success-mstp",
@ -462,8 +552,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"The following STP topologies are not configured or number of changes not within the threshold:\n"
"{'topologies': {'Cist': {'Cpu': {'Number of changes': 15}, 'Port-Channel5': {'Number of changes': 15}}}}"
"Topology: Cist Interface: Cpu - Number of changes not within the threshold - Expected: 10 Actual: 15",
"Topology: Cist Interface: Port-Channel5 - Number of changes not within the threshold - Expected: 10 Actual: 15",
],
},
},
@ -484,6 +574,50 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"threshold": 10},
"expected": {"result": "failure", "messages": ["STP is not configured."]},
"expected": {"result": "failure", "messages": ["STP is not configured"]},
},
{
"name": "success",
"test": VerifySTPDisabledVlans,
"eos_data": [{"spanningTreeVlanInstances": {"1": {"spanningTreeVlanInstance": {"protocol": "mstp", "bridge": {"priority": 32768}}}, "6": {}, "4094": {}}}],
"inputs": {"vlans": ["6", "4094"]},
"expected": {"result": "success"},
},
{
"name": "failure-stp-not-configured",
"test": VerifySTPDisabledVlans,
"eos_data": [{"spanningTreeVlanInstances": {}}],
"inputs": {"vlans": ["6", "4094"]},
"expected": {"result": "failure", "messages": ["STP is not configured"]},
},
{
"name": "failure-vlans-not-found",
"test": VerifySTPDisabledVlans,
"eos_data": [
{
"spanningTreeVlanInstances": {
"1": {"spanningTreeVlanInstance": {"protocol": "mstp", "bridge": {}}},
"6": {"spanningTreeVlanInstance": {"protocol": "mstp", "bridge": {}}},
"4094": {"spanningTreeVlanInstance": {"protocol": "mstp", "bridge": {}}},
}
}
],
"inputs": {"vlans": ["16", "4093"]},
"expected": {"result": "failure", "messages": ["VLAN: 16 - Not configured", "VLAN: 4093 - Not configured"]},
},
{
"name": "failure-vlans-enabled",
"test": VerifySTPDisabledVlans,
"eos_data": [
{
"spanningTreeVlanInstances": {
"1": {"spanningTreeVlanInstance": {"protocol": "mstp", "bridge": {}}},
"6": {"spanningTreeVlanInstance": {"protocol": "mstp", "bridge": {}}},
"4094": {"spanningTreeVlanInstance": {"protocol": "mstp", "bridge": {}}},
}
}
],
"inputs": {"vlans": ["6", "4094"]},
"expected": {"result": "failure", "messages": ["VLAN: 6 - STP is enabled", "VLAN: 4094 - STP is enabled"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Test inputs for anta.tests.stun.py."""
@ -108,7 +108,7 @@ DATA: list[dict[str, Any]] = [
},
"expected": {
"result": "failure",
"messages": ["Client 100.64.3.2 Port: 4500 - STUN client translation not found.", "Client 172.18.3.2 Port: 4500 - STUN client translation not found."],
"messages": ["Client 100.64.3.2 Port: 4500 - STUN client translation not found", "Client 172.18.3.2 Port: 4500 - STUN client translation not found"],
},
},
{
@ -134,7 +134,7 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Client 100.64.3.2 Port: 4500 - STUN client translation not found.",
"Client 100.64.3.2 Port: 4500 - STUN client translation not found",
"Client 172.18.3.2 Port: 4500 - Incorrect public-facing address - Expected: 192.118.3.2 Actual: 192.18.3.2",
"Client 172.18.3.2 Port: 4500 - Incorrect public-facing port - Expected: 6006 Actual: 4800",
],
@ -163,7 +163,7 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Client 100.64.3.2 Port: 4500 - STUN client translation not found.",
"Client 100.64.3.2 Port: 4500 - STUN client translation not found",
"Client 172.18.4.2 Port: 4800 - Incorrect public-facing address - Expected: 192.118.3.2 Actual: 192.18.3.2",
"Client 172.18.4.2 Port: 4800 - Incorrect public-facing port - Expected: 6006 Actual: 4800",
],
@ -193,7 +193,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {},
"expected": {
"result": "failure",
"messages": ["STUN server status is disabled."],
"messages": ["STUN server status is disabled"],
},
},
{
@ -208,7 +208,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {},
"expected": {
"result": "failure",
"messages": ["STUN server is not running."],
"messages": ["STUN server is not running"],
},
},
{
@ -223,7 +223,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {},
"expected": {
"result": "failure",
"messages": ["STUN server status is disabled and not running."],
"messages": ["STUN server status is disabled and not running"],
},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Test inputs for anta.tests.system."""
@ -12,6 +12,7 @@ from anta.tests.system import (
VerifyCoredump,
VerifyCPUUtilization,
VerifyFileSystemUtilization,
VerifyMaintenance,
VerifyMemoryUtilization,
VerifyNTP,
VerifyNTPAssociations,
@ -33,7 +34,7 @@ DATA: list[dict[str, Any]] = [
"test": VerifyUptime,
"eos_data": [{"upTime": 665.15, "loadAvg": [0.13, 0.12, 0.09], "users": 1, "currentTime": 1683186659.139859}],
"inputs": {"minimum": 666},
"expected": {"result": "failure", "messages": ["Device uptime is 665.15 seconds"]},
"expected": {"result": "failure", "messages": ["Device uptime is incorrect - Expected: 666s Actual: 665.15s"]},
},
{
"name": "success-no-reload",
@ -74,7 +75,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["Reload cause is: 'Reload after crash.'"]},
"expected": {"result": "failure", "messages": ["Reload cause is: Reload after crash."]},
},
{
"name": "success-without-minidump",
@ -95,14 +96,14 @@ DATA: list[dict[str, Any]] = [
"test": VerifyCoredump,
"eos_data": [{"mode": "compressedDeferred", "coreFiles": ["core.2344.1584483862.Mlag.gz", "core.23101.1584483867.Mlag.gz"]}],
"inputs": None,
"expected": {"result": "failure", "messages": ["Core dump(s) have been found: ['core.2344.1584483862.Mlag.gz', 'core.23101.1584483867.Mlag.gz']"]},
"expected": {"result": "failure", "messages": ["Core dump(s) have been found: core.2344.1584483862.Mlag.gz, core.23101.1584483867.Mlag.gz"]},
},
{
"name": "failure-with-minidump",
"test": VerifyCoredump,
"eos_data": [{"mode": "compressedDeferred", "coreFiles": ["minidump", "core.2344.1584483862.Mlag.gz", "core.23101.1584483867.Mlag.gz"]}],
"inputs": None,
"expected": {"result": "failure", "messages": ["Core dump(s) have been found: ['core.2344.1584483862.Mlag.gz', 'core.23101.1584483867.Mlag.gz']"]},
"expected": {"result": "failure", "messages": ["Core dump(s) have been found: core.2344.1584483862.Mlag.gz, core.23101.1584483867.Mlag.gz"]},
},
{
"name": "success",
@ -190,7 +191,7 @@ EntityManager::doBackoff waiting for remote sysdb version ...................ok
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["Device has reported a high CPU utilization: 75.2%"]},
"expected": {"result": "failure", "messages": ["Device has reported a high CPU utilization - Expected: < 75% Actual: 75.2%"]},
},
{
"name": "success",
@ -222,7 +223,7 @@ EntityManager::doBackoff waiting for remote sysdb version ...................ok
},
],
"inputs": None,
"expected": {"result": "failure", "messages": ["Device has reported a high memory usage: 95.56%"]},
"expected": {"result": "failure", "messages": ["Device has reported a high memory usage - Expected: < 75% Actual: 95.56%"]},
},
{
"name": "success",
@ -253,8 +254,8 @@ none 294M 78M 217M 84% /.overlay
"expected": {
"result": "failure",
"messages": [
"Mount point /dev/sda2 3.9G 988M 2.9G 84% /mnt/flash is higher than 75%: reported 84%",
"Mount point none 294M 78M 217M 84% /.overlay is higher than 75%: reported 84%",
"Mount point: /dev/sda2 3.9G 988M 2.9G 84% /mnt/flash - Higher disk space utilization - Expected: 75% Actual: 84%",
"Mount point: none 294M 78M 217M 84% /.overlay - Higher disk space utilization - Expected: 75% Actual: 84%",
],
},
},
@ -278,7 +279,7 @@ poll interval unknown
""",
],
"inputs": None,
"expected": {"result": "failure", "messages": ["The device is not synchronized with the configured NTP server(s): 'unsynchronised'"]},
"expected": {"result": "failure", "messages": ["NTP status mismatch - Expected: synchronised Actual: unsynchronised"]},
},
{
"name": "success",
@ -346,6 +347,65 @@ poll interval unknown
},
"expected": {"result": "success"},
},
{
"name": "success-ntp-pool-as-input",
"test": VerifyNTPAssociations,
"eos_data": [
{
"peers": {
"1.1.1.1": {
"condition": "sys.peer",
"peerIpAddr": "1.1.1.1",
"stratumLevel": 1,
},
"2.2.2.2": {
"condition": "candidate",
"peerIpAddr": "2.2.2.2",
"stratumLevel": 2,
},
"3.3.3.3": {
"condition": "candidate",
"peerIpAddr": "3.3.3.3",
"stratumLevel": 2,
},
}
}
],
"inputs": {"ntp_pool": {"server_addresses": ["1.1.1.1", "2.2.2.2", "3.3.3.3"], "preferred_stratum_range": [1, 2]}},
"expected": {"result": "success"},
},
{
"name": "success-ntp-pool-hostname",
"test": VerifyNTPAssociations,
"eos_data": [
{
"peers": {
"itsys-ntp010p.aristanetworks.com": {
"condition": "sys.peer",
"peerIpAddr": "1.1.1.1",
"stratumLevel": 1,
},
"itsys-ntp011p.aristanetworks.com": {
"condition": "candidate",
"peerIpAddr": "2.2.2.2",
"stratumLevel": 2,
},
"itsys-ntp012p.aristanetworks.com": {
"condition": "candidate",
"peerIpAddr": "3.3.3.3",
"stratumLevel": 2,
},
}
}
],
"inputs": {
"ntp_pool": {
"server_addresses": ["itsys-ntp010p.aristanetworks.com", "itsys-ntp011p.aristanetworks.com", "itsys-ntp012p.aristanetworks.com"],
"preferred_stratum_range": [1, 2],
}
},
"expected": {"result": "success"},
},
{
"name": "success-ip-dns",
"test": VerifyNTPAssociations,
@ -380,7 +440,7 @@ poll interval unknown
"expected": {"result": "success"},
},
{
"name": "failure",
"name": "failure-ntp-server",
"test": VerifyNTPAssociations,
"eos_data": [
{
@ -413,9 +473,11 @@ poll interval unknown
"expected": {
"result": "failure",
"messages": [
"1.1.1.1 (Preferred: True, Stratum: 1) - Bad association - Condition: candidate, Stratum: 2",
"2.2.2.2 (Preferred: False, Stratum: 2) - Bad association - Condition: sys.peer, Stratum: 2",
"3.3.3.3 (Preferred: False, Stratum: 2) - Bad association - Condition: sys.peer, Stratum: 3",
"NTP Server: 1.1.1.1 Preferred: True Stratum: 1 - Incorrect condition - Expected: sys.peer Actual: candidate",
"NTP Server: 1.1.1.1 Preferred: True Stratum: 1 - Incorrect stratum level - Expected: 1 Actual: 2",
"NTP Server: 2.2.2.2 Preferred: False Stratum: 2 - Incorrect condition - Expected: candidate Actual: sys.peer",
"NTP Server: 3.3.3.3 Preferred: False Stratum: 2 - Incorrect condition - Expected: candidate Actual: sys.peer",
"NTP Server: 3.3.3.3 Preferred: False Stratum: 2 - Incorrect stratum level - Expected: 2 Actual: 3",
],
},
},
@ -463,7 +525,7 @@ poll interval unknown
},
"expected": {
"result": "failure",
"messages": ["3.3.3.3 (Preferred: False, Stratum: 1) - Not configured"],
"messages": ["NTP Server: 3.3.3.3 Preferred: False Stratum: 1 - Not configured"],
},
},
{
@ -490,9 +552,311 @@ poll interval unknown
"expected": {
"result": "failure",
"messages": [
"1.1.1.1 (Preferred: True, Stratum: 1) - Bad association - Condition: candidate, Stratum: 1",
"2.2.2.2 (Preferred: False, Stratum: 1) - Not configured",
"3.3.3.3 (Preferred: False, Stratum: 1) - Not configured",
"NTP Server: 1.1.1.1 Preferred: True Stratum: 1 - Incorrect condition - Expected: sys.peer Actual: candidate",
"NTP Server: 2.2.2.2 Preferred: False Stratum: 1 - Not configured",
"NTP Server: 3.3.3.3 Preferred: False Stratum: 1 - Not configured",
],
},
},
{
"name": "failure-ntp-pool-as-input",
"test": VerifyNTPAssociations,
"eos_data": [
{
"peers": {
"ntp1.pool": {
"condition": "sys.peer",
"peerIpAddr": "1.1.1.1",
"stratumLevel": 1,
},
"ntp2.pool": {
"condition": "candidate",
"peerIpAddr": "2.2.2.2",
"stratumLevel": 2,
},
"ntp3.pool": {
"condition": "candidate",
"peerIpAddr": "3.3.3.3",
"stratumLevel": 2,
},
}
}
],
"inputs": {"ntp_pool": {"server_addresses": ["1.1.1.1", "2.2.2.2"], "preferred_stratum_range": [1, 2]}},
"expected": {
"result": "failure",
"messages": ["NTP Server: 3.3.3.3 Hostname: ntp3.pool - Associated but not part of the provided NTP pool"],
},
},
{
"name": "failure-ntp-pool-as-input-bad-association",
"test": VerifyNTPAssociations,
"eos_data": [
{
"peers": {
"ntp1.pool": {
"condition": "sys.peer",
"peerIpAddr": "1.1.1.1",
"stratumLevel": 1,
},
"ntp2.pool": {
"condition": "candidate",
"peerIpAddr": "2.2.2.2",
"stratumLevel": 2,
},
"ntp3.pool": {
"condition": "reject",
"peerIpAddr": "3.3.3.3",
"stratumLevel": 3,
},
}
}
],
"inputs": {"ntp_pool": {"server_addresses": ["1.1.1.1", "2.2.2.2", "3.3.3.3"], "preferred_stratum_range": [1, 2]}},
"expected": {
"result": "failure",
"messages": [
"NTP Server: 3.3.3.3 Hostname: ntp3.pool - Incorrect condition - Expected: sys.peer, candidate Actual: reject",
"NTP Server: 3.3.3.3 Hostname: ntp3.pool - Incorrect stratum level - Expected Stratum Range: 1 to 2 Actual: 3",
],
},
},
{
"name": "failure-ntp-pool-hostname",
"test": VerifyNTPAssociations,
"eos_data": [
{
"peers": {
"itsys-ntp010p.aristanetworks.com": {
"condition": "sys.peer",
"peerIpAddr": "1.1.1.1",
"stratumLevel": 5,
},
"itsys-ntp011p.aristanetworks.com": {
"condition": "reject",
"peerIpAddr": "2.2.2.2",
"stratumLevel": 4,
},
"itsys-ntp012p.aristanetworks.com": {
"condition": "candidate",
"peerIpAddr": "3.3.3.3",
"stratumLevel": 2,
},
}
}
],
"inputs": {"ntp_pool": {"server_addresses": ["itsys-ntp010p.aristanetworks.com", "itsys-ntp011p.aristanetworks.com"], "preferred_stratum_range": [1, 2]}},
"expected": {
"result": "failure",
"messages": [
"NTP Server: 1.1.1.1 Hostname: itsys-ntp010p.aristanetworks.com - Incorrect stratum level - Expected Stratum Range: 1 to 2 Actual: 5",
"NTP Server: 2.2.2.2 Hostname: itsys-ntp011p.aristanetworks.com - Incorrect condition - Expected: sys.peer, candidate Actual: reject",
"NTP Server: 2.2.2.2 Hostname: itsys-ntp011p.aristanetworks.com - Incorrect stratum level - Expected Stratum Range: 1 to 2 Actual: 4",
"NTP Server: 3.3.3.3 Hostname: itsys-ntp012p.aristanetworks.com - Associated but not part of the provided NTP pool",
],
},
},
{
"name": "success-no-maintenance-configured",
"test": VerifyMaintenance,
"eos_data": [
{
"units": {},
"interfaces": {},
"vrfs": {},
"warnings": ["Maintenance Mode is disabled."],
},
],
"inputs": None,
"expected": {"result": "success"},
},
{
"name": "success-maintenance-configured-but-not-enabled",
"test": VerifyMaintenance,
"eos_data": [
{
"units": {
"System": {
"state": "active",
"adminState": "active",
"stateChangeTime": 0.0,
"onBootMaintenance": False,
"intfsViolatingTrafficThreshold": False,
"aggInBpsRate": 0,
"aggOutBpsRate": 0,
}
},
"interfaces": {},
"vrfs": {},
},
],
"inputs": None,
"expected": {"result": "success"},
},
{
"name": "success-multiple-units-but-not-enabled",
"test": VerifyMaintenance,
"eos_data": [
{
"units": {
"mlag": {
"state": "active",
"adminState": "active",
"stateChangeTime": 0.0,
"onBootMaintenance": False,
"intfsViolatingTrafficThreshold": False,
"aggInBpsRate": 0,
"aggOutBpsRate": 0,
},
"System": {
"state": "active",
"adminState": "active",
"stateChangeTime": 0.0,
"onBootMaintenance": False,
"intfsViolatingTrafficThreshold": False,
"aggInBpsRate": 0,
"aggOutBpsRate": 0,
},
},
"interfaces": {},
"vrfs": {},
},
],
"inputs": None,
"expected": {"result": "success"},
},
{
"name": "failure-maintenance-enabled",
"test": VerifyMaintenance,
"eos_data": [
{
"units": {
"mlag": {
"state": "underMaintenance",
"adminState": "underMaintenance",
"stateChangeTime": 1741257120.9532886,
"onBootMaintenance": False,
"intfsViolatingTrafficThreshold": False,
"aggInBpsRate": 0,
"aggOutBpsRate": 0,
},
"System": {
"state": "active",
"adminState": "active",
"stateChangeTime": 0.0,
"onBootMaintenance": False,
"intfsViolatingTrafficThreshold": False,
"aggInBpsRate": 0,
"aggOutBpsRate": 0,
},
},
"interfaces": {},
"vrfs": {},
},
],
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"Units under maintenance: 'mlag'.",
"Possible causes: 'Quiesce is configured'.",
],
},
},
{
"name": "failure-multiple-reasons",
"test": VerifyMaintenance,
"eos_data": [
{
"units": {
"mlag": {
"state": "underMaintenance",
"adminState": "underMaintenance",
"stateChangeTime": 1741257120.9532895,
"onBootMaintenance": False,
"intfsViolatingTrafficThreshold": False,
"aggInBpsRate": 0,
"aggOutBpsRate": 0,
},
"System": {
"state": "maintenanceModeEnter",
"adminState": "underMaintenance",
"stateChangeTime": 1741257669.7231765,
"onBootMaintenance": False,
"intfsViolatingTrafficThreshold": False,
"aggInBpsRate": 0,
"aggOutBpsRate": 0,
},
},
"interfaces": {},
"vrfs": {},
},
],
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"Units under maintenance: 'mlag'.",
"Units entering maintenance: 'System'.",
"Possible causes: 'Quiesce is configured'.",
],
},
},
{
"name": "failure-onboot-maintenance",
"test": VerifyMaintenance,
"eos_data": [
{
"units": {
"System": {
"state": "underMaintenance",
"adminState": "underMaintenance",
"stateChangeTime": 1741258774.3756502,
"onBootMaintenance": True,
"intfsViolatingTrafficThreshold": False,
"aggInBpsRate": 0,
"aggOutBpsRate": 0,
}
},
"interfaces": {},
"vrfs": {},
},
],
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"Units under maintenance: 'System'.",
"Possible causes: 'On-boot maintenance is configured, Quiesce is configured'.",
],
},
},
{
"name": "failure-entering-maintenance-interface-violation",
"test": VerifyMaintenance,
"eos_data": [
{
"units": {
"System": {
"state": "maintenanceModeEnter",
"adminState": "underMaintenance",
"stateChangeTime": 1741257669.7231765,
"onBootMaintenance": False,
"intfsViolatingTrafficThreshold": True,
"aggInBpsRate": 0,
"aggOutBpsRate": 0,
}
},
"interfaces": {},
"vrfs": {},
},
],
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"Units entering maintenance: 'System'.",
"Possible causes: 'Interface traffic threshold violation, Quiesce is configured'.",
],
},
},

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.vlan.py."""
@ -7,7 +7,7 @@ from __future__ import annotations
from typing import Any
from anta.tests.vlan import VerifyVlanInternalPolicy
from anta.tests.vlan import VerifyDynamicVlanSource, VerifyVlanInternalPolicy
from tests.units.anta_tests import test
DATA: list[dict[str, Any]] = [
@ -23,14 +23,70 @@ DATA: list[dict[str, Any]] = [
"test": VerifyVlanInternalPolicy,
"eos_data": [{"policy": "descending", "startVlanId": 4094, "endVlanId": 1006}],
"inputs": {"policy": "ascending", "start_vlan_id": 1006, "end_vlan_id": 4094},
"expected": {
"result": "failure",
"messages": ["Incorrect VLAN internal allocation policy configured - Expected: ascending Actual: descending"],
},
},
{
"name": "failure-incorrect-start-end-id",
"test": VerifyVlanInternalPolicy,
"eos_data": [{"policy": "ascending", "startVlanId": 4094, "endVlanId": 1006}],
"inputs": {"policy": "ascending", "start_vlan_id": 1006, "end_vlan_id": 4094},
"expected": {
"result": "failure",
"messages": [
"The VLAN internal allocation policy is not configured properly:\n"
"Expected `ascending` as the policy, but found `descending` instead.\n"
"Expected `1006` as the startVlanId, but found `4094` instead.\n"
"Expected `4094` as the endVlanId, but found `1006` instead."
"VLAN internal allocation policy: ascending - Incorrect start VLAN id configured - Expected: 1006 Actual: 4094",
"VLAN internal allocation policy: ascending - Incorrect end VLAN id configured - Expected: 4094 Actual: 1006",
],
},
},
{
"name": "success",
"test": VerifyDynamicVlanSource,
"eos_data": [{"dynamicVlans": {"evpn": {"vlanIds": [1199]}, "mlagsync": {"vlanIds": [1401]}, "vccbfd": {"vlanIds": [1501]}}}],
"inputs": {"sources": ["evpn", "mlagsync"], "strict": False},
"expected": {"result": "success"},
},
{
"name": "failure-no-dynamic-vlan-sources",
"test": VerifyDynamicVlanSource,
"eos_data": [{"dynamicVlans": {}}],
"inputs": {"sources": ["evpn", "mlagsync"], "strict": False},
"expected": {"result": "failure", "messages": ["Dynamic VLAN source(s) not found in configuration: evpn, mlagsync"]},
},
{
"name": "failure-dynamic-vlan-sources-mismatch",
"test": VerifyDynamicVlanSource,
"eos_data": [{"dynamicVlans": {"vccbfd": {"vlanIds": [1500]}, "mlagsync": {"vlanIds": [1501]}}}],
"inputs": {"sources": ["evpn", "mlagsync"], "strict": False},
"expected": {
"result": "failure",
"messages": ["Dynamic VLAN source(s) not found in configuration: evpn"],
},
},
{
"name": "success-strict-mode",
"test": VerifyDynamicVlanSource,
"eos_data": [{"dynamicVlans": {"evpn": {"vlanIds": [1199]}, "mlagsync": {"vlanIds": [1502], "vccbfd": {"vlanIds": []}}}}],
"inputs": {"sources": ["evpn", "mlagsync"], "strict": True},
"expected": {"result": "success"},
},
{
"name": "failure-all-sources-exact-match-additional-source-found",
"test": VerifyDynamicVlanSource,
"eos_data": [{"dynamicVlans": {"evpn": {"vlanIds": [1199]}, "mlagsync": {"vlanIds": [1500]}, "vccbfd": {"vlanIds": [1500]}}}],
"inputs": {"sources": ["evpn", "mlagsync"], "strict": True},
"expected": {
"result": "failure",
"messages": ["Strict mode enabled: Unexpected sources have VLANs allocated: vccbfd"],
},
},
{
"name": "failure-all-sources-exact-match-expected-source-not-found",
"test": VerifyDynamicVlanSource,
"eos_data": [{"dynamicVlans": {"evpn": {"vlanIds": [1199]}, "mlagsync": {"vlanIds": []}}}],
"inputs": {"sources": ["evpn", "mlagsync"], "strict": True},
"expected": {"result": "failure", "messages": ["Dynamic VLAN source(s) exist but have no VLANs allocated: mlagsync"]},
},
]

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
"""Tests for anta.tests.vxlan.py."""
@ -23,28 +23,28 @@ DATA: list[dict[str, Any]] = [
"test": VerifyVxlan1Interface,
"eos_data": [{"interfaceDescriptions": {"Loopback0": {"lineProtocolStatus": "up", "interfaceStatus": "up"}}}],
"inputs": None,
"expected": {"result": "skipped", "messages": ["Vxlan1 interface is not configured"]},
"expected": {"result": "skipped", "messages": ["Interface: Vxlan1 - Not configured"]},
},
{
"name": "failure-down-up",
"test": VerifyVxlan1Interface,
"eos_data": [{"interfaceDescriptions": {"Vxlan1": {"lineProtocolStatus": "down", "interfaceStatus": "up"}}}],
"inputs": None,
"expected": {"result": "failure", "messages": ["Vxlan1 interface is down/up"]},
"expected": {"result": "failure", "messages": ["Interface: Vxlan1 - Incorrect Line protocol status/Status - Expected: up/up Actual: down/up"]},
},
{
"name": "failure-up-down",
"test": VerifyVxlan1Interface,
"eos_data": [{"interfaceDescriptions": {"Vxlan1": {"lineProtocolStatus": "up", "interfaceStatus": "down"}}}],
"inputs": None,
"expected": {"result": "failure", "messages": ["Vxlan1 interface is up/down"]},
"expected": {"result": "failure", "messages": ["Interface: Vxlan1 - Incorrect Line protocol status/Status - Expected: up/up Actual: up/down"]},
},
{
"name": "failure-down-down",
"test": VerifyVxlan1Interface,
"eos_data": [{"interfaceDescriptions": {"Vxlan1": {"lineProtocolStatus": "down", "interfaceStatus": "down"}}}],
"inputs": None,
"expected": {"result": "failure", "messages": ["Vxlan1 interface is down/down"]},
"expected": {"result": "failure", "messages": ["Interface: Vxlan1 - Incorrect Line protocol status/Status - Expected: up/up Actual: down/down"]},
},
{
"name": "success",
@ -176,15 +176,7 @@ DATA: list[dict[str, Any]] = [
"inputs": None,
"expected": {
"result": "failure",
"messages": [
"VXLAN config sanity check is not passing: {'localVtep': {'description': 'Local VTEP Configuration Check', "
"'allCheckPass': False, 'detail': '', 'hasWarning': True, 'items': [{'name': 'Loopback IP Address', 'checkPass': True, "
"'hasWarning': False, 'detail': ''}, {'name': 'VLAN-VNI Map', 'checkPass': False, 'hasWarning': False, 'detail': "
"'No VLAN-VNI mapping in Vxlan1'}, {'name': 'Flood List', 'checkPass': False, 'hasWarning': True, 'detail': "
"'No VXLAN VLANs in Vxlan1'}, {'name': 'Routing', 'checkPass': True, 'hasWarning': False, 'detail': ''}, {'name': "
"'VNI VRF ACL', 'checkPass': True, 'hasWarning': False, 'detail': ''}, {'name': 'VRF-VNI Dynamic VLAN', 'checkPass': True, "
"'hasWarning': False, 'detail': ''}, {'name': 'Decap VRF-VNI Map', 'checkPass': True, 'hasWarning': False, 'detail': ''}]}}",
],
"messages": ["Vxlan Category: localVtep - Config sanity check is not passing"],
},
},
{
@ -228,7 +220,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"bindings": {10010: 10, 10020: 20, 500: 1199}},
"expected": {"result": "failure", "messages": ["The following VNI(s) have no binding: ['10010']"]},
"expected": {"result": "failure", "messages": ["Interface: Vxlan1 VNI: 10010 - Binding not found"]},
},
{
"name": "failure-wrong-binding",
@ -246,7 +238,7 @@ DATA: list[dict[str, Any]] = [
},
],
"inputs": {"bindings": {10020: 20, 500: 1199}},
"expected": {"result": "failure", "messages": ["The following VNI(s) have the wrong VLAN binding: [{'10020': 30}]"]},
"expected": {"result": "failure", "messages": ["Interface: Vxlan1 VNI: 10020 VLAN: 20 - Wrong VLAN binding - Actual: 30"]},
},
{
"name": "failure-no-and-wrong-binding",
@ -266,7 +258,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"bindings": {10010: 10, 10020: 20, 500: 1199}},
"expected": {
"result": "failure",
"messages": ["The following VNI(s) have no binding: ['10010']", "The following VNI(s) have the wrong VLAN binding: [{'10020': 30}]"],
"messages": ["Interface: Vxlan1 VNI: 10010 - Binding not found", "Interface: Vxlan1 VNI: 10020 VLAN: 20 - Wrong VLAN binding - Actual: 30"],
},
},
{
@ -288,21 +280,21 @@ DATA: list[dict[str, Any]] = [
"test": VerifyVxlanVtep,
"eos_data": [{"vteps": {}, "interfaces": {"Vxlan1": {"vteps": ["10.1.1.5", "10.1.1.6"]}}}],
"inputs": {"vteps": ["10.1.1.5", "10.1.1.6", "10.1.1.7"]},
"expected": {"result": "failure", "messages": ["The following VTEP peer(s) are missing from the Vxlan1 interface: ['10.1.1.7']"]},
"expected": {"result": "failure", "messages": ["The following VTEP peer(s) are missing from the Vxlan1 interface: 10.1.1.7"]},
},
{
"name": "failure-no-vtep",
"test": VerifyVxlanVtep,
"eos_data": [{"vteps": {}, "interfaces": {"Vxlan1": {"vteps": []}}}],
"inputs": {"vteps": ["10.1.1.5", "10.1.1.6"]},
"expected": {"result": "failure", "messages": ["The following VTEP peer(s) are missing from the Vxlan1 interface: ['10.1.1.5', '10.1.1.6']"]},
"expected": {"result": "failure", "messages": ["The following VTEP peer(s) are missing from the Vxlan1 interface: 10.1.1.5, 10.1.1.6"]},
},
{
"name": "failure-no-input-vtep",
"test": VerifyVxlanVtep,
"eos_data": [{"vteps": {}, "interfaces": {"Vxlan1": {"vteps": ["10.1.1.5"]}}}],
"inputs": {"vteps": []},
"expected": {"result": "failure", "messages": ["Unexpected VTEP peer(s) on Vxlan1 interface: ['10.1.1.5']"]},
"expected": {"result": "failure", "messages": ["Unexpected VTEP peer(s) on Vxlan1 interface: 10.1.1.5"]},
},
{
"name": "failure-missmatch",
@ -312,8 +304,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"The following VTEP peer(s) are missing from the Vxlan1 interface: ['10.1.1.5']",
"Unexpected VTEP peer(s) on Vxlan1 interface: ['10.1.1.7', '10.1.1.8']",
"The following VTEP peer(s) are missing from the Vxlan1 interface: 10.1.1.5",
"Unexpected VTEP peer(s) on Vxlan1 interface: 10.1.1.7, 10.1.1.8",
],
},
},
@ -345,7 +337,7 @@ DATA: list[dict[str, Any]] = [
"inputs": {"source_interface": "lo1", "udp_port": 4789},
"expected": {
"result": "failure",
"messages": ["Source interface is not correct. Expected `Loopback1` as source interface but found `Loopback10` instead."],
"messages": ["Interface: Vxlan1 - Incorrect Source interface - Expected: Loopback1 Actual: Loopback10"],
},
},
{
@ -356,8 +348,8 @@ DATA: list[dict[str, Any]] = [
"expected": {
"result": "failure",
"messages": [
"Source interface is not correct. Expected `Loopback1` as source interface but found `Loopback10` instead.",
"UDP port is not correct. Expected `4780` as UDP port but found `4789` instead.",
"Interface: Vxlan1 - Incorrect Source interface - Expected: Loopback1 Actual: Loopback10",
"Interface: Vxlan1 - Incorrect UDP port - Expected: 4780 Actual: 4789",
],
},
},