Netbox Update Device IP Task¤
task api name:
update_device_ip
The Netbox Update Device IP Task is a feature of the NorFab Netbox Service that allows you to synchronize and update the IP addresses data of your network devices in Netbox. This task ensures that the IP address records in Netbox are accurate and up-to-date, reflecting the current state of your network infrastructure.
How it works - Netbox worker on a call to update IP addresses task fetches live data from network devices using nominated datasource, by default it is Nornir service parse task using NAPALM get_interfaces_ip
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 IP addresses
-
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 IP addresses data back to Netbox Service worker
-
Netbox worker processes device data and updates or creates IP address records in Netbox for requested devices
Limitations¤
Datasource nornir
uses NAPALM get_interfaces_ip
getter and as such only supports these device platforms:
- Arista EOS
- Cisco IOS
- Cisco IOSXR
- Cisco NXOS
- Juniper JUNOS
Update Device IP Sample Usage¤
NORFAB Netbox Update Device IP Command Shell Reference¤
NorFab shell supports these command options for Netbox update_device_ip
task:
nf#man tree netbox.update.device.ip-addresses
root
└── netbox: Netbox service
└── update: Update Netbox data
└── device: Update device data
└── ip-addresses: Update device interface IP addresses
├── 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: List of Netbox devices to update
│ └── 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'
└── batch-size: Number of devices to process at a time, default '10'
nf#
Python API Reference¤
Update the IP addresses of devices in Netbox.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
instance
|
str
|
The instance name to use. |
None
|
dry_run
|
bool
|
If True, no changes will be made. |
False
|
datasource
|
str
|
The data source to use. Supported datasources:
|
'nornir'
|
timeout
|
int
|
The timeout for the operation. |
60
|
devices
|
list
|
The list of devices to update. |
None
|
create
|
bool
|
If True, new IP addresses 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. |
{}
|
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
1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 |
|