Merging upstream version 0.14.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
082ce481df
commit
2265bd9c67
211 changed files with 12174 additions and 6401 deletions
|
@ -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"]},
|
||||
},
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue