Generated Inventory data model
Inventory Entry¶
Bases: BaseModel
Inventory model exposed by Inventory class.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
Device name |
username |
str
|
Username to use for connection. |
password |
password
|
Password to use for connection. |
enable_password |
Optional[str]
|
enable_password to use on the device, required for some tests |
session |
Any
|
JSONRPC session. |
established |
bool
|
Flag to mark if connection is established (True) or not (False). Default: False. |
is_online |
bool
|
Flag to mark if host is alive (True) or not (False). Default: False. |
hw_model |
str
|
HW name gathered during device discovery. |
url |
str
|
eAPI URL to use to build session. |
tags |
List[str]
|
List of attached tags read from inventory file. |
Source code in anta/inventory/models.py
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 121 122 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 168 169 170 171 172 173 174 175 176 177 178 179 |
|
Config
¶
Pydantic model configuration
Source code in anta/inventory/models.py
101 102 103 |
|
__eq__(other)
¶
Two InventoryDevice objects are equal if the hostname and the port are the same. This covers the use case of port forwarding when the host is localhost and the devices have different ports.
Source code in anta/inventory/models.py
138 139 140 141 142 143 |
|
assert_enable_password_is_not_none(test_name=None)
¶
raise ValueError is enable_password is None
Source code in anta/inventory/models.py
145 146 147 148 149 150 151 152 153 154 |
|
build_device(values)
¶
Build the device session object
Source code in anta/inventory/models.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
|
create_ssh_socket(ssh_port=22, banner_timeout=60)
¶
Create SSH socket to send commend over SSH
Returns:
Type | Description |
---|---|
paramiko.SSHClient
|
paramiko.SSHClient: SSH Socket created |
Source code in anta/inventory/models.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
Inventory¶
Bases: BaseModel
Inventory model to list all InventoryDevice entries.
Attributes:
Name | Type | Description |
---|---|---|
__root__(List[InventoryDevice]) |
A list of InventoryDevice objects. |
Source code in anta/inventory/models.py
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 |
|
__getitem__(item)
¶
Use custom getitem method.
Source code in anta/inventory/models.py
201 202 203 |
|
__iter__()
¶
Use custom iter method.
Source code in anta/inventory/models.py
197 198 199 |
|
__len__()
¶
Support for length of root
Source code in anta/inventory/models.py
205 206 207 |
|
append(value)
¶
Add support for append method.
Source code in anta/inventory/models.py
193 194 195 |
|
json()
¶
Returns a JSON representation of the devices
Source code in anta/inventory/models.py
209 210 211 |
|