Merging upstream version 1.4.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
a6f5a146cb
commit
3254dea030
166 changed files with 13787 additions and 11959 deletions
|
@ -5,8 +5,11 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from anta.models import AntaTest
|
||||
from anta.result_manager.models import AntaTestStatus
|
||||
from anta.tests.aaa import (
|
||||
VerifyAcctConsoleMethods,
|
||||
VerifyAcctDefaultMethods,
|
||||
|
@ -18,510 +21,326 @@ from anta.tests.aaa import (
|
|||
)
|
||||
from tests.units.anta_tests import test
|
||||
|
||||
DATA: list[dict[str, Any]] = [
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyTacacsSourceIntf,
|
||||
if TYPE_CHECKING:
|
||||
from tests.units.anta_tests import AntaUnitTestDataDict
|
||||
|
||||
DATA: AntaUnitTestDataDict = {
|
||||
(VerifyTacacsSourceIntf, "success"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
},
|
||||
],
|
||||
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-configured",
|
||||
"test": VerifyTacacsSourceIntf,
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [],
|
||||
"groups": {},
|
||||
"srcIntf": {},
|
||||
},
|
||||
],
|
||||
(VerifyTacacsSourceIntf, "failure-not-configured"): {
|
||||
"eos_data": [{"tacacsServers": [], "groups": {}, "srcIntf": {}}],
|
||||
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-wrong-intf",
|
||||
"test": VerifyTacacsSourceIntf,
|
||||
(VerifyTacacsSourceIntf, "failure-wrong-intf"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
},
|
||||
],
|
||||
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management1"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["VRF: MGMT - Source interface mismatch - Expected: Management0 Actual: Management1"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - Source interface mismatch - Expected: Management0 Actual: Management1"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-wrong-vrf",
|
||||
"test": VerifyTacacsSourceIntf,
|
||||
(VerifyTacacsSourceIntf, "failure-wrong-vrf"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
},
|
||||
],
|
||||
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"PROD": "Management0"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"intf": "Management0", "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyTacacsServers,
|
||||
(VerifyTacacsServers, "success"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
},
|
||||
],
|
||||
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-servers",
|
||||
"test": VerifyTacacsServers,
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [],
|
||||
"groups": {},
|
||||
"srcIntf": {},
|
||||
},
|
||||
],
|
||||
(VerifyTacacsServers, "failure-no-servers"): {
|
||||
"eos_data": [{"tacacsServers": [], "groups": {}, "srcIntf": {}}],
|
||||
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["No TACACS servers are configured"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No TACACS servers are configured"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-configured",
|
||||
"test": VerifyTacacsServers,
|
||||
(VerifyTacacsServers, "failure-not-configured"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
},
|
||||
],
|
||||
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"servers": ["10.22.10.91", "10.22.10.92"], "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["TACACS servers 10.22.10.92 are not configured in VRF MGMT"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS servers 10.22.10.92 are not configured in VRF MGMT"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-wrong-vrf",
|
||||
"test": VerifyTacacsServers,
|
||||
(VerifyTacacsServers, "failure-wrong-vrf"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "PROD"},
|
||||
},
|
||||
],
|
||||
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "PROD"}}],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"},
|
||||
"expected": {"result": "failure", "messages": ["TACACS servers 10.22.10.91 are not configured in VRF MGMT"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS servers 10.22.10.91 are not configured in VRF MGMT"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyTacacsServerGroups,
|
||||
(VerifyTacacsServerGroups, "success"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
},
|
||||
],
|
||||
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
||||
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"groups": ["GROUP1"]},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-server-groups",
|
||||
"test": VerifyTacacsServerGroups,
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [],
|
||||
"groups": {},
|
||||
"srcIntf": {},
|
||||
},
|
||||
],
|
||||
(VerifyTacacsServerGroups, "failure-no-server-groups"): {
|
||||
"eos_data": [{"tacacsServers": [], "groups": {}, "srcIntf": {}}],
|
||||
"inputs": {"groups": ["GROUP1"]},
|
||||
"expected": {"result": "failure", "messages": ["No TACACS server group(s) are configured"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No TACACS server group(s) are configured"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-configured",
|
||||
"test": VerifyTacacsServerGroups,
|
||||
(VerifyTacacsServerGroups, "failure-not-configured"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"tacacsServers": [
|
||||
{
|
||||
"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"},
|
||||
},
|
||||
],
|
||||
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}],
|
||||
"groups": {"GROUP2": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}},
|
||||
"srcIntf": {"MGMT": "Management0"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"groups": ["GROUP1"]},
|
||||
"expected": {"result": "failure", "messages": ["TACACS server group(s) GROUP1 are not configured"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS server group(s) GROUP1 are not configured"]},
|
||||
},
|
||||
{
|
||||
"name": "success-login-enable",
|
||||
"test": VerifyAuthenMethods,
|
||||
(VerifyAuthenMethods, "success-login-enable"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group tacacs+", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "success-dot1x",
|
||||
"test": VerifyAuthenMethods,
|
||||
(VerifyAuthenMethods, "success-dot1x"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group tacacs+", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["radius"], "types": ["dot1x"]},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "failure-no-login-console",
|
||||
"test": VerifyAuthenMethods,
|
||||
(VerifyAuthenMethods, "failure-no-login-console"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authentication methods are not configured for login console"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authentication methods are not configured for login console"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-login-console",
|
||||
"test": VerifyAuthenMethods,
|
||||
(VerifyAuthenMethods, "failure-login-console"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group radius", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authentication methods group tacacs+, local are not matching for login console"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authentication methods group tacacs+, local are not matching for login console"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-login-default",
|
||||
"test": VerifyAuthenMethods,
|
||||
(VerifyAuthenMethods, "failure-login-default"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"loginAuthenMethods": {"default": {"methods": ["group radius", "local"]}, "login": {"methods": ["group tacacs+", "local"]}},
|
||||
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}},
|
||||
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authentication methods group tacacs+, local are not matching for login"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authentication methods group tacacs+, local are not matching for login"]},
|
||||
},
|
||||
{
|
||||
"name": "success",
|
||||
"test": VerifyAuthzMethods,
|
||||
(VerifyAuthzMethods, "success"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}},
|
||||
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "success-skipping-exec",
|
||||
"test": VerifyAuthzMethods,
|
||||
(VerifyAuthzMethods, "success-skipping-exec"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}},
|
||||
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands"]},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "failure-commands",
|
||||
"test": VerifyAuthzMethods,
|
||||
(VerifyAuthzMethods, "failure-commands"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group radius", "local"]}},
|
||||
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authorization methods group tacacs+, local are not matching for commands"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authorization methods group tacacs+, local are not matching for commands"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-exec",
|
||||
"test": VerifyAuthzMethods,
|
||||
(VerifyAuthzMethods, "failure-exec"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}},
|
||||
"execAuthzMethods": {"exec": {"methods": ["group radius", "local"]}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA authorization methods group tacacs+, local are not matching for exec"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authorization methods group tacacs+, local are not matching for exec"]},
|
||||
},
|
||||
{
|
||||
"name": "success-commands-exec-system",
|
||||
"test": VerifyAcctDefaultMethods,
|
||||
(VerifyAcctDefaultMethods, "success-commands-exec-system"): {
|
||||
"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": []}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "success-dot1x",
|
||||
"test": VerifyAcctDefaultMethods,
|
||||
(VerifyAcctDefaultMethods, "success-dot1x"): {
|
||||
"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": []}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["radius", "logging"], "types": ["dot1x"]},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-configured",
|
||||
"test": VerifyAcctDefaultMethods,
|
||||
(VerifyAcctDefaultMethods, "failure-not-configured"): {
|
||||
"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": []}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA default accounting is not configured for commands"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA default accounting is not configured for commands"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-configured-empty",
|
||||
"test": VerifyAcctDefaultMethods,
|
||||
(VerifyAcctDefaultMethods, "failure-not-configured-empty"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA default accounting is not configured for system, exec, commands"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA default accounting is not configured for system, exec, commands"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-matching",
|
||||
"test": VerifyAcctDefaultMethods,
|
||||
(VerifyAcctDefaultMethods, "failure-not-matching"): {
|
||||
"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": []}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA accounting default methods group tacacs+, logging are not matching for commands"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA accounting default methods group tacacs+, logging are not matching for commands"]},
|
||||
},
|
||||
{
|
||||
"name": "success-commands-exec-system",
|
||||
"test": VerifyAcctConsoleMethods,
|
||||
(VerifyAcctConsoleMethods, "success-commands-exec-system"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"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"],
|
||||
},
|
||||
},
|
||||
"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": [], "consoleMethods": []}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "success-dot1x",
|
||||
"test": VerifyAcctConsoleMethods,
|
||||
(VerifyAcctConsoleMethods, "success-dot1x"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"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"],
|
||||
},
|
||||
},
|
||||
},
|
||||
"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"]}},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["dot1x"]},
|
||||
"expected": {"result": "success"},
|
||||
"expected": {"result": AntaTestStatus.SUCCESS},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-configured",
|
||||
"test": VerifyAcctConsoleMethods,
|
||||
(VerifyAcctConsoleMethods, "failure-not-configured"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"commandsAcctMethods": {
|
||||
"privilege0-15": {
|
||||
"defaultMethods": [],
|
||||
"consoleMethods": [],
|
||||
},
|
||||
},
|
||||
"execAcctMethods": {
|
||||
"exec": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
},
|
||||
},
|
||||
"systemAcctMethods": {
|
||||
"system": {
|
||||
"defaultMethods": [],
|
||||
"consoleAction": "startStop",
|
||||
"consoleMethods": ["group tacacs+", "logging"],
|
||||
},
|
||||
},
|
||||
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
||||
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA console accounting is not configured for commands"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA console accounting is not configured for commands"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-configured-empty",
|
||||
"test": VerifyAcctConsoleMethods,
|
||||
(VerifyAcctConsoleMethods, "failure-not-configured-empty"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA console accounting is not configured for system, exec, commands"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA console accounting is not configured for system, exec, commands"]},
|
||||
},
|
||||
{
|
||||
"name": "failure-not-matching",
|
||||
"test": VerifyAcctConsoleMethods,
|
||||
(VerifyAcctConsoleMethods, "failure-not-matching"): {
|
||||
"eos_data": [
|
||||
{
|
||||
"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"],
|
||||
},
|
||||
},
|
||||
"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"]}},
|
||||
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]},
|
||||
"expected": {"result": "failure", "messages": ["AAA accounting console methods group tacacs+, logging are not matching for commands"]},
|
||||
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA accounting console methods group tacacs+, logging are not matching for commands"]},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue