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
Branching Support¤
Update device IP task is branch aware and can push updates to the branch. Netbox Branching Plugin need to be installed on Netbox instance.
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 worker to target, default 'any'
├── verbose-result: Control output details, default 'False'
├── progress: Display progress events, default 'True'
├── 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
├── datasource: Service to use to retrieve device data, default 'nornir'
│ └── nornir: Use Nornir service to retrieve data from devices
│ ├── FO: Filter hosts using Filter Object
│ ├── FB: Filter hosts by name using Glob Patterns
│ ├── FH: Filter hosts by hostname
│ ├── FC: Filter hosts containment of pattern in name
│ ├── FR: Filter hosts by name using Regular Expressions
│ ├── FG: Filter hosts by group
│ ├── FP: Filter hosts by hostname using IP Prefix
│ ├── FL: Filter hosts by names list
│ ├── FM: Filter hosts by platform
│ ├── FN: Negate the match
│ ├── add-details: Add task details to results, default 'False'
│ ├── num-workers: RetryRunner number of threads for tasks execution
│ ├── num-connectors: RetryRunner number of threads for device connections
│ ├── connect-retry: RetryRunner number of connection attempts
│ ├── task-retry: RetryRunner number of attempts to run task
│ ├── reconnect-on-fail: RetryRunner perform reconnect to host on task failure
│ ├── connect-check: RetryRunner test TCP connection before opening actual connection
│ ├── connect-timeout: RetryRunner timeout in seconds to wait for test TCP connection to establish
│ ├── 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'
└── branch: Branching plugin branch name to use
nf#
Python API Reference¤
Update the IP addresses of devices in Netbox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job
|
Job
|
NorFab Job object containing relevant metadata |
required |
instance
|
str
|
The Netbox 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
|
branch
|
str
|
Branch name to use, need to have branching plugin installed, automatically creates branch if it does not exist in Netbox. |
None
|
**kwargs
|
Additional keyword arguments. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
Result
|
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
2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 | |