Netbox Get Nornir Inventory Task¤
task api name:
get_nornir_inventory
This task designed to provide Nornir workers with inventory data sourced from Netbox.
How it works
Netbox NorFab workers able to talk with Netbox GraphQL and REST API. Nornir workers can be configured to request Nornir inventory from Netbox workers on startup. Netbox workers in response to such a request will be fetching devices data from Netbox and constructing Nornir inventory returning it to Nornir worker.
-
On startup Nornir worker sends
get_nornir_inventory
request to Netbox NorFab Workers -
Netbox worker fetches devices data from netbox - hostnames, interfaces, ip addresses, circuits, connections, configuration contexts etc.
-
Netbox worker constructs Nornir inventory and sends it back to Nornir worker
Get Nornir Inventory Sample Usage¤
NORFAB Netbox Get Nornir Inventory Command Shell Reference¤
NorFab shell supports these command options for Netbox get_nornir_inventory
task:
Python API Reference¤
Method to query Netbox devices data and construct Nornir inventory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters
|
list
|
List of filters to apply when querying devices. |
None
|
devices
|
list
|
List of specific devices to query. |
None
|
instance
|
str
|
Netbox instance name to query. |
None
|
interfaces
|
Union[dict, bool]
|
Whether to include interfaces data. If a dict is provided, it will be used as arguments for the query. |
False
|
connections
|
Union[dict, bool]
|
Whether to include connections data. If a dict is provided, it will be used as arguments for the query. |
False
|
circuits
|
Union[dict, bool]
|
Whether to include circuits data. If a dict is provided, it will be used as arguments for the query. |
False
|
nbdata
|
bool
|
Whether to include Netbox devices data in the host's data |
True
|
primary_ip
|
str
|
Primary IP version to use for the hostname. |
'ip4'
|
Returns:
Type | Description |
---|---|
dict
|
Nornir Inventory compatible dictionary |
Source code in norfab\workers\netbox_worker.py
1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 |
|