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.
|
||||
"""Data for testing anta.tests.logging."""
|
||||
|
@ -9,6 +9,7 @@ from typing import Any
|
|||
|
||||
from anta.tests.logging import (
|
||||
VerifyLoggingAccounting,
|
||||
VerifyLoggingEntries,
|
||||
VerifyLoggingErrors,
|
||||
VerifyLoggingHostname,
|
||||
VerifyLoggingHosts,
|
||||
|
@ -16,6 +17,7 @@ from anta.tests.logging import (
|
|||
VerifyLoggingPersistent,
|
||||
VerifyLoggingSourceIntf,
|
||||
VerifyLoggingTimestamp,
|
||||
VerifySyslogLogging,
|
||||
)
|
||||
from tests.units.anta_tests import test
|
||||
|
||||
|
@ -96,7 +98,7 @@ DATA: list[dict[str, Any]] = [
|
|||
""",
|
||||
],
|
||||
"inputs": {"interface": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["Source-interface 'Management0' is not configured in VRF MGMT"]},
|
||||
"expected": {"result": "failure", "messages": ["Source-interface: Management0 VRF: MGMT - Not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-vrf",
|
||||
|
@ -111,7 +113,7 @@ DATA: list[dict[str, Any]] = [
|
|||
""",
|
||||
],
|
||||
"inputs": {"interface": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["Source-interface 'Management0' is not configured in VRF MGMT"]},
|
||||
"expected": {"result": "failure", "messages": ["Source-interface: Management0 VRF: MGMT - Not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
|
@ -141,7 +143,7 @@ DATA: list[dict[str, Any]] = [
|
|||
""",
|
||||
],
|
||||
"inputs": {"hosts": ["10.22.10.92", "10.22.10.93", "10.22.10.94"], "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["Syslog servers ['10.22.10.93', '10.22.10.94'] are not configured in VRF MGMT"]},
|
||||
"expected": {"result": "failure", "messages": ["Syslog servers 10.22.10.93, 10.22.10.94 are not configured in VRF MGMT"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-vrf",
|
||||
|
@ -156,7 +158,7 @@ DATA: list[dict[str, Any]] = [
|
|||
""",
|
||||
],
|
||||
"inputs": {"hosts": ["10.22.10.92", "10.22.10.93", "10.22.10.94"], "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["Syslog servers ['10.22.10.93', '10.22.10.94'] are not configured in VRF MGMT"]},
|
||||
"expected": {"result": "failure", "messages": ["Syslog servers 10.22.10.93, 10.22.10.94 are not configured in VRF MGMT"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
|
@ -166,14 +168,14 @@ DATA: list[dict[str, Any]] = [
|
|||
"2023-05-10T13:54:21.463497-05:00 NW-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
|
||||
"Message from arista on command-api (10.22.1.107): ANTA VerifyLoggingLogsGeneration validation\n",
|
||||
],
|
||||
"inputs": None,
|
||||
"inputs": {"severity_level": "informational"},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifyLoggingLogsGeneration,
|
||||
"eos_data": ["", "Log Buffer:\n"],
|
||||
"inputs": None,
|
||||
"inputs": {"severity_level": "notifications"},
|
||||
"expected": {"result": "failure", "messages": ["Logs are not generated"]},
|
||||
},
|
||||
{
|
||||
|
@ -185,7 +187,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"2023-05-10T15:41:44.701810-05:00 NW-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
|
||||
"Message from arista on command-api (10.22.1.107): ANTA VerifyLoggingHostname validation\n",
|
||||
],
|
||||
"inputs": None,
|
||||
"inputs": {"severity_level": "informational"},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
|
@ -194,10 +196,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"eos_data": [
|
||||
{"hostname": "NW-CORE", "fqdn": "NW-CORE.example.org"},
|
||||
"",
|
||||
"2023-05-10T13:54:21.463497-05:00 NW-CORE ConfigAgent: %SYS-6-LOGMSG_INFO: "
|
||||
"2023-05-10T13:54:21.463497-05:00 NW-CORE ConfigAgent: %SYS-6-LOGMSG_NOTICE: "
|
||||
"Message from arista on command-api (10.22.1.107): ANTA VerifyLoggingLogsHostname validation\n",
|
||||
],
|
||||
"inputs": None,
|
||||
"inputs": {"severity_level": "notifications"},
|
||||
"expected": {"result": "failure", "messages": ["Logs are not generated with the device FQDN"]},
|
||||
},
|
||||
{
|
||||
|
@ -210,7 +212,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"2023-05-10T15:42:44.680813-05:00 NW-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
|
||||
"Other log\n",
|
||||
],
|
||||
"inputs": None,
|
||||
"inputs": {"severity_level": "informational"},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
|
@ -223,7 +225,7 @@ DATA: list[dict[str, Any]] = [
|
|||
"2023-05-10T15:42:44.680813+05:00 NW-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
|
||||
"Other log\n",
|
||||
],
|
||||
"inputs": None,
|
||||
"inputs": {"severity_level": "informational"},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
|
@ -231,10 +233,10 @@ DATA: list[dict[str, Any]] = [
|
|||
"test": VerifyLoggingTimestamp,
|
||||
"eos_data": [
|
||||
"",
|
||||
"May 10 13:54:22 NE-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: "
|
||||
"May 10 13:54:22 NE-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_ALERT: "
|
||||
"Message from arista on command-api (10.22.1.107): ANTA VerifyLoggingTimestamp validation\n",
|
||||
],
|
||||
"inputs": None,
|
||||
"inputs": {"severity_level": "alerts"},
|
||||
"expected": {"result": "failure", "messages": ["Logs are not generated with the appropriate timestamp format"]},
|
||||
},
|
||||
{
|
||||
|
@ -242,9 +244,9 @@ DATA: list[dict[str, Any]] = [
|
|||
"test": VerifyLoggingTimestamp,
|
||||
"eos_data": [
|
||||
"",
|
||||
"May 10 13:54:22 NE-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_INFO: Message from arista on command-api (10.22.1.107): BLAH\n",
|
||||
"May 10 13:54:22 NE-CORE.example.org ConfigAgent: %SYS-6-LOGMSG_NOTICE: Message from arista on command-api (10.22.1.107): BLAH\n",
|
||||
],
|
||||
"inputs": None,
|
||||
"inputs": {"severity_level": "notifications"},
|
||||
"expected": {"result": "failure", "messages": ["Logs are not generated with the appropriate timestamp format"]},
|
||||
},
|
||||
{
|
||||
|
@ -277,4 +279,85 @@ DATA: list[dict[str, Any]] = [
|
|||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Device has reported syslog messages with a severity of ERRORS or higher"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifySyslogLogging,
|
||||
"eos_data": [
|
||||
"""Syslog logging: enabled
|
||||
Buffer logging: level debugging
|
||||
|
||||
External configuration:
|
||||
active:
|
||||
inactive:
|
||||
|
||||
Facility Severity Effective Severity
|
||||
-------------------- ------------- ------------------
|
||||
aaa debugging debugging
|
||||
accounting debugging debugging""",
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure",
|
||||
"test": VerifySyslogLogging,
|
||||
"eos_data": [
|
||||
"""Syslog logging: disabled
|
||||
Buffer logging: level debugging
|
||||
Console logging: level errors
|
||||
Persistent logging: disabled
|
||||
Monitor logging: level errors
|
||||
|
||||
External configuration:
|
||||
active:
|
||||
inactive:
|
||||
|
||||
Facility Severity Effective Severity
|
||||
-------------------- ------------- ------------------
|
||||
aaa debugging debugging
|
||||
accounting debugging debugging""",
|
||||
],
|
||||
"inputs": None,
|
||||
"expected": {"result": "failure", "messages": ["Syslog logging is disabled"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyLoggingEntries,
|
||||
"eos_data": [
|
||||
"""Mar 13 04:10:45 s1-leaf1 ProcMgr: %PROCMGR-6-TERMINATE_RUNNING_PROCESS: Terminating deconfigured/reconfigured process 'SystemInitMonitor' (PID=859)
|
||||
Mar 13 04:10:45 s1-leaf1 ProcMgr: %PROCMGR-6-PROCESS_TERMINATED: 'SystemInitMonitor' (PID=859, status=9) has terminated.""",
|
||||
"""Mar 13 04:10:45 s1-leaf1 ProcMgr: %PROCMGR-7-WORKER_WARMSTART_DONE: ProcMgr worker warm start done. (PID=547)""",
|
||||
],
|
||||
"inputs": {
|
||||
"logging_entries": [
|
||||
{"regex_match": ".*PROCMGR-6-PROCESS_TERMINATED:.*", "last_number_messages": 3},
|
||||
{"regex_match": ".*ProcMgr worker warm start.*", "last_number_messages": 2, "severity_level": "debugging"},
|
||||
]
|
||||
},
|
||||
"expected": {"result": "success"},
|
||||
},
|
||||
{
|
||||
"name": "failure-log-str-not-found",
|
||||
"test": VerifyLoggingEntries,
|
||||
"eos_data": [
|
||||
"""Mar 12 04:34:01 s1-leaf1 ProcMgr: %PROCMGR-7-WORKER_WARMSTART_DONE: ProcMgr worker warm start done. (PID=559)
|
||||
Mar 12 04:34:01 s1-leaf1 ProcMgr: %PROCMGR-6-PROCESS_TERMINATED: 'SystemInitMonitor' (PID=867, status=9) has terminated.""",
|
||||
"""Mar 13 03:58:12 s1-leaf1 ConfigAgent: %SYS-5-CONFIG_SESSION_ABORTED: User cvpsystem aborted
|
||||
configuration session capiVerify-612-612b34a2ffbf11ef96ba3a348d538ba0 on TerminAttr (localhost)
|
||||
Mar 13 04:10:45 s1-leaf1 SystemInitMonitor: %SYS-5-SYSTEM_INITIALIZED: System is initialized""",
|
||||
],
|
||||
"inputs": {
|
||||
"logging_entries": [
|
||||
{"regex_match": ".ACCOUNTING-5-EXEC: cvpadmin ssh.", "last_number_messages": 3},
|
||||
{"regex_match": ".*ProcMgr worker warm start.*", "last_number_messages": 10, "severity_level": "debugging"},
|
||||
]
|
||||
},
|
||||
"expected": {
|
||||
"result": "failure",
|
||||
"messages": [
|
||||
"Pattern: .ACCOUNTING-5-EXEC: cvpadmin ssh. - Not found in last 3 informational log entries",
|
||||
"Pattern: .*ProcMgr worker warm start.* - Not found in last 10 debugging log entries",
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue