| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
"""Tests for anta.tests.aaa.py.""" |
| 5 |
|
| 6 |
from __future__ import annotations |
| 7 |
|
| 8 |
import sys |
| 9 |
from typing import TYPE_CHECKING |
| 10 |
|
| 11 |
from anta.models import AntaTest |
| 12 |
from anta.result_manager.models import AntaTestStatus |
| 13 |
from anta.tests.aaa import ( |
| 14 |
VerifyAcctConsoleMethods, |
| 15 |
VerifyAcctDefaultMethods, |
| 16 |
VerifyAuthenMethods, |
| 17 |
VerifyAuthzMethods, |
| 18 |
VerifyTacacsServerGroups, |
| 19 |
VerifyTacacsServers, |
| 20 |
VerifyTacacsSourceIntf, |
| 21 |
) |
| 22 |
from tests.units.anta_tests import test |
| 23 |
|
| 24 |
if TYPE_CHECKING: |
| 25 |
from tests.units.anta_tests import AntaUnitTestData |
| 26 |
|
| 27 |
DATA: AntaUnitTestData = { |
| 28 |
(VerifyTacacsSourceIntf, "success"): { |
| 29 |
"eos_data": [ |
| 30 |
{ |
| 31 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}], |
| 32 |
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}}, |
| 33 |
"srcIntf": {"MGMT": "Management0"}, |
| 34 |
} |
| 35 |
], |
| 36 |
"inputs": {"intf": "Management0", "vrf": "MGMT"}, |
| 37 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 38 |
}, |
| 39 |
(VerifyTacacsSourceIntf, "failure-not-configured"): { |
| 40 |
"eos_data": [{"tacacsServers": [], "groups": {}, "srcIntf": {}}], |
| 41 |
"inputs": {"intf": "Management0", "vrf": "MGMT"}, |
| 42 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]}, |
| 43 |
}, |
| 44 |
(VerifyTacacsSourceIntf, "failure-wrong-intf"): { |
| 45 |
"eos_data": [ |
| 46 |
{ |
| 47 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}], |
| 48 |
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}}, |
| 49 |
"srcIntf": {"MGMT": "Management1"}, |
| 50 |
} |
| 51 |
], |
| 52 |
"inputs": {"intf": "Management0", "vrf": "MGMT"}, |
| 53 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT - Source interface mismatch - Expected: Management0 Actual: Management1"]}, |
| 54 |
}, |
| 55 |
(VerifyTacacsSourceIntf, "failure-wrong-vrf"): { |
| 56 |
"eos_data": [ |
| 57 |
{ |
| 58 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}], |
| 59 |
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}}, |
| 60 |
"srcIntf": {"PROD": "Management0"}, |
| 61 |
} |
| 62 |
], |
| 63 |
"inputs": {"intf": "Management0", "vrf": "MGMT"}, |
| 64 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["VRF: MGMT Source Interface: Management0 - Not configured"]}, |
| 65 |
}, |
| 66 |
(VerifyTacacsServers, "success"): { |
| 67 |
"eos_data": [ |
| 68 |
{ |
| 69 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}], |
| 70 |
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}}, |
| 71 |
"srcIntf": {"MGMT": "Management0"}, |
| 72 |
} |
| 73 |
], |
| 74 |
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"}, |
| 75 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 76 |
}, |
| 77 |
(VerifyTacacsServers, "success-default-vrf"): { |
| 78 |
"eos_data": [ |
| 79 |
{ |
| 80 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49}}], |
| 81 |
} |
| 82 |
], |
| 83 |
"inputs": {"servers": ["10.22.10.91"]}, |
| 84 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 85 |
}, |
| 86 |
(VerifyTacacsServers, "failure-no-servers"): { |
| 87 |
"eos_data": [{"tacacsServers": [], "groups": {}, "srcIntf": {}}], |
| 88 |
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"}, |
| 89 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No TACACS servers are configured"]}, |
| 90 |
}, |
| 91 |
(VerifyTacacsServers, "failure-not-configured"): { |
| 92 |
"eos_data": [ |
| 93 |
{ |
| 94 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}], |
| 95 |
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}}, |
| 96 |
"srcIntf": {"MGMT": "Management0"}, |
| 97 |
} |
| 98 |
], |
| 99 |
"inputs": {"servers": ["10.22.10.91", "10.22.10.92"], "vrf": "MGMT"}, |
| 100 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS servers 10.22.10.92 are not configured in VRF MGMT"]}, |
| 101 |
}, |
| 102 |
(VerifyTacacsServers, "failure-wrong-vrf"): { |
| 103 |
"eos_data": [ |
| 104 |
{ |
| 105 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "PROD"}}], |
| 106 |
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}}, |
| 107 |
"srcIntf": {"MGMT": "Management0"}, |
| 108 |
} |
| 109 |
], |
| 110 |
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"}, |
| 111 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS servers 10.22.10.91 are not configured in VRF MGMT"]}, |
| 112 |
}, |
| 113 |
(VerifyTacacsServers, "failure-wrong-vrf-2"): { |
| 114 |
"eos_data": [ |
| 115 |
{ |
| 116 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "PROD"}}], |
| 117 |
} |
| 118 |
], |
| 119 |
"inputs": {"servers": ["10.22.10.91"]}, |
| 120 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS servers 10.22.10.91 are not configured in VRF default"]}, |
| 121 |
}, |
| 122 |
(VerifyTacacsServers, "failure-wrong-vrf-3"): { |
| 123 |
"eos_data": [ |
| 124 |
{ |
| 125 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49}}], |
| 126 |
} |
| 127 |
], |
| 128 |
"inputs": {"servers": ["10.22.10.91"], "vrf": "MGMT"}, |
| 129 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS servers 10.22.10.91 are not configured in VRF MGMT"]}, |
| 130 |
}, |
| 131 |
(VerifyTacacsServerGroups, "success"): { |
| 132 |
"eos_data": [ |
| 133 |
{ |
| 134 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}], |
| 135 |
"groups": {"GROUP1": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}}, |
| 136 |
"srcIntf": {"MGMT": "Management0"}, |
| 137 |
} |
| 138 |
], |
| 139 |
"inputs": {"groups": ["GROUP1"]}, |
| 140 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 141 |
}, |
| 142 |
(VerifyTacacsServerGroups, "failure-no-server-groups"): { |
| 143 |
"eos_data": [{"tacacsServers": [], "groups": {}, "srcIntf": {}}], |
| 144 |
"inputs": {"groups": ["GROUP1"]}, |
| 145 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No TACACS server group(s) are configured"]}, |
| 146 |
}, |
| 147 |
(VerifyTacacsServerGroups, "failure-not-configured"): { |
| 148 |
"eos_data": [ |
| 149 |
{ |
| 150 |
"tacacsServers": [{"serverInfo": {"hostname": "10.22.10.91", "authport": 49, "vrf": "MGMT"}}], |
| 151 |
"groups": {"GROUP2": {"serverGroup": "TACACS+", "members": [{"hostname": "SERVER1", "authport": 49, "vrf": "MGMT"}]}}, |
| 152 |
"srcIntf": {"MGMT": "Management0"}, |
| 153 |
} |
| 154 |
], |
| 155 |
"inputs": {"groups": ["GROUP1"]}, |
| 156 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["TACACS server group(s) GROUP1 are not configured"]}, |
| 157 |
}, |
| 158 |
(VerifyAuthenMethods, "success-login-enable"): { |
| 159 |
"eos_data": [ |
| 160 |
{ |
| 161 |
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group tacacs+", "local"]}}, |
| 162 |
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}}, |
| 163 |
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}}, |
| 164 |
} |
| 165 |
], |
| 166 |
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]}, |
| 167 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 168 |
}, |
| 169 |
(VerifyAuthenMethods, "success-dot1x"): { |
| 170 |
"eos_data": [ |
| 171 |
{ |
| 172 |
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group tacacs+", "local"]}}, |
| 173 |
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}}, |
| 174 |
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}}, |
| 175 |
} |
| 176 |
], |
| 177 |
"inputs": {"methods": ["radius"], "types": ["dot1x"]}, |
| 178 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 179 |
}, |
| 180 |
(VerifyAuthenMethods, "failure-no-login-console"): { |
| 181 |
"eos_data": [ |
| 182 |
{ |
| 183 |
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}}, |
| 184 |
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}}, |
| 185 |
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}}, |
| 186 |
} |
| 187 |
], |
| 188 |
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]}, |
| 189 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authentication methods are not configured for login console"]}, |
| 190 |
}, |
| 191 |
(VerifyAuthenMethods, "failure-login-console"): { |
| 192 |
"eos_data": [ |
| 193 |
{ |
| 194 |
"loginAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}, "login": {"methods": ["group radius", "local"]}}, |
| 195 |
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}}, |
| 196 |
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}}, |
| 197 |
} |
| 198 |
], |
| 199 |
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]}, |
| 200 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authentication methods group tacacs+, local are not matching for login console"]}, |
| 201 |
}, |
| 202 |
(VerifyAuthenMethods, "failure-login-default"): { |
| 203 |
"eos_data": [ |
| 204 |
{ |
| 205 |
"loginAuthenMethods": {"default": {"methods": ["group radius", "local"]}, "login": {"methods": ["group tacacs+", "local"]}}, |
| 206 |
"enableAuthenMethods": {"default": {"methods": ["group tacacs+", "local"]}}, |
| 207 |
"dot1xAuthenMethods": {"default": {"methods": ["group radius"]}}, |
| 208 |
} |
| 209 |
], |
| 210 |
"inputs": {"methods": ["tacacs+", "local"], "types": ["login", "enable"]}, |
| 211 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authentication methods group tacacs+, local are not matching for login"]}, |
| 212 |
}, |
| 213 |
(VerifyAuthzMethods, "success"): { |
| 214 |
"eos_data": [ |
| 215 |
{ |
| 216 |
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}}, |
| 217 |
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}}, |
| 218 |
} |
| 219 |
], |
| 220 |
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]}, |
| 221 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 222 |
}, |
| 223 |
(VerifyAuthzMethods, "success-skipping-exec"): { |
| 224 |
"eos_data": [ |
| 225 |
{ |
| 226 |
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}}, |
| 227 |
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}}, |
| 228 |
} |
| 229 |
], |
| 230 |
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands"]}, |
| 231 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 232 |
}, |
| 233 |
(VerifyAuthzMethods, "failure-commands"): { |
| 234 |
"eos_data": [ |
| 235 |
{ |
| 236 |
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group radius", "local"]}}, |
| 237 |
"execAuthzMethods": {"exec": {"methods": ["group tacacs+", "local"]}}, |
| 238 |
} |
| 239 |
], |
| 240 |
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]}, |
| 241 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authorization methods group tacacs+, local are not matching for commands"]}, |
| 242 |
}, |
| 243 |
(VerifyAuthzMethods, "failure-exec"): { |
| 244 |
"eos_data": [ |
| 245 |
{ |
| 246 |
"commandsAuthzMethods": {"privilege0-15": {"methods": ["group tacacs+", "local"]}}, |
| 247 |
"execAuthzMethods": {"exec": {"methods": ["group radius", "local"]}}, |
| 248 |
} |
| 249 |
], |
| 250 |
"inputs": {"methods": ["tacacs+", "local"], "types": ["commands", "exec"]}, |
| 251 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA authorization methods group tacacs+, local are not matching for exec"]}, |
| 252 |
}, |
| 253 |
(VerifyAcctDefaultMethods, "success-commands-exec-system"): { |
| 254 |
"eos_data": [ |
| 255 |
{ |
| 256 |
"commandsAcctMethods": {"privilege0-15": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 257 |
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 258 |
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 259 |
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}}, |
| 260 |
} |
| 261 |
], |
| 262 |
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]}, |
| 263 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 264 |
}, |
| 265 |
(VerifyAcctDefaultMethods, "success-dot1x"): { |
| 266 |
"eos_data": [ |
| 267 |
{ |
| 268 |
"commandsAcctMethods": {"privilege0-15": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 269 |
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 270 |
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 271 |
"dot1xAcctMethods": {"dot1x": {"defaultAction": "startStop", "defaultMethods": ["group radius", "logging"], "consoleMethods": []}}, |
| 272 |
} |
| 273 |
], |
| 274 |
"inputs": {"methods": ["radius", "logging"], "types": ["dot1x"]}, |
| 275 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 276 |
}, |
| 277 |
(VerifyAcctDefaultMethods, "failure-not-configured"): { |
| 278 |
"eos_data": [ |
| 279 |
{ |
| 280 |
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}}, |
| 281 |
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 282 |
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 283 |
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}}, |
| 284 |
} |
| 285 |
], |
| 286 |
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]}, |
| 287 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA default accounting is not configured for commands"]}, |
| 288 |
}, |
| 289 |
(VerifyAcctDefaultMethods, "failure-not-configured-empty"): { |
| 290 |
"eos_data": [ |
| 291 |
{ |
| 292 |
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleMethods": []}}, |
| 293 |
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleMethods": []}}, |
| 294 |
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}}, |
| 295 |
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}}, |
| 296 |
} |
| 297 |
], |
| 298 |
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]}, |
| 299 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA default accounting is not configured for system, exec, commands"]}, |
| 300 |
}, |
| 301 |
(VerifyAcctDefaultMethods, "failure-not-matching"): { |
| 302 |
"eos_data": [ |
| 303 |
{ |
| 304 |
"commandsAcctMethods": {"privilege0-15": {"defaultAction": "startStop", "defaultMethods": ["group radius", "logging"], "consoleMethods": []}}, |
| 305 |
"execAcctMethods": {"exec": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 306 |
"systemAcctMethods": {"system": {"defaultAction": "startStop", "defaultMethods": ["group tacacs+", "logging"], "consoleMethods": []}}, |
| 307 |
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}}, |
| 308 |
} |
| 309 |
], |
| 310 |
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]}, |
| 311 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA accounting default methods group tacacs+, logging are not matching for commands"]}, |
| 312 |
}, |
| 313 |
(VerifyAcctConsoleMethods, "success-commands-exec-system"): { |
| 314 |
"eos_data": [ |
| 315 |
{ |
| 316 |
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 317 |
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 318 |
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 319 |
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}}, |
| 320 |
} |
| 321 |
], |
| 322 |
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]}, |
| 323 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 324 |
}, |
| 325 |
(VerifyAcctConsoleMethods, "success-dot1x"): { |
| 326 |
"eos_data": [ |
| 327 |
{ |
| 328 |
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 329 |
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 330 |
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 331 |
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 332 |
} |
| 333 |
], |
| 334 |
"inputs": {"methods": ["tacacs+", "logging"], "types": ["dot1x"]}, |
| 335 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 336 |
}, |
| 337 |
(VerifyAcctConsoleMethods, "failure-not-configured"): { |
| 338 |
"eos_data": [ |
| 339 |
{ |
| 340 |
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}}, |
| 341 |
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 342 |
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 343 |
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}}, |
| 344 |
} |
| 345 |
], |
| 346 |
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]}, |
| 347 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA console accounting is not configured for commands"]}, |
| 348 |
}, |
| 349 |
(VerifyAcctConsoleMethods, "failure-not-configured-empty"): { |
| 350 |
"eos_data": [ |
| 351 |
{ |
| 352 |
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleMethods": []}}, |
| 353 |
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleMethods": []}}, |
| 354 |
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleMethods": []}}, |
| 355 |
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}}, |
| 356 |
} |
| 357 |
], |
| 358 |
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]}, |
| 359 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA console accounting is not configured for system, exec, commands"]}, |
| 360 |
}, |
| 361 |
(VerifyAcctConsoleMethods, "failure-not-matching"): { |
| 362 |
"eos_data": [ |
| 363 |
{ |
| 364 |
"commandsAcctMethods": {"privilege0-15": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group radius", "logging"]}}, |
| 365 |
"execAcctMethods": {"exec": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 366 |
"systemAcctMethods": {"system": {"defaultMethods": [], "consoleAction": "startStop", "consoleMethods": ["group tacacs+", "logging"]}}, |
| 367 |
"dot1xAcctMethods": {"dot1x": {"defaultMethods": [], "consoleMethods": []}}, |
| 368 |
} |
| 369 |
], |
| 370 |
"inputs": {"methods": ["tacacs+", "logging"], "types": ["commands", "exec", "system"]}, |
| 371 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["AAA accounting console methods group tacacs+, logging are not matching for commands"]}, |
| 372 |
}, |
| 373 |
} |