Adding upstream version 1.4.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
dc7df702ea
commit
7996c81031
166 changed files with 13787 additions and 11959 deletions
|
@ -5,101 +5,67 @@
|
|||
|
||||
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.path_selection import VerifyPathsHealth, VerifySpecificPath
|
||||
from tests.units.anta_tests import test
|
||||
|
||||
DATA: list[dict[str, Any]] = [
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyPathsHealth,
|
||||
if TYPE_CHECKING:
|
||||
from tests.units.anta_tests import AntaUnitTestDataDict
|
||||
|
||||
DATA: AntaUnitTestDataDict = {
|
||||
(VerifyPathsHealth, "success"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"dpsPeers": {
|
||||
"10.255.0.1": {
|
||||
"dpsGroups": {
|
||||
"internet": {
|
||||
"dpsPaths": {
|
||||
"path3": {"state": "routeResolved", "dpsSessions": {"0": {"active": True}}},
|
||||
},
|
||||
},
|
||||
"mpls": {
|
||||
"dpsPaths": {
|
||||
"path4": {"state": "ipsecEstablished", "dpsSessions": {"0": {"active": True}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
"internet": {"dpsPaths": {"path3": {"state": "routeResolved", "dpsSessions": {"0": {"active": True}}}}},
|
||||
"mpls": {"dpsPaths": {"path4": {"state": "ipsecEstablished", "dpsSessions": {"0": {"active": True}}}}},
|
||||
}
|
||||
},
|
||||
"10.255.0.2": {
|
||||
"dpsGroups": {
|
||||
"internet": {
|
||||
"dpsPaths": {
|
||||
"path1": {"state": "ipsecEstablished", "dpsSessions": {"0": {"active": True}}},
|
||||
},
|
||||
},
|
||||
"mpls": {
|
||||
"dpsPaths": {
|
||||
"path2": {"state": "routeResolved", "dpsSessions": {"0": {"active": True}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
"internet": {"dpsPaths": {"path1": {"state": "ipsecEstablished", "dpsSessions": {"0": {"active": True}}}}},
|
||||
"mpls": {"dpsPaths": {"path2": {"state": "routeResolved", "dpsSessions": {"0": {"active": True}}}}},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-peer",
|
||||
"test": VerifyPathsHealth,
|
||||
"eos_data": [
|
||||
{"dpsPeers": {}},
|
||||
],
|
||||
(VerifyPathsHealth, "failure-no-peer"): {
|
||||
"eos_data": [{"dpsPeers": {}}],
|
||||
"inputs": {},
|
||||
"expected": {"result": "failure", "messages": ["No path configured for router path-selection"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No path configured for router path-selection"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-established",
|
||||
"test": VerifyPathsHealth,
|
||||
(VerifyPathsHealth, "failure-not-established"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"dpsPeers": {
|
||||
"10.255.0.1": {
|
||||
"dpsGroups": {
|
||||
"internet": {
|
||||
"dpsPaths": {
|
||||
"path3": {"state": "ipsecPending", "dpsSessions": {"0": {"active": False}}},
|
||||
},
|
||||
},
|
||||
"mpls": {
|
||||
"dpsPaths": {
|
||||
"path4": {"state": "ipsecPending", "dpsSessions": {"0": {"active": False}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
"internet": {"dpsPaths": {"path3": {"state": "ipsecPending", "dpsSessions": {"0": {"active": False}}}}},
|
||||
"mpls": {"dpsPaths": {"path4": {"state": "ipsecPending", "dpsSessions": {"0": {"active": False}}}}},
|
||||
}
|
||||
},
|
||||
"10.255.0.2": {
|
||||
"dpsGroups": {
|
||||
"internet": {
|
||||
"dpsPaths": {
|
||||
"path1": {"state": "ipsecEstablished", "dpsSessions": {"0": {"active": True}}},
|
||||
},
|
||||
},
|
||||
"mpls": {
|
||||
"dpsPaths": {
|
||||
"path2": {"state": "ipsecPending", "dpsSessions": {"0": {"active": False}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
"internet": {"dpsPaths": {"path1": {"state": "ipsecEstablished", "dpsSessions": {"0": {"active": True}}}}},
|
||||
"mpls": {"dpsPaths": {"path2": {"state": "ipsecPending", "dpsSessions": {"0": {"active": False}}}}},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"result": AntaTestStatus.FAILURE,
|
||||
"messages": [
|
||||
"Peer: 10.255.0.1 Path Group: internet - Invalid path state - Expected: ipsecEstablished, routeResolved Actual: ipsecPending",
|
||||
"Peer: 10.255.0.1 Path Group: mpls - Invalid path state - Expected: ipsecEstablished, routeResolved Actual: ipsecPending",
|
||||
|
@ -107,46 +73,28 @@ DATA: list[dict[str, Any]] = [
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-inactive",
|
||||
"test": VerifyPathsHealth,
|
||||
(VerifyPathsHealth, "failure-inactive"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"dpsPeers": {
|
||||
"10.255.0.1": {
|
||||
"dpsGroups": {
|
||||
"internet": {
|
||||
"dpsPaths": {
|
||||
"path3": {"state": "routeResolved", "dpsSessions": {"0": {"active": False}}},
|
||||
},
|
||||
},
|
||||
"mpls": {
|
||||
"dpsPaths": {
|
||||
"path4": {"state": "routeResolved", "dpsSessions": {"0": {"active": False}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
"internet": {"dpsPaths": {"path3": {"state": "routeResolved", "dpsSessions": {"0": {"active": False}}}}},
|
||||
"mpls": {"dpsPaths": {"path4": {"state": "routeResolved", "dpsSessions": {"0": {"active": False}}}}},
|
||||
}
|
||||
},
|
||||
"10.255.0.2": {
|
||||
"dpsGroups": {
|
||||
"internet": {
|
||||
"dpsPaths": {
|
||||
"path1": {"state": "routeResolved", "dpsSessions": {"0": {"active": True}}},
|
||||
},
|
||||
},
|
||||
"mpls": {
|
||||
"dpsPaths": {
|
||||
"path2": {"state": "routeResolved", "dpsSessions": {"0": {"active": False}}},
|
||||
},
|
||||
},
|
||||
},
|
||||
"internet": {"dpsPaths": {"path1": {"state": "routeResolved", "dpsSessions": {"0": {"active": True}}}}},
|
||||
"mpls": {"dpsPaths": {"path2": {"state": "routeResolved", "dpsSessions": {"0": {"active": False}}}}},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"result": AntaTestStatus.FAILURE,
|
||||
"messages": [
|
||||
"Peer: 10.255.0.1 Path Group internet - Telemetry state inactive",
|
||||
"Peer: 10.255.0.1 Path Group mpls - Telemetry state inactive",
|
||||
|
@ -154,9 +102,7 @@ DATA: list[dict[str, Any]] = [
|
|||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifySpecificPath,
|
||||
(VerifySpecificPath, "success"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"dpsPeers": {
|
||||
|
@ -200,21 +146,10 @@ DATA: list[dict[str, Any]] = [
|
|||
{"peer": "10.255.0.2", "path_group": "mpls", "source_address": "172.18.13.2", "destination_address": "172.18.15.2"},
|
||||
]
|
||||
},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "failure-expected-path-group-not-found",
|
||||
"test": VerifySpecificPath,
|
||||
"eos_data": [
|
||||
{
|
||||
"dpsPeers": {
|
||||
"10.255.0.2": {
|
||||
"dpsGroups": {"internet": {}},
|
||||
},
|
||||
"10.255.0.1": {"peerName": "", "dpsGroups": {"mpls": {}}},
|
||||
}
|
||||
}
|
||||
],
|
||||
(VerifySpecificPath, "failure-expected-path-group-not-found"): {
|
||||
"eos_data": [{"dpsPeers": {"10.255.0.2": {"dpsGroups": {"internet": {}}}, "10.255.0.1": {"peerName": "", "dpsGroups": {"mpls": {}}}}}],
|
||||
"inputs": {
|
||||
"paths": [
|
||||
{"peer": "10.255.0.1", "path_group": "internet", "source_address": "100.64.3.2", "destination_address": "100.64.1.2"},
|
||||
|
@ -222,30 +157,27 @@ DATA: list[dict[str, Any]] = [
|
|||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"result": AntaTestStatus.FAILURE,
|
||||
"messages": [
|
||||
"Peer: 10.255.0.1 PathGroup: internet Source: 100.64.3.2 Destination: 100.64.1.2 - No DPS path found for this peer and path group",
|
||||
"Peer: 10.255.0.2 PathGroup: mpls Source: 172.18.13.2 Destination: 172.18.15.2 - No DPS path found for this peer and path group",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-router-path-configured",
|
||||
"test": VerifySpecificPath,
|
||||
(VerifySpecificPath, "failure-no-router-path-configured"): {
|
||||
"eos_data": [{"dpsPeers": {}}],
|
||||
"inputs": {"paths": [{"peer": "10.255.0.1", "path_group": "internet", "source_address": "100.64.3.2", "destination_address": "100.64.1.2"}]},
|
||||
"expected": {"result": "failure", "messages": ["Router path-selection not configured"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Router path-selection not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-specific-peer-configured",
|
||||
"test": VerifySpecificPath,
|
||||
(VerifySpecificPath, "failure-no-specific-peer-configured"): {
|
||||
"eos_data": [{"dpsPeers": {"10.255.0.2": {}}}],
|
||||
"inputs": {"paths": [{"peer": "10.255.0.1", "path_group": "internet", "source_address": "172.18.3.2", "destination_address": "172.18.5.2"}]},
|
||||
"expected": {"result": "failure", "messages": ["Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - Peer not found"]},
|
||||
"expected": {
|
||||
"result": AntaTestStatus.FAILURE,
|
||||
"messages": ["Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - Peer not found"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-established",
|
||||
"test": VerifySpecificPath,
|
||||
(VerifySpecificPath, "failure-not-established"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"dpsPeers": {
|
||||
|
@ -285,18 +217,16 @@ DATA: list[dict[str, Any]] = [
|
|||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"result": AntaTestStatus.FAILURE,
|
||||
"messages": [
|
||||
"Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - Invalid state path - Expected: ipsecEstablished, routeResolved "
|
||||
"Actual: ipsecPending",
|
||||
"Peer: 10.255.0.2 PathGroup: mpls Source: 172.18.13.2 Destination: 172.18.15.2 - Invalid state path - Expected: ipsecEstablished, routeResolved "
|
||||
"Actual: ipsecPending",
|
||||
"Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - Invalid state path - "
|
||||
"Expected: ipsecEstablished, routeResolved Actual: ipsecPending",
|
||||
"Peer: 10.255.0.2 PathGroup: mpls Source: 172.18.13.2 Destination: 172.18.15.2 - Invalid state path - "
|
||||
"Expected: ipsecEstablished, routeResolved Actual: ipsecPending",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-inactive",
|
||||
"test": VerifySpecificPath,
|
||||
(VerifySpecificPath, "failure-inactive"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"dpsPeers": {
|
||||
|
@ -333,16 +263,14 @@ DATA: list[dict[str, Any]] = [
|
|||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"result": AntaTestStatus.FAILURE,
|
||||
"messages": [
|
||||
"Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - Telemetry state inactive for this path",
|
||||
"Peer: 10.255.0.2 PathGroup: mpls Source: 172.18.13.2 Destination: 172.18.15.2 - Telemetry state inactive for this path",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-source-destination-not-configured",
|
||||
"test": VerifySpecificPath,
|
||||
(VerifySpecificPath, "failure-source-destination-not-configured"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"dpsPeers": {
|
||||
|
@ -374,11 +302,11 @@ DATA: list[dict[str, Any]] = [
|
|||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"result": AntaTestStatus.FAILURE,
|
||||
"messages": [
|
||||
"Peer: 10.255.0.1 PathGroup: internet Source: 172.18.3.2 Destination: 172.18.5.2 - No path matching the source and destination found",
|
||||
"Peer: 10.255.0.2 PathGroup: mpls Source: 172.18.13.2 Destination: 172.18.15.2 - No path matching the source and destination found",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue