Result Manager models
TestResult Entry¶
Bases: BaseModel
Describe 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. |
results |
str
|
Result of the test. Can be one of unset / failure / success. |
message |
str
|
Message to report after the test. |
Source code in anta/result_manager/models.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 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 81 82 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 |
|
is_error(message='')
¶
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
81 82 83 84 85 86 87 88 89 90 91 |
|
is_failure(message='')
¶
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
57 58 59 60 61 62 63 64 65 66 67 |
|
is_skipped(message='')
¶
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
69 70 71 72 73 74 75 76 77 78 79 |
|
is_success(message='')
¶
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
45 46 47 48 49 50 51 52 53 54 55 |
|
name_must_be_in(v)
¶
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
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
ListResult¶
Bases: BaseModel
List result for all tests on all devices.
Attributes:
Name | Type | Description |
---|---|---|
__root__ |
List[TestResult]
|
A list of TestResult objects. |
Source code in anta/result_manager/models.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
__getitem__(item)
¶
Use custom getitem method.
Source code in anta/result_manager/models.py
133 134 135 |
|
__iter__()
¶
Use custom iter method.
Source code in anta/result_manager/models.py
129 130 131 |
|
__len__()
¶
Support for length of root
Source code in anta/result_manager/models.py
137 138 139 |
|
append(value)
¶
Add support for append method.
Source code in anta/result_manager/models.py
125 126 127 |
|
extend(values)
¶
Add support for extend method.
Source code in anta/result_manager/models.py
121 122 123 |
|