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
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | |