Merging upstream version 1.3.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
5b922100c9
commit
8a6a3342fc
337 changed files with 16571 additions and 4891 deletions
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2023-2024 Arista Networks, Inc.
|
||||
# Copyright (c) 2023-2025 Arista Networks, Inc.
|
||||
# Use of this source code is governed by the Apache License 2.0
|
||||
# that can be found in the LICENSE file.
|
||||
"""Test for anta.tests.routing submodule."""
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2023-2024 Arista Networks, Inc.
|
||||
# Copyright (c) 2023-2025 Arista Networks, Inc.
|
||||
# Use of this source code is governed by the Apache License 2.0
|
||||
# that can be found in the LICENSE file.
|
||||
"""Tests for anta.tests.routing.generic.py."""
|
||||
|
@ -11,7 +11,7 @@ from typing import Any
|
|||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from anta.tests.routing.generic import VerifyIPv4RouteType, VerifyRoutingProtocolModel, VerifyRoutingTableEntry, VerifyRoutingTableSize
|
||||
from anta.tests.routing.generic import VerifyIPv4RouteNextHops, VerifyIPv4RouteType, VerifyRoutingProtocolModel, VerifyRoutingTableEntry, VerifyRoutingTableSize
|
||||
from tests.units.anta_tests import test
|
||||
|
||||
DATA: list[dict[str, Any]] = [
|
||||
|
@ -27,14 +27,14 @@ DATA: list[dict[str, Any]] = [
|
|||
"test": VerifyRoutingProtocolModel,
|
||||
"eos_data": [{"vrfs": {"default": {}}, "protoModelStatus": {"configuredProtoModel": "ribd", "operatingProtoModel": "ribd"}}],
|
||||
"inputs": {"model": "multi-agent"},
|
||||
"expected": {"result": "failure", "messages": ["routing model is misconfigured: configured: ribd - operating: ribd - expected: multi-agent"]},
|
||||
"expected": {"result": "failure", "messages": ["Routing model is misconfigured - Expected: multi-agent Actual: ribd"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-mismatch-operating-model",
|
||||
"test": VerifyRoutingProtocolModel,
|
||||
"eos_data": [{"vrfs": {"default": {}}, "protoModelStatus": {"configuredProtoModel": "multi-agent", "operatingProtoModel": "ribd"}}],
|
||||
"inputs": {"model": "multi-agent"},
|
||||
"expected": {"result": "failure", "messages": ["routing model is misconfigured: configured: multi-agent - operating: ribd - expected: multi-agent"]},
|
||||
"expected": {"result": "failure", "messages": ["Routing model is misconfigured - Expected: multi-agent Actual: ribd"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
|
@ -68,7 +68,7 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
],
|
||||
"inputs": {"minimum": 42, "maximum": 666},
|
||||
"expected": {"result": "failure", "messages": ["routing-table has 1000 routes and not between min (42) and maximum (666)"]},
|
||||
"expected": {"result": "failure", "messages": ["Routing table routes are outside the routes range - Expected: 42 <= to >= 666 Actual: 1000"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
|
@ -204,9 +204,20 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"routingDisabled": False,
|
||||
"allRoutesProgrammedHardware": True,
|
||||
"allRoutesProgrammedKernel": True,
|
||||
"defaultRouteState": "notSet",
|
||||
"routes": {},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2"]},
|
||||
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: ['10.1.0.1']"]},
|
||||
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2", "10.1.0.3"]},
|
||||
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: 10.1.0.1, 10.1.0.3"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-wrong-route",
|
||||
|
@ -260,7 +271,7 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
],
|
||||
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2"]},
|
||||
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: ['10.1.0.2']"]},
|
||||
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: 10.1.0.2"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-wrong-route-collect-all",
|
||||
|
@ -302,7 +313,7 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
],
|
||||
"inputs": {"vrf": "default", "routes": ["10.1.0.1", "10.1.0.2"], "collect": "all"},
|
||||
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: ['10.1.0.2']"]},
|
||||
"expected": {"result": "failure", "messages": ["The following route(s) are missing from the routing table of VRF default: 10.1.0.2"]},
|
||||
},
|
||||
{
|
||||
"name": "success-valid-route-type",
|
||||
|
@ -348,6 +359,164 @@ DATA: list[dict[str, Any]] = [
|
|||
"inputs": {"routes_entries": [{"vrf": "default", "prefix": "10.10.0.1/32", "route_type": "eBGP"}]},
|
||||
"expected": {"result": "failure", "messages": ["Prefix: 10.10.0.1/32 VRF: default - VRF not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyIPv4RouteNextHops,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"routes": {
|
||||
"10.10.0.1/32": {
|
||||
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
|
||||
}
|
||||
}
|
||||
},
|
||||
"MGMT": {
|
||||
"routes": {
|
||||
"10.100.0.128/31": {
|
||||
"vias": [
|
||||
{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"},
|
||||
{"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"},
|
||||
{"nexthopAddr": "10.100.0.101", "interface": "Ethernet4"},
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"route_entries": [
|
||||
{"prefix": "10.10.0.1/32", "vrf": "default", "nexthops": ["10.100.0.10", "10.100.0.8"]},
|
||||
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "nexthops": ["10.100.0.8", "10.100.0.10"]},
|
||||
]
|
||||
},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "success-strict-true",
|
||||
"test": VerifyIPv4RouteNextHops,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"routes": {
|
||||
"10.10.0.1/32": {
|
||||
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
|
||||
}
|
||||
}
|
||||
},
|
||||
"MGMT": {
|
||||
"routes": {
|
||||
"10.100.0.128/31": {
|
||||
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"route_entries": [
|
||||
{"prefix": "10.10.0.1/32", "vrf": "default", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
|
||||
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
|
||||
]
|
||||
},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-configured",
|
||||
"test": VerifyIPv4RouteNextHops,
|
||||
"eos_data": [
|
||||
{"vrfs": {"default": {"routes": {}}, "MGMT": {"routes": {}}}},
|
||||
],
|
||||
"inputs": {
|
||||
"route_entries": [
|
||||
{"prefix": "10.10.0.1/32", "vrf": "default", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
|
||||
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": ["Prefix: 10.10.0.1/32 VRF: default - prefix not found", "Prefix: 10.100.0.128/31 VRF: MGMT - prefix not found"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure-strict-failed",
|
||||
"test": VerifyIPv4RouteNextHops,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"routes": {
|
||||
"10.10.0.1/32": {
|
||||
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
|
||||
}
|
||||
}
|
||||
},
|
||||
"MGMT": {
|
||||
"routes": {
|
||||
"10.100.0.128/31": {
|
||||
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.11", "interface": "Ethernet2"}],
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"route_entries": [
|
||||
{"prefix": "10.10.0.1/32", "vrf": "default", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10", "10.100.0.11"]},
|
||||
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "strict": True, "nexthops": ["10.100.0.8", "10.100.0.10"]},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"Prefix: 10.10.0.1/32 VRF: default - List of next-hops not matching - Expected: 10.100.0.10, 10.100.0.11, 10.100.0.8 "
|
||||
"Actual: 10.100.0.10, 10.100.0.8",
|
||||
"Prefix: 10.100.0.128/31 VRF: MGMT - List of next-hops not matching - Expected: 10.100.0.10, 10.100.0.8 Actual: 10.100.0.11, 10.100.0.8",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifyIPv4RouteNextHops,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"routes": {
|
||||
"10.10.0.1/32": {
|
||||
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
|
||||
}
|
||||
}
|
||||
},
|
||||
"MGMT": {
|
||||
"routes": {
|
||||
"10.100.0.128/31": {
|
||||
"vias": [{"nexthopAddr": "10.100.0.8", "interface": "Ethernet1"}, {"nexthopAddr": "10.100.0.10", "interface": "Ethernet2"}],
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"inputs": {
|
||||
"route_entries": [
|
||||
{"prefix": "10.10.0.1/32", "vrf": "default", "nexthops": ["10.100.0.8", "10.100.0.10", "10.100.0.11"]},
|
||||
{"prefix": "10.100.0.128/31", "vrf": "MGMT", "nexthops": ["10.100.0.8", "10.100.0.10", "10.100.0.11"]},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"Prefix: 10.10.0.1/32 VRF: default Nexthop: 10.100.0.11 - Route not found",
|
||||
"Prefix: 10.100.0.128/31 VRF: MGMT Nexthop: 10.100.0.11 - Route not found",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2023-2024 Arista Networks, Inc.
|
||||
# Copyright (c) 2023-2025 Arista Networks, Inc.
|
||||
# Use of this source code is governed by the Apache License 2.0
|
||||
# that can be found in the LICENSE file.
|
||||
"""Tests for anta.tests.routing.ospf.py."""
|
||||
|
@ -122,13 +122,13 @@ DATA: list[dict[str, Any]] = [
|
|||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"Some neighbors are not correctly configured: [{'vrf': 'default', 'instance': '666', 'neighbor': '7.7.7.7', 'state': '2-way'},"
|
||||
" {'vrf': 'BLAH', 'instance': '777', 'neighbor': '8.8.8.8', 'state': 'down'}].",
|
||||
"Instance: 666 VRF: default Interface: 7.7.7.7 - Incorrect adjacency state - Expected: Full Actual: 2-way",
|
||||
"Instance: 777 VRF: BLAH Interface: 8.8.8.8 - Incorrect adjacency state - Expected: Full Actual: down",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "skipped",
|
||||
"name": "skipped-ospf-not-configured",
|
||||
"test": VerifyOSPFNeighborState,
|
||||
"eos_data": [
|
||||
{
|
||||
|
@ -136,7 +136,33 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["no OSPF neighbor found"]},
|
||||
"expected": {"result": "skipped", "messages": ["OSPF not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "skipped-neighbor-not-found",
|
||||
"test": VerifyOSPFNeighborState,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"instList": {
|
||||
"666": {
|
||||
"ospfNeighborEntries": [],
|
||||
},
|
||||
},
|
||||
},
|
||||
"BLAH": {
|
||||
"instList": {
|
||||
"777": {
|
||||
"ospfNeighborEntries": [],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["No OSPF neighbor detected"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
|
@ -193,35 +219,6 @@ DATA: list[dict[str, Any]] = [
|
|||
"inputs": {"number": 3},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure-wrong-number",
|
||||
"test": VerifyOSPFNeighborCount,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"instList": {
|
||||
"666": {
|
||||
"ospfNeighborEntries": [
|
||||
{
|
||||
"routerId": "7.7.7.7",
|
||||
"priority": 1,
|
||||
"drState": "DR",
|
||||
"interfaceName": "Ethernet1",
|
||||
"adjacencyState": "full",
|
||||
"inactivity": 1683298014.844345,
|
||||
"interfaceAddress": "10.3.0.1",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"number": 3},
|
||||
"expected": {"result": "failure", "messages": ["device has 1 neighbors (expected 3)"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-good-number-wrong-state",
|
||||
"test": VerifyOSPFNeighborCount,
|
||||
|
@ -277,14 +274,11 @@ DATA: list[dict[str, Any]] = [
|
|||
"inputs": {"number": 3},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"Some neighbors are not correctly configured: [{'vrf': 'default', 'instance': '666', 'neighbor': '7.7.7.7', 'state': '2-way'},"
|
||||
" {'vrf': 'BLAH', 'instance': '777', 'neighbor': '8.8.8.8', 'state': 'down'}].",
|
||||
],
|
||||
"messages": ["Neighbor count mismatch - Expected: 3 Actual: 1"],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "skipped",
|
||||
"name": "skipped-ospf-not-configured",
|
||||
"test": VerifyOSPFNeighborCount,
|
||||
"eos_data": [
|
||||
{
|
||||
|
@ -292,7 +286,38 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
],
|
||||
"inputs": {"number": 3},
|
||||
"expected": {"result": "skipped", "messages": ["no OSPF neighbor found"]},
|
||||
"expected": {"result": "skipped", "messages": ["OSPF not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "skipped-no-neighbor-detected",
|
||||
"test": VerifyOSPFNeighborCount,
|
||||
"eos_data": [
|
||||
{
|
||||
"vrfs": {
|
||||
"default": {
|
||||
"instList": {
|
||||
"666": {
|
||||
"ospfNeighborEntries": [],
|
||||
},
|
||||
},
|
||||
},
|
||||
"BLAH": {
|
||||
"instList": {
|
||||
"777": {
|
||||
"ospfNeighborEntries": [],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"inputs": {"number": 3},
|
||||
"expected": {
|
||||
"result": "skipped",
|
||||
"messages": [
|
||||
"No OSPF neighbor detected",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
|
@ -394,7 +419,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"inputs": None,
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": ["OSPF Instances ['1', '10'] crossed the maximum LSA threshold."],
|
||||
"messages": [
|
||||
"Instance: 1 - Crossed the maximum LSA threshold - Expected: < 9000 Actual: 11500",
|
||||
"Instance: 10 - Crossed the maximum LSA threshold - Expected: < 750 Actual: 1500",
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -406,6 +434,6 @@ DATA: list[dict[str, Any]] = [
|
|||
},
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "skipped", "messages": ["No OSPF instance found."]},
|
||||
"expected": {"result": "skipped", "messages": ["OSPF not configured"]},
|
||||
},
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue