| 1 |
classDiagram |
| 2 |
direction LR |
| 3 |
namespace Inventory { |
| 4 |
class AntaInventory { |
| 5 |
devices : list[AntaDevice] |
| 6 |
max_potential_connections : int | None |
| 7 |
INVENTORY_ROOT_KEY : str$ |
| 8 |
INVENTORY_OUTPUT_FORMAT : list[str]$ |
| 9 |
parse(filename: str | Path, username: str, password: str, enable_password: str | None, timeout: float | None, file_format: Literal['yaml', 'json'], enable: bool, insecure: bool, disable_cache: bool, use_session_auth: bool | None) AntaInventory$ |
| 10 |
add_device(device: AntaDevice) None |
| 11 |
connect_inventory() None |
| 12 |
disconnect_inventory() None |
| 13 |
dump() AntaInventoryInput |
| 14 |
get_inventory(established_only: bool, tags: set[str] | None, devices: set[str] | None) AntaInventory |
| 15 |
is_base_class(device: AntaDevice) TypeIs[AntaDevice] |
| 16 |
} |
| 17 |
class AntaInventoryHost:::pydantic { |
| 18 |
name : str | None |
| 19 |
host : Hostname | IPvAnyAddress |
| 20 |
port : Port | None |
| 21 |
tags : set[str] | None |
| 22 |
disable_cache : bool |
| 23 |
use_session_auth : bool |
| 24 |
} |
| 25 |
class AntaInventoryInput:::pydantic { |
| 26 |
hosts : list[AntaInventoryHost] | None |
| 27 |
networks : list[AntaInventoryNetwork] | None |
| 28 |
ranges : list[AntaInventoryRange] | None |
| 29 |
yaml() str |
| 30 |
to_json() str |
| 31 |
} |
| 32 |
class AntaInventoryNetwork:::pydantic { |
| 33 |
network : IPvAnyNetwork |
| 34 |
tags : set[str] | None |
| 35 |
disable_cache : bool |
| 36 |
use_session_auth : bool |
| 37 |
} |
| 38 |
class AntaInventoryRange:::pydantic { |
| 39 |
start : IPvAnyAddress |
| 40 |
end : IPvAnyAddress |
| 41 |
tags : set[str] | None |
| 42 |
disable_cache : bool |
| 43 |
use_session_auth : bool |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
namespace Device { |
| 48 |
class AntaDevice { |
| 49 |
<<Abstract>> |
| 50 |
capabilities : AntaDeviceCapabilities$ |
| 51 |
name : str |
| 52 |
tags : set[str] |
| 53 |
hw_model : str | None |
| 54 |
established : bool |
| 55 |
is_online : bool |
| 56 |
cache : AntaCache | None |
| 57 |
cache_locks : defaultdict[str, asyncio.Lock] | None |
| 58 |
max_connections : int | None |
| 59 |
cache_statistics : dict[str, Any] | None |
| 60 |
collect(command: AntaCommand, collection_id: str | None) None |
| 61 |
collect_commands(commands: list[AntaCommand], collection_id: str | None) None |
| 62 |
copy(sources: list[Path], destination: Path, direction: Literal['to', 'from']) None |
| 63 |
disconnect() None |
| 64 |
refresh()* None |
| 65 |
_collect(command: AntaCommand, collection_id: str | None)* None |
| 66 |
} |
| 67 |
class AsyncEOSDevice { |
| 68 |
capabilities : AntaDeviceCapabilities$ |
| 69 |
enable : bool |
| 70 |
max_connections : int | None |
| 71 |
use_session_auth : bool |
| 72 |
_client : asynceapi.Device |
| 73 |
_eapi_opts : EAPIClientConnectionOptions |
| 74 |
_ssh_opts : SSHClientConnectionOptions |
| 75 |
_command_semaphore : asyncio.Semaphore |
| 76 |
copy(sources: list[Path], destination: Path, direction: Literal['to', 'from']) None |
| 77 |
disconnect() None |
| 78 |
refresh() None |
| 79 |
_collect(command: AntaCommand, collection_id: str | None) None |
| 80 |
} |
| 81 |
class AntaDeviceCapabilities:::dataclass { |
| 82 |
<<Frozen Dataclass>> |
| 83 |
supports_session_auth : bool |
| 84 |
} |
| 85 |
class EAPIClientConnectionOptions:::dataclass { |
| 86 |
<<Frozen Dataclass>> |
| 87 |
host : str |
| 88 |
username : str |
| 89 |
password : str |
| 90 |
port : int | None |
| 91 |
proto : Literal['http', 'https'] |
| 92 |
timeout : float | None |
| 93 |
use_session_auth : bool |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
namespace Catalog { |
| 98 |
class AntaCatalog { |
| 99 |
tests : list[AntaTestDefinition] |
| 100 |
filename : Path | None |
| 101 |
indexes_built : bool |
| 102 |
tag_to_tests : defaultdict[str | None, set[AntaTestDefinition]] |
| 103 |
parse(filename: str | Path, file_format: Literal['yaml', 'json']) AntaCatalog$ |
| 104 |
from_dict(data: RawCatalogInput, filename: str | Path | None) AntaCatalog$ |
| 105 |
from_list(data: ListAntaTestTuples) AntaCatalog$ |
| 106 |
merge_catalogs(catalogs: list[AntaCatalog]) AntaCatalog$ |
| 107 |
build_indexes(filtered_tests: set[str] | None) None |
| 108 |
clear_indexes() None |
| 109 |
dump() AntaCatalogFile |
| 110 |
get_tests_by_tags(tags: set[str], strict: bool) set[AntaTestDefinition] |
| 111 |
merge(catalog: AntaCatalog) AntaCatalog |
| 112 |
} |
| 113 |
class AntaCatalogFile:::pydantic { |
| 114 |
root : dict[ImportString[Any], list[AntaTestDefinition]] |
| 115 |
flatten_modules(data: dict[str, Any], package: str | None) dict[ModuleType, list[Any]]$ |
| 116 |
yaml() str |
| 117 |
to_json() str |
| 118 |
} |
| 119 |
class AntaTestDefinition:::pydantic { |
| 120 |
inputs : Input |
| 121 |
test : type[AntaTest] |
| 122 |
check_inputs() Self |
| 123 |
instantiate_inputs(data: AntaTest.Input | dict[str, Any] | None, info: ValidationInfo) AntaTest.Input |
| 124 |
serialize_model() dict[str, AntaTest.Input] |
| 125 |
} |
| 126 |
} |
| 127 |
|
| 128 |
namespace Test { |
| 129 |
class AntaTest { |
| 130 |
<<Abstract>> |
| 131 |
name : str$ |
| 132 |
description : str$ |
| 133 |
categories : list[str]$ |
| 134 |
commands : list[AntaTemplate | AntaCommand]$ |
| 135 |
progress : Progress | None$ |
| 136 |
nrfu_task : TaskID | None$ |
| 137 |
device : AntaDevice |
| 138 |
inputs : Input |
| 139 |
result : TestResult |
| 140 |
instance_commands : list[AntaCommand] |
| 141 |
failed_commands : list[AntaCommand] |
| 142 |
collected : bool |
| 143 |
blocked : bool |
| 144 |
module : str |
| 145 |
logger : Logger |
| 146 |
anta_test(function: Callable[..., Any]) Callable[..., Coroutine[Any, Any, TestResult]]$ |
| 147 |
collect() None |
| 148 |
render(template: AntaTemplate) list[AntaCommand] |
| 149 |
save_commands_data(eos_data: list[dict[str, Any] | str]) None |
| 150 |
update_progress() None$ |
| 151 |
test() Coroutine[Any, Any, TestResult]* |
| 152 |
} |
| 153 |
class Input:::pydantic { |
| 154 |
filters : Filters | None |
| 155 |
result_overwrite : ResultOverwrite | None |
| 156 |
} |
| 157 |
class Filters:::pydantic { |
| 158 |
tags : set[str] | None |
| 159 |
} |
| 160 |
class ResultOverwrite:::pydantic { |
| 161 |
categories : list[str] | None |
| 162 |
custom_field : str | None |
| 163 |
description : str | None |
| 164 |
} |
| 165 |
class AntaCommand:::pydantic { |
| 166 |
command : str |
| 167 |
version : Literal[1, 'latest'] |
| 168 |
revision : Revision | None |
| 169 |
ofmt : Literal['json', 'text'] |
| 170 |
output : dict[str, Any] | str | None |
| 171 |
template : AntaTemplate | None |
| 172 |
errors : list[str] |
| 173 |
params : AntaParamsBaseModel |
| 174 |
use_cache : bool |
| 175 |
uid : str |
| 176 |
json_output : dict[str, Any] |
| 177 |
text_output : str |
| 178 |
error : bool |
| 179 |
collected : bool |
| 180 |
requires_privileges : bool |
| 181 |
returned_known_eos_error : bool |
| 182 |
supported : bool |
| 183 |
} |
| 184 |
class AntaTemplate { |
| 185 |
template : str |
| 186 |
version : Literal[1, 'latest'] |
| 187 |
revision : Revision | None |
| 188 |
ofmt : Literal['json', 'text'] |
| 189 |
use_cache : bool |
| 190 |
params_schema : type[AntaParamsBaseModel] |
| 191 |
render(params: str | int | bool) AntaCommand |
| 192 |
} |
| 193 |
} |
| 194 |
|
| 195 |
namespace Result_Manager { |
| 196 |
class ResultManager { |
| 197 |
results : list[TestResult] |
| 198 |
status : AntaTestStatus |
| 199 |
error_status : bool |
| 200 |
dump : list[dict[str, Any]] |
| 201 |
json : str |
| 202 |
results_by_status : dict[AntaTestStatus, list[TestResult]] |
| 203 |
results_by_category : list[TestResult] |
| 204 |
device_stats : dict[str, DeviceStats] |
| 205 |
category_stats : dict[str, CategoryStats] |
| 206 |
sorted_category_stats : dict[str, CategoryStats] |
| 207 |
test_stats : dict[str, TestStats] |
| 208 |
add(result: TestResult) None |
| 209 |
filter(hide: set[AntaTestStatus]) ResultManager |
| 210 |
filter_by_devices(devices: set[str]) ResultManager |
| 211 |
filter_by_tests(tests: set[str]) ResultManager |
| 212 |
get_devices() set[str] |
| 213 |
get_results(status: set[AntaTestStatus] | None, sort_by: list[str] | None) list[TestResult] |
| 214 |
get_status(ignore_error: bool) str |
| 215 |
get_tests() set[str] |
| 216 |
get_total_results(status: set[AntaTestStatus] | None) int |
| 217 |
merge_results(results_managers: list[ResultManager]) ResultManager$ |
| 218 |
reset() None |
| 219 |
sort(sort_by: list[str]) ResultManager |
| 220 |
} |
| 221 |
class TestResult:::pydantic { |
| 222 |
name : str |
| 223 |
test : str |
| 224 |
categories : list[str] |
| 225 |
description : str |
| 226 |
result : AntaTestStatus |
| 227 |
messages : list[str] |
| 228 |
atomic_results : list[AtomicTestResult] |
| 229 |
custom_field : str | None |
| 230 |
add(description: str, status: AntaTestStatus, messages: list[str] | None) AtomicTestResult |
| 231 |
is_error(message: str | None) None |
| 232 |
is_failure(message: str | None) None |
| 233 |
is_skipped(message: str | None) None |
| 234 |
is_success(message: str | None) None |
| 235 |
} |
| 236 |
class AtomicTestResult:::pydantic { |
| 237 |
description : str |
| 238 |
result : AntaTestStatus |
| 239 |
messages : list[str] |
| 240 |
parent : TestResult |
| 241 |
is_error(message: str | None) None |
| 242 |
is_failure(message: str | None) None |
| 243 |
is_skipped(message: str | None) None |
| 244 |
is_success(message: str | None) None |
| 245 |
} |
| 246 |
class AntaTestStatus { |
| 247 |
<<Enumeration>> |
| 248 |
UNSET |
| 249 |
SUCCESS |
| 250 |
FAILURE |
| 251 |
ERROR |
| 252 |
SKIPPED |
| 253 |
} |
| 254 |
class DeviceStats:::dataclass { |
| 255 |
<<Dataclass>> |
| 256 |
tests_success_count : int |
| 257 |
tests_skipped_count : int |
| 258 |
tests_failure_count : int |
| 259 |
tests_error_count : int |
| 260 |
tests_unset_count : int |
| 261 |
tests_failure : set[str] |
| 262 |
categories_failed : set[str] |
| 263 |
categories_skipped : set[str] |
| 264 |
} |
| 265 |
class CategoryStats:::dataclass { |
| 266 |
<<Dataclass>> |
| 267 |
tests_success_count : int |
| 268 |
tests_skipped_count : int |
| 269 |
tests_failure_count : int |
| 270 |
tests_error_count : int |
| 271 |
tests_unset_count : int |
| 272 |
} |
| 273 |
class TestStats:::dataclass { |
| 274 |
<<Dataclass>> |
| 275 |
devices_success_count : int |
| 276 |
devices_skipped_count : int |
| 277 |
devices_failure_count : int |
| 278 |
devices_error_count : int |
| 279 |
devices_unset_count : int |
| 280 |
devices_failure : set[str] |
| 281 |
} |
| 282 |
} |
| 283 |
|
| 284 |
AntaInventory o-- AntaDevice : devices |
| 285 |
AntaInventory ..> AntaInventoryInput : parse()/dump() |
| 286 |
AntaInventoryInput ..> AntaInventoryHost |
| 287 |
AntaInventoryInput ..> AntaInventoryNetwork |
| 288 |
AntaInventoryInput ..> AntaInventoryRange |
| 289 |
AntaCatalog o-- AntaTestDefinition : tests |
| 290 |
AntaCatalog ..> AntaCatalogFile : dump() |
| 291 |
AntaTestDefinition *-- Input : inputs |
| 292 |
AntaTestDefinition ..> AntaTest : test |
| 293 |
AsyncEOSDevice --|> AntaDevice |
| 294 |
AntaDevice *-- AntaDeviceCapabilities : capabilities |
| 295 |
AsyncEOSDevice *-- AntaDeviceCapabilities : capabilities |
| 296 |
AsyncEOSDevice *-- EAPIClientConnectionOptions : _eapi_opts |
| 297 |
AntaDevice --o AntaTest : device |
| 298 |
AntaTest *-- Input : inputs |
| 299 |
Input *-- Filters : filters |
| 300 |
Input *-- ResultOverwrite : result_overwrite |
| 301 |
AntaTest o-- AntaCommand : commands |
| 302 |
AntaTest o-- AntaCommand : instance_commands |
| 303 |
AntaTest o-- AntaTemplate : commands |
| 304 |
AntaTemplate ..> AntaCommand : render() |
| 305 |
AntaTest *-- TestResult : result |
| 306 |
ResultManager o-- TestResult : results |
| 307 |
ResultManager *-- AntaTestStatus : status |
| 308 |
ResultManager *-- DeviceStats : device_stats |
| 309 |
ResultManager *-- CategoryStats : category_stats |
| 310 |
ResultManager *-- TestStats : test_stats |
| 311 |
TestResult o-- AtomicTestResult : atomic_results |
| 312 |
TestResult *-- AntaTestStatus : result |
| 313 |
AtomicTestResult *-- AntaTestStatus : result |
| 314 |
classDef pydantic fill:#D63965 |
| 315 |
classDef dataclass fill:#2F9E44 |