| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
"""Test inputs for anta.tests.system.""" |
| 5 |
|
| 6 |
from __future__ import annotations |
| 7 |
|
| 8 |
import sys |
| 9 |
from json import dumps |
| 10 |
from typing import TYPE_CHECKING, Any |
| 11 |
|
| 12 |
from anta.models import AntaTest |
| 13 |
from anta.result_manager.models import AntaTestStatus |
| 14 |
from anta.tests.system import ( |
| 15 |
VerifyAgentLogs, |
| 16 |
VerifyCoredump, |
| 17 |
VerifyCPUUtilization, |
| 18 |
VerifyFilePresence, |
| 19 |
VerifyFileSystemUtilization, |
| 20 |
VerifyFlashUtilization, |
| 21 |
VerifyMaintenance, |
| 22 |
VerifyMemoryUtilization, |
| 23 |
VerifyNTP, |
| 24 |
VerifyNTPAssociations, |
| 25 |
VerifyReloadCause, |
| 26 |
VerifyUptime, |
| 27 |
) |
| 28 |
from tests.units.anta_tests import test |
| 29 |
|
| 30 |
if TYPE_CHECKING: |
| 31 |
from tests.units.anta_tests import AntaUnitTestData |
| 32 |
|
| 33 |
DATA: AntaUnitTestData = { |
| 34 |
(VerifyUptime, "success"): { |
| 35 |
"eos_data": [{"upTime": 1186689.15, "loadAvg": [0.13, 0.12, 0.09], "users": 1, "currentTime": 1683186659.139859}], |
| 36 |
"inputs": {"minimum": 666}, |
| 37 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 38 |
}, |
| 39 |
(VerifyUptime, "failure"): { |
| 40 |
"eos_data": [{"upTime": 665.15, "loadAvg": [0.13, 0.12, 0.09], "users": 1, "currentTime": 1683186659.139859}], |
| 41 |
"inputs": {"minimum": 666}, |
| 42 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Device uptime is incorrect - Expected: 666s Actual: 665.15s"]}, |
| 43 |
}, |
| 44 |
(VerifyReloadCause, "success-no-reload"): { |
| 45 |
"eos_data": [{"kernelCrashData": [], "resetCauses": [], "full": False}], |
| 46 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 47 |
}, |
| 48 |
(VerifyReloadCause, "success"): { |
| 49 |
"eos_data": [ |
| 50 |
{ |
| 51 |
"resetCauses": [ |
| 52 |
{"recommendedAction": "No action necessary.", "description": "Reload requested by the user.", "timestamp": 1683186892.0, "debugInfoIsDir": False} |
| 53 |
], |
| 54 |
"full": False, |
| 55 |
} |
| 56 |
], |
| 57 |
"inputs": {"allowed_causes": ["Reload requested by the user."]}, |
| 58 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 59 |
}, |
| 60 |
(VerifyReloadCause, "success-valid-cause-user"): { |
| 61 |
"eos_data": [ |
| 62 |
{ |
| 63 |
"resetCauses": [ |
| 64 |
{"recommendedAction": "No action necessary.", "description": "Reload requested by the user.", "timestamp": 1683186892.0, "debugInfoIsDir": False} |
| 65 |
], |
| 66 |
"full": False, |
| 67 |
} |
| 68 |
], |
| 69 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 70 |
}, |
| 71 |
(VerifyReloadCause, "success-valid-reload-cause-ztp"): { |
| 72 |
"eos_data": [ |
| 73 |
{ |
| 74 |
"resetCauses": [ |
| 75 |
{ |
| 76 |
"description": "System reloaded due to Zero Touch Provisioning", |
| 77 |
"timestamp": 1729856740.0, |
| 78 |
"recommendedAction": "No action necessary.", |
| 79 |
"debugInfoIsDir": False, |
| 80 |
} |
| 81 |
], |
| 82 |
"full": False, |
| 83 |
} |
| 84 |
], |
| 85 |
"inputs": {"allowed_causes": ["ZTP"]}, |
| 86 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 87 |
}, |
| 88 |
(VerifyReloadCause, "success-valid-reload-cause-fpga"): { |
| 89 |
"eos_data": [ |
| 90 |
{ |
| 91 |
"resetCauses": [ |
| 92 |
{ |
| 93 |
"description": "Reload requested after FPGA upgrade", |
| 94 |
"timestamp": 1729856740.0, |
| 95 |
"recommendedAction": "No action necessary.", |
| 96 |
"debugInfoIsDir": False, |
| 97 |
} |
| 98 |
], |
| 99 |
"full": False, |
| 100 |
} |
| 101 |
], |
| 102 |
"inputs": {"allowed_causes": ["fpga"]}, |
| 103 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 104 |
}, |
| 105 |
(VerifyReloadCause, "success-valid-reload-cause-user-hitless"): { |
| 106 |
"eos_data": [ |
| 107 |
{ |
| 108 |
"resetCauses": [ |
| 109 |
{ |
| 110 |
"description": "Hitless reload requested by the user.", |
| 111 |
"timestamp": 1753717488.0, |
| 112 |
"recommendedAction": "No action necessary.", |
| 113 |
"debugInfoIsDir": False, |
| 114 |
} |
| 115 |
], |
| 116 |
"full": False, |
| 117 |
} |
| 118 |
], |
| 119 |
"inputs": {"allowed_causes": ["USER_HITLESS"]}, |
| 120 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 121 |
}, |
| 122 |
(VerifyReloadCause, "failure-invalid-reload-cause"): { |
| 123 |
"eos_data": [ |
| 124 |
{ |
| 125 |
"resetCauses": [ |
| 126 |
{ |
| 127 |
"description": "Reload requested after FPGA upgrade", |
| 128 |
"timestamp": 1729856740.0, |
| 129 |
"recommendedAction": "No action necessary.", |
| 130 |
"debugInfoIsDir": False, |
| 131 |
} |
| 132 |
], |
| 133 |
"full": False, |
| 134 |
} |
| 135 |
], |
| 136 |
"inputs": {"allowed_causes": ["ZTP"]}, |
| 137 |
"expected": { |
| 138 |
"result": AntaTestStatus.FAILURE, |
| 139 |
"messages": ["Invalid reload cause - Expected: 'System reloaded due to Zero Touch Provisioning' Actual: 'Reload requested after FPGA upgrade'"], |
| 140 |
}, |
| 141 |
}, |
| 142 |
(VerifyReloadCause, "failure"): { |
| 143 |
"eos_data": [ |
| 144 |
{ |
| 145 |
"resetCauses": [ |
| 146 |
{"recommendedAction": "No action necessary.", "description": "Reload after crash.", "timestamp": 1683186892.0, "debugInfoIsDir": False} |
| 147 |
], |
| 148 |
"full": False, |
| 149 |
} |
| 150 |
], |
| 151 |
"expected": { |
| 152 |
"result": AntaTestStatus.FAILURE, |
| 153 |
"messages": ["Invalid reload cause - Expected: 'Reload requested by the user.', 'Reload requested after FPGA upgrade' Actual: 'Reload after crash.'"], |
| 154 |
}, |
| 155 |
}, |
| 156 |
(VerifyReloadCause, "failed"): { |
| 157 |
"eos_data": [ |
| 158 |
{ |
| 159 |
"resetCauses": [ |
| 160 |
{"recommendedAction": "No action necessary.", "description": "Reload after crash.", "timestamp": 1683186892.0, "debugInfoIsDir": False} |
| 161 |
], |
| 162 |
"full": False, |
| 163 |
} |
| 164 |
], |
| 165 |
"inputs": {"allowed_causes": ["Reload requested by the user."]}, |
| 166 |
"expected": { |
| 167 |
"result": AntaTestStatus.FAILURE, |
| 168 |
"messages": ["Invalid reload cause - Expected: 'Reload requested by the user.' Actual: 'Reload after crash.'"], |
| 169 |
}, |
| 170 |
}, |
| 171 |
(VerifyCoredump, "success-without-minidump"): { |
| 172 |
"eos_data": [{"mode": "compressedDeferred", "coreFiles": []}], |
| 173 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 174 |
}, |
| 175 |
(VerifyCoredump, "success-with-minidump"): { |
| 176 |
"eos_data": [{"mode": "compressedDeferred", "coreFiles": ["minidump"]}], |
| 177 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 178 |
}, |
| 179 |
(VerifyCoredump, "failure-without-minidump"): { |
| 180 |
"eos_data": [{"mode": "compressedDeferred", "coreFiles": ["core.2344.1584483862.Mlag.gz", "core.23101.1584483867.Mlag.gz"]}], |
| 181 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Core dump(s) have been found: core.2344.1584483862.Mlag.gz, core.23101.1584483867.Mlag.gz"]}, |
| 182 |
}, |
| 183 |
(VerifyCoredump, "failure-with-minidump"): { |
| 184 |
"eos_data": [{"mode": "compressedDeferred", "coreFiles": ["minidump", "core.2344.1584483862.Mlag.gz", "core.23101.1584483867.Mlag.gz"]}], |
| 185 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Core dump(s) have been found: core.2344.1584483862.Mlag.gz, core.23101.1584483867.Mlag.gz"]}, |
| 186 |
}, |
| 187 |
(VerifyAgentLogs, "success"): {"eos_data": [""], "expected": {"result": AntaTestStatus.SUCCESS}}, |
| 188 |
(VerifyAgentLogs, "failure"): { |
| 189 |
"eos_data": [ |
| 190 |
"===> /var/log/agents/Test-666 Thu May 4 09:57:02 2023 <===\nCLI Exception: Exception\nCLI Exception: Backtrace\n===> /var/log/agents/Aaa-855" |
| 191 |
" Fri Jul 7 15:07:00 2023 <===\n===== Output from /usr/bin/Aaa [] (PID=855) started Jul 7 15:06:11.606414 ===\n" |
| 192 |
"EntityManager::doBackoff waiting for remote sysdb version ....ok\n\n===> /var/log/agents/Acl-830" |
| 193 |
" Fri Jul 7 15:07:00 2023 <===\n===== Output from /usr/bin/Acl [] (PID=830) started Jul 7 15:06:10.871700 ===\n" |
| 194 |
"EntityManager::doBackoff waiting for remote sysdb version ...................ok\n" |
| 195 |
], |
| 196 |
"expected": { |
| 197 |
"result": AntaTestStatus.FAILURE, |
| 198 |
"messages": [ |
| 199 |
"Device has reported agent crashes:\n * /var/log/agents/Test-666 Thu May 4 09:57:02 2023\n" |
| 200 |
" * /var/log/agents/Aaa-855 Fri Jul 7 15:07:00 2023\n * /var/log/agents/Acl-830 Fri Jul 7 15:07:00 2023" |
| 201 |
], |
| 202 |
}, |
| 203 |
}, |
| 204 |
(VerifyCPUUtilization, "success"): { |
| 205 |
"eos_data": [ |
| 206 |
{ |
| 207 |
"timeInfo": {"loadAvg": [5.82, 4.52, 4.07]}, |
| 208 |
"cpuInfo": {"%Cpu(s)": {"user": 69.8, "system": 25.4, "nice": 0.0, "idle": 60.4}}, |
| 209 |
"memInfo": {}, |
| 210 |
"processes": {}, |
| 211 |
} |
| 212 |
], |
| 213 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 214 |
}, |
| 215 |
(VerifyCPUUtilization, "success-custom-threshold"): { |
| 216 |
"eos_data": [ |
| 217 |
{ |
| 218 |
"timeInfo": {"loadAvg": [5.82, 4.52, 4.07]}, |
| 219 |
"cpuInfo": {"%Cpu(s)": {"user": 50.0, "system": 25.0, "nice": 0.0, "idle": 40.0}}, |
| 220 |
"memInfo": {}, |
| 221 |
"processes": {}, |
| 222 |
} |
| 223 |
], |
| 224 |
"inputs": {"threshold": 70.0}, |
| 225 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 226 |
}, |
| 227 |
(VerifyCPUUtilization, "success-load-avg-period-1"): { |
| 228 |
"eos_data": [ |
| 229 |
{ |
| 230 |
"timeInfo": {"loadAvg": [4.0, 3.5, 2.8]}, |
| 231 |
"cpuInfo": {"%Cpu(s)": {"user": 25.0, "system": 5.0, "nice": 0.0, "idle": 70.0}}, |
| 232 |
"memInfo": {}, |
| 233 |
"processes": {}, |
| 234 |
}, |
| 235 |
"8\n", |
| 236 |
], |
| 237 |
"inputs": {"period": 1}, |
| 238 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 239 |
}, |
| 240 |
(VerifyCPUUtilization, "success-load-avg-period-5"): { |
| 241 |
"eos_data": [ |
| 242 |
{ |
| 243 |
"timeInfo": {"loadAvg": [5.82, 3.0, 2.5]}, |
| 244 |
"cpuInfo": {"%Cpu(s)": {"user": 25.0, "system": 5.0, "nice": 0.0, "idle": 70.0}}, |
| 245 |
"memInfo": {}, |
| 246 |
"processes": {}, |
| 247 |
}, |
| 248 |
"4\n", |
| 249 |
], |
| 250 |
"inputs": {"period": 5}, |
| 251 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 252 |
}, |
| 253 |
(VerifyCPUUtilization, "success-load-avg-period-15"): { |
| 254 |
"eos_data": [ |
| 255 |
{ |
| 256 |
"timeInfo": {"loadAvg": [5.82, 4.52, 2.0]}, |
| 257 |
"cpuInfo": {"%Cpu(s)": {"user": 25.0, "system": 5.0, "nice": 0.0, "idle": 70.0}}, |
| 258 |
"memInfo": {}, |
| 259 |
"processes": {}, |
| 260 |
}, |
| 261 |
"4\n", |
| 262 |
], |
| 263 |
"inputs": {"period": 15}, |
| 264 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 265 |
}, |
| 266 |
(VerifyCPUUtilization, "failure-custom-threshold"): { |
| 267 |
"eos_data": [ |
| 268 |
{ |
| 269 |
"timeInfo": {"loadAvg": [5.82, 4.52, 4.07]}, |
| 270 |
"cpuInfo": {"%Cpu(s)": {"user": 50.0, "system": 25.0, "nice": 0.0, "idle": 25.0}}, |
| 271 |
"memInfo": {}, |
| 272 |
"processes": {}, |
| 273 |
} |
| 274 |
], |
| 275 |
"inputs": {"threshold": 70.0}, |
| 276 |
"expected": { |
| 277 |
"result": AntaTestStatus.FAILURE, |
| 278 |
"messages": ["CPU utilization is above the threshold - Expected: < 70.0% Actual: 75.0%"], |
| 279 |
}, |
| 280 |
}, |
| 281 |
(VerifyCPUUtilization, "failure-load-avg-period-1"): { |
| 282 |
"eos_data": [ |
| 283 |
{ |
| 284 |
"timeInfo": {"loadAvg": [8.0, 5.0, 3.5]}, |
| 285 |
"cpuInfo": {"%Cpu(s)": {"user": 25.0, "system": 5.0, "nice": 0.0, "idle": 70.0}}, |
| 286 |
"memInfo": {}, |
| 287 |
"processes": {}, |
| 288 |
}, |
| 289 |
"4\n", |
| 290 |
], |
| 291 |
"inputs": {"period": 1}, |
| 292 |
"expected": { |
| 293 |
"result": AntaTestStatus.FAILURE, |
| 294 |
"messages": ["CPU load average (1 min) is above the threshold - Expected: < 75.0% Actual: 200.0%"], |
| 295 |
}, |
| 296 |
}, |
| 297 |
(VerifyCPUUtilization, "failure-load-avg-period-5"): { |
| 298 |
"eos_data": [ |
| 299 |
{ |
| 300 |
"timeInfo": {"loadAvg": [5.82, 6.0, 3.5]}, |
| 301 |
"cpuInfo": {"%Cpu(s)": {"user": 25.0, "system": 5.0, "nice": 0.0, "idle": 70.0}}, |
| 302 |
"memInfo": {}, |
| 303 |
"processes": {}, |
| 304 |
}, |
| 305 |
"4\n", |
| 306 |
], |
| 307 |
"inputs": {"period": 5}, |
| 308 |
"expected": { |
| 309 |
"result": AntaTestStatus.FAILURE, |
| 310 |
"messages": ["CPU load average (5 min) is above the threshold - Expected: < 75.0% Actual: 150.0%"], |
| 311 |
}, |
| 312 |
}, |
| 313 |
(VerifyCPUUtilization, "failure-load-avg-period-15"): { |
| 314 |
"eos_data": [ |
| 315 |
{ |
| 316 |
"timeInfo": {"loadAvg": [5.82, 4.52, 5.0]}, |
| 317 |
"cpuInfo": {"%Cpu(s)": {"user": 25.0, "system": 5.0, "nice": 0.0, "idle": 70.0}}, |
| 318 |
"memInfo": {}, |
| 319 |
"processes": {}, |
| 320 |
}, |
| 321 |
"4\n", |
| 322 |
], |
| 323 |
"inputs": {"period": 15}, |
| 324 |
"expected": { |
| 325 |
"result": AntaTestStatus.FAILURE, |
| 326 |
"messages": ["CPU load average (15 min) is above the threshold - Expected: < 75.0% Actual: 125.0%"], |
| 327 |
}, |
| 328 |
}, |
| 329 |
(VerifyMemoryUtilization, "success"): { |
| 330 |
"eos_data": [ |
| 331 |
{"uptime": 1994.67, "modelName": "vEOS-lab", "internalVersion": "4.27.3F-26379303.4273F", "memTotal": 2004568, "memFree": 879004, "version": "4.27.3F"} |
| 332 |
], |
| 333 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 334 |
}, |
| 335 |
(VerifyMemoryUtilization, "failure"): { |
| 336 |
"eos_data": [ |
| 337 |
{"uptime": 1994.67, "modelName": "vEOS-lab", "internalVersion": "4.27.3F-26379303.4273F", "memTotal": 2004568, "memFree": 89004, "version": "4.27.3F"} |
| 338 |
], |
| 339 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Device has reported a high memory usage - Expected: < 75% Actual: 95.56%"]}, |
| 340 |
}, |
| 341 |
(VerifyFileSystemUtilization, "success"): { |
| 342 |
"eos_data": [ |
| 343 |
"Filesystem Size Used Avail Use% Mounted on\n/dev/sda2 3.9G 988M 2.9G 26% /mnt/flash\nnone 294M 78M 217M 27% /\n" |
| 344 |
"none 294M 78M 217M 27% /.overlay\n/dev/loop0 461M 461M 0 100% /rootfs-i386\n" |
| 345 |
], |
| 346 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 347 |
}, |
| 348 |
(VerifyFileSystemUtilization, "failure"): { |
| 349 |
"eos_data": [ |
| 350 |
"Filesystem Size Used Avail Use% Mounted on\n/dev/sda2 3.9G 988M 2.9G 84% /mnt/flash\nnone 294M 78M 217M 27% /\n" |
| 351 |
"none 294M 78M 217M 84% /.overlay\n/dev/loop0 461M 461M 0 100% /rootfs-i386\n" |
| 352 |
], |
| 353 |
"expected": { |
| 354 |
"result": AntaTestStatus.FAILURE, |
| 355 |
"messages": [ |
| 356 |
"Mount point: /dev/sda2 3.9G 988M 2.9G 84% /mnt/flash - Higher disk space utilization - Expected: 75% Actual: 84%", |
| 357 |
"Mount point: none 294M 78M 217M 84% /.overlay - Higher disk space utilization - Expected: 75% Actual: 84%", |
| 358 |
], |
| 359 |
}, |
| 360 |
}, |
| 361 |
(VerifyNTP, "success"): {"eos_data": ["synchronised\npoll interval unknown\n"], "expected": {"result": AntaTestStatus.SUCCESS}}, |
| 362 |
(VerifyNTP, "failure"): { |
| 363 |
"eos_data": ["unsynchronised\npoll interval unknown\n"], |
| 364 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["NTP status mismatch - Expected: synchronised Actual: unsynchronised"]}, |
| 365 |
}, |
| 366 |
(VerifyNTPAssociations, "success"): { |
| 367 |
"eos_data": [ |
| 368 |
{ |
| 369 |
"peers": { |
| 370 |
"1.1.1.1": {"condition": "sys.peer", "peerIpAddr": "1.1.1.1", "stratumLevel": 1}, |
| 371 |
"2.2.2.2": {"condition": "candidate", "peerIpAddr": "2.2.2.2", "stratumLevel": 2}, |
| 372 |
"3.3.3.3": {"condition": "candidate", "peerIpAddr": "3.3.3.3", "stratumLevel": 2}, |
| 373 |
} |
| 374 |
} |
| 375 |
], |
| 376 |
"inputs": { |
| 377 |
"ntp_servers": [ |
| 378 |
{"server_address": "1.1.1.1", "preferred": True, "stratum": 1}, |
| 379 |
{"server_address": "2.2.2.2", "stratum": 2}, |
| 380 |
{"server_address": "3.3.3.3", "stratum": 2}, |
| 381 |
] |
| 382 |
}, |
| 383 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 384 |
}, |
| 385 |
(VerifyNTPAssociations, "success-pool-name"): { |
| 386 |
"eos_data": [ |
| 387 |
{ |
| 388 |
"peers": { |
| 389 |
"1.ntp.networks.com": {"condition": "sys.peer", "peerIpAddr": "1.1.1.1", "stratumLevel": 1}, |
| 390 |
"2.ntp.networks.com": {"condition": "candidate", "peerIpAddr": "2.2.2.2", "stratumLevel": 2}, |
| 391 |
"3.ntp.networks.com": {"condition": "candidate", "peerIpAddr": "3.3.3.3", "stratumLevel": 2}, |
| 392 |
} |
| 393 |
} |
| 394 |
], |
| 395 |
"inputs": { |
| 396 |
"ntp_servers": [ |
| 397 |
{"server_address": "1.ntp.networks.com", "preferred": True, "stratum": 1}, |
| 398 |
{"server_address": "2.ntp.networks.com", "stratum": 2}, |
| 399 |
{"server_address": "3.ntp.networks.com", "stratum": 2}, |
| 400 |
] |
| 401 |
}, |
| 402 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 403 |
}, |
| 404 |
(VerifyNTPAssociations, "success-ntp-pool-as-input"): { |
| 405 |
"eos_data": [ |
| 406 |
{ |
| 407 |
"peers": { |
| 408 |
"1.1.1.1": {"condition": "sys.peer", "peerIpAddr": "1.1.1.1", "stratumLevel": 1}, |
| 409 |
"2.2.2.2": {"condition": "candidate", "peerIpAddr": "2.2.2.2", "stratumLevel": 2}, |
| 410 |
"3.3.3.3": {"condition": "candidate", "peerIpAddr": "3.3.3.3", "stratumLevel": 2}, |
| 411 |
} |
| 412 |
} |
| 413 |
], |
| 414 |
"inputs": {"ntp_pool": {"server_addresses": ["1.1.1.1", "2.2.2.2", "3.3.3.3"], "preferred_stratum_range": [1, 2]}}, |
| 415 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 416 |
}, |
| 417 |
(VerifyNTPAssociations, "success-ntp-pool-hostname"): { |
| 418 |
"eos_data": [ |
| 419 |
{ |
| 420 |
"peers": { |
| 421 |
"itsys-ntp010p.aristanetworks.com": {"condition": "sys.peer", "peerIpAddr": "1.1.1.1", "stratumLevel": 1}, |
| 422 |
"itsys-ntp011p.aristanetworks.com": {"condition": "candidate", "peerIpAddr": "2.2.2.2", "stratumLevel": 2}, |
| 423 |
"itsys-ntp012p.aristanetworks.com": {"condition": "candidate", "peerIpAddr": "3.3.3.3", "stratumLevel": 2}, |
| 424 |
} |
| 425 |
} |
| 426 |
], |
| 427 |
"inputs": { |
| 428 |
"ntp_pool": { |
| 429 |
"server_addresses": ["itsys-ntp010p.aristanetworks.com", "itsys-ntp011p.aristanetworks.com", "itsys-ntp012p.aristanetworks.com"], |
| 430 |
"preferred_stratum_range": [1, 2], |
| 431 |
} |
| 432 |
}, |
| 433 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 434 |
}, |
| 435 |
(VerifyNTPAssociations, "success-ip-dns"): { |
| 436 |
"eos_data": [ |
| 437 |
{ |
| 438 |
"peers": { |
| 439 |
"1.1.1.1 (1.ntp.networks.com)": {"condition": "sys.peer", "peerIpAddr": "1.1.1.1", "stratumLevel": 1}, |
| 440 |
"2.2.2.2 (2.ntp.networks.com)": {"condition": "candidate", "peerIpAddr": "2.2.2.2", "stratumLevel": 2}, |
| 441 |
"3.3.3.3 (3.ntp.networks.com)": {"condition": "candidate", "peerIpAddr": "3.3.3.3", "stratumLevel": 2}, |
| 442 |
} |
| 443 |
} |
| 444 |
], |
| 445 |
"inputs": { |
| 446 |
"ntp_servers": [ |
| 447 |
{"server_address": "1.1.1.1", "preferred": True, "stratum": 1}, |
| 448 |
{"server_address": "2.2.2.2", "stratum": 2}, |
| 449 |
{"server_address": "3.3.3.3", "stratum": 2}, |
| 450 |
] |
| 451 |
}, |
| 452 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 453 |
}, |
| 454 |
(VerifyNTPAssociations, "failure-ntp-server"): { |
| 455 |
"eos_data": [ |
| 456 |
{ |
| 457 |
"peers": { |
| 458 |
"1.1.1.1": {"condition": "candidate", "peerIpAddr": "1.1.1.1", "stratumLevel": 2}, |
| 459 |
"2.2.2.2": {"condition": "sys.peer", "peerIpAddr": "2.2.2.2", "stratumLevel": 2}, |
| 460 |
"3.3.3.3": {"condition": "sys.peer", "peerIpAddr": "3.3.3.3", "stratumLevel": 3}, |
| 461 |
} |
| 462 |
} |
| 463 |
], |
| 464 |
"inputs": { |
| 465 |
"ntp_servers": [ |
| 466 |
{"server_address": "1.1.1.1", "preferred": True, "stratum": 1}, |
| 467 |
{"server_address": "2.2.2.2", "stratum": 2}, |
| 468 |
{"server_address": "3.3.3.3", "stratum": 2}, |
| 469 |
] |
| 470 |
}, |
| 471 |
"expected": { |
| 472 |
"result": AntaTestStatus.FAILURE, |
| 473 |
"messages": [ |
| 474 |
"NTP Server: 1.1.1.1 Preferred: True Stratum: 1 - Incorrect condition - Expected: sys.peer Actual: candidate", |
| 475 |
"NTP Server: 1.1.1.1 Preferred: True Stratum: 1 - Incorrect stratum level - Expected: 1 Actual: 2", |
| 476 |
"NTP Server: 2.2.2.2 Preferred: False Stratum: 2 - Incorrect condition - Expected: candidate Actual: sys.peer", |
| 477 |
"NTP Server: 3.3.3.3 Preferred: False Stratum: 2 - Incorrect condition - Expected: candidate Actual: sys.peer", |
| 478 |
"NTP Server: 3.3.3.3 Preferred: False Stratum: 2 - Incorrect stratum level - Expected: 2 Actual: 3", |
| 479 |
], |
| 480 |
}, |
| 481 |
}, |
| 482 |
(VerifyNTPAssociations, "failure-no-peers"): { |
| 483 |
"eos_data": [{"peers": {}}], |
| 484 |
"inputs": { |
| 485 |
"ntp_servers": [ |
| 486 |
{"server_address": "1.1.1.1", "preferred": True, "stratum": 1}, |
| 487 |
{"server_address": "2.2.2.2", "stratum": 1}, |
| 488 |
{"server_address": "3.3.3.3", "stratum": 1}, |
| 489 |
] |
| 490 |
}, |
| 491 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["No NTP peers configured"]}, |
| 492 |
}, |
| 493 |
(VerifyNTPAssociations, "failure-one-peer-not-found"): { |
| 494 |
"eos_data": [ |
| 495 |
{ |
| 496 |
"peers": { |
| 497 |
"1.1.1.1": {"condition": "sys.peer", "peerIpAddr": "1.1.1.1", "stratumLevel": 1}, |
| 498 |
"2.2.2.2": {"condition": "candidate", "peerIpAddr": "2.2.2.2", "stratumLevel": 1}, |
| 499 |
} |
| 500 |
} |
| 501 |
], |
| 502 |
"inputs": { |
| 503 |
"ntp_servers": [ |
| 504 |
{"server_address": "1.1.1.1", "preferred": True, "stratum": 1}, |
| 505 |
{"server_address": "2.2.2.2", "stratum": 1}, |
| 506 |
{"server_address": "3.3.3.3", "stratum": 1}, |
| 507 |
] |
| 508 |
}, |
| 509 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["NTP Server: 3.3.3.3 Preferred: False Stratum: 1 - Not configured"]}, |
| 510 |
}, |
| 511 |
(VerifyNTPAssociations, "failure-with-two-peers-not-found"): { |
| 512 |
"eos_data": [{"peers": {"1.1.1.1": {"condition": "candidate", "peerIpAddr": "1.1.1.1", "stratumLevel": 1}}}], |
| 513 |
"inputs": { |
| 514 |
"ntp_servers": [ |
| 515 |
{"server_address": "1.1.1.1", "preferred": True, "stratum": 1}, |
| 516 |
{"server_address": "2.2.2.2", "stratum": 1}, |
| 517 |
{"server_address": "3.3.3.3", "stratum": 1}, |
| 518 |
] |
| 519 |
}, |
| 520 |
"expected": { |
| 521 |
"result": AntaTestStatus.FAILURE, |
| 522 |
"messages": [ |
| 523 |
"NTP Server: 1.1.1.1 Preferred: True Stratum: 1 - Incorrect condition - Expected: sys.peer Actual: candidate", |
| 524 |
"NTP Server: 2.2.2.2 Preferred: False Stratum: 1 - Not configured", |
| 525 |
"NTP Server: 3.3.3.3 Preferred: False Stratum: 1 - Not configured", |
| 526 |
], |
| 527 |
}, |
| 528 |
}, |
| 529 |
(VerifyNTPAssociations, "failure-ntp-pool-as-input"): { |
| 530 |
"eos_data": [ |
| 531 |
{ |
| 532 |
"peers": { |
| 533 |
"ntp1.pool": {"condition": "sys.peer", "peerIpAddr": "1.1.1.1", "stratumLevel": 1}, |
| 534 |
"ntp2.pool": {"condition": "candidate", "peerIpAddr": "2.2.2.2", "stratumLevel": 2}, |
| 535 |
"ntp3.pool": {"condition": "candidate", "peerIpAddr": "3.3.3.3", "stratumLevel": 2}, |
| 536 |
} |
| 537 |
} |
| 538 |
], |
| 539 |
"inputs": {"ntp_pool": {"server_addresses": ["1.1.1.1", "2.2.2.2"], "preferred_stratum_range": [1, 2]}}, |
| 540 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["NTP Server: 3.3.3.3 Hostname: ntp3.pool - Associated but not part of the provided NTP pool"]}, |
| 541 |
}, |
| 542 |
(VerifyNTPAssociations, "failure-ntp-pool-as-input-bad-association"): { |
| 543 |
"eos_data": [ |
| 544 |
{ |
| 545 |
"peers": { |
| 546 |
"ntp1.pool": {"condition": "sys.peer", "peerIpAddr": "1.1.1.1", "stratumLevel": 1}, |
| 547 |
"ntp2.pool": {"condition": "candidate", "peerIpAddr": "2.2.2.2", "stratumLevel": 2}, |
| 548 |
"ntp3.pool": {"condition": "reject", "peerIpAddr": "3.3.3.3", "stratumLevel": 3}, |
| 549 |
} |
| 550 |
} |
| 551 |
], |
| 552 |
"inputs": {"ntp_pool": {"server_addresses": ["1.1.1.1", "2.2.2.2", "3.3.3.3"], "preferred_stratum_range": [1, 2]}}, |
| 553 |
"expected": { |
| 554 |
"result": AntaTestStatus.FAILURE, |
| 555 |
"messages": [ |
| 556 |
"NTP Server: 3.3.3.3 Hostname: ntp3.pool - Incorrect condition - Expected: sys.peer, candidate Actual: reject", |
| 557 |
"NTP Server: 3.3.3.3 Hostname: ntp3.pool - Incorrect stratum level - Expected Stratum Range: 1 to 2 Actual: 3", |
| 558 |
], |
| 559 |
}, |
| 560 |
}, |
| 561 |
(VerifyNTPAssociations, "failure-ntp-pool-hostname"): { |
| 562 |
"eos_data": [ |
| 563 |
{ |
| 564 |
"peers": { |
| 565 |
"itsys-ntp010p.aristanetworks.com": {"condition": "sys.peer", "peerIpAddr": "1.1.1.1", "stratumLevel": 5}, |
| 566 |
"itsys-ntp011p.aristanetworks.com": {"condition": "reject", "peerIpAddr": "2.2.2.2", "stratumLevel": 4}, |
| 567 |
"itsys-ntp012p.aristanetworks.com": {"condition": "candidate", "peerIpAddr": "3.3.3.3", "stratumLevel": 2}, |
| 568 |
} |
| 569 |
} |
| 570 |
], |
| 571 |
"inputs": {"ntp_pool": {"server_addresses": ["itsys-ntp010p.aristanetworks.com", "itsys-ntp011p.aristanetworks.com"], "preferred_stratum_range": [1, 2]}}, |
| 572 |
"expected": { |
| 573 |
"result": AntaTestStatus.FAILURE, |
| 574 |
"messages": [ |
| 575 |
"NTP Server: 1.1.1.1 Hostname: itsys-ntp010p.aristanetworks.com - Incorrect stratum level - Expected Stratum Range: 1 to 2 Actual: 5", |
| 576 |
"NTP Server: 2.2.2.2 Hostname: itsys-ntp011p.aristanetworks.com - Incorrect condition - Expected: sys.peer, candidate Actual: reject", |
| 577 |
"NTP Server: 2.2.2.2 Hostname: itsys-ntp011p.aristanetworks.com - Incorrect stratum level - Expected Stratum Range: 1 to 2 Actual: 4", |
| 578 |
"NTP Server: 3.3.3.3 Hostname: itsys-ntp012p.aristanetworks.com - Associated but not part of the provided NTP pool", |
| 579 |
], |
| 580 |
}, |
| 581 |
}, |
| 582 |
(VerifyMaintenance, "success-no-maintenance-configured"): { |
| 583 |
"eos_data": [{"units": {}, "interfaces": {}, "vrfs": {}, "warnings": ["Maintenance Mode is disabled."]}], |
| 584 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 585 |
}, |
| 586 |
(VerifyMaintenance, "success-maintenance-configured-but-not-enabled"): { |
| 587 |
"eos_data": [ |
| 588 |
{ |
| 589 |
"units": { |
| 590 |
"System": { |
| 591 |
"state": "active", |
| 592 |
"adminState": "active", |
| 593 |
"stateChangeTime": 0.0, |
| 594 |
"onBootMaintenance": False, |
| 595 |
"intfsViolatingTrafficThreshold": False, |
| 596 |
"aggInBpsRate": 0, |
| 597 |
"aggOutBpsRate": 0, |
| 598 |
} |
| 599 |
}, |
| 600 |
"interfaces": {}, |
| 601 |
"vrfs": {}, |
| 602 |
} |
| 603 |
], |
| 604 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 605 |
}, |
| 606 |
(VerifyMaintenance, "success-multiple-units-but-not-enabled"): { |
| 607 |
"eos_data": [ |
| 608 |
{ |
| 609 |
"units": { |
| 610 |
"mlag": { |
| 611 |
"state": "active", |
| 612 |
"adminState": "active", |
| 613 |
"stateChangeTime": 0.0, |
| 614 |
"onBootMaintenance": False, |
| 615 |
"intfsViolatingTrafficThreshold": False, |
| 616 |
"aggInBpsRate": 0, |
| 617 |
"aggOutBpsRate": 0, |
| 618 |
}, |
| 619 |
"System": { |
| 620 |
"state": "active", |
| 621 |
"adminState": "active", |
| 622 |
"stateChangeTime": 0.0, |
| 623 |
"onBootMaintenance": False, |
| 624 |
"intfsViolatingTrafficThreshold": False, |
| 625 |
"aggInBpsRate": 0, |
| 626 |
"aggOutBpsRate": 0, |
| 627 |
}, |
| 628 |
}, |
| 629 |
"interfaces": {}, |
| 630 |
"vrfs": {}, |
| 631 |
} |
| 632 |
], |
| 633 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 634 |
}, |
| 635 |
(VerifyMaintenance, "failure-maintenance-enabled"): { |
| 636 |
"eos_data": [ |
| 637 |
{ |
| 638 |
"units": { |
| 639 |
"mlag": { |
| 640 |
"state": "underMaintenance", |
| 641 |
"adminState": "underMaintenance", |
| 642 |
"stateChangeTime": 1741257120.9532886, |
| 643 |
"onBootMaintenance": False, |
| 644 |
"intfsViolatingTrafficThreshold": False, |
| 645 |
"aggInBpsRate": 0, |
| 646 |
"aggOutBpsRate": 0, |
| 647 |
}, |
| 648 |
"System": { |
| 649 |
"state": "active", |
| 650 |
"adminState": "active", |
| 651 |
"stateChangeTime": 0.0, |
| 652 |
"onBootMaintenance": False, |
| 653 |
"intfsViolatingTrafficThreshold": False, |
| 654 |
"aggInBpsRate": 0, |
| 655 |
"aggOutBpsRate": 0, |
| 656 |
}, |
| 657 |
}, |
| 658 |
"interfaces": {}, |
| 659 |
"vrfs": {}, |
| 660 |
} |
| 661 |
], |
| 662 |
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Units under maintenance: 'mlag'", "Possible causes: 'Quiesce is configured'"]}, |
| 663 |
}, |
| 664 |
(VerifyMaintenance, "failure-multiple-reasons"): { |
| 665 |
"eos_data": [ |
| 666 |
{ |
| 667 |
"units": { |
| 668 |
"mlag": { |
| 669 |
"state": "underMaintenance", |
| 670 |
"adminState": "underMaintenance", |
| 671 |
"stateChangeTime": 1741257120.9532895, |
| 672 |
"onBootMaintenance": False, |
| 673 |
"intfsViolatingTrafficThreshold": False, |
| 674 |
"aggInBpsRate": 0, |
| 675 |
"aggOutBpsRate": 0, |
| 676 |
}, |
| 677 |
"System": { |
| 678 |
"state": "maintenanceModeEnter", |
| 679 |
"adminState": "underMaintenance", |
| 680 |
"stateChangeTime": 1741257669.7231765, |
| 681 |
"onBootMaintenance": False, |
| 682 |
"intfsViolatingTrafficThreshold": False, |
| 683 |
"aggInBpsRate": 0, |
| 684 |
"aggOutBpsRate": 0, |
| 685 |
}, |
| 686 |
}, |
| 687 |
"interfaces": {}, |
| 688 |
"vrfs": {}, |
| 689 |
} |
| 690 |
], |
| 691 |
"expected": { |
| 692 |
"result": AntaTestStatus.FAILURE, |
| 693 |
"messages": ["Units under maintenance: 'mlag'", "Units entering maintenance: 'System'", "Possible causes: 'Quiesce is configured'"], |
| 694 |
}, |
| 695 |
}, |
| 696 |
(VerifyMaintenance, "failure-onboot-maintenance"): { |
| 697 |
"eos_data": [ |
| 698 |
{ |
| 699 |
"units": { |
| 700 |
"System": { |
| 701 |
"state": "underMaintenance", |
| 702 |
"adminState": "underMaintenance", |
| 703 |
"stateChangeTime": 1741258774.3756502, |
| 704 |
"onBootMaintenance": True, |
| 705 |
"intfsViolatingTrafficThreshold": False, |
| 706 |
"aggInBpsRate": 0, |
| 707 |
"aggOutBpsRate": 0, |
| 708 |
} |
| 709 |
}, |
| 710 |
"interfaces": {}, |
| 711 |
"vrfs": {}, |
| 712 |
} |
| 713 |
], |
| 714 |
"expected": { |
| 715 |
"result": AntaTestStatus.FAILURE, |
| 716 |
"messages": ["Units under maintenance: 'System'", "Possible causes: 'On-boot maintenance is configured, Quiesce is configured'"], |
| 717 |
}, |
| 718 |
}, |
| 719 |
(VerifyMaintenance, "failure-entering-maintenance-interface-violation"): { |
| 720 |
"eos_data": [ |
| 721 |
{ |
| 722 |
"units": { |
| 723 |
"System": { |
| 724 |
"state": "maintenanceModeEnter", |
| 725 |
"adminState": "underMaintenance", |
| 726 |
"stateChangeTime": 1741257669.7231765, |
| 727 |
"onBootMaintenance": False, |
| 728 |
"intfsViolatingTrafficThreshold": True, |
| 729 |
"aggInBpsRate": 0, |
| 730 |
"aggOutBpsRate": 0, |
| 731 |
} |
| 732 |
}, |
| 733 |
"interfaces": {}, |
| 734 |
"vrfs": {}, |
| 735 |
} |
| 736 |
], |
| 737 |
"expected": { |
| 738 |
"result": AntaTestStatus.FAILURE, |
| 739 |
"messages": ["Units entering maintenance: 'System'", "Possible causes: 'Interface traffic threshold violation, Quiesce is configured'"], |
| 740 |
}, |
| 741 |
}, |
| 742 |
(VerifyFlashUtilization, "success-dual-supervisor"): { |
| 743 |
"eos_data": [ |
| 744 |
{ |
| 745 |
"fileSystems": [ |
| 746 |
{"currentFs": False, "size": 9852540, "free": 9727696, "fsType": "flash", "permission": "rw", "prefix": "file:"}, |
| 747 |
{"currentFs": True, "size": 229572940, "free": 220819308, "fsType": "flash", "linuxFs": "ext4", "permission": "rw", "prefix": "flash:"}, |
| 748 |
] |
| 749 |
}, |
| 750 |
{"output": dumps({"fileSystems": [{"prefix": "flash:", "size": 229572940, "free": 221256196}]})}, |
| 751 |
], |
| 752 |
"inputs": {"max_utilization": 70, "check_peer_supervisor": True}, |
| 753 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 754 |
}, |
| 755 |
(VerifyFlashUtilization, "success-single-supervisor"): { |
| 756 |
"eos_data": [ |
| 757 |
{ |
| 758 |
"fileSystems": [ |
| 759 |
{"currentFs": False, "size": 9852540, "free": 9727696, "fsType": "flash", "permission": "rw", "prefix": "file:"}, |
| 760 |
{"currentFs": True, "size": 229572940, "free": 220819308, "fsType": "flash", "linuxFs": "ext4", "permission": "rw", "prefix": "flash:"}, |
| 761 |
] |
| 762 |
} |
| 763 |
], |
| 764 |
"inputs": {"max_utilization": 70}, |
| 765 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 766 |
}, |
| 767 |
(VerifyFlashUtilization, "failure-single-supervisor"): { |
| 768 |
"eos_data": [ |
| 769 |
{ |
| 770 |
"fileSystems": [ |
| 771 |
{"currentFs": False, "size": 9852540, "free": 9727696, "fsType": "flash", "permission": "rw", "prefix": "file:"}, |
| 772 |
{"currentFs": True, "size": 229572940, "free": 65871824, "fsType": "flash", "linuxFs": "ext4", "permission": "rw", "prefix": "flash:"}, |
| 773 |
] |
| 774 |
} |
| 775 |
], |
| 776 |
"inputs": {"max_utilization": 70}, |
| 777 |
"expected": { |
| 778 |
"result": AntaTestStatus.FAILURE, |
| 779 |
"messages": ["Flash utilization above threshold - Expected: <= 70.0% Actual: 71.31%"], |
| 780 |
}, |
| 781 |
}, |
| 782 |
(VerifyFlashUtilization, "failure-dual-supervisor"): { |
| 783 |
"eos_data": [ |
| 784 |
{ |
| 785 |
"fileSystems": [ |
| 786 |
{"currentFs": False, "size": 9852540, "free": 9727696, "fsType": "flash", "permission": "rw", "prefix": "file:"}, |
| 787 |
{"currentFs": True, "size": 229572940, "free": 60871824, "fsType": "flash", "linuxFs": "ext4", "permission": "rw", "prefix": "flash:"}, |
| 788 |
] |
| 789 |
}, |
| 790 |
{"output": dumps({"fileSystems": [{"prefix": "flash:", "size": 229572940, "free": 55871824}]})}, |
| 791 |
], |
| 792 |
"inputs": {"max_utilization": 60, "check_peer_supervisor": True}, |
| 793 |
"expected": { |
| 794 |
"result": AntaTestStatus.FAILURE, |
| 795 |
"messages": [ |
| 796 |
"Active Supervisor - Flash utilization above threshold - Expected: <= 60.0% Actual: 73.48%", |
| 797 |
"Standby Supervisor - Flash utilization above threshold - Expected: <= 60.0% Actual: 75.66%", |
| 798 |
], |
| 799 |
}, |
| 800 |
}, |
| 801 |
(VerifyFlashUtilization, "failure-flash-drive-not-configured"): { |
| 802 |
"eos_data": [ |
| 803 |
{ |
| 804 |
"fileSystems": [ |
| 805 |
{"currentFs": False, "size": 9852540, "free": 9727696, "fsType": "flash", "permission": "rw", "prefix": "file:"}, |
| 806 |
{"currentFs": True, "size": 229572940, "free": 60871824, "fsType": "flash", "linuxFs": "ext4", "permission": "rw", "prefix": "file"}, |
| 807 |
] |
| 808 |
}, |
| 809 |
{"output": dumps({"fileSystems": [{"prefix": "certificate:", "size": 229572940, "free": 55871824}]})}, |
| 810 |
], |
| 811 |
"inputs": {"max_utilization": 60, "check_peer_supervisor": True}, |
| 812 |
"expected": { |
| 813 |
"result": AntaTestStatus.FAILURE, |
| 814 |
"messages": ["Active Supervisor - Flash not found", "Standby Supervisor - Flash not found"], |
| 815 |
}, |
| 816 |
}, |
| 817 |
(VerifyFlashUtilization, "failure-bad-command-output"): { |
| 818 |
"eos_data": [ |
| 819 |
{ |
| 820 |
"fileSystems": [ |
| 821 |
{"currentFs": True, "size": 229572940, "free": 220819308, "fsType": "flash", "linuxFs": "ext4", "permission": "rw", "prefix": "flash:"}, |
| 822 |
] |
| 823 |
}, |
| 824 |
{"output": {"fileSystems": [{"prefix": "certificate:", "size": 229572940, "free": 55871824}]}}, |
| 825 |
], |
| 826 |
"inputs": {"max_utilization": 60, "check_peer_supervisor": True}, |
| 827 |
"expected": { |
| 828 |
"result": AntaTestStatus.FAILURE, |
| 829 |
"messages": ["Standby Supervisor - Failed to parse command output"], |
| 830 |
}, |
| 831 |
}, |
| 832 |
(VerifyFlashUtilization, "failure-single-system-flash-drive-not-configured"): { |
| 833 |
"eos_data": [ |
| 834 |
{ |
| 835 |
"fileSystems": [ |
| 836 |
{"currentFs": False, "size": 9852540, "free": 9727696, "fsType": "flash", "permission": "rw", "prefix": "file:"}, |
| 837 |
{"currentFs": True, "size": 229572940, "free": 60871824, "fsType": "flash", "linuxFs": "ext4", "permission": "rw", "prefix": "file"}, |
| 838 |
] |
| 839 |
}, |
| 840 |
], |
| 841 |
"inputs": {"max_utilization": 60}, |
| 842 |
"expected": { |
| 843 |
"result": AntaTestStatus.FAILURE, |
| 844 |
"messages": ["Flash not found"], |
| 845 |
}, |
| 846 |
}, |
| 847 |
(VerifyFlashUtilization, "failure-single-system-flash-size-0"): { |
| 848 |
"eos_data": [ |
| 849 |
{ |
| 850 |
"fileSystems": [ |
| 851 |
{"currentFs": False, "size": 0, "free": 9727696, "fsType": "flash", "permission": "rw", "prefix": "flash:"}, |
| 852 |
] |
| 853 |
}, |
| 854 |
], |
| 855 |
"inputs": {"max_utilization": 60}, |
| 856 |
"expected": { |
| 857 |
"result": AntaTestStatus.FAILURE, |
| 858 |
"messages": ["Flash reported a size of 0"], |
| 859 |
}, |
| 860 |
}, |
| 861 |
(VerifyFilePresence, "success"): { |
| 862 |
"eos_data": [ |
| 863 |
{ |
| 864 |
"urls": { |
| 865 |
"flash:/": { |
| 866 |
"entries": { |
| 867 |
"2025_01_06.cfg": { |
| 868 |
"permissions": "-rw-", |
| 869 |
}, |
| 870 |
"2025_01_07.cfg": { |
| 871 |
"permissions": "-rw-", |
| 872 |
}, |
| 873 |
"script.py": { |
| 874 |
"permissions": "-rw-", |
| 875 |
}, |
| 876 |
} |
| 877 |
} |
| 878 |
} |
| 879 |
}, |
| 880 |
{ |
| 881 |
"urls": { |
| 882 |
"supervisor-peer:/mnt/flash": { |
| 883 |
"entries": { |
| 884 |
"2025_01_06.cfg": { |
| 885 |
"permissions": "-rw-", |
| 886 |
}, |
| 887 |
"2025_01_07.cfg": { |
| 888 |
"permissions": "-rw-", |
| 889 |
}, |
| 890 |
"script.py": { |
| 891 |
"permissions": "-rw-", |
| 892 |
}, |
| 893 |
} |
| 894 |
} |
| 895 |
} |
| 896 |
}, |
| 897 |
], |
| 898 |
"inputs": {"filenames": ["script.py"], "check_peer_supervisor": True}, |
| 899 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 900 |
}, |
| 901 |
(VerifyFilePresence, "success-primary-supervisor"): { |
| 902 |
"eos_data": [ |
| 903 |
{ |
| 904 |
"urls": { |
| 905 |
"flash:/": { |
| 906 |
"entries": { |
| 907 |
"2025_01_06.cfg": { |
| 908 |
"permissions": "-rw-", |
| 909 |
}, |
| 910 |
"2025_01_07.cfg": { |
| 911 |
"permissions": "-rw-", |
| 912 |
}, |
| 913 |
"script.py": { |
| 914 |
"permissions": "-rw-", |
| 915 |
}, |
| 916 |
} |
| 917 |
} |
| 918 |
} |
| 919 |
} |
| 920 |
], |
| 921 |
"inputs": {"filenames": ["script.py"]}, |
| 922 |
"expected": {"result": AntaTestStatus.SUCCESS}, |
| 923 |
}, |
| 924 |
(VerifyFilePresence, "failure"): { |
| 925 |
"eos_data": [ |
| 926 |
{ |
| 927 |
"urls": { |
| 928 |
"flash:/": { |
| 929 |
"entries": { |
| 930 |
"2025_01_06.cfg": { |
| 931 |
"permissions": "-rw-", |
| 932 |
}, |
| 933 |
"2025_01_07.cfg": { |
| 934 |
"permissions": "-rw-", |
| 935 |
}, |
| 936 |
} |
| 937 |
} |
| 938 |
} |
| 939 |
}, |
| 940 |
{ |
| 941 |
"urls": { |
| 942 |
"supervisor-peer:/mnt/flash": { |
| 943 |
"entries": { |
| 944 |
"2025_01_06.cfg": { |
| 945 |
"permissions": "-rw-", |
| 946 |
}, |
| 947 |
"2025_01_07.cfg": { |
| 948 |
"permissions": "-rw-", |
| 949 |
}, |
| 950 |
} |
| 951 |
} |
| 952 |
} |
| 953 |
}, |
| 954 |
], |
| 955 |
"inputs": {"filenames": ["latency_script.py"], "check_peer_supervisor": True}, |
| 956 |
"expected": { |
| 957 |
"result": AntaTestStatus.FAILURE, |
| 958 |
"messages": ["File: latency_script.py - Not found", "File: latency_script.py - Not found on standby supervisor"], |
| 959 |
}, |
| 960 |
}, |
| 961 |
(VerifyFilePresence, "failure-primary-supervisor"): { |
| 962 |
"eos_data": [ |
| 963 |
{ |
| 964 |
"urls": { |
| 965 |
"flash:/": { |
| 966 |
"entries": { |
| 967 |
"2025_01_06.cfg": { |
| 968 |
"permissions": "-rw-", |
| 969 |
}, |
| 970 |
"2025_01_07.cfg": { |
| 971 |
"permissions": "-rw-", |
| 972 |
}, |
| 973 |
} |
| 974 |
} |
| 975 |
} |
| 976 |
} |
| 977 |
], |
| 978 |
"inputs": {"filenames": ["latency_script.py"]}, |
| 979 |
"expected": { |
| 980 |
"result": AntaTestStatus.FAILURE, |
| 981 |
"messages": [ |
| 982 |
"File: latency_script.py - Not found", |
| 983 |
], |
| 984 |
}, |
| 985 |
}, |
| 986 |
} |