Adding upstream version 0.14.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
ecf5ca3300
commit
6721599912
211 changed files with 12174 additions and 6401 deletions
|
@ -1,3 +1,4 @@
|
|||
# Copyright (c) 2023-2024 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 submodule."""
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# Copyright (c) 2023-2024 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
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.routing.generic.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -43,9 +42,9 @@ DATA: list[dict[str, Any]] = [
|
|||
# Output truncated
|
||||
"maskLen": {"8": 2},
|
||||
"totalRoutes": 123,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"minimum": 42, "maximum": 666},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -60,9 +59,9 @@ DATA: list[dict[str, Any]] = [
|
|||
# Output truncated
|
||||
"maskLen": {"8": 2},
|
||||
"totalRoutes": 1000,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"minimum": 42, "maximum": 666},
|
||||
"expected": {"result": "failure", "messages": ["routing-table has 1000 routes and not between min (42) and maximum (666)"]},
|
||||
|
@ -99,10 +98,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"preference": 20,
|
||||
"metric": 0,
|
||||
"vias": [{"nexthopAddr": "10.1.255.4", "interface": "Ethernet1"}],
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"vrfs": {
|
||||
|
@ -122,10 +121,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"preference": 20,
|
||||
"metric": 0,
|
||||
"vias": [{"nexthopAddr": "10.1.255.6", "interface": "Ethernet2"}],
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2"]},
|
||||
|
@ -143,8 +142,8 @@ DATA: list[dict[str, Any]] = [
|
|||
"allRoutesProgrammedKernel": True,
|
||||
"defaultRouteState": "notSet",
|
||||
"routes": {},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"vrfs": {
|
||||
|
@ -164,10 +163,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"preference": 20,
|
||||
"metric": 0,
|
||||
"vias": [{"nexthopAddr": "10.1.255.6", "interface": "Ethernet2"}],
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2"]},
|
||||
|
@ -195,10 +194,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"preference": 20,
|
||||
"metric": 0,
|
||||
"vias": [{"nexthopAddr": "10.1.255.4", "interface": "Ethernet1"}],
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"vrfs": {
|
||||
|
@ -218,10 +217,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"preference": 20,
|
||||
"metric": 0,
|
||||
"vias": [{"nexthopAddr": "10.1.255.6", "interface": "Ethernet2"}],
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2"]},
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.routing.ospf.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from anta.tests.routing.ospf import VerifyOSPFNeighborCount, VerifyOSPFNeighborState
|
||||
from anta.tests.routing.ospf import VerifyOSPFMaxLSA, VerifyOSPFNeighborCount, VerifyOSPFNeighborState
|
||||
from tests.lib.anta import test # noqa: F401; pylint: disable=W0611
|
||||
|
||||
DATA: list[dict[str, Any]] = [
|
||||
|
@ -40,9 +39,9 @@ DATA: list[dict[str, Any]] = [
|
|||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"BLAH": {
|
||||
"instList": {
|
||||
|
@ -56,13 +55,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"adjacencyState": "full",
|
||||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -95,9 +94,9 @@ DATA: list[dict[str, Any]] = [
|
|||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"BLAH": {
|
||||
"instList": {
|
||||
|
@ -111,20 +110,20 @@ DATA: list[dict[str, Any]] = [
|
|||
"adjacencyState": "down",
|
||||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"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'}]."
|
||||
" {'vrf': 'BLAH', 'instance': '777', 'neighbor': '8.8.8.8', 'state': 'down'}].",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -134,7 +133,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"vrfs": {},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["no OSPF neighbor found"]},
|
||||
|
@ -167,9 +166,9 @@ DATA: list[dict[str, Any]] = [
|
|||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"BLAH": {
|
||||
"instList": {
|
||||
|
@ -183,13 +182,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"adjacencyState": "full",
|
||||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"number": 3},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -213,12 +212,12 @@ DATA: list[dict[str, Any]] = [
|
|||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"number": 3},
|
||||
"expected": {"result": "failure", "messages": ["device has 1 neighbors (expected 3)"]},
|
||||
|
@ -251,9 +250,9 @@ DATA: list[dict[str, Any]] = [
|
|||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
"BLAH": {
|
||||
"instList": {
|
||||
|
@ -267,20 +266,20 @@ DATA: list[dict[str, Any]] = [
|
|||
"adjacencyState": "down",
|
||||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"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'}]."
|
||||
" {'vrf': 'BLAH', 'instance': '777', 'neighbor': '8.8.8.8', 'state': 'down'}].",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -290,9 +289,123 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"vrfs": {},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"number": 3},
|
||||
"expected": {"result": "skipped", "messages": ["no OSPF neighbor found"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyOSPFMaxLSA,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"instList": {
|
||||
"1": {
|
||||
"instanceId": 1,
|
||||
"maxLsaInformation": {
|
||||
"maxLsa": 12000,
|
||||
"maxLsaThreshold": 75,
|
||||
},
|
||||
"routerId": "1.1.1.1",
|
||||
"lsaInformation": {
|
||||
"lsaArrivalInterval": 1000,
|
||||
"lsaStartInterval": 1000,
|
||||
"lsaHoldInterval": 5000,
|
||||
"lsaMaxWaitInterval": 5000,
|
||||
"numLsa": 9,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"TEST": {
|
||||
"instList": {
|
||||
"10": {
|
||||
"instanceId": 10,
|
||||
"maxLsaInformation": {
|
||||
"maxLsa": 1000,
|
||||
"maxLsaThreshold": 75,
|
||||
},
|
||||
"routerId": "20.20.20.20",
|
||||
"lsaInformation": {
|
||||
"lsaArrivalInterval": 1000,
|
||||
"lsaStartInterval": 1000,
|
||||
"lsaHoldInterval": 5000,
|
||||
"lsaMaxWaitInterval": 5000,
|
||||
"numLsa": 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifyOSPFMaxLSA,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"instList": {
|
||||
"1": {
|
||||
"instanceId": 1,
|
||||
"maxLsaInformation": {
|
||||
"maxLsa": 12000,
|
||||
"maxLsaThreshold": 75,
|
||||
},
|
||||
"routerId": "1.1.1.1",
|
||||
"lsaInformation": {
|
||||
"lsaArrivalInterval": 1000,
|
||||
"lsaStartInterval": 1000,
|
||||
"lsaHoldInterval": 5000,
|
||||
"lsaMaxWaitInterval": 5000,
|
||||
"numLsa": 11500,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"TEST": {
|
||||
"instList": {
|
||||
"10": {
|
||||
"instanceId": 10,
|
||||
"maxLsaInformation": {
|
||||
"maxLsa": 1000,
|
||||
"maxLsaThreshold": 75,
|
||||
},
|
||||
"routerId": "20.20.20.20",
|
||||
"lsaInformation": {
|
||||
"lsaArrivalInterval": 1000,
|
||||
"lsaStartInterval": 1000,
|
||||
"lsaHoldInterval": 5000,
|
||||
"lsaMaxWaitInterval": 5000,
|
||||
"numLsa": 1500,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": ["OSPF Instances ['1', '10'] crossed the maximum LSA threshold."],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "skipped",
|
||||
"test": VerifyOSPFMaxLSA,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["No OSPF instance found."]},
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.aaa.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -28,11 +27,11 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -45,7 +44,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [],
|
||||
"groups": {},
|
||||
"srcIntf": {},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["Source-interface Management0 is not configured in VRF MGMT"]},
|
||||
|
@ -58,11 +57,11 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management1"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["Wrong source-interface configured in VRF MGMT"]},
|
||||
|
@ -75,11 +74,11 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"PROD": "Management0"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["Source-interface Management0 is not configured in VRF MGMT"]},
|
||||
|
@ -92,11 +91,11 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -109,7 +108,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [],
|
||||
"groups": {},
|
||||
"srcIntf": {},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["No TACACS servers are configured"]},
|
||||
|
@ -122,11 +121,11 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"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"]},
|
||||
|
@ -139,11 +138,11 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "PROD"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["TACACS servers ['10.22.10.91'] are not configured in VRF MGMT"]},
|
||||
|
@ -156,11 +155,11 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"groups": ["GROUP1"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -173,7 +172,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [],
|
||||
"groups": {},
|
||||
"srcIntf": {},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"groups": ["GROUP1"]},
|
||||
"expected": {"result": "failure", "messages": ["No TACACS server group(s) are configured"]},
|
||||
|
@ -186,11 +185,11 @@ DATA: list[dict[str, Any]] = [
|
|||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"groups": {"GROUP2": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"groups": ["GROUP1"]},
|
||||
"expected": {"result": "failure", "messages": ["TACACS server group(s) ['GROUP1'] are not configured"]},
|
||||
|
@ -203,7 +202,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group tacacs+", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -216,7 +215,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group tacacs+", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["radius"], "types": ["dot1x"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -229,7 +228,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authentication methods are not configured for login console"]},
|
||||
|
@ -242,7 +241,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group radius", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authentication methods ['group tacacs+', 'local'] are not matching for login console"]},
|
||||
|
@ -255,7 +254,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"loginAuthenMethods": {"default": {"methods": ["group radius", "local"]}, "login": {"methods": ["group tacacs+", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authentication methods ['group tacacs+', 'local'] are not matching for ['login']"]},
|
||||
|
@ -267,7 +266,7 @@ DATA: list[dict[str, Any]] = [
|
|||
{
|
||||
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}},
|
||||
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -279,7 +278,7 @@ DATA: list[dict[str, Any]] = [
|
|||
{
|
||||
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group radius", "local"]}},
|
||||
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authorization methods ['group tacacs+', 'local'] are not matching for ['commands']"]},
|
||||
|
@ -291,7 +290,7 @@ DATA: list[dict[str, Any]] = [
|
|||
{
|
||||
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}},
|
||||
"execAuthzMethods": {"exec": {"methods": ["group radius", "local"]}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authorization methods ['group tacacs+', 'local'] are not matching for ['exec']"]},
|
||||
|
@ -305,7 +304,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
||||
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -319,7 +318,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
||||
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultAction": "startStop", "defaultMethods": ["group radius", "logging"], "consoleMethods": []}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["radius", "logging"], "types": ["dot1x"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -333,7 +332,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
||||
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA default accounting is not configured for ['commands']"]},
|
||||
|
@ -347,7 +346,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA default accounting is not configured for ['system', 'exec', 'commands']"]},
|
||||
|
@ -361,7 +360,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
||||
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA accounting default methods ['group tacacs+', 'logging'] are not matching for ['commands']"]},
|
||||
|
@ -376,24 +375,24 @@ DATA: list[dict[str, Any]] = [
|
|||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"execAcctMethods": {
|
||||
"exec": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"systemAcctMethods": {
|
||||
"system": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -408,30 +407,30 @@ DATA: list[dict[str, Any]] = [
|
|||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"execAcctMethods": {
|
||||
"exec": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"systemAcctMethods": {
|
||||
"system": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"dot1xAcctMethods": {
|
||||
"dot1x": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["dot1x"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -445,24 +444,24 @@ DATA: list[dict[str, Any]] = [
|
|||
"privilege0-15": {
|
||||
"defaultMethods": [],
|
||||
"consoleMethods": [],
|
||||
}
|
||||
},
|
||||
},
|
||||
"execAcctMethods": {
|
||||
"exec": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"systemAcctMethods": {
|
||||
"system": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA console accounting is not configured for ['commands']"]},
|
||||
|
@ -476,7 +475,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA console accounting is not configured for ['system', 'exec', 'commands']"]},
|
||||
|
@ -491,24 +490,24 @@ DATA: list[dict[str, Any]] = [
|
|||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group radius", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"execAcctMethods": {
|
||||
"exec": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"systemAcctMethods": {
|
||||
"system": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
}
|
||||
},
|
||||
},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA accounting console methods ['group tacacs+', 'logging'] are not matching for ['commands']"]},
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.bfd.py."""
|
||||
|
||||
# pylint: disable=C0302
|
||||
from __future__ import annotations
|
||||
|
||||
|
@ -11,7 +10,7 @@ from typing import Any
|
|||
|
||||
# pylint: disable=C0413
|
||||
# because of the patch above
|
||||
from anta.tests.bfd import VerifyBFDPeersHealth, VerifyBFDPeersIntervals, VerifyBFDSpecificPeers # noqa: E402
|
||||
from anta.tests.bfd import VerifyBFDPeersHealth, VerifyBFDPeersIntervals, VerifyBFDSpecificPeers
|
||||
from tests.lib.anta import test # noqa: F401; pylint: disable=W0611
|
||||
|
||||
DATA: list[dict[str, Any]] = [
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Data for testing anta.tests.configuration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.connectivity.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -27,8 +26,8 @@ DATA: list[dict[str, Any]] = [
|
|||
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
|
||||
|
||||
"""
|
||||
]
|
||||
""",
|
||||
],
|
||||
},
|
||||
{
|
||||
"messages": [
|
||||
|
@ -40,8 +39,8 @@ DATA: list[dict[str, Any]] = [
|
|||
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
|
||||
|
||||
"""
|
||||
]
|
||||
""",
|
||||
],
|
||||
},
|
||||
],
|
||||
"expected": {"result": "success"},
|
||||
|
@ -61,8 +60,8 @@ DATA: list[dict[str, Any]] = [
|
|||
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
|
||||
|
||||
"""
|
||||
]
|
||||
""",
|
||||
],
|
||||
},
|
||||
{
|
||||
"messages": [
|
||||
|
@ -74,8 +73,8 @@ DATA: list[dict[str, Any]] = [
|
|||
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
|
||||
|
||||
"""
|
||||
]
|
||||
""",
|
||||
],
|
||||
},
|
||||
],
|
||||
"expected": {"result": "success"},
|
||||
|
@ -94,8 +93,8 @@ DATA: list[dict[str, Any]] = [
|
|||
1 packets transmitted, 1 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
|
||||
|
||||
"""
|
||||
]
|
||||
""",
|
||||
],
|
||||
},
|
||||
],
|
||||
"expected": {"result": "success"},
|
||||
|
@ -115,8 +114,8 @@ DATA: list[dict[str, Any]] = [
|
|||
2 packets transmitted, 0 received, 100% packet loss, time 10ms
|
||||
|
||||
|
||||
"""
|
||||
]
|
||||
""",
|
||||
],
|
||||
},
|
||||
{
|
||||
"messages": [
|
||||
|
@ -128,8 +127,8 @@ DATA: list[dict[str, Any]] = [
|
|||
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
|
||||
|
||||
"""
|
||||
]
|
||||
""",
|
||||
],
|
||||
},
|
||||
],
|
||||
"expected": {"result": "failure", "messages": ["Connectivity test failed for the following source-destination pairs: [('10.0.0.5', '10.0.0.11')]"]},
|
||||
|
@ -149,8 +148,8 @@ DATA: list[dict[str, Any]] = [
|
|||
2 packets transmitted, 0 received, 100% packet loss, time 10ms
|
||||
|
||||
|
||||
"""
|
||||
]
|
||||
""",
|
||||
],
|
||||
},
|
||||
{
|
||||
"messages": [
|
||||
|
@ -162,8 +161,8 @@ DATA: list[dict[str, Any]] = [
|
|||
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
|
||||
|
||||
"""
|
||||
]
|
||||
""",
|
||||
],
|
||||
},
|
||||
],
|
||||
"expected": {"result": "failure", "messages": ["Connectivity test failed for the following source-destination pairs: [('Management0', '10.0.0.11')]"]},
|
||||
|
@ -175,7 +174,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"neighbors": [
|
||||
{"port": "Ethernet1", "neighbor_device": "DC1-SPINE1", "neighbor_port": "Ethernet1"},
|
||||
{"port": "Ethernet2", "neighbor_device": "DC1-SPINE2", "neighbor_port": "Ethernet1"},
|
||||
]
|
||||
],
|
||||
},
|
||||
"eos_data": [
|
||||
{
|
||||
|
@ -192,8 +191,8 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaceId_v2": "Ethernet1",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet1",
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
"Ethernet2": {
|
||||
"lldpNeighborInfo": [
|
||||
|
@ -207,11 +206,53 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaceId_v2": "Ethernet1",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet2",
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "success-multiple-neighbors",
|
||||
"test": VerifyLLDPNeighbors,
|
||||
"inputs": {
|
||||
"neighbors": [
|
||||
{"port": "Ethernet1", "neighbor_device": "DC1-SPINE2", "neighbor_port": "Ethernet1"},
|
||||
],
|
||||
},
|
||||
"eos_data": [
|
||||
{
|
||||
"lldpNeighbors": {
|
||||
"Ethernet1": {
|
||||
"lldpNeighborInfo": [
|
||||
{
|
||||
"chassisIdType": "macAddress",
|
||||
"chassisId": "001c.73a0.fc18",
|
||||
"systemName": "DC1-SPINE1",
|
||||
"neighborInterfaceInfo": {
|
||||
"interfaceIdType": "interfaceName",
|
||||
"interfaceId": '"Ethernet1"',
|
||||
"interfaceId_v2": "Ethernet1",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet1",
|
||||
},
|
||||
},
|
||||
{
|
||||
"chassisIdType": "macAddress",
|
||||
"chassisId": "001c.73f7.d138",
|
||||
"systemName": "DC1-SPINE2",
|
||||
"neighborInterfaceInfo": {
|
||||
"interfaceIdType": "interfaceName",
|
||||
"interfaceId": '"Ethernet1"',
|
||||
"interfaceId_v2": "Ethernet1",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet2",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
|
@ -222,7 +263,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"neighbors": [
|
||||
{"port": "Ethernet1", "neighbor_device": "DC1-SPINE1", "neighbor_port": "Ethernet1"},
|
||||
{"port": "Ethernet2", "neighbor_device": "DC1-SPINE2", "neighbor_port": "Ethernet1"},
|
||||
]
|
||||
],
|
||||
},
|
||||
"eos_data": [
|
||||
{
|
||||
|
@ -239,13 +280,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaceId_v2": "Ethernet1",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet1",
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"expected": {"result": "failure", "messages": ["The following port(s) have issues: {'port_not_configured': ['Ethernet2']}"]},
|
||||
"expected": {"result": "failure", "messages": ["Port(s) not configured:\n Ethernet2"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-neighbor",
|
||||
|
@ -254,7 +295,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"neighbors": [
|
||||
{"port": "Ethernet1", "neighbor_device": "DC1-SPINE1", "neighbor_port": "Ethernet1"},
|
||||
{"port": "Ethernet2", "neighbor_device": "DC1-SPINE2", "neighbor_port": "Ethernet1"},
|
||||
]
|
||||
],
|
||||
},
|
||||
"eos_data": [
|
||||
{
|
||||
|
@ -271,14 +312,14 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaceId_v2": "Ethernet1",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet1",
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
"Ethernet2": {"lldpNeighborInfo": []},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"expected": {"result": "failure", "messages": ["The following port(s) have issues: {'no_lldp_neighbor': ['Ethernet2']}"]},
|
||||
"expected": {"result": "failure", "messages": ["No LLDP neighbor(s) on port(s):\n Ethernet2"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-wrong-neighbor",
|
||||
|
@ -287,7 +328,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"neighbors": [
|
||||
{"port": "Ethernet1", "neighbor_device": "DC1-SPINE1", "neighbor_port": "Ethernet1"},
|
||||
{"port": "Ethernet2", "neighbor_device": "DC1-SPINE2", "neighbor_port": "Ethernet1"},
|
||||
]
|
||||
],
|
||||
},
|
||||
"eos_data": [
|
||||
{
|
||||
|
@ -304,8 +345,8 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaceId_v2": "Ethernet1",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet1",
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
"Ethernet2": {
|
||||
"lldpNeighborInfo": [
|
||||
|
@ -319,13 +360,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaceId_v2": "Ethernet2",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet2",
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"expected": {"result": "failure", "messages": ["The following port(s) have issues: {'wrong_lldp_neighbor': ['Ethernet2']}"]},
|
||||
"expected": {"result": "failure", "messages": ["Wrong LLDP neighbor(s) on port(s):\n Ethernet2\n DC1-SPINE2_Ethernet2"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-multiple",
|
||||
|
@ -335,7 +376,7 @@ DATA: list[dict[str, Any]] = [
|
|||
{"port": "Ethernet1", "neighbor_device": "DC1-SPINE1", "neighbor_port": "Ethernet1"},
|
||||
{"port": "Ethernet2", "neighbor_device": "DC1-SPINE2", "neighbor_port": "Ethernet1"},
|
||||
{"port": "Ethernet3", "neighbor_device": "DC1-SPINE3", "neighbor_port": "Ethernet1"},
|
||||
]
|
||||
],
|
||||
},
|
||||
"eos_data": [
|
||||
{
|
||||
|
@ -352,18 +393,62 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaceId_v2": "Ethernet2",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet1",
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
"Ethernet2": {"lldpNeighborInfo": []},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"The following port(s) have issues: {'wrong_lldp_neighbor': ['Ethernet1'], 'no_lldp_neighbor': ['Ethernet2'], 'port_not_configured': ['Ethernet3']}"
|
||||
"Wrong LLDP neighbor(s) on port(s):\n Ethernet1\n DC1-SPINE1_Ethernet2\n"
|
||||
"No LLDP neighbor(s) on port(s):\n Ethernet2\n"
|
||||
"Port(s) not configured:\n Ethernet3"
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-multiple-neighbors",
|
||||
"test": VerifyLLDPNeighbors,
|
||||
"inputs": {
|
||||
"neighbors": [
|
||||
{"port": "Ethernet1", "neighbor_device": "DC1-SPINE3", "neighbor_port": "Ethernet1"},
|
||||
],
|
||||
},
|
||||
"eos_data": [
|
||||
{
|
||||
"lldpNeighbors": {
|
||||
"Ethernet1": {
|
||||
"lldpNeighborInfo": [
|
||||
{
|
||||
"chassisIdType": "macAddress",
|
||||
"chassisId": "001c.73a0.fc18",
|
||||
"systemName": "DC1-SPINE1",
|
||||
"neighborInterfaceInfo": {
|
||||
"interfaceIdType": "interfaceName",
|
||||
"interfaceId": '"Ethernet1"',
|
||||
"interfaceId_v2": "Ethernet1",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet1",
|
||||
},
|
||||
},
|
||||
{
|
||||
"chassisIdType": "macAddress",
|
||||
"chassisId": "001c.73f7.d138",
|
||||
"systemName": "DC1-SPINE2",
|
||||
"neighborInterfaceInfo": {
|
||||
"interfaceIdType": "interfaceName",
|
||||
"interfaceId": '"Ethernet1"',
|
||||
"interfaceId_v2": "Ethernet1",
|
||||
"interfaceDescription": "P2P_LINK_TO_DC1-LEAF1A_Ethernet2",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"expected": {"result": "failure", "messages": ["Wrong LLDP neighbor(s) on port(s):\n Ethernet1\n DC1-SPINE1_Ethernet1\n DC1-SPINE2_Ethernet1"]},
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Test inputs for anta.tests.field_notices."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -22,7 +23,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "Aboot", "version": "Aboot-veos-8.0.0-3255441"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -39,10 +40,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "Aboot", "version": "Aboot-veos-4.0.1-3255441"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["device is running incorrect version of aboot (4.0.1)"]},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": ["device is running incorrect version of aboot (4.0.1)"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-4.1",
|
||||
|
@ -56,10 +60,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "Aboot", "version": "Aboot-veos-4.1.0-3255441"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["device is running incorrect version of aboot (4.1.0)"]},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": ["device is running incorrect version of aboot (4.1.0)"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-6.0",
|
||||
|
@ -73,10 +80,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "Aboot", "version": "Aboot-veos-6.0.1-3255441"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["device is running incorrect version of aboot (6.0.1)"]},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": ["device is running incorrect version of aboot (6.0.1)"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-6.1",
|
||||
|
@ -90,10 +100,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "Aboot", "version": "Aboot-veos-6.1.1-3255441"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["device is running incorrect version of aboot (6.1.1)"]},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": ["device is running incorrect version of aboot (6.1.1)"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "skipped-model",
|
||||
|
@ -107,10 +120,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "Aboot", "version": "Aboot-veos-8.0.0-3255441"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["device is not impacted by FN044"]},
|
||||
"expected": {
|
||||
"result": "skipped",
|
||||
"messages": ["device is not impacted by FN044"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "success-JPE",
|
||||
|
@ -123,7 +139,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "7"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success", "messages": ["FN72 is mitigated"]},
|
||||
|
@ -139,7 +155,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "7"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success", "messages": ["FN72 is mitigated"]},
|
||||
|
@ -155,7 +171,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "7"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success", "messages": ["FN72 is mitigated"]},
|
||||
|
@ -171,7 +187,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "7"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success", "messages": ["FN72 is mitigated"]},
|
||||
|
@ -187,7 +203,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "7"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["Device not exposed"]},
|
||||
|
@ -203,10 +219,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "5"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["Platform is not impacted by FN072"]},
|
||||
"expected": {
|
||||
"result": "skipped",
|
||||
"messages": ["Platform is not impacted by FN072"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "skipped-range-JPE",
|
||||
|
@ -219,7 +238,39 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "5"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["Device not exposed"]},
|
||||
},
|
||||
{
|
||||
"name": "skipped-range-K-JPE",
|
||||
"test": VerifyFieldNotice72Resolution,
|
||||
"eos_data": [
|
||||
{
|
||||
"modelName": "DCS-7280SR3K-48YC8",
|
||||
"serialNumber": "JPE2134000",
|
||||
"details": {
|
||||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "5"}],
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["Device not exposed"]},
|
||||
},
|
||||
{
|
||||
"name": "skipped-range-JAS",
|
||||
"test": VerifyFieldNotice72Resolution,
|
||||
"eos_data": [
|
||||
{
|
||||
"modelName": "DCS-7280SR3-48YC8",
|
||||
"serialNumber": "JAS2041000",
|
||||
"details": {
|
||||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "5"}],
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["Device not exposed"]},
|
||||
|
@ -235,7 +286,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "5"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["Device not exposed"]},
|
||||
|
@ -251,7 +302,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "5"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Device is exposed to FN72"]},
|
||||
|
@ -267,7 +318,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm1", "version": "5"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Device is exposed to FN72"]},
|
||||
|
@ -283,9 +334,12 @@ DATA: list[dict[str, Any]] = [
|
|||
"deviations": [],
|
||||
"components": [{"name": "FixedSystemvrm2", "version": "5"}],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "error", "messages": ["Error in running test - FixedSystemvrm1 not found"]},
|
||||
"expected": {
|
||||
"result": "error",
|
||||
"messages": ["Error in running test - FixedSystemvrm1 not found"],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Data for testing anta.tests.configuration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from anta.tests.greent import VerifyGreenT, VerifyGreenTCounters
|
||||
from tests.lib.anta import test # noqa: F401; pylint: disable=W0611
|
||||
|
||||
DATA: list[dict[str, Any]] = [
|
||||
{
|
||||
|
@ -21,12 +23,19 @@ DATA: list[dict[str, Any]] = [
|
|||
"test": VerifyGreenTCounters,
|
||||
"eos_data": [{"sampleRcvd": 0, "sampleDiscarded": 0, "multiDstSampleRcvd": 0, "grePktSent": 0, "sampleSent": 0}],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure"},
|
||||
"expected": {"result": "failure", "messages": ["GreenT counters are not incremented"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyGreenT,
|
||||
"eos_data": [{"sampleRcvd": 0, "sampleDiscarded": 0, "multiDstSampleRcvd": 0, "grePktSent": 1, "sampleSent": 0}],
|
||||
"eos_data": [
|
||||
{
|
||||
"profiles": {
|
||||
"default": {"interfaces": [], "appliedInterfaces": [], "samplePolicy": "default", "failures": {}, "appliedInterfaces6": [], "failures6": {}},
|
||||
"testProfile": {"interfaces": [], "appliedInterfaces": [], "samplePolicy": "default", "failures": {}, "appliedInterfaces6": [], "failures6": {}},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
|
@ -37,11 +46,10 @@ DATA: list[dict[str, Any]] = [
|
|||
{
|
||||
"profiles": {
|
||||
"default": {"interfaces": [], "appliedInterfaces": [], "samplePolicy": "default", "failures": {}, "appliedInterfaces6": [], "failures6": {}},
|
||||
"testProfile": {"interfaces": [], "appliedInterfaces": [], "samplePolicy": "default", "failures": {}, "appliedInterfaces6": [], "failures6": {}},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure"},
|
||||
"expected": {"result": "failure", "messages": ["No GreenT policy is created"]},
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Test inputs for anta.tests.hardware."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -26,8 +27,8 @@ DATA: list[dict[str, Any]] = [
|
|||
"xcvrSlots": {
|
||||
"1": {"mfgName": "Arista Networks", "modelName": "QSFP-100G-DR", "serialNum": "XKT203501340", "hardwareRev": "21"},
|
||||
"2": {"mfgName": "Arista Networks", "modelName": "QSFP-100G-DR", "serialNum": "XKT203501337", "hardwareRev": "21"},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"manufacturers": ["Arista Networks"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -40,8 +41,8 @@ DATA: list[dict[str, Any]] = [
|
|||
"xcvrSlots": {
|
||||
"1": {"mfgName": "Arista Networks", "modelName": "QSFP-100G-DR", "serialNum": "XKT203501340", "hardwareRev": "21"},
|
||||
"2": {"mfgName": "Arista Networks", "modelName": "QSFP-100G-DR", "serialNum": "XKT203501337", "hardwareRev": "21"},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"manufacturers": ["Arista"]},
|
||||
"expected": {"result": "failure", "messages": ["Some transceivers are from unapproved manufacturers: {'1': 'Arista Networks', '2': 'Arista Networks'}"]},
|
||||
|
@ -57,7 +58,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"shutdownOnOverheat": "True",
|
||||
"systemStatus": "temperatureOk",
|
||||
"recoveryModeOnOverheat": "recoveryModeNA",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -73,7 +74,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"shutdownOnOverheat": "True",
|
||||
"systemStatus": "temperatureKO",
|
||||
"recoveryModeOnOverheat": "recoveryModeNA",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Device temperature exceeds acceptable limits. Current system status: 'temperatureKO'"]},
|
||||
|
@ -100,10 +101,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"pidDriverCount": 0,
|
||||
"isPidDriver": False,
|
||||
"name": "DomTemperatureSensor54",
|
||||
}
|
||||
},
|
||||
],
|
||||
"cardSlots": [],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -130,10 +131,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"pidDriverCount": 0,
|
||||
"isPidDriver": False,
|
||||
"name": "DomTemperatureSensor54",
|
||||
}
|
||||
},
|
||||
],
|
||||
"cardSlots": [],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
|
@ -141,7 +142,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"messages": [
|
||||
"The following sensors are operating outside the acceptable temperature range or have raised alerts: "
|
||||
"{'DomTemperatureSensor54': "
|
||||
"{'hwStatus': 'ko', 'alertCount': 0}}"
|
||||
"{'hwStatus': 'ko', 'alertCount': 0}}",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -167,10 +168,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"pidDriverCount": 0,
|
||||
"isPidDriver": False,
|
||||
"name": "DomTemperatureSensor54",
|
||||
}
|
||||
},
|
||||
],
|
||||
"cardSlots": [],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
|
@ -178,7 +179,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"messages": [
|
||||
"The following sensors are operating outside the acceptable temperature range or have raised alerts: "
|
||||
"{'DomTemperatureSensor54': "
|
||||
"{'hwStatus': 'ok', 'alertCount': 1}}"
|
||||
"{'hwStatus': 'ok', 'alertCount': 1}}",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -200,7 +201,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"currentZones": 1,
|
||||
"configuredZones": 0,
|
||||
"systemStatus": "coolingOk",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -223,7 +224,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"currentZones": 1,
|
||||
"configuredZones": 0,
|
||||
"systemStatus": "coolingKo",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Device system cooling is not OK: 'coolingKo'"]},
|
||||
|
@ -254,7 +255,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": True,
|
||||
"speedStable": True,
|
||||
"label": "PowerSupply1/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "PowerSupply1",
|
||||
|
@ -272,7 +273,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": True,
|
||||
"speedStable": True,
|
||||
"label": "PowerSupply2/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "PowerSupply2",
|
||||
|
@ -292,7 +293,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "1/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "1",
|
||||
|
@ -310,7 +311,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "2/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "2",
|
||||
|
@ -328,7 +329,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "3/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "3",
|
||||
|
@ -346,7 +347,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "4/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "4",
|
||||
|
@ -356,7 +357,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"currentZones": 1,
|
||||
"configuredZones": 0,
|
||||
"systemStatus": "coolingOk",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"states": ["ok"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -387,7 +388,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": True,
|
||||
"speedStable": True,
|
||||
"label": "PowerSupply1/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "PowerSupply1",
|
||||
|
@ -405,7 +406,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": True,
|
||||
"speedStable": True,
|
||||
"label": "PowerSupply2/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "PowerSupply2",
|
||||
|
@ -425,7 +426,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "1/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "1",
|
||||
|
@ -443,7 +444,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "2/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "2",
|
||||
|
@ -461,7 +462,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "3/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "3",
|
||||
|
@ -479,7 +480,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "4/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "4",
|
||||
|
@ -489,7 +490,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"currentZones": 1,
|
||||
"configuredZones": 0,
|
||||
"systemStatus": "coolingOk",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"states": ["ok", "Not Inserted"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -520,7 +521,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": True,
|
||||
"speedStable": True,
|
||||
"label": "PowerSupply1/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "PowerSupply1",
|
||||
|
@ -538,7 +539,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": True,
|
||||
"speedStable": True,
|
||||
"label": "PowerSupply2/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "PowerSupply2",
|
||||
|
@ -558,7 +559,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "1/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "1",
|
||||
|
@ -576,7 +577,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "2/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "2",
|
||||
|
@ -594,7 +595,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "3/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "3",
|
||||
|
@ -612,7 +613,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "4/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "4",
|
||||
|
@ -622,7 +623,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"currentZones": 1,
|
||||
"configuredZones": 0,
|
||||
"systemStatus": "CoolingKo",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"states": ["ok", "Not Inserted"]},
|
||||
"expected": {"result": "failure", "messages": ["Fan 1/1 on Fan Tray 1 is: 'down'"]},
|
||||
|
@ -653,7 +654,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": True,
|
||||
"speedStable": True,
|
||||
"label": "PowerSupply1/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "PowerSupply1",
|
||||
|
@ -671,7 +672,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": True,
|
||||
"speedStable": True,
|
||||
"label": "PowerSupply2/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "PowerSupply2",
|
||||
|
@ -691,7 +692,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "1/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "1",
|
||||
|
@ -709,7 +710,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "2/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "2",
|
||||
|
@ -727,7 +728,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "3/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "3",
|
||||
|
@ -745,7 +746,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"speedHwOverride": False,
|
||||
"speedStable": True,
|
||||
"label": "4/1",
|
||||
}
|
||||
},
|
||||
],
|
||||
"speed": 30,
|
||||
"label": "4",
|
||||
|
@ -755,7 +756,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"currentZones": 1,
|
||||
"configuredZones": 0,
|
||||
"systemStatus": "CoolingKo",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"states": ["ok", "Not Inserted"]},
|
||||
"expected": {"result": "failure", "messages": ["Fan PowerSupply1/1 on PowerSupply PowerSupply1 is: 'down'"]},
|
||||
|
@ -801,8 +802,8 @@ DATA: list[dict[str, Any]] = [
|
|||
"outputCurrent": 9.828125,
|
||||
"managed": True,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"states": ["ok"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -848,8 +849,8 @@ DATA: list[dict[str, Any]] = [
|
|||
"outputCurrent": 9.828125,
|
||||
"managed": True,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"states": ["ok", "Not Inserted"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -895,8 +896,8 @@ DATA: list[dict[str, Any]] = [
|
|||
"outputCurrent": 9.828125,
|
||||
"managed": True,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"states": ["ok"]},
|
||||
"expected": {"result": "failure", "messages": ["The following power supplies status are not in the accepted states list: {'1': {'state': 'powerLoss'}}"]},
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Data for testing anta.tests.lanz."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -15,7 +16,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"test": VerifyLANZ,
|
||||
"eos_data": [{"lanzEnabled": True}],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success", "messages": ["LANZ is enabled"]},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Data for testing anta.tests.logging."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -77,7 +78,7 @@ DATA: list[dict[str, Any]] = [
|
|||
Logging to '10.22.10.93' port 514 in VRF MGMT via tcp
|
||||
Logging to '10.22.10.94' port 911 in VRF MGMT via udp
|
||||
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"inputs": {"interface": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -92,7 +93,7 @@ DATA: list[dict[str, Any]] = [
|
|||
Logging to '10.22.10.93' port 514 in VRF MGMT via tcp
|
||||
Logging to '10.22.10.94' port 911 in VRF MGMT via udp
|
||||
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"inputs": {"interface": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["Source-interface 'Management0' is not configured in VRF MGMT"]},
|
||||
|
@ -107,7 +108,7 @@ DATA: list[dict[str, Any]] = [
|
|||
Logging to '10.22.10.93' port 514 in VRF MGMT via tcp
|
||||
Logging to '10.22.10.94' port 911 in VRF MGMT via udp
|
||||
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"inputs": {"interface": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["Source-interface 'Management0' is not configured in VRF MGMT"]},
|
||||
|
@ -122,7 +123,7 @@ DATA: list[dict[str, Any]] = [
|
|||
Logging to '10.22.10.93' port 514 in VRF MGMT via tcp
|
||||
Logging to '10.22.10.94' port 911 in VRF MGMT via udp
|
||||
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"inputs": {"hosts": ["10.22.10.92", "10.22.10.93", "10.22.10.94"], "vrf": "MGMT"},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -137,7 +138,7 @@ DATA: list[dict[str, Any]] = [
|
|||
Logging to '10.22.10.103' port 514 in VRF MGMT via tcp
|
||||
Logging to '10.22.10.104' port 911 in VRF MGMT via udp
|
||||
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"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"]},
|
||||
|
@ -152,7 +153,7 @@ DATA: list[dict[str, Any]] = [
|
|||
Logging to '10.22.10.93' port 514 in VRF default via tcp
|
||||
Logging to '10.22.10.94' port 911 in VRF default via udp
|
||||
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"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"]},
|
||||
|
@ -246,7 +247,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"name": "failure",
|
||||
"test": VerifyLoggingErrors,
|
||||
"eos_data": [
|
||||
"Aug 2 19:57:42 DC1-LEAF1A Mlag: %FWK-3-SOCKET_CLOSE_REMOTE: Connection to Mlag (pid:27200) at tbt://192.168.0.1:4432/+n closed by peer (EOF)"
|
||||
"Aug 2 19:57:42 DC1-LEAF1A Mlag: %FWK-3-SOCKET_CLOSE_REMOTE: Connection to Mlag (pid:27200) at tbt://192.168.0.1:4432/+n closed by peer (EOF)",
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Device has reported syslog messages with a severity of ERRORS or higher"]},
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.mlag.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -25,7 +24,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"state": "disabled",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["MLAG is disabled"]},
|
||||
|
@ -47,7 +46,7 @@ DATA: list[dict[str, Any]] = [
|
|||
{
|
||||
"state": "active",
|
||||
"mlagPorts": {"Disabled": 0, "Configured": 0, "Inactive": 0, "Active-partial": 0, "Active-full": 1},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -58,7 +57,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"state": "disabled",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["MLAG is disabled"]},
|
||||
|
@ -70,7 +69,7 @@ DATA: list[dict[str, Any]] = [
|
|||
{
|
||||
"state": "active",
|
||||
"mlagPorts": {"Disabled": 0, "Configured": 0, "Inactive": 0, "Active-partial": 1, "Active-full": 1},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
|
@ -85,7 +84,7 @@ DATA: list[dict[str, Any]] = [
|
|||
{
|
||||
"state": "active",
|
||||
"mlagPorts": {"Disabled": 0, "Configured": 0, "Inactive": 1, "Active-partial": 1, "Active-full": 1},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
|
@ -106,7 +105,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"mlagActive": False,
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["MLAG is disabled"]},
|
||||
|
@ -117,7 +116,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"dummy": False,
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "error", "messages": ["Incorrect JSON response - 'mlagActive' state was not found"]},
|
||||
|
@ -131,7 +130,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaceConfiguration": {},
|
||||
"mlagActive": True,
|
||||
"mlagConnected": True,
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
|
@ -140,7 +139,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"MLAG config-sanity returned inconsistencies: "
|
||||
"{'globalConfiguration': {'mlag': {'globalParameters': "
|
||||
"{'dual-primary-detection-delay': {'localValue': '0', 'peerValue': '200'}}}}, "
|
||||
"'interfaceConfiguration': {}}"
|
||||
"'interfaceConfiguration': {}}",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -153,7 +152,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaceConfiguration": {"trunk-native-vlan mlag30": {"interface": {"Port-Channel30": {"localValue": "123", "peerValue": "3700"}}}},
|
||||
"mlagActive": True,
|
||||
"mlagConnected": True,
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
|
@ -162,7 +161,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"MLAG config-sanity returned inconsistencies: "
|
||||
"{'globalConfiguration': {}, "
|
||||
"'interfaceConfiguration': {'trunk-native-vlan mlag30': "
|
||||
"{'interface': {'Port-Channel30': {'localValue': '123', 'peerValue': '3700'}}}}}"
|
||||
"{'interface': {'Port-Channel30': {'localValue': '123', 'peerValue': '3700'}}}}}",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -179,7 +178,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"state": "disabled",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"reload_delay": 300, "reload_delay_non_mlag": 330},
|
||||
"expected": {"result": "skipped", "messages": ["MLAG is disabled"]},
|
||||
|
@ -202,7 +201,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"dualPrimaryMlagRecoveryDelay": 60,
|
||||
"dualPrimaryNonMlagRecoveryDelay": 0,
|
||||
"detail": {"dualPrimaryDetectionDelay": 200, "dualPrimaryAction": "none"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"detection_delay": 200, "errdisabled": False, "recovery_delay": 60, "recovery_delay_non_mlag": 0},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -213,7 +212,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"state": "disabled",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"detection_delay": 200, "errdisabled": False, "recovery_delay": 60, "recovery_delay_non_mlag": 0},
|
||||
"expected": {"result": "skipped", "messages": ["MLAG is disabled"]},
|
||||
|
@ -226,7 +225,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"state": "active",
|
||||
"dualPrimaryDetectionState": "disabled",
|
||||
"dualPrimaryPortsErrdisabled": False,
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"detection_delay": 200, "errdisabled": False, "recovery_delay": 60, "recovery_delay_non_mlag": 0},
|
||||
"expected": {"result": "failure", "messages": ["Dual-primary detection is disabled"]},
|
||||
|
@ -242,7 +241,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"dualPrimaryMlagRecoveryDelay": 160,
|
||||
"dualPrimaryNonMlagRecoveryDelay": 0,
|
||||
"detail": {"dualPrimaryDetectionDelay": 300, "dualPrimaryAction": "none"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"detection_delay": 200, "errdisabled": False, "recovery_delay": 60, "recovery_delay_non_mlag": 0},
|
||||
"expected": {
|
||||
|
@ -254,7 +253,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"'detail.dualPrimaryAction': 'none', "
|
||||
"'dualPrimaryMlagRecoveryDelay': 160, "
|
||||
"'dualPrimaryNonMlagRecoveryDelay': 0}"
|
||||
)
|
||||
),
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -269,7 +268,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"dualPrimaryMlagRecoveryDelay": 60,
|
||||
"dualPrimaryNonMlagRecoveryDelay": 0,
|
||||
"detail": {"dualPrimaryDetectionDelay": 200, "dualPrimaryAction": "none"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"detection_delay": 200, "errdisabled": True, "recovery_delay": 60, "recovery_delay_non_mlag": 0},
|
||||
"expected": {
|
||||
|
@ -281,7 +280,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"'detail.dualPrimaryAction': 'none', "
|
||||
"'dualPrimaryMlagRecoveryDelay': 60, "
|
||||
"'dualPrimaryNonMlagRecoveryDelay': 0}"
|
||||
)
|
||||
),
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Test inputs for anta.tests.multicast."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -44,7 +45,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"robustness": 2,
|
||||
"immediateLeave": "enabled",
|
||||
"reportFloodingSwitchPorts": [],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"vlans": {1: True, 42: True}},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -67,12 +68,12 @@ DATA: list[dict[str, Any]] = [
|
|||
"maxGroups": 65534,
|
||||
"immediateLeave": "default",
|
||||
"floodingTraffic": True,
|
||||
}
|
||||
},
|
||||
},
|
||||
"robustness": 2,
|
||||
"immediateLeave": "enabled",
|
||||
"reportFloodingSwitchPorts": [],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"vlans": {42: False}},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -100,7 +101,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"robustness": 2,
|
||||
"immediateLeave": "enabled",
|
||||
"reportFloodingSwitchPorts": [],
|
||||
}
|
||||
},
|
||||
],
|
||||
"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."]},
|
||||
|
@ -128,7 +129,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"robustness": 2,
|
||||
"immediateLeave": "enabled",
|
||||
"reportFloodingSwitchPorts": [],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"vlans": {1: True}},
|
||||
"expected": {"result": "failure", "messages": ["IGMP state for vlan 1 is disabled"]},
|
||||
|
@ -143,7 +144,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"robustness": 2,
|
||||
"immediateLeave": "enabled",
|
||||
"reportFloodingSwitchPorts": [],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"enabled": True},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -155,7 +156,7 @@ DATA: list[dict[str, Any]] = [
|
|||
{
|
||||
"reportFlooding": "disabled",
|
||||
"igmpSnoopingState": "disabled",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"enabled": False},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -167,7 +168,7 @@ DATA: list[dict[str, Any]] = [
|
|||
{
|
||||
"reportFlooding": "disabled",
|
||||
"igmpSnoopingState": "disabled",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"enabled": True},
|
||||
"expected": {"result": "failure", "messages": ["IGMP state is not valid: disabled"]},
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.profiles.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -30,7 +29,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"name": "success",
|
||||
"test": VerifyTcamProfile,
|
||||
"eos_data": [
|
||||
{"pmfProfiles": {"FixedSystem": {"config": "test", "configType": "System Profile", "status": "test", "mode": "tcam"}}, "lastProgrammingStatus": {}}
|
||||
{"pmfProfiles": {"FixedSystem": {"config": "test", "configType": "System Profile", "status": "test", "mode": "tcam"}}, "lastProgrammingStatus": {}},
|
||||
],
|
||||
"inputs": {"profile": "test"},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -39,7 +38,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"name": "failure",
|
||||
"test": VerifyTcamProfile,
|
||||
"eos_data": [
|
||||
{"pmfProfiles": {"FixedSystem": {"config": "test", "configType": "System Profile", "status": "default", "mode": "tcam"}}, "lastProgrammingStatus": {}}
|
||||
{"pmfProfiles": {"FixedSystem": {"config": "test", "configType": "System Profile", "status": "default", "mode": "tcam"}}, "lastProgrammingStatus": {}},
|
||||
],
|
||||
"inputs": {"profile": "test"},
|
||||
"expected": {"result": "failure", "messages": ["Incorrect profile running on device: default"]},
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Data for testing anta.tests.ptp."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from anta.tests.ptp import VerifyPtpStatus
|
||||
from anta.tests.ptp import VerifyPtpGMStatus, VerifyPtpLockStatus, VerifyPtpModeStatus, VerifyPtpOffset, VerifyPtpPortModeStatus
|
||||
from tests.lib.anta import test # noqa: F401; pylint: disable=W0611
|
||||
|
||||
DATA: list[dict[str, Any]] = [
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyPtpStatus,
|
||||
"test": VerifyPtpModeStatus,
|
||||
"eos_data": [
|
||||
{
|
||||
"ptpMode": "ptpBoundaryClock",
|
||||
|
@ -34,9 +36,305 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifyPtpStatus,
|
||||
"test": VerifyPtpModeStatus,
|
||||
"eos_data": [{"ptpMode": "ptpDisabled", "ptpIntfSummaries": {}}],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["The device is not configured as a PTP Boundary Clock: 'ptpDisabled'"]},
|
||||
},
|
||||
{
|
||||
"name": "error",
|
||||
"test": VerifyPtpModeStatus,
|
||||
"eos_data": [{"ptpIntfSummaries": {}}],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure"},
|
||||
"expected": {"result": "error", "messages": ["'ptpMode' variable is not present in the command output"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyPtpGMStatus,
|
||||
"eos_data": [
|
||||
{
|
||||
"ptpMode": "ptpBoundaryClock",
|
||||
"ptpProfile": "ptpDefaultProfile",
|
||||
"ptpClockSummary": {
|
||||
"clockIdentity": "0x00:1c:73:ff:ff:14:00:01",
|
||||
"gmClockIdentity": "0xec:46:70:ff:fe:00:ff:a8",
|
||||
"numberOfSlavePorts": 1,
|
||||
"numberOfMasterPorts": 8,
|
||||
"slavePort": "Ethernet27/1",
|
||||
"slaveVlanId": 0,
|
||||
"offsetFromMaster": -11,
|
||||
"meanPathDelay": 105,
|
||||
"stepsRemoved": 2,
|
||||
"skew": 1.0000015265007687,
|
||||
"lastSyncTime": 1708599750,
|
||||
"currentPtpSystemTime": 1708599750,
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"gmid": "0xec:46:70:ff:fe:00:ff:a8"},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifyPtpGMStatus,
|
||||
"eos_data": [
|
||||
{
|
||||
"ptpMode": "ptpBoundaryClock",
|
||||
"ptpProfile": "ptpDefaultProfile",
|
||||
"ptpClockSummary": {
|
||||
"clockIdentity": "0x00:1c:73:ff:ff:0a:00:01",
|
||||
"gmClockIdentity": "0x00:1c:73:ff:ff:0a:00:01",
|
||||
"numberOfSlavePorts": 0,
|
||||
"numberOfMasterPorts": 4,
|
||||
"offsetFromMaster": 3,
|
||||
"meanPathDelay": 496,
|
||||
"stepsRemoved": 0,
|
||||
"skew": 1.0000074628720317,
|
||||
"lastSyncTime": 1708600129,
|
||||
"currentPtpSystemTime": 1708600153,
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"gmid": "0xec:46:70:ff:fe:00:ff:a8"},
|
||||
"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.",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "error",
|
||||
"test": VerifyPtpGMStatus,
|
||||
"eos_data": [{"ptpIntfSummaries": {}}],
|
||||
"inputs": {"gmid": "0xec:46:70:ff:fe:00:ff:a8"},
|
||||
"expected": {"result": "error", "messages": ["'ptpClockSummary' variable is not present in the command output"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyPtpLockStatus,
|
||||
"eos_data": [
|
||||
{
|
||||
"ptpMode": "ptpBoundaryClock",
|
||||
"ptpProfile": "ptpDefaultProfile",
|
||||
"ptpClockSummary": {
|
||||
"clockIdentity": "0x00:1c:73:ff:ff:14:00:01",
|
||||
"gmClockIdentity": "0xec:46:70:ff:fe:00:ff:a8",
|
||||
"numberOfSlavePorts": 1,
|
||||
"numberOfMasterPorts": 8,
|
||||
"slavePort": "Ethernet27/1",
|
||||
"slaveVlanId": 0,
|
||||
"offsetFromMaster": -11,
|
||||
"meanPathDelay": 105,
|
||||
"stepsRemoved": 2,
|
||||
"skew": 1.0000015265007687,
|
||||
"lastSyncTime": 1708599750,
|
||||
"currentPtpSystemTime": 1708599750,
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifyPtpLockStatus,
|
||||
"eos_data": [
|
||||
{
|
||||
"ptpMode": "ptpBoundaryClock",
|
||||
"ptpProfile": "ptpDefaultProfile",
|
||||
"ptpClockSummary": {
|
||||
"clockIdentity": "0x00:1c:73:ff:ff:0a:00:01",
|
||||
"gmClockIdentity": "0x00:1c:73:ff:ff:0a:00:01",
|
||||
"numberOfSlavePorts": 0,
|
||||
"numberOfMasterPorts": 4,
|
||||
"offsetFromMaster": 3,
|
||||
"meanPathDelay": 496,
|
||||
"stepsRemoved": 0,
|
||||
"skew": 1.0000074628720317,
|
||||
"lastSyncTime": 1708600129,
|
||||
"currentPtpSystemTime": 1708600286,
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["The device lock is more than 60s old: 157s"]},
|
||||
},
|
||||
{
|
||||
"name": "error",
|
||||
"test": VerifyPtpLockStatus,
|
||||
"eos_data": [{"ptpIntfSummaries": {}}],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
"result": "error",
|
||||
"messages": [
|
||||
"'ptpClockSummary' variable is not present in the command output",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyPtpOffset,
|
||||
"eos_data": [
|
||||
{
|
||||
"monitorEnabled": True,
|
||||
"ptpMode": "ptpBoundaryClock",
|
||||
"offsetFromMasterThreshold": 250,
|
||||
"meanPathDelayThreshold": 1500,
|
||||
"ptpMonitorData": [
|
||||
{
|
||||
"intf": "Ethernet27/1",
|
||||
"realLastSyncTime": 1708599815611398400,
|
||||
"lastSyncSeqId": 44413,
|
||||
"offsetFromMaster": 2,
|
||||
"meanPathDelay": 105,
|
||||
"skew": 1.000001614,
|
||||
},
|
||||
{
|
||||
"intf": "Ethernet27/1",
|
||||
"realLastSyncTime": 1708599815486101500,
|
||||
"lastSyncSeqId": 44412,
|
||||
"offsetFromMaster": -13,
|
||||
"meanPathDelay": 105,
|
||||
"skew": 1.000001614,
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifyPtpOffset,
|
||||
"eos_data": [
|
||||
{
|
||||
"monitorEnabled": True,
|
||||
"ptpMode": "ptpBoundaryClock",
|
||||
"offsetFromMasterThreshold": 250,
|
||||
"meanPathDelayThreshold": 1500,
|
||||
"ptpMonitorData": [
|
||||
{
|
||||
"intf": "Ethernet27/1",
|
||||
"realLastSyncTime": 1708599815611398400,
|
||||
"lastSyncSeqId": 44413,
|
||||
"offsetFromMaster": 1200,
|
||||
"meanPathDelay": 105,
|
||||
"skew": 1.000001614,
|
||||
},
|
||||
{
|
||||
"intf": "Ethernet27/1",
|
||||
"realLastSyncTime": 1708599815486101500,
|
||||
"lastSyncSeqId": 44412,
|
||||
"offsetFromMaster": -1300,
|
||||
"meanPathDelay": 105,
|
||||
"skew": 1.000001614,
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [("The device timing offset from master is greater than +/- 1000ns: {'Ethernet27/1': [1200, -1300]}")],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "skipped",
|
||||
"test": VerifyPtpOffset,
|
||||
"eos_data": [
|
||||
{
|
||||
"monitorEnabled": True,
|
||||
"ptpMonitorData": [],
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["PTP is not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyPtpPortModeStatus,
|
||||
"eos_data": [
|
||||
{
|
||||
"ptpMode": "ptpBoundaryClock",
|
||||
"ptpProfile": "ptpDefaultProfile",
|
||||
"ptpClockSummary": {
|
||||
"clockIdentity": "0x00:1c:73:ff:ff:0a:00:01",
|
||||
"gmClockIdentity": "0x00:1c:73:ff:ff:0a:00:01",
|
||||
"numberOfSlavePorts": 0,
|
||||
"numberOfMasterPorts": 4,
|
||||
"offsetFromMaster": 0,
|
||||
"meanPathDelay": 0,
|
||||
"stepsRemoved": 0,
|
||||
"skew": 1.0,
|
||||
},
|
||||
"ptpIntfSummaries": {
|
||||
"Ethernet53": {
|
||||
"interface": "Ethernet53",
|
||||
"ptpIntfVlanSummaries": [
|
||||
{
|
||||
"vlanId": 0,
|
||||
"portState": "psDisabled",
|
||||
"delayMechanism": "e2e",
|
||||
"transportMode": "ipv4",
|
||||
"mpassEnabled": False,
|
||||
"mpassStatus": "active",
|
||||
}
|
||||
],
|
||||
},
|
||||
"Ethernet1": {
|
||||
"interface": "Ethernet1",
|
||||
"ptpIntfVlanSummaries": [
|
||||
{"vlanId": 0, "portState": "psMaster", "delayMechanism": "e2e", "transportMode": "ipv4", "mpassEnabled": False, "mpassStatus": "active"}
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifyPtpPortModeStatus,
|
||||
"eos_data": [{"ptpIntfSummaries": {}}],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["No interfaces are PTP enabled"]},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifyPtpPortModeStatus,
|
||||
"eos_data": [
|
||||
{
|
||||
"ptpMode": "ptpBoundaryClock",
|
||||
"ptpProfile": "ptpDefaultProfile",
|
||||
"ptpClockSummary": {
|
||||
"clockIdentity": "0x00:1c:73:ff:ff:0a:00:01",
|
||||
"gmClockIdentity": "0x00:1c:73:ff:ff:0a:00:01",
|
||||
"numberOfSlavePorts": 0,
|
||||
"numberOfMasterPorts": 4,
|
||||
"offsetFromMaster": 0,
|
||||
"meanPathDelay": 0,
|
||||
"stepsRemoved": 0,
|
||||
"skew": 1.0,
|
||||
},
|
||||
"ptpIntfSummaries": {
|
||||
"Ethernet53": {
|
||||
"interface": "Ethernet53",
|
||||
"ptpIntfVlanSummaries": [
|
||||
{"vlanId": 0, "portState": "none", "delayMechanism": "e2e", "transportMode": "ipv4", "mpassEnabled": False, "mpassStatus": "active"}
|
||||
],
|
||||
},
|
||||
"Ethernet1": {
|
||||
"interface": "Ethernet1",
|
||||
"ptpIntfVlanSummaries": [
|
||||
{"vlanId": 0, "portState": "none", "delayMechanism": "e2e", "transportMode": "ipv4", "mpassEnabled": False, "mpassStatus": "active"}
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["The following interface(s) are not in a valid PTP state: '['Ethernet53', 'Ethernet1']'"]},
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.security.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -16,7 +15,9 @@ from anta.tests.security import (
|
|||
VerifyAPISSLCertificate,
|
||||
VerifyBannerLogin,
|
||||
VerifyBannerMotd,
|
||||
VerifyIPSecConnHealth,
|
||||
VerifyIPv4ACL,
|
||||
VerifySpecificIPSecConn,
|
||||
VerifySSHIPv4Acl,
|
||||
VerifySSHIPv6Acl,
|
||||
VerifySSHStatus,
|
||||
|
@ -107,7 +108,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"unixSocketServer": {"configured": False, "running": False},
|
||||
"sslProfile": {"name": "API_SSL_Profile", "configured": True, "state": "valid"},
|
||||
"tlsProtocol": ["1.2"],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -124,7 +125,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"unixSocketServer": {"configured": False, "running": False},
|
||||
"sslProfile": {"name": "API_SSL_Profile", "configured": True, "state": "valid"},
|
||||
"tlsProtocol": ["1.2"],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["eAPI HTTP server is enabled globally"]},
|
||||
|
@ -141,7 +142,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"unixSocketServer": {"configured": False, "running": False},
|
||||
"sslProfile": {"name": "API_SSL_Profile", "configured": True, "state": "valid"},
|
||||
"tlsProtocol": ["1.2"],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"profile": "API_SSL_Profile"},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -157,7 +158,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"httpsServer": {"configured": True, "running": True, "port": 443},
|
||||
"unixSocketServer": {"configured": False, "running": False},
|
||||
"tlsProtocol": ["1.2"],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"profile": "API_SSL_Profile"},
|
||||
"expected": {"result": "failure", "messages": ["eAPI HTTPS server SSL profile (API_SSL_Profile) is not configured"]},
|
||||
|
@ -174,7 +175,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"unixSocketServer": {"configured": False, "running": False},
|
||||
"sslProfile": {"name": "Wrong_SSL_Profile", "configured": True, "state": "valid"},
|
||||
"tlsProtocol": ["1.2"],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"profile": "API_SSL_Profile"},
|
||||
"expected": {"result": "failure", "messages": ["eAPI HTTPS server SSL profile (API_SSL_Profile) is misconfigured or invalid"]},
|
||||
|
@ -897,4 +898,278 @@ DATA: list[dict[str, Any]] = [
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyIPSecConnHealth,
|
||||
"eos_data": [
|
||||
{
|
||||
"connections": {
|
||||
"default-172.18.3.2-172.18.5.2-srcUnused-0": {
|
||||
"pathDict": {"path9": "Established"},
|
||||
},
|
||||
"default-100.64.3.2-100.64.5.2-srcUnused-0": {
|
||||
"pathDict": {"path10": "Established"},
|
||||
},
|
||||
}
|
||||
}
|
||||
],
|
||||
"inputs": {},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-connection",
|
||||
"test": VerifyIPSecConnHealth,
|
||||
"eos_data": [{"connections": {}}],
|
||||
"inputs": {},
|
||||
"expected": {"result": "failure", "messages": ["No IPv4 security connection configured."]},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-established",
|
||||
"test": VerifyIPSecConnHealth,
|
||||
"eos_data": [
|
||||
{
|
||||
"connections": {
|
||||
"default-172.18.3.2-172.18.5.2-srcUnused-0": {
|
||||
"pathDict": {"path9": "Idle"},
|
||||
"saddr": "172.18.3.2",
|
||||
"daddr": "172.18.2.2",
|
||||
"tunnelNs": "default",
|
||||
},
|
||||
"Guest-100.64.3.2-100.64.5.2-srcUnused-0": {"pathDict": {"path10": "Idle"}, "saddr": "100.64.3.2", "daddr": "100.64.5.2", "tunnelNs": "Guest"},
|
||||
}
|
||||
}
|
||||
],
|
||||
"inputs": {},
|
||||
"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."
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "success-with-connection",
|
||||
"test": VerifySpecificIPSecConn,
|
||||
"eos_data": [
|
||||
{
|
||||
"connections": {
|
||||
"Guest-172.18.3.2-172.18.2.2-srcUnused-0": {
|
||||
"pathDict": {"path9": "Established"},
|
||||
"saddr": "172.18.3.2",
|
||||
"daddr": "172.18.2.2",
|
||||
"tunnelNs": "Guest",
|
||||
},
|
||||
"Guest-100.64.3.2-100.64.2.2-srcUnused-0": {
|
||||
"pathDict": {"path10": "Established"},
|
||||
"saddr": "100.64.3.2",
|
||||
"daddr": "100.64.2.2",
|
||||
"tunnelNs": "Guest",
|
||||
},
|
||||
}
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"ip_security_connections": [
|
||||
{
|
||||
"peer": "10.255.0.1",
|
||||
"vrf": "Guest",
|
||||
"connections": [
|
||||
{"source_address": "100.64.3.2", "destination_address": "100.64.2.2"},
|
||||
{"source_address": "172.18.3.2", "destination_address": "172.18.2.2"},
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "success-without-connection",
|
||||
"test": VerifySpecificIPSecConn,
|
||||
"eos_data": [
|
||||
{
|
||||
"connections": {
|
||||
"default-172.18.3.2-172.18.2.2-srcUnused-0": {
|
||||
"pathDict": {"path9": "Established"},
|
||||
"saddr": "172.18.3.2",
|
||||
"daddr": "172.18.2.2",
|
||||
"tunnelNs": "default",
|
||||
},
|
||||
"default-100.64.3.2-100.64.2.2-srcUnused-0": {"pathDict": {"path10": "Established"}, "saddr": "100.64.3.2", "daddr": "100.64.2.2"},
|
||||
}
|
||||
}
|
||||
],
|
||||
"inputs": {
|
||||
"ip_security_connections": [
|
||||
{
|
||||
"peer": "10.255.0.1",
|
||||
"vrf": "default",
|
||||
},
|
||||
]
|
||||
},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-connection",
|
||||
"test": VerifySpecificIPSecConn,
|
||||
"eos_data": [
|
||||
{"connections": {}},
|
||||
{
|
||||
"connections": {
|
||||
"DATA-172.18.3.2-172.18.2.2-srcUnused-0": {
|
||||
"pathDict": {"path9": "Established"},
|
||||
"saddr": "172.18.3.2",
|
||||
"daddr": "172.18.2.2",
|
||||
"tunnelNs": "DATA",
|
||||
},
|
||||
"DATA-100.64.3.2-100.64.2.2-srcUnused-0": {
|
||||
"pathDict": {"path10": "Established"},
|
||||
"saddr": "100.64.3.2",
|
||||
"daddr": "100.64.2.2",
|
||||
"tunnelNs": "DATA",
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"ip_security_connections": [
|
||||
{
|
||||
"peer": "10.255.0.1",
|
||||
"vrf": "default",
|
||||
},
|
||||
{
|
||||
"peer": "10.255.0.2",
|
||||
"vrf": "DATA",
|
||||
"connections": [
|
||||
{"source_address": "100.64.3.2", "destination_address": "100.64.2.2"},
|
||||
{"source_address": "172.18.3.2", "destination_address": "172.18.2.2"},
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
"expected": {"result": "failure", "messages": ["No IPv4 security connection configured for peer `10.255.0.1`."]},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-established",
|
||||
"test": VerifySpecificIPSecConn,
|
||||
"eos_data": [
|
||||
{
|
||||
"connections": {
|
||||
"default-172.18.3.2-172.18.5.2-srcUnused-0": {
|
||||
"pathDict": {"path9": "Idle"},
|
||||
"saddr": "172.18.3.2",
|
||||
"daddr": "172.18.2.2",
|
||||
"tunnelNs": "default",
|
||||
},
|
||||
"default-100.64.3.2-100.64.5.2-srcUnused-0": {
|
||||
"pathDict": {"path10": "Idle"},
|
||||
"saddr": "100.64.2.2",
|
||||
"daddr": "100.64.1.2",
|
||||
"tunnelNs": "default",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"connections": {
|
||||
"MGMT-172.18.2.2-172.18.1.2-srcUnused-0": {"pathDict": {"path9": "Idle"}, "saddr": "172.18.2.2", "daddr": "172.18.1.2", "tunnelNs": "MGMT"},
|
||||
"MGMT-100.64.2.2-100.64.1.2-srcUnused-0": {"pathDict": {"path10": "Idle"}, "saddr": "100.64.2.2", "daddr": "100.64.1.2", "tunnelNs": "MGMT"},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"ip_security_connections": [
|
||||
{
|
||||
"peer": "10.255.0.1",
|
||||
"vrf": "default",
|
||||
},
|
||||
{
|
||||
"peer": "10.255.0.2",
|
||||
"vrf": "MGMT",
|
||||
"connections": [
|
||||
{"source_address": "100.64.2.2", "destination_address": "100.64.1.2"},
|
||||
{"source_address": "172.18.2.2", "destination_address": "172.18.1.2"},
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"Expected state of IPv4 security connection `source:172.18.3.2 destination:172.18.2.2 vrf:default` for peer `10.255.0.1` is `Established` "
|
||||
"but found `Idle` instead.",
|
||||
"Expected state of IPv4 security connection `source:100.64.2.2 destination:100.64.1.2 vrf:default` for peer `10.255.0.1` is `Established` "
|
||||
"but found `Idle` instead.",
|
||||
"Expected state of IPv4 security connection `source:100.64.2.2 destination:100.64.1.2 vrf:MGMT` for peer `10.255.0.2` is `Established` "
|
||||
"but found `Idle` instead.",
|
||||
"Expected state of IPv4 security connection `source:172.18.2.2 destination:172.18.1.2 vrf:MGMT` for peer `10.255.0.2` is `Established` "
|
||||
"but found `Idle` instead.",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-missing-connection",
|
||||
"test": VerifySpecificIPSecConn,
|
||||
"eos_data": [
|
||||
{
|
||||
"connections": {
|
||||
"default-172.18.3.2-172.18.5.2-srcUnused-0": {
|
||||
"pathDict": {"path9": "Idle"},
|
||||
"saddr": "172.18.3.2",
|
||||
"daddr": "172.18.2.2",
|
||||
"tunnelNs": "default",
|
||||
},
|
||||
"default-100.64.3.2-100.64.5.2-srcUnused-0": {
|
||||
"pathDict": {"path10": "Idle"},
|
||||
"saddr": "100.64.3.2",
|
||||
"daddr": "100.64.2.2",
|
||||
"tunnelNs": "default",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"connections": {
|
||||
"default-172.18.2.2-172.18.1.2-srcUnused-0": {
|
||||
"pathDict": {"path9": "Idle"},
|
||||
"saddr": "172.18.2.2",
|
||||
"daddr": "172.18.1.2",
|
||||
"tunnelNs": "default",
|
||||
},
|
||||
"default-100.64.2.2-100.64.1.2-srcUnused-0": {
|
||||
"pathDict": {"path10": "Idle"},
|
||||
"saddr": "100.64.2.2",
|
||||
"daddr": "100.64.1.2",
|
||||
"tunnelNs": "default",
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"ip_security_connections": [
|
||||
{
|
||||
"peer": "10.255.0.1",
|
||||
"vrf": "default",
|
||||
},
|
||||
{
|
||||
"peer": "10.255.0.2",
|
||||
"vrf": "default",
|
||||
"connections": [
|
||||
{"source_address": "100.64.4.2", "destination_address": "100.64.1.2"},
|
||||
{"source_address": "172.18.4.2", "destination_address": "172.18.1.2"},
|
||||
],
|
||||
},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"Expected state of IPv4 security connection `source:172.18.3.2 destination:172.18.2.2 vrf:default` for peer `10.255.0.1` is `Established` "
|
||||
"but found `Idle` instead.",
|
||||
"Expected state of IPv4 security connection `source:100.64.3.2 destination:100.64.2.2 vrf:default` for peer `10.255.0.1` is `Established` "
|
||||
"but found `Idle` instead.",
|
||||
"IPv4 security connection `source:100.64.4.2 destination:100.64.1.2 vrf:default` for peer `10.255.0.2` is not found.",
|
||||
"IPv4 security connection `source:172.18.4.2 destination:172.18.1.2 vrf:default` for peer `10.255.0.2` is not found.",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.services.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.snmp.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Test inputs for anta.tests.hardware."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -18,7 +19,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"modelName": "vEOS-lab",
|
||||
"internalVersion": "4.27.0F-24305004.4270F",
|
||||
"version": "4.27.0F",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"versions": ["4.27.0F", "4.28.0F"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -31,7 +32,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"modelName": "vEOS-lab",
|
||||
"internalVersion": "4.27.0F-24305004.4270F",
|
||||
"version": "4.27.0F",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"versions": ["4.27.1F"]},
|
||||
"expected": {"result": "failure", "messages": ["device is running version \"4.27.0F\" not in expected versions: ['4.27.1F']"]},
|
||||
|
@ -52,7 +53,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"TerminAttr-core": {"release": "1", "version": "v1.17.0"},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {"versions": ["v1.17.0", "v1.18.1"]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -73,7 +74,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"TerminAttr-core": {"release": "1", "version": "v1.17.0"},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"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']"]},
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.stp.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -84,8 +83,8 @@ DATA: list[dict[str, Any]] = [
|
|||
"interfaces": {
|
||||
"Ethernet10": {"bpduSent": 201, "bpduReceived": 0, "bpduTaggedError": 3, "bpduOtherError": 0, "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']"]},
|
||||
|
@ -145,7 +144,7 @@ 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 fowarding state: [{'VLAN 10': ['Ethernet10']}, {'VLAN 20': ['Ethernet10']}]"],
|
||||
"messages": ["The following VLAN(s) have interface(s) that are not in a forwarding state: [{'VLAN 10': ['Ethernet10']}, {'VLAN 20': ['Ethernet10']}]"],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -162,7 +161,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
},
|
||||
},
|
||||
"VL20": {
|
||||
"rootBridge": {
|
||||
|
@ -172,7 +171,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
},
|
||||
},
|
||||
"VL30": {
|
||||
"rootBridge": {
|
||||
|
@ -182,10 +181,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"priority": 32768, "instances": [10, 20]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -204,7 +203,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
},
|
||||
},
|
||||
"VL20": {
|
||||
"rootBridge": {
|
||||
|
@ -214,7 +213,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
},
|
||||
},
|
||||
"VL30": {
|
||||
"rootBridge": {
|
||||
|
@ -224,10 +223,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"priority": 32768},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -246,10 +245,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"priority": 16384, "instances": [0]},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -268,10 +267,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"priority": 32768, "instances": [0]},
|
||||
"expected": {"result": "failure", "messages": ["Unsupported STP instance type: WRONG0"]},
|
||||
|
@ -297,7 +296,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
},
|
||||
},
|
||||
"VL20": {
|
||||
"rootBridge": {
|
||||
|
@ -307,7 +306,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
},
|
||||
},
|
||||
"VL30": {
|
||||
"rootBridge": {
|
||||
|
@ -317,10 +316,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"helloTime": 2.0,
|
||||
"maxAge": 20,
|
||||
"forwardDelay": 15,
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"priority": 32768, "instances": [10, 20, 30]},
|
||||
"expected": {"result": "failure", "messages": ["The following instance(s) have the wrong STP root priority configured: ['VL20', 'VL30']"]},
|
||||
|
|
176
tests/units/anta_tests/test_stun.py
Normal file
176
tests/units/anta_tests/test_stun.py
Normal file
|
@ -0,0 +1,176 @@
|
|||
# Copyright (c) 2023-2024 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."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from anta.tests.stun import VerifyStunClient
|
||||
from tests.lib.anta import test # noqa: F401; pylint: disable=W0611
|
||||
|
||||
DATA: list[dict[str, Any]] = [
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyStunClient,
|
||||
"eos_data": [
|
||||
{
|
||||
"bindings": {
|
||||
"000000010a64ff0100000000": {
|
||||
"sourceAddress": {"ip": "100.64.3.2", "port": 4500},
|
||||
"publicAddress": {"ip": "192.64.3.2", "port": 6006},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bindings": {
|
||||
"000000040a64ff0100000000": {
|
||||
"sourceAddress": {"ip": "172.18.3.2", "port": 4500},
|
||||
"publicAddress": {"ip": "192.18.3.2", "port": 6006},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bindings": {
|
||||
"000000040a64ff0100000000": {
|
||||
"sourceAddress": {"ip": "172.18.4.2", "port": 4500},
|
||||
"publicAddress": {"ip": "192.18.4.2", "port": 6006},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bindings": {
|
||||
"000000040a64ff0100000000": {
|
||||
"sourceAddress": {"ip": "172.18.6.2", "port": 4500},
|
||||
"publicAddress": {"ip": "192.18.6.2", "port": 6006},
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"stun_clients": [
|
||||
{"source_address": "100.64.3.2", "public_address": "192.64.3.2", "source_port": 4500, "public_port": 6006},
|
||||
{"source_address": "172.18.3.2"},
|
||||
{"source_address": "172.18.4.2", "source_port": 4500, "public_address": "192.18.4.2"},
|
||||
{"source_address": "172.18.6.2", "source_port": 4500, "public_port": 6006},
|
||||
]
|
||||
},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure-incorrect-public-ip",
|
||||
"test": VerifyStunClient,
|
||||
"eos_data": [
|
||||
{
|
||||
"bindings": {
|
||||
"000000010a64ff0100000000": {
|
||||
"sourceAddress": {"ip": "100.64.3.2", "port": 4500},
|
||||
"publicAddress": {"ip": "192.64.3.2", "port": 6006},
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bindings": {
|
||||
"000000040a64ff0100000000": {
|
||||
"sourceAddress": {"ip": "172.18.3.2", "port": 4500},
|
||||
"publicAddress": {"ip": "192.18.3.2", "port": 6006},
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"stun_clients": [
|
||||
{"source_address": "100.64.3.2", "public_address": "192.164.3.2", "source_port": 4500, "public_port": 6006},
|
||||
{"source_address": "172.18.3.2", "public_address": "192.118.3.2", "source_port": 4500, "public_port": 6006},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"For STUN source `100.64.3.2:4500`:\nExpected `192.164.3.2` as the public ip, but found `192.64.3.2` instead.",
|
||||
"For STUN source `172.18.3.2:4500`:\nExpected `192.118.3.2` as the public ip, but found `192.18.3.2` instead.",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-client",
|
||||
"test": VerifyStunClient,
|
||||
"eos_data": [
|
||||
{"bindings": {}},
|
||||
{"bindings": {}},
|
||||
],
|
||||
"inputs": {
|
||||
"stun_clients": [
|
||||
{"source_address": "100.64.3.2", "public_address": "192.164.3.2", "source_port": 4500, "public_port": 6006},
|
||||
{"source_address": "172.18.3.2", "public_address": "192.118.3.2", "source_port": 4500, "public_port": 6006},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": ["STUN client transaction for source `100.64.3.2:4500` is not found.", "STUN client transaction for source `172.18.3.2:4500` is not found."],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-incorrect-public-port",
|
||||
"test": VerifyStunClient,
|
||||
"eos_data": [
|
||||
{"bindings": {}},
|
||||
{
|
||||
"bindings": {
|
||||
"000000040a64ff0100000000": {
|
||||
"sourceAddress": {"ip": "172.18.3.2", "port": 4500},
|
||||
"publicAddress": {"ip": "192.18.3.2", "port": 4800},
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"stun_clients": [
|
||||
{"source_address": "100.64.3.2", "public_address": "192.164.3.2", "source_port": 4500, "public_port": 6006},
|
||||
{"source_address": "172.18.3.2", "public_address": "192.118.3.2", "source_port": 4500, "public_port": 6006},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"STUN client transaction for source `100.64.3.2:4500` is not found.",
|
||||
"For STUN source `172.18.3.2:4500`:\n"
|
||||
"Expected `192.118.3.2` as the public ip, but found `192.18.3.2` instead.\n"
|
||||
"Expected `6006` as the public port, but found `4800` instead.",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-all-type",
|
||||
"test": VerifyStunClient,
|
||||
"eos_data": [
|
||||
{"bindings": {}},
|
||||
{
|
||||
"bindings": {
|
||||
"000000040a64ff0100000000": {
|
||||
"sourceAddress": {"ip": "172.18.3.2", "port": 4500},
|
||||
"publicAddress": {"ip": "192.18.3.2", "port": 4800},
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"stun_clients": [
|
||||
{"source_address": "100.64.3.2", "public_address": "192.164.3.2", "source_port": 4500, "public_port": 6006},
|
||||
{"source_address": "172.18.4.2", "public_address": "192.118.3.2", "source_port": 4800, "public_port": 6006},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"STUN client transaction for source `100.64.3.2:4500` is not found.",
|
||||
"For STUN source `172.18.4.2:4800`:\n"
|
||||
"Expected `172.18.4.2` as the source ip, but found `172.18.3.2` instead.\n"
|
||||
"Expected `4800` as the source port, but found `4500` instead.\n"
|
||||
"Expected `192.118.3.2` as the public ip, but found `192.18.3.2` instead.\n"
|
||||
"Expected `6006` as the public port, but found `4800` instead.",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
|
@ -1,7 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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"""
|
||||
"""Test inputs for anta.tests.system."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -46,10 +47,15 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"resetCauses": [
|
||||
{"recommendedAction": "No action necessary.", "description": "Reload requested by the user.", "timestamp": 1683186892.0, "debugInfoIsDir": False}
|
||||
{
|
||||
"recommendedAction": "No action necessary.",
|
||||
"description": "Reload requested by the user.",
|
||||
"timestamp": 1683186892.0,
|
||||
"debugInfoIsDir": False,
|
||||
},
|
||||
],
|
||||
"full": False,
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -61,10 +67,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{
|
||||
"resetCauses": [
|
||||
{"recommendedAction": "No action necessary.", "description": "Reload after crash.", "timestamp": 1683186892.0, "debugInfoIsDir": False}
|
||||
{"recommendedAction": "No action necessary.", "description": "Reload after crash.", "timestamp": 1683186892.0, "debugInfoIsDir": False},
|
||||
],
|
||||
"full": False,
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Reload cause is: 'Reload after crash.'"]},
|
||||
|
@ -125,7 +131,7 @@ EntityManager::doBackoff waiting for remote sysdb version ....ok
|
|||
===> /var/log/agents/Acl-830 Fri Jul 7 15:07:00 2023 <===
|
||||
===== Output from /usr/bin/Acl [] (PID=830) started Jul 7 15:06:10.871700 ===
|
||||
EntityManager::doBackoff waiting for remote sysdb version ...................ok
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
|
@ -158,9 +164,9 @@ EntityManager::doBackoff waiting for remote sysdb version ...................ok
|
|||
"activeTime": 360,
|
||||
"virtMem": "6644",
|
||||
"sharedMem": "3996",
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -185,9 +191,9 @@ EntityManager::doBackoff waiting for remote sysdb version ...................ok
|
|||
"activeTime": 360,
|
||||
"virtMem": "6644",
|
||||
"sharedMem": "3996",
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Device has reported a high CPU utilization: 75.2%"]},
|
||||
|
@ -203,7 +209,7 @@ EntityManager::doBackoff waiting for remote sysdb version ...................ok
|
|||
"memTotal": 2004568,
|
||||
"memFree": 879004,
|
||||
"version": "4.27.3F",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -219,7 +225,7 @@ EntityManager::doBackoff waiting for remote sysdb version ...................ok
|
|||
"memTotal": 2004568,
|
||||
"memFree": 89004,
|
||||
"version": "4.27.3F",
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Device has reported a high memory usage: 95.56%"]},
|
||||
|
@ -233,7 +239,7 @@ EntityManager::doBackoff waiting for remote sysdb version ...................ok
|
|||
none 294M 78M 217M 27% /
|
||||
none 294M 78M 217M 27% /.overlay
|
||||
/dev/loop0 461M 461M 0 100% /rootfs-i386
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -247,7 +253,7 @@ none 294M 78M 217M 27% /.overlay
|
|||
none 294M 78M 217M 27% /
|
||||
none 294M 78M 217M 84% /.overlay
|
||||
/dev/loop0 461M 461M 0 100% /rootfs-i386
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
|
@ -264,7 +270,7 @@ none 294M 78M 217M 84% /.overlay
|
|||
"eos_data": [
|
||||
"""synchronised
|
||||
poll interval unknown
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -275,7 +281,7 @@ poll interval unknown
|
|||
"eos_data": [
|
||||
"""unsynchronised
|
||||
poll interval unknown
|
||||
"""
|
||||
""",
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["The device is not synchronized with the configured NTP server(s): 'unsynchronised'"]},
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.vlan.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# Copyright (c) 2023-2024 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
|
||||
"""
|
||||
"""Tests for anta.tests.vxlan.py."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -107,7 +106,7 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
},
|
||||
"warnings": [],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
|
@ -172,7 +171,7 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
},
|
||||
"warnings": ["Your configuration contains warnings. This does not mean misconfigurations. But you may wish to re-check your configurations."],
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {
|
||||
|
@ -184,7 +183,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"'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': ''}]}}"
|
||||
"'hasWarning': False, 'detail': ''}, {'name': 'Decap VRF-VNI Map', 'checkPass': True, 'hasWarning': False, 'detail': ''}]}}",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -203,12 +202,12 @@ DATA: list[dict[str, Any]] = [
|
|||
"vxlanIntfs": {
|
||||
"Vxlan1": {
|
||||
"vniBindings": {
|
||||
"10020": {"vlan": 20, "dynamicVlan": False, "source": "static", "interfaces": {"Ethernet31": {"dot1q": 0}, "Vxlan1": {"dot1q": 20}}}
|
||||
"10020": {"vlan": 20, "dynamicVlan": False, "source": "static", "interfaces": {"Ethernet31": {"dot1q": 0}, "Vxlan1": {"dot1q": 20}}},
|
||||
},
|
||||
"vniBindingsToVrf": {"500": {"vrfName": "PROD", "vlan": 1199, "source": "evpn"}},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"bindings": {10020: 20, 500: 1199}},
|
||||
"expected": {"result": "success"},
|
||||
|
@ -221,12 +220,12 @@ DATA: list[dict[str, Any]] = [
|
|||
"vxlanIntfs": {
|
||||
"Vxlan1": {
|
||||
"vniBindings": {
|
||||
"10020": {"vlan": 20, "dynamicVlan": False, "source": "static", "interfaces": {"Ethernet31": {"dot1q": 0}, "Vxlan1": {"dot1q": 20}}}
|
||||
"10020": {"vlan": 20, "dynamicVlan": False, "source": "static", "interfaces": {"Ethernet31": {"dot1q": 0}, "Vxlan1": {"dot1q": 20}}},
|
||||
},
|
||||
"vniBindingsToVrf": {"500": {"vrfName": "PROD", "vlan": 1199, "source": "evpn"}},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"bindings": {10010: 10, 10020: 20, 500: 1199}},
|
||||
"expected": {"result": "failure", "messages": ["The following VNI(s) have no binding: ['10010']"]},
|
||||
|
@ -239,12 +238,12 @@ DATA: list[dict[str, Any]] = [
|
|||
"vxlanIntfs": {
|
||||
"Vxlan1": {
|
||||
"vniBindings": {
|
||||
"10020": {"vlan": 30, "dynamicVlan": False, "source": "static", "interfaces": {"Ethernet31": {"dot1q": 0}, "Vxlan1": {"dot1q": 20}}}
|
||||
"10020": {"vlan": 30, "dynamicVlan": False, "source": "static", "interfaces": {"Ethernet31": {"dot1q": 0}, "Vxlan1": {"dot1q": 20}}},
|
||||
},
|
||||
"vniBindingsToVrf": {"500": {"vrfName": "PROD", "vlan": 1199, "source": "evpn"}},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"bindings": {10020: 20, 500: 1199}},
|
||||
"expected": {"result": "failure", "messages": ["The following VNI(s) have the wrong VLAN binding: [{'10020': 30}]"]},
|
||||
|
@ -257,12 +256,12 @@ DATA: list[dict[str, Any]] = [
|
|||
"vxlanIntfs": {
|
||||
"Vxlan1": {
|
||||
"vniBindings": {
|
||||
"10020": {"vlan": 30, "dynamicVlan": False, "source": "static", "interfaces": {"Ethernet31": {"dot1q": 0}, "Vxlan1": {"dot1q": 20}}}
|
||||
"10020": {"vlan": 30, "dynamicVlan": False, "source": "static", "interfaces": {"Ethernet31": {"dot1q": 0}, "Vxlan1": {"dot1q": 20}}},
|
||||
},
|
||||
"vniBindingsToVrf": {"500": {"vrfName": "PROD", "vlan": 1199, "source": "evpn"}},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"bindings": {10010: 10, 10020: 20, 500: 1199}},
|
||||
"expected": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue