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¤
Retrieve and construct Nornir inventory from NetBox data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters
|
list
|
List of filters to apply when retrieving devices from NetBox. |
None
|
devices
|
list
|
List of specific devices to retrieve from NetBox. |
None
|
instance
|
str
|
NetBox instance to use. |
None
|
interfaces
|
Union[dict, bool]
|
If True, include interfaces data in the inventory. If a dict, use it as arguments for the get_interfaces method. |
False
|
connections
|
Union[dict, bool]
|
If True, include connections data in the inventory. If a dict, use it as arguments for the get_connections method. |
False
|
circuits
|
Union[dict, bool]
|
If True, include circuits data in the inventory. If a dict, use it as arguments for the get_circuits method. |
False
|
nbdata
|
bool
|
If True, include a copy of NetBox device's data in the host's data. |
True
|
primary_ip
|
str
|
Specify whether to use 'ip4' or 'ip6' for the primary IP address. Defaults to 'ip4'. |
'ip4'
|
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Nornir inventory dictionary containing hosts and their respective data. |
Source code in norfab\workers\netbox_worker.py
1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 |
|