ANTA catalog for logging tests
VerifyLoggingAccounting ¶
Verifies if AAA accounting logs are generated.
Expected Results
- Success: The test will pass if AAA accounting logs are generated.
- Failure: The test will fail if AAA accounting logs are NOT generated.
Examples
anta.tests.logging:
- VerifyLoggingAccounting:
Source code in anta/tests/logging.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 |
|
VerifyLoggingErrors ¶
Verifies there are no syslog messages with a severity of ERRORS or higher.
Expected Results
- Success: The test will pass if there are NO syslog messages with a severity of ERRORS or higher.
- Failure: The test will fail if ERRORS or higher syslog messages are present.
Examples
anta.tests.logging:
- VerifyLoggingErrors:
Source code in anta/tests/logging.py
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
|
VerifyLoggingHostname ¶
Verifies if logs are generated with the device FQDN.
This test performs the following checks:
- Retrieves the device’s configured FQDN
- Sends a test log message at the informational level
- Retrieves the most recent logs (last 30 seconds)
- Verifies that the test message includes the complete FQDN of the device
Warning
EOS logging buffer should be set to severity level informational
or higher for this test to work.
Expected Results
- Success: If logs are generated with the device’s complete FQDN.
- Failure: If any of the following occur:
- The test message is not found in recent logs
- The log message does not include the device’s FQDN
- The FQDN in the log message doesn’t match the configured FQDN
Examples
anta.tests.logging:
- VerifyLoggingHostname:
Source code in anta/tests/logging.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
|
VerifyLoggingHosts ¶
Verifies logging hosts (syslog servers) for a specified VRF.
Expected Results
- Success: The test will pass if the provided syslog servers are configured in the specified VRF.
- Failure: The test will fail if the provided syslog servers are NOT configured in the specified VRF.
Examples
anta.tests.logging:
- VerifyLoggingHosts:
hosts:
- 1.1.1.1
- 2.2.2.2
vrf: default
Inputs¶
Name | Type | Description | Default |
---|---|---|---|
hosts |
list[IPv4Address]
|
List of hosts (syslog servers) IP addresses.
|
- |
vrf |
str
|
The name of the VRF to transport log messages. Defaults to `default`.
|
'default'
|
Source code in anta/tests/logging.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
VerifyLoggingLogsGeneration ¶
Verifies if logs are generated.
This test performs the following checks:
- Sends a test log message at the informational level
- Retrieves the most recent logs (last 30 seconds)
- Verifies that the test message was successfully logged
Warning
EOS logging buffer should be set to severity level informational
or higher for this test to work.
Expected Results
- Success: If logs are being generated and the test message is found in recent logs.
- Failure: If any of the following occur:
- The test message is not found in recent logs
- The logging system is not capturing new messages
- No logs are being generated
Examples
anta.tests.logging:
- VerifyLoggingLogsGeneration:
Source code in anta/tests/logging.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
VerifyLoggingPersistent ¶
Verifies if logging persistent is enabled and logs are saved in flash.
Expected Results
- Success: The test will pass if logging persistent is enabled and logs are in flash.
- Failure: The test will fail if logging persistent is disabled or no logs are saved in flash.
Examples
anta.tests.logging:
- VerifyLoggingPersistent:
Source code in anta/tests/logging.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
VerifyLoggingSourceIntf ¶
Verifies logging source-interface for a specified VRF.
Expected Results
- Success: The test will pass if the provided logging source-interface is configured in the specified VRF.
- Failure: The test will fail if the provided logging source-interface is NOT configured in the specified VRF.
Examples
anta.tests.logging:
- VerifyLoggingSourceIntf:
interface: Management0
vrf: default
Inputs¶
Source code in anta/tests/logging.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
VerifyLoggingTimestamp ¶
Verifies if logs are generated with the appropriate timestamp.
This test performs the following checks:
- Sends a test log message at the informational level
- Retrieves the most recent logs (last 30 seconds)
- Verifies that the test message is present with a high-resolution RFC3339 timestamp format
- Example format:
2024-01-25T15:30:45.123456+00:00
- Includes microsecond precision
- Contains timezone offset
- Example format:
Warning
EOS logging buffer should be set to severity level informational
or higher for this test to work.
Expected Results
- Success: If logs are generated with the correct high-resolution RFC3339 timestamp format.
- Failure: If any of the following occur:
- The test message is not found in recent logs
- The timestamp format does not match the expected RFC3339 format
Examples
anta.tests.logging:
- VerifyLoggingTimestamp:
Source code in anta/tests/logging.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
|
_get_logging_states ¶
_get_logging_states(
logger: logging.Logger, command_output: str
) -> str
Parse show logging
output and gets operational logging states used in the tests in this module.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logger
|
Logger
|
The logger object. |
required |
command_output
|
str
|
The |
required |
Returns:
Type | Description |
---|---|
str
|
The operational logging states. |
Source code in anta/tests/logging.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|