2025-03-17 07:33:45 +01:00
|
|
|
# Copyright (c) 2023-2025 Arista Networks, Inc.
|
2025-02-05 11:32:35 +01:00
|
|
|
# Use of this source code is governed by the Apache License 2.0
|
|
|
|
# that can be found in the LICENSE file.
|
2025-02-05 11:38:32 +01:00
|
|
|
"""Tests for anta.tests.aaa.py."""
|
|
|
|
|
2025-02-05 11:32:35 +01:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2025-05-15 09:34:27 +02:00
|
|
|
import sys
|
|
|
|
from typing import TYPE_CHECKING
|
2025-02-05 11:32:35 +01:00
|
|
|
|
2025-05-15 09:34:27 +02:00
|
|
|
from anta.models import AntaTest
|
|
|
|
from anta.result_manager.models import AntaTestStatus
|
2025-02-05 11:32:35 +01:00
|
|
|
from anta.tests.aaa import (
|
|
|
|
VerifyAcctConsoleMethods,
|
|
|
|
VerifyAcctDefaultMethods,
|
|
|
|
VerifyAuthenMethods,
|
|
|
|
VerifyAuthzMethods,
|
|
|
|
VerifyTacacsServerGroups,
|
|
|
|
VerifyTacacsServers,
|
|
|
|
VerifyTacacsSourceIntf,
|
|
|
|
)
|
2025-02-05 11:54:23 +01:00
|
|
|
from tests.units.anta_tests import test
|
2025-02-05 11:32:35 +01:00
|
|
|
|
2025-05-15 09:34:27 +02:00
|
|
|
if TYPE_CHECKING:
|
|
|
|
from tests.units.anta_tests import AntaUnitTestDataDict
|
|
|
|
|
|
|
|
DATA: AntaUnitTestDataDict = {
|
|
|
|
(VerifyTacacsSourceIntf, "success"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
|
|
|
"srcIntf": {"MGMT": "Management0"},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsSourceIntf, "failure-not-configured"): {
|
|
|
|
"eos_data": [{"tacacsServers": [], "groups": {}, "srcIntf": {}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsSourceIntf, "failure-wrong-intf"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
|
|
|
"srcIntf": {"MGMT": "Management1"},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - Source interface mismatch - Expected: Management0 Actual: Management1"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsSourceIntf, "failure-wrong-vrf"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
|
|
|
"srcIntf": {"PROD": "Management0"},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsServers, "success"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
|
|
|
"srcIntf": {"MGMT": "Management0"},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsServers, "failure-no-servers"): {
|
|
|
|
"eos_data": [{"tacacsServers": [], "groups": {}, "srcIntf": {}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No TACACS servers are configured"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsServers, "failure-not-configured"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
|
|
|
"srcIntf": {"MGMT": "Management0"},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"servers": ["10.22.10.91", "10.22.10.92"], "vrf": "MGMT"},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS servers 10.22.10.92 are not configured in VRF MGMT"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsServers, "failure-wrong-vrf"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "PROD"}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
|
|
|
"srcIntf": {"MGMT": "Management0"},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS servers 10.22.10.91 are not configured in VRF MGMT"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsServerGroups, "success"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
|
|
|
"srcIntf": {"MGMT": "Management0"},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"groups": ["GROUP1"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsServerGroups, "failure-no-server-groups"): {
|
|
|
|
"eos_data": [{"tacacsServers": [], "groups": {}, "srcIntf": {}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"inputs": {"groups": ["GROUP1"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No TACACS server group(s) are configured"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyTacacsServerGroups, "failure-not-configured"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
2025-02-05 11:32:35 +01:00
|
|
|
"groups": {"GROUP2": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
|
|
|
"srcIntf": {"MGMT": "Management0"},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"groups": ["GROUP1"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS server group(s) GROUP1 are not configured"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAuthenMethods, "success-login-enable"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAuthenMethods, "success-dot1x"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["radius"], "types": ["dot1x"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAuthenMethods, "failure-no-login-console"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authentication methods are not configured for login console"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAuthenMethods, "failure-login-console"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group radius", "local"]}},
|
|
|
|
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authentication methods group tacacs+, local are not matching for login console"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAuthenMethods, "failure-login-default"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"loginAuthenMethods": {"default": {"methods": ["group radius", "local"]}, "login": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authentication methods group tacacs+, local are not matching for login"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAuthzMethods, "success"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAuthzMethods, "success-skipping-exec"): {
|
2025-02-05 11:39:42 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:39:42 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:39:42 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAuthzMethods, "failure-commands"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group radius", "local"]}},
|
|
|
|
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authorization methods group tacacs+, local are not matching for commands"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAuthzMethods, "failure-exec"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}},
|
|
|
|
"execAuthzMethods": {"exec": {"methods": ["group radius", "local"]}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authorization methods group tacacs+, local are not matching for exec"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctDefaultMethods, "success-commands-exec-system"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctDefaultMethods, "success-dot1x"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultAction": "startStop", "defaultMethods": ["group radius", "logging"], "consoleMethods": []}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["radius", "logging"], "types": ["dot1x"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctDefaultMethods, "failure-not-configured"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA default accounting is not configured for commands"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctDefaultMethods, "failure-not-configured-empty"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleMethods": []}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleMethods": []}},
|
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}},
|
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA default accounting is not configured for system, exec, commands"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctDefaultMethods, "failure-not-matching"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultAction": "startStop", "defaultMethods": ["group radius", "logging"], "consoleMethods": []}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}},
|
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA accounting default methods group tacacs+, logging are not matching for commands"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctConsoleMethods, "success-commands-exec-system"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
|
|
|
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
2025-02-05 11:32:35 +01:00
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctConsoleMethods, "success-dot1x"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
|
|
|
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "logging"], "types": ["dot1x"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.SUCCESS},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctConsoleMethods, "failure-not-configured"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
|
|
|
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
2025-02-05 11:32:35 +01:00
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA console accounting is not configured for commands"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctConsoleMethods, "failure-not-configured-empty"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
|
|
|
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleMethods": []}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleMethods": []}},
|
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}},
|
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA console accounting is not configured for system, exec, commands"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
(VerifyAcctConsoleMethods, "failure-not-matching"): {
|
2025-02-05 11:32:35 +01:00
|
|
|
"eos_data": [
|
|
|
|
{
|
2025-05-15 09:34:27 +02:00
|
|
|
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group radius", "logging"]}},
|
|
|
|
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
|
|
|
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
2025-02-05 11:32:35 +01:00
|
|
|
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|
2025-02-05 11:32:35 +01:00
|
|
|
],
|
|
|
|
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
2025-05-15 09:34:27 +02:00
|
|
|
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA accounting console methods group tacacs+, logging are not matching for commands"]},
|
2025-02-05 11:32:35 +01:00
|
|
|
},
|
2025-05-15 09:34:27 +02:00
|
|
|
}
|