Adding upstream version 1.4.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-15 09:34:27 +02:00
parent dc7df702ea
commit 7996c81031
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
166 changed files with 13787 additions and 11959 deletions

View file

@ -5,15 +5,19 @@
from __future__ import annotations
from typing import Any
import sys
from typing import TYPE_CHECKING, Any
from anta.models import AntaTest
from anta.result_manager.models import AntaTestStatus
from anta.tests.avt import VerifyAVTPathHealth, VerifyAVTRole, VerifyAVTSpecificPath
from tests.units.anta_tests import test
DATA: list[dict[str, Any]] = [
{
"name": "success",
"test": VerifyAVTPathHealth,
if TYPE_CHECKING:
from tests.units.anta_tests import AntaUnitTestDataDict
DATA: AntaUnitTestDataDict = {
(VerifyAVTPathHealth, "success"): {
"eos_data": [
{
"vrfs": {
@ -21,18 +25,10 @@ DATA: list[dict[str, Any]] = [
"avts": {
"DATA-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:9": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:1": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:9": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:1": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
}
}
@ -41,12 +37,8 @@ DATA: list[dict[str, Any]] = [
"avts": {
"GUEST-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
}
}
@ -55,28 +47,16 @@ DATA: list[dict[str, Any]] = [
"avts": {
"CONTROL-PLANE-PROFILE": {
"avtPaths": {
"direct:9": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:1": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:9": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:1": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
},
"DEFAULT-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
},
}
@ -85,21 +65,14 @@ DATA: list[dict[str, Any]] = [
}
],
"inputs": {},
"expected": {"result": "success"},
"expected": {"result": AntaTestStatus.SUCCESS},
},
{
"name": "failure-avt-not-configured",
"test": VerifyAVTPathHealth,
(VerifyAVTPathHealth, "failure-avt-not-configured"): {
"eos_data": [{"vrfs": {}}],
"inputs": {},
"expected": {
"result": "failure",
"messages": ["Adaptive virtual topology paths are not configured"],
},
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Adaptive virtual topology paths are not configured"]},
},
{
"name": "failure-not-active-path",
"test": VerifyAVTPathHealth,
(VerifyAVTPathHealth, "failure-not-active-path"): {
"eos_data": [
{
"vrfs": {
@ -107,18 +80,10 @@ DATA: list[dict[str, Any]] = [
"avts": {
"DATA-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:9": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:1": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:9": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:1": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
}
}
@ -127,12 +92,8 @@ DATA: list[dict[str, Any]] = [
"avts": {
"GUEST-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": False},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": False}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
}
}
@ -141,28 +102,16 @@ DATA: list[dict[str, Any]] = [
"avts": {
"CONTROL-PLANE-PROFILE": {
"avtPaths": {
"direct:9": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:1": {
"flags": {"directPath": True, "valid": True, "active": False},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:9": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:1": {"flags": {"directPath": True, "valid": True, "active": False}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
},
"DEFAULT-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": False},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": False}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
},
}
@ -172,7 +121,7 @@ DATA: list[dict[str, Any]] = [
],
"inputs": {},
"expected": {
"result": "failure",
"result": AntaTestStatus.FAILURE,
"messages": [
"VRF: guest Profile: GUEST-AVT-POLICY-DEFAULT AVT path: direct:10 - Not active",
"VRF: default Profile: CONTROL-PLANE-PROFILE AVT path: direct:1 - Not active",
@ -180,9 +129,7 @@ DATA: list[dict[str, Any]] = [
],
},
},
{
"name": "failure-invalid-path",
"test": VerifyAVTPathHealth,
(VerifyAVTPathHealth, "failure-invalid-path"): {
"eos_data": [
{
"vrfs": {
@ -190,18 +137,10 @@ DATA: list[dict[str, Any]] = [
"avts": {
"DATA-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:9": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {
"flags": {"directPath": True, "valid": False, "active": True},
},
"direct:1": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:9": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:10": {"flags": {"directPath": True, "valid": False, "active": True}},
"direct:1": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
}
}
@ -210,12 +149,8 @@ DATA: list[dict[str, Any]] = [
"avts": {
"GUEST-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": False, "active": True},
},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": False, "active": True}},
}
}
}
@ -224,28 +159,16 @@ DATA: list[dict[str, Any]] = [
"avts": {
"CONTROL-PLANE-PROFILE": {
"avtPaths": {
"direct:9": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {
"flags": {"directPath": True, "valid": False, "active": True},
},
"direct:1": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:9": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:10": {"flags": {"directPath": True, "valid": False, "active": True}},
"direct:1": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
},
"DEFAULT-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": False, "active": True},
},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": False, "active": True}},
}
},
}
@ -255,7 +178,7 @@ DATA: list[dict[str, Any]] = [
],
"inputs": {},
"expected": {
"result": "failure",
"result": AntaTestStatus.FAILURE,
"messages": [
"VRF: data Profile: DATA-AVT-POLICY-DEFAULT AVT path: direct:10 - Invalid",
"VRF: guest Profile: GUEST-AVT-POLICY-DEFAULT AVT path: direct:8 - Invalid",
@ -264,9 +187,7 @@ DATA: list[dict[str, Any]] = [
],
},
},
{
"name": "failure-not-active-and-invalid",
"test": VerifyAVTPathHealth,
(VerifyAVTPathHealth, "failure-not-active-and-invalid"): {
"eos_data": [
{
"vrfs": {
@ -274,18 +195,10 @@ DATA: list[dict[str, Any]] = [
"avts": {
"DATA-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:9": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {
"flags": {"directPath": True, "valid": False, "active": False},
},
"direct:1": {
"flags": {"directPath": True, "valid": True, "active": False},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:9": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:10": {"flags": {"directPath": True, "valid": False, "active": False}},
"direct:1": {"flags": {"directPath": True, "valid": True, "active": False}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
}
}
@ -294,12 +207,8 @@ DATA: list[dict[str, Any]] = [
"avts": {
"GUEST-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:10": {
"flags": {"directPath": True, "valid": False, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": False, "active": False},
},
"direct:10": {"flags": {"directPath": True, "valid": False, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": False, "active": False}},
}
}
}
@ -308,28 +217,16 @@ DATA: list[dict[str, Any]] = [
"avts": {
"CONTROL-PLANE-PROFILE": {
"avtPaths": {
"direct:9": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:10": {
"flags": {"directPath": True, "valid": False, "active": False},
},
"direct:1": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:8": {
"flags": {"directPath": True, "valid": True, "active": True},
},
"direct:9": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:10": {"flags": {"directPath": True, "valid": False, "active": False}},
"direct:1": {"flags": {"directPath": True, "valid": True, "active": True}},
"direct:8": {"flags": {"directPath": True, "valid": True, "active": True}},
}
},
"DEFAULT-AVT-POLICY-DEFAULT": {
"avtPaths": {
"direct:10": {
"flags": {"directPath": True, "valid": True, "active": False},
},
"direct:8": {
"flags": {"directPath": True, "valid": False, "active": False},
},
"direct:10": {"flags": {"directPath": True, "valid": True, "active": False}},
"direct:8": {"flags": {"directPath": True, "valid": False, "active": False}},
}
},
}
@ -339,7 +236,7 @@ DATA: list[dict[str, Any]] = [
],
"inputs": {},
"expected": {
"result": "failure",
"result": AntaTestStatus.FAILURE,
"messages": [
"VRF: data Profile: DATA-AVT-POLICY-DEFAULT AVT path: direct:10 - Invalid and not active",
"VRF: data Profile: DATA-AVT-POLICY-DEFAULT AVT path: direct:1 - Not active",
@ -351,9 +248,7 @@ DATA: list[dict[str, Any]] = [
],
},
},
{
"name": "success",
"test": VerifyAVTSpecificPath,
(VerifyAVTSpecificPath, "success"): {
"eos_data": [
{
"vrfs": {
@ -383,7 +278,7 @@ DATA: list[dict[str, Any]] = [
},
}
}
},
}
},
"data": {
"avts": {
@ -415,11 +310,11 @@ DATA: list[dict[str, Any]] = [
"destination": "10.101.255.1",
},
}
},
}
}
},
}
},
}
],
"inputs": {
"avt_paths": [
@ -428,14 +323,10 @@ DATA: list[dict[str, Any]] = [
{"avt_name": "DATA-AVT-POLICY-CONTROL-PLANE", "vrf": "data", "destination": "10.101.255.1", "next_hop": "10.101.255.2"},
]
},
"expected": {"result": "success"},
"expected": {"result": AntaTestStatus.SUCCESS},
},
{
"name": "failure-no-peer",
"test": VerifyAVTSpecificPath,
"eos_data": [
{"vrfs": {}},
],
(VerifyAVTSpecificPath, "failure-no-peer"): {
"eos_data": [{"vrfs": {}}],
"inputs": {
"avt_paths": [
{"avt_name": "MGMT-AVT-POLICY-DEFAULT", "vrf": "default", "destination": "10.101.255.2", "next_hop": "10.101.255.1", "path_type": "multihop"},
@ -443,13 +334,11 @@ DATA: list[dict[str, Any]] = [
]
},
"expected": {
"result": "failure",
"result": AntaTestStatus.FAILURE,
"messages": ["AVT: MGMT-AVT-POLICY-DEFAULT VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.1 - No AVT path configured"],
},
},
{
"name": "failure-path_type_check_true",
"test": VerifyAVTSpecificPath,
(VerifyAVTSpecificPath, "failure-path_type_check_true"): {
"eos_data": [
{
"vrfs": {
@ -469,7 +358,7 @@ DATA: list[dict[str, Any]] = [
},
}
}
},
}
},
"data": {
"avts": {
@ -486,11 +375,11 @@ DATA: list[dict[str, Any]] = [
"destination": "10.101.255.3",
},
}
},
}
}
},
}
},
}
],
"inputs": {
"avt_paths": [
@ -505,16 +394,14 @@ DATA: list[dict[str, Any]] = [
]
},
"expected": {
"result": "failure",
"result": AntaTestStatus.FAILURE,
"messages": [
"AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.11 Path Type: multihop - Path not found",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.21 Path Type: direct - Path not found",
],
},
},
{
"name": "failure-path_type_check_false",
"test": VerifyAVTSpecificPath,
(VerifyAVTSpecificPath, "failure-path_type_check_false"): {
"eos_data": [
{
"vrfs": {
@ -534,7 +421,7 @@ DATA: list[dict[str, Any]] = [
},
}
}
},
}
},
"data": {
"avts": {
@ -551,34 +438,27 @@ DATA: list[dict[str, Any]] = [
"destination": "10.101.255.3",
},
}
},
}
}
},
}
},
}
],
"inputs": {
"avt_paths": [
{
"avt_name": "DEFAULT-AVT-POLICY-CONTROL-PLANE",
"vrf": "default",
"destination": "10.101.255.2",
"next_hop": "10.101.255.11",
},
{"avt_name": "DEFAULT-AVT-POLICY-CONTROL-PLANE", "vrf": "default", "destination": "10.101.255.2", "next_hop": "10.101.255.11"},
{"avt_name": "DATA-AVT-POLICY-CONTROL-PLANE", "vrf": "data", "destination": "10.101.255.1", "next_hop": "10.101.255.21"},
]
},
"expected": {
"result": "failure",
"result": AntaTestStatus.FAILURE,
"messages": [
"AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.11 - Path not found",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.21 - Path not found",
],
},
},
{
"name": "failure-incorrect-path",
"test": VerifyAVTSpecificPath,
(VerifyAVTSpecificPath, "failure-incorrect-path"): {
"eos_data": [
{
"vrfs": {
@ -590,10 +470,10 @@ DATA: list[dict[str, Any]] = [
"flags": {"directPath": False, "valid": False, "active": True},
"nexthopAddr": "10.101.255.1",
"destination": "10.101.255.2",
},
}
}
}
},
}
},
"data": {
"avts": {
@ -625,11 +505,11 @@ DATA: list[dict[str, Any]] = [
"destination": "10.101.255.1",
},
}
},
}
}
},
}
},
}
],
"inputs": {
"avt_paths": [
@ -644,29 +524,21 @@ DATA: list[dict[str, Any]] = [
]
},
"expected": {
"result": "failure",
"result": AntaTestStatus.FAILURE,
"messages": [
"AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.1 - "
"Incorrect path multihop:3 - Valid: False Active: True",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.1 - "
"Incorrect path direct:10 - Valid: False Active: True",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.1 - "
"Incorrect path direct:9 - Valid: True Active: False",
"AVT: DEFAULT-AVT-POLICY-CONTROL-PLANE VRF: default Destination: 10.101.255.2 Next-hop: 10.101.255.1 - Incorrect path multihop:3 - "
"Valid: False Active: True",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.1 - Incorrect path direct:10 - "
"Valid: False Active: True",
"AVT: DATA-AVT-POLICY-CONTROL-PLANE VRF: data Destination: 10.101.255.1 Next-hop: 10.101.255.1 - Incorrect path direct:9 - "
"Valid: True Active: False",
],
},
},
{
"name": "success",
"test": VerifyAVTRole,
"eos_data": [{"role": "edge"}],
"inputs": {"role": "edge"},
"expected": {"result": "success"},
},
{
"name": "failure-incorrect-role",
"test": VerifyAVTRole,
(VerifyAVTRole, "success"): {"eos_data": [{"role": "edge"}], "inputs": {"role": "edge"}, "expected": {"result": AntaTestStatus.SUCCESS}},
(VerifyAVTRole, "failure-incorrect-role"): {
"eos_data": [{"role": "transit"}],
"inputs": {"role": "edge"},
"expected": {"result": "failure", "messages": ["AVT role mismatch - Expected: edge Actual: transit"]},
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AVT role mismatch - Expected: edge Actual: transit"]},
},
]
}