Netbox Create IP Task¤
task api name:
create_ip
Task to create next available IP from prefix or get existing IP address.
Netbox service create_ip
task integrated with Nornir service and can be called
using nb_create_ip Jinja2 filter,
allowing to allocate IP addresses in Netbox on the fly while rendering configuration templates.
NORFAB Netbox Create IP Command Shell Reference¤
NorFab shell supports these command options for Netbox create_ip
task:
nf#man tree netbox.create.ip
root
└── netbox: Netbox service
└── create: Create objects in Netbox
└── ip: Allocate next available IP address from prefix
├── instance: Netbox instance name to target
├── workers: Filter worker to target, default 'any'
├── timeout: Job timeout
├── verbose-result: Control output details, default 'False'
├── *prefix: Prefix to allocate IP address from, can also provide prefix name or filters
├── device: Device name to associate IP address with
├── interface: Device interface name to associate IP address with
├── 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
└── dry-run: Do not commit to database
nf#
Python API Reference¤
Allocate the next available IP address from a given subnet.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job
|
Job
|
NorFab Job object containing relevant metadata |
required |
prefix
|
str
|
The prefix from which to allocate the IP address. |
required |
description
|
str
|
A description for the allocated IP address. |
None
|
device
|
str
|
The device associated with the IP address. |
None
|
interface
|
str
|
The interface associated with the IP address. |
None
|
vrf
|
str
|
The VRF (Virtual Routing and Forwarding) instance. |
None
|
tags
|
list
|
A list of tags to associate with the IP address. |
None
|
dns_name
|
str
|
The DNS name for the IP address. |
None
|
tenant
|
str
|
The tenant associated with the IP address. |
None
|
comments
|
str
|
Additional comments for the IP address. |
None
|
instance
|
str
|
The NetBox instance to use. |
None
|
dry_run
|
bool
|
If True, do not actually allocate the IP address. Defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Result
|
A dictionary containing the result of the IP allocation. |
Source code in norfab\workers\netbox_worker.py
2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 |
|