Netbox Update Device Interfaces Task¤
task api name:
update_device_interfaces
The Netbox Update Device Interfaces Task is a feature of the NorFab Netbox Service that allows you to synchronize and update the interface data of your network devices in Netbox. This task ensures that the interface configurations in Netbox are accurate and up-to-date, reflecting the current state of your network infrastructure.
Keeping interface data accurate and up-to-date is crucial for effective network management. The Netbox Update Device Interfaces Task automates the process of updating interface information, such as interface names, statuses, mac addresses, and other relevant details.
How it works - Netbox worker on a call to update interfaces task fetches live data from network devices using nominated datasource, by default it is Nornir service parse task using NAPALM get_interfaces
getter. Once data retrieved from network, Netbox worker updates records in Netbox database for device interfaces.
-
Client submits and on-demand request to NorFab Netbox worker to update device interfaces
-
Netbox worker sends job request to nominated datasource service to fetch live data from network devices
-
Datasource service fetches data from the network
-
Datasource returns devices interfaces data back to Netbox Service worker
-
Netbox worker processes device interfaces data and updates records in Netbox for requested devices
Limitations¤
Datasource nornir
uses NAPALM get_interfaces
getter and as such only supports these device platforms:
- Arista EOS
- Cisco IOS
- Cisco IOSXR
- Cisco NXOS
- Juniper JUNOS
Update Device Interfaces Sample Usage¤
NORFAB Netbox Update Device Interfaces Command Shell Reference¤
NorFab shell supports these command options for Netbox update_device_interfaces
task:
nf# man tree netbox.update.device.interfaces
root
└── netbox: Netbox service
└── update: Update Netbox data
└── device: Update device data
└── interfaces: Update device interfaces
├── timeout: Job timeout
├── workers: Filter workers to target, default 'any'
├── instance: Netbox instance name to target
├── dry_run: Return information that would be pushed to Netbox but do not push it
├── devices: Devices to update
└── datasource: Service to use to retrieve device data, default 'nornir'
└── nornir: Use Nornir service to retrieve data from devices
├── add_details: Add task details to results, default 'False'
├── run_num_workers: RetryRunner number of threads for tasks execution
├── run_num_connectors: RetryRunner number of threads for device connections
├── run_connect_retry: RetryRunner number of connection attempts
├── run_task_retry: RetryRunner number of attempts to run task
├── run_reconnect_on_fail: RetryRunner perform reconnect to host on task failure
├── run_connect_check: RetryRunner test TCP connection before opening actual connection
├── run_connect_timeout: RetryRunner timeout in seconds to wait for test TCP connection to establish
├── run_creds_retry: RetryRunner list of connection credentials and parameters to retry
├── tf: File group name to save task results to on worker file system
├── tf_skip_failed: Save results to file for failed tasks
├── diff: File group name to run the diff for
├── diff_last: File version number to diff, default is 1 (last)
└── progress: Display progress events, default 'True'
nf#
Python API Reference¤
Update or create device interfaces in Netbox. Interface parameters updated:
- interface name
- interface description
- mtu
- mac address
- admin status
- speed
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance
|
str
|
The instance name to use. |
None
|
dry_run
|
bool
|
If True, no changes will be made to Netbox. |
False
|
datasource
|
str
|
The data source to use. Supported datasources:
|
'nornir'
|
timeout
|
int
|
The timeout for the job. |
60
|
devices
|
list
|
List of devices to update. |
None
|
create
|
bool
|
If True, new interfaces will be created if they do not exist. |
True
|
batch_size
|
int
|
The number of devices to process in each batch. |
10
|
**kwargs
|
Additional keyword arguments to pass to the job. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary containing the results of the update operation. |
Raises:
Type | Description |
---|---|
Exception
|
If a device does not exist in Netbox. |
UnsupportedServiceError
|
If the specified datasource is not supported. |
Source code in norfab\workers\netbox_worker.py
1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 |
|