Result Manager models
Test Result model¶
UML Diagram¶
TestResult ¶
Bases: BaseModel
Describe the result of a test from a single device.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Device name where the test has run. |
test |
str
|
Test name runs on the device. |
categories |
List[str]
|
List of categories the TestResult belongs to, by default the AntaTest categories. |
description |
str
|
TestResult description, by default the AntaTest description. |
results |
str
|
Result of the test. Can be one of [“unset”, “success”, “failure”, “error”, “skipped”]. |
message |
str
|
Message to report after the test if any. |
custom_field |
str
|
Custom field to store a string for flexibility in integrating with ANTA |
is_error ¶
is_error(message: str = '') -> bool
Helper to set status to error
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Optional message related to the test |
''
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Always true |
Source code in anta/result_manager/models.py
89 90 91 92 93 94 95 96 97 98 99 |
|
is_failure ¶
is_failure(message: str = '') -> bool
Helper to set status to failure
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Optional message related to the test |
''
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Always true |
Source code in anta/result_manager/models.py
65 66 67 68 69 70 71 72 73 74 75 |
|
is_skipped ¶
is_skipped(message: str = '') -> bool
Helper to set status to skipped
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Optional message related to the test |
''
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Always true |
Source code in anta/result_manager/models.py
77 78 79 80 81 82 83 84 85 86 87 |
|
is_success ¶
is_success(message: str = '') -> bool
Helper to set status to success
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Optional message related to the test |
''
|
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Always true |
Source code in anta/result_manager/models.py
53 54 55 56 57 58 59 60 61 62 63 |
|
name_must_be_in
classmethod
¶
name_must_be_in(v: str) -> str
Status validator
Validate status is a supported one
Parameters:
Name | Type | Description | Default |
---|---|---|---|
v |
str
|
User defined status |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If status is unsupported |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
status value |
Source code in anta/result_manager/models.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
ListResult ¶
Bases: RootModel[List[TestResult]]
List result for all tests on all devices.
Attributes:
Name | Type | Description |
---|---|---|
__root__ |
List[TestResult]
|
A list of TestResult objects. |
append ¶
append(value: TestResult) -> None
Add support for append method.
Source code in anta/result_manager/models.py
138 139 140 |
|
extend ¶
extend(values: List[TestResult]) -> None
Add support for extend method.
Source code in anta/result_manager/models.py
134 135 136 |
|