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\netbox_worker.py
3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 | |