Merging upstream version 1.1.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-05 11:54:55 +01:00
parent 50f8dbf7e8
commit 2044ea6182
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
196 changed files with 10121 additions and 3780 deletions

View file

@ -1,259 +0,0 @@
# 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.
# pylint: skip-file
"""JSON Data for unit tests."""
INVENTORY_MODEL_HOST_VALID = [
{"name": "validIPv4", "input": "1.1.1.1", "expected_result": "valid"},
{
"name": "validIPv6",
"input": "fe80::cc62:a9ff:feef:932a",
},
]
INVENTORY_MODEL_HOST_INVALID = [
{
"name": "invalidIPv4_with_netmask",
"input": "1.1.1.1/32",
},
{
"name": "invalidIPv6_with_netmask",
"input": "fe80::cc62:a9ff:feef:932a/128",
},
{"name": "invalidHost_format", "input": "@", "expected_result": "invalid"},
{
"name": "invalidIPv6_format",
"input": "fe80::cc62:a9ff:feef:",
},
]
INVENTORY_MODEL_HOST_CACHE = [
{"name": "Host cache default", "input": {"host": "1.1.1.1"}, "expected_result": False},
{"name": "Host cache enabled", "input": {"host": "1.1.1.1", "disable_cache": False}, "expected_result": False},
{"name": "Host cache disabled", "input": {"host": "1.1.1.1", "disable_cache": True}, "expected_result": True},
]
INVENTORY_MODEL_NETWORK_VALID = [
{"name": "ValidIPv4_Subnet", "input": "1.1.1.0/24", "expected_result": "valid"},
{"name": "ValidIPv6_Subnet", "input": "2001:db8::/32", "expected_result": "valid"},
]
INVENTORY_MODEL_NETWORK_INVALID = [
{"name": "ValidIPv4_Subnet", "input": "1.1.1.0/17", "expected_result": "invalid"},
{
"name": "InvalidIPv6_Subnet",
"input": "2001:db8::/16",
"expected_result": "invalid",
},
]
INVENTORY_MODEL_NETWORK_CACHE = [
{"name": "Network cache default", "input": {"network": "1.1.1.0/24"}, "expected_result": False},
{"name": "Network cache enabled", "input": {"network": "1.1.1.0/24", "disable_cache": False}, "expected_result": False},
{"name": "Network cache disabled", "input": {"network": "1.1.1.0/24", "disable_cache": True}, "expected_result": True},
]
INVENTORY_MODEL_RANGE_VALID = [
{
"name": "ValidIPv4_Range",
"input": {"start": "10.1.0.1", "end": "10.1.0.10"},
"expected_result": "valid",
},
]
INVENTORY_MODEL_RANGE_INVALID = [
{
"name": "InvalidIPv4_Range_name",
"input": {"start": "toto", "end": "10.1.0.1"},
"expected_result": "invalid",
},
]
INVENTORY_MODEL_RANGE_CACHE = [
{"name": "Range cache default", "input": {"start": "1.1.1.1", "end": "1.1.1.10"}, "expected_result": False},
{"name": "Range cache enabled", "input": {"start": "1.1.1.1", "end": "1.1.1.10", "disable_cache": False}, "expected_result": False},
{"name": "Range cache disabled", "input": {"start": "1.1.1.1", "end": "1.1.1.10", "disable_cache": True}, "expected_result": True},
]
INVENTORY_MODEL_VALID = [
{
"name": "Valid_Host_Only",
"input": {"hosts": [{"host": "192.168.0.17"}, {"host": "192.168.0.2"}]},
"expected_result": "valid",
},
{
"name": "Valid_Networks_Only",
"input": {"networks": [{"network": "192.168.0.0/16"}, {"network": "192.168.1.0/24"}]},
"expected_result": "valid",
},
{
"name": "Valid_Ranges_Only",
"input": {
"ranges": [
{"start": "10.1.0.1", "end": "10.1.0.10"},
{"start": "10.2.0.1", "end": "10.2.1.10"},
],
},
"expected_result": "valid",
},
]
INVENTORY_MODEL_INVALID = [
{
"name": "Host_with_Invalid_entry",
"input": {"hosts": [{"host": "192.168.0.17"}, {"host": "192.168.0.2/32"}]},
"expected_result": "invalid",
},
]
INVENTORY_DEVICE_MODEL_VALID = [
{
"name": "Valid_Inventory",
"input": [{"host": "1.1.1.1", "username": "arista", "password": "arista123!"}, {"host": "1.1.1.2", "username": "arista", "password": "arista123!"}],
"expected_result": "valid",
},
]
INVENTORY_DEVICE_MODEL_INVALID = [
{
"name": "Invalid_Inventory",
"input": [{"host": "1.1.1.1", "password": "arista123!"}, {"host": "1.1.1.1", "username": "arista"}],
"expected_result": "invalid",
},
]
ANTA_INVENTORY_TESTS_VALID = [
{
"name": "ValidInventory_with_host_only",
"input": {"anta_inventory": {"hosts": [{"host": "192.168.0.17"}, {"host": "192.168.0.2"}, {"host": "my.awesome.host.com"}]}},
"expected_result": "valid",
"parameters": {
"ipaddress_in_scope": "192.168.0.17",
"ipaddress_out_of_scope": "192.168.1.1",
"nb_hosts": 2,
},
},
{
"name": "ValidInventory_with_networks_only",
"input": {"anta_inventory": {"networks": [{"network": "192.168.0.0/24"}]}},
"expected_result": "valid",
"parameters": {
"ipaddress_in_scope": "192.168.0.1",
"ipaddress_out_of_scope": "192.168.1.1",
"nb_hosts": 256,
},
},
{
"name": "ValidInventory_with_ranges_only",
"input": {
"anta_inventory": {
"ranges": [
{"start": "10.0.0.1", "end": "10.0.0.11"},
{"start": "10.0.0.101", "end": "10.0.0.111"},
],
},
},
"expected_result": "valid",
"parameters": {
"ipaddress_in_scope": "10.0.0.10",
"ipaddress_out_of_scope": "192.168.1.1",
"nb_hosts": 22,
},
},
{
"name": "ValidInventory_with_host_port",
"input": {"anta_inventory": {"hosts": [{"host": "192.168.0.17", "port": 443}, {"host": "192.168.0.2", "port": 80}]}},
"expected_result": "valid",
"parameters": {
"ipaddress_in_scope": "192.168.0.17",
"ipaddress_out_of_scope": "192.168.1.1",
"nb_hosts": 2,
},
},
{
"name": "ValidInventory_with_host_tags",
"input": {"anta_inventory": {"hosts": [{"host": "192.168.0.17", "tags": ["leaf"]}, {"host": "192.168.0.2", "tags": ["spine"]}]}},
"expected_result": "valid",
"parameters": {
"ipaddress_in_scope": "192.168.0.17",
"ipaddress_out_of_scope": "192.168.1.1",
"nb_hosts": 2,
},
},
{
"name": "ValidInventory_with_networks_tags",
"input": {"anta_inventory": {"networks": [{"network": "192.168.0.0/24", "tags": ["leaf"]}]}},
"expected_result": "valid",
"parameters": {
"ipaddress_in_scope": "192.168.0.1",
"ipaddress_out_of_scope": "192.168.1.1",
"nb_hosts": 256,
},
},
{
"name": "ValidInventory_with_ranges_tags",
"input": {
"anta_inventory": {
"ranges": [
{"start": "10.0.0.1", "end": "10.0.0.11", "tags": ["leaf"]},
{"start": "10.0.0.101", "end": "10.0.0.111", "tags": ["spine"]},
],
},
},
"expected_result": "valid",
"parameters": {
"ipaddress_in_scope": "10.0.0.10",
"ipaddress_out_of_scope": "192.168.1.1",
"nb_hosts": 22,
},
},
]
ANTA_INVENTORY_TESTS_INVALID = [
{
"name": "InvalidInventory_with_host_only",
"input": {"anta_inventory": {"hosts": [{"host": "192.168.0.17/32"}, {"host": "192.168.0.2"}]}},
"expected_result": "invalid",
},
{
"name": "InvalidInventory_wrong_network_bits",
"input": {"anta_inventory": {"networks": [{"network": "192.168.42.0/8"}]}},
"expected_result": "invalid",
},
{
"name": "InvalidInventory_wrong_network",
"input": {"anta_inventory": {"networks": [{"network": "toto"}]}},
"expected_result": "invalid",
},
{
"name": "InvalidInventory_wrong_range",
"input": {"anta_inventory": {"ranges": [{"start": "toto", "end": "192.168.42.42"}]}},
"expected_result": "invalid",
},
{
"name": "InvalidInventory_wrong_range_type_mismatch",
"input": {"anta_inventory": {"ranges": [{"start": "fe80::cafe", "end": "192.168.42.42"}]}},
"expected_result": "invalid",
},
{
"name": "Invalid_Root_Key",
"input": {
"inventory": {
"ranges": [
{"start": "10.0.0.1", "end": "10.0.0.11"},
{"start": "10.0.0.100", "end": "10.0.0.111"},
],
},
},
"expected_result": "invalid",
},
]
TEST_RESULT_SET_STATUS = [
{"name": "set_success", "target": "success", "message": "success"},
{"name": "set_error", "target": "error", "message": "error"},
{"name": "set_failure", "target": "failure", "message": "failure"},
{"name": "set_skipped", "target": "skipped", "message": "skipped"},
{"name": "set_unset", "target": "unset", "message": "unset"},
]

View file

@ -0,0 +1,11 @@
{
"anta.tests.software": [
{
"VerifyEOSVersion": {
"versions": [
"4.31.1F"
]
}
}
]
}

View file

@ -0,0 +1 @@
{aasas"anta.tests.software":[{"VerifyEOSVersion":{"versions":["4.31.1F"]}}]}

View file

@ -3,30 +3,28 @@ anta.tests.system:
- VerifyUptime:
minimum: 10
filters:
tags: ['fabric']
tags: ['spine']
- VerifyUptime:
minimum: 9
filters:
tags: ['leaf']
- VerifyReloadCause:
filters:
tags: ['leaf', 'spine']
tags: ['spine', 'leaf']
- VerifyCoredump:
- VerifyAgentLogs:
- VerifyCPUUtilization:
filters:
tags: ['leaf']
- VerifyMemoryUtilization:
filters:
tags: ['testdevice']
- VerifyFileSystemUtilization:
- VerifyNTP:
anta.tests.mlag:
- VerifyMlagStatus:
filters:
tags: ['leaf']
anta.tests.interfaces:
- VerifyL3MTU:
mtu: 1500
filters:
tags: ['demo']
tags: ['spine']

View file

@ -1,12 +0,0 @@
---
anta_inventory:
hosts:
- name: dummy
host: dummy.anta.ninja
tags: ["leaf"]
- name: dummy2
host: dummy2.anta.ninja
tags: ["leaf"]
- name: dummy3
host: dummy3.anta.ninja
tags: ["spine"]

View file

@ -0,0 +1,12 @@
---
anta_inventory:
hosts:
- name: leaf1
host: leaf1.anta.arista.com
tags: ["leaf"]
- name: leaf2
host: leaf2.anta.arista.com
tags: ["leaf"]
- name: spine1
host: spine1.anta.arista.com
tags: ["spine"]

View file

@ -0,0 +1,79 @@
# ANTA Report
**Table of Contents:**
- [ANTA Report](#anta-report)
- [Test Results Summary](#test-results-summary)
- [Summary Totals](#summary-totals)
- [Summary Totals Device Under Test](#summary-totals-device-under-test)
- [Summary Totals Per Category](#summary-totals-per-category)
- [Test Results](#test-results)
## Test Results Summary
### Summary Totals
| Total Tests | Total Tests Success | Total Tests Skipped | Total Tests Failure | Total Tests Error |
| ----------- | ------------------- | ------------------- | ------------------- | ------------------|
| 30 | 7 | 2 | 19 | 2 |
### Summary Totals Device Under Test
| Device Under Test | Total Tests | Tests Success | Tests Skipped | Tests Failure | Tests Error | Categories Skipped | Categories Failed |
| ------------------| ----------- | ------------- | ------------- | ------------- | ----------- | -------------------| ------------------|
| DC1-SPINE1 | 15 | 2 | 2 | 10 | 1 | MLAG, VXLAN | AAA, BFD, BGP, Connectivity, Routing, SNMP, STP, Services, Software, System |
| DC1-LEAF1A | 15 | 5 | 0 | 9 | 1 | - | AAA, BFD, BGP, Connectivity, SNMP, STP, Services, Software, System |
### Summary Totals Per Category
| Test Category | Total Tests | Tests Success | Tests Skipped | Tests Failure | Tests Error |
| ------------- | ----------- | ------------- | ------------- | ------------- | ----------- |
| AAA | 2 | 0 | 0 | 2 | 0 |
| BFD | 2 | 0 | 0 | 2 | 0 |
| BGP | 2 | 0 | 0 | 2 | 0 |
| Connectivity | 4 | 0 | 0 | 2 | 2 |
| Interfaces | 2 | 2 | 0 | 0 | 0 |
| MLAG | 2 | 1 | 1 | 0 | 0 |
| Routing | 2 | 1 | 0 | 1 | 0 |
| SNMP | 2 | 0 | 0 | 2 | 0 |
| STP | 2 | 0 | 0 | 2 | 0 |
| Security | 2 | 2 | 0 | 0 | 0 |
| Services | 2 | 0 | 0 | 2 | 0 |
| Software | 2 | 0 | 0 | 2 | 0 |
| System | 2 | 0 | 0 | 2 | 0 |
| VXLAN | 2 | 1 | 1 | 0 | 0 |
## Test Results
| Device Under Test | Categories | Test | Description | Custom Field | Result | Messages |
| ----------------- | ---------- | ---- | ----------- | ------------ | ------ | -------- |
| DC1-LEAF1A | BFD | VerifyBFDSpecificPeers | Verifies the IPv4 BFD peer's sessions and remote disc in the specified VRF. | - | failure | Following BFD peers are not configured, status is not up or remote disc is zero: {'192.0.255.8': {'default': 'Not Configured'}, '192.0.255.7': {'default': 'Not Configured'}} |
| DC1-LEAF1A | BGP | VerifyBGPPeerCount | Verifies the count of BGP peers. | - | failure | Failures: [{'afi': 'ipv4', 'safi': 'unicast', 'vrfs': {'PROD': 'Expected: 2, Actual: 1'}}, {'afi': 'ipv4', 'safi': 'multicast', 'vrfs': {'DEV': 'Expected: 3, Actual: 0'}}] |
| DC1-LEAF1A | Software | VerifyEOSVersion | Verifies the EOS version of the device. | - | failure | device is running version "4.31.1F-34554157.4311F (engineering build)" not in expected versions: ['4.25.4M', '4.26.1F'] |
| DC1-LEAF1A | Services | VerifyHostname | Verifies the hostname of a device. | - | failure | Expected 's1-spine1' as the hostname, but found 'DC1-LEAF1A' instead. |
| DC1-LEAF1A | Interfaces | VerifyInterfaceUtilization | Verifies that the utilization of interfaces is below a certain threshold. | - | success | - |
| DC1-LEAF1A | Connectivity | VerifyLLDPNeighbors | Verifies that the provided LLDP neighbors are connected properly. | - | failure | Wrong LLDP neighbor(s) on port(s): Ethernet1 DC1-SPINE1_Ethernet1 Ethernet2 DC1-SPINE2_Ethernet1 Port(s) not configured: Ethernet7 |
| DC1-LEAF1A | MLAG | VerifyMlagStatus | Verifies the health status of the MLAG configuration. | - | success | - |
| DC1-LEAF1A | System | VerifyNTP | Verifies if NTP is synchronised. | - | failure | The device is not synchronized with the configured NTP server(s): 'NTP is disabled.' |
| DC1-LEAF1A | Connectivity | VerifyReachability | Test the network reachability to one or many destination IP(s). | - | error | ping vrf MGMT 1.1.1.1 source Management1 repeat 2 has failed: No source interface Management1 |
| DC1-LEAF1A | Routing | VerifyRoutingTableEntry | Verifies that the provided routes are present in the routing table of a specified VRF. | - | success | - |
| DC1-LEAF1A | STP | VerifySTPMode | Verifies the configured STP mode for a provided list of VLAN(s). | - | failure | Wrong STP mode configured for the following VLAN(s): [10, 20] |
| DC1-LEAF1A | SNMP | VerifySnmpStatus | Verifies if the SNMP agent is enabled. | - | failure | SNMP agent disabled in vrf default |
| DC1-LEAF1A | AAA | VerifyTacacsSourceIntf | Verifies TACACS source-interface for a specified VRF. | - | failure | Source-interface Management0 is not configured in VRF default |
| DC1-LEAF1A | Security | VerifyTelnetStatus | Verifies if Telnet is disabled in the default VRF. | - | success | - |
| DC1-LEAF1A | VXLAN | VerifyVxlan1Interface | Verifies the Vxlan1 interface status. | - | success | - |
| DC1-SPINE1 | BFD | VerifyBFDSpecificPeers | Verifies the IPv4 BFD peer's sessions and remote disc in the specified VRF. | - | failure | Following BFD peers are not configured, status is not up or remote disc is zero: {'192.0.255.8': {'default': 'Not Configured'}, '192.0.255.7': {'default': 'Not Configured'}} |
| DC1-SPINE1 | BGP | VerifyBGPPeerCount | Verifies the count of BGP peers. | - | failure | Failures: [{'afi': 'ipv4', 'safi': 'unicast', 'vrfs': {'PROD': 'Not Configured', 'default': 'Expected: 3, Actual: 4'}}, {'afi': 'ipv4', 'safi': 'multicast', 'vrfs': {'DEV': 'Not Configured'}}, {'afi': 'evpn', 'vrfs': {'default': 'Expected: 2, Actual: 4'}}] |
| DC1-SPINE1 | Software | VerifyEOSVersion | Verifies the EOS version of the device. | - | failure | device is running version "4.31.1F-34554157.4311F (engineering build)" not in expected versions: ['4.25.4M', '4.26.1F'] |
| DC1-SPINE1 | Services | VerifyHostname | Verifies the hostname of a device. | - | failure | Expected 's1-spine1' as the hostname, but found 'DC1-SPINE1' instead. |
| DC1-SPINE1 | Interfaces | VerifyInterfaceUtilization | Verifies that the utilization of interfaces is below a certain threshold. | - | success | - |
| DC1-SPINE1 | Connectivity | VerifyLLDPNeighbors | Verifies that the provided LLDP neighbors are connected properly. | - | failure | Wrong LLDP neighbor(s) on port(s): Ethernet1 DC1-LEAF1A_Ethernet1 Ethernet2 DC1-LEAF1B_Ethernet1 Port(s) not configured: Ethernet7 |
| DC1-SPINE1 | MLAG | VerifyMlagStatus | Verifies the health status of the MLAG configuration. | - | skipped | MLAG is disabled |
| DC1-SPINE1 | System | VerifyNTP | Verifies if NTP is synchronised. | - | failure | The device is not synchronized with the configured NTP server(s): 'NTP is disabled.' |
| DC1-SPINE1 | Connectivity | VerifyReachability | Test the network reachability to one or many destination IP(s). | - | error | ping vrf MGMT 1.1.1.1 source Management1 repeat 2 has failed: No source interface Management1 |
| DC1-SPINE1 | Routing | VerifyRoutingTableEntry | Verifies that the provided routes are present in the routing table of a specified VRF. | - | failure | The following route(s) are missing from the routing table of VRF default: ['10.1.0.2'] |
| DC1-SPINE1 | STP | VerifySTPMode | Verifies the configured STP mode for a provided list of VLAN(s). | - | failure | STP mode 'rapidPvst' not configured for the following VLAN(s): [10, 20] |
| DC1-SPINE1 | SNMP | VerifySnmpStatus | Verifies if the SNMP agent is enabled. | - | failure | SNMP agent disabled in vrf default |
| DC1-SPINE1 | AAA | VerifyTacacsSourceIntf | Verifies TACACS source-interface for a specified VRF. | - | failure | Source-interface Management0 is not configured in VRF default |
| DC1-SPINE1 | Security | VerifyTelnetStatus | Verifies if Telnet is disabled in the default VRF. | - | success | - |
| DC1-SPINE1 | VXLAN | VerifyVxlan1Interface | Verifies the Vxlan1 interface status. | - | skipped | Vxlan1 interface is not configured |

View file

@ -1,16 +0,0 @@
anta_inventory:
hosts:
- host: 10.73.1.238
name: cv_atd1
- host: 192.168.0.10
name: spine1
- host: 192.168.0.11
name: spine2
- host: 192.168.0.12
name: leaf1
- host: 192.168.0.13
name: leaf2
- host: 192.168.0.14
name: leaf3
- host: 192.168.0.15
name: leaf4