Netbox Create IP Bulk Task¤
task api name:
create_ip_bulk
Task to allocate next available IP from prefix or get existing IP address for multiple devices and interfaces.
Branching Support¤
Create IP task is branch aware and can create IP addresses within the branch. Netbox Branching Plugin need to be installed on Netbox instance.
NORFAB Netbox Create IP Command Shell Reference¤
NorFab shell supports these command options for Netbox create_ip task:
nf# man tree netbox.create.ip_bulk
root
└── netbox: Netbox service
└── create: Create objects in Netbox
└── ip-bulk: Allocate next available IP address from prefix for multiple devices and interfaces
├── timeout: Job timeout
├── workers: Filter worker to target, default 'any'
├── verbose-result: Control output details, default 'False'
├── progress: Display progress events, default 'True'
├── nowait: Do not wait for job to complete, default 'False'
├── instance: Netbox instance name to target
├── dry-run: Do not commit to database
├── branch: Branching plugin branch name to use
├── *prefix: Prefix to allocate IP address from, can also provide prefix name or filters
├── *devices: List of device names to create IP address for
├── interface_regex: Regular expression of device interface names to create IP address for
├── interface_list: List of interface names to create IP address for
├── description: IP address description
├── vrf: VRF to associate with IP address
├── tags: Tags to add to IP address
├── dns_name: IP address DNS name
├── tenant: Tenant name to associate with IP address
├── comments: IP address comments field
├── role: IP address functional role
├── mask-len: Mask length to use for IP address
├── create-peer-ip: Create link peer IP address as well
└── status: IP address status
nf#
Python API Reference¤
Bulk assigns IP addresses to interfaces of specified devices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job
|
Job
|
The job instance used for logging and tracking the task. |
required |
prefix
|
Union[str, dict]
|
The IP prefix or a dictionary containing prefix details. |
required |
devices
|
list[str]
|
A list of device names to process. Defaults to None. |
None
|
interface_list
|
list[str]
|
A list of specific interfaces to target. Defaults to None. |
None
|
interface_regex
|
str
|
A regex pattern to match interfaces. Defaults to None. |
None
|
instance
|
Union[None, str]
|
The instance name to use. Defaults to None. |
None
|
kwargs
|
dict
|
Additional arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
Result |
Result
|
A Result object containing the task details, results, and resources. |
Notes
- If both
interface_listandinterface_regexare provided,interface_listtakes precedence. - The
prefixparameter can be a string representing the prefix or a dictionary with additional details.
Source code in norfab\workers\netbox_worker\ip_tasks.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |