IPAM

class pynetbox.models.ipam.Prefixes(values, api, endpoint)
available_ips

Represents the available-ips detail endpoint.

Returns a DetailEndpoint object that is the interface for viewing and creating IP addresses inside a prefix.

Returns:DetailEndpoint
Examples:
>>> prefix = nb.ipam.prefixes.get(24)
>>> prefix.available_ips.list()
[10.0.0.1/24, 10.0.0.2/24, 10.0.0.3/24, 10.0.0.4/24, 10.0.0.5/24, ...]

To create a single IP:

>>> prefix = nb.ipam.prefixes.get(24)
>>> prefix.available_ips.create()
10.0.0.1/24

To create multiple IPs:

>>> prefix = nb.ipam.prefixes.get(24)
>>> create = prefix.available_ips.create([{} for i in range(2)])
>>> create
[10.0.0.2/24, 10.0.0.3/24]
available_prefixes

Represents the available-prefixes detail endpoint.

Returns a DetailEndpoint object that is the interface for viewing and creating prefixes inside a parent prefix.

Very similar to available_ips() , except that dict (or list of dicts) passed to .create() needs to have a prefix_length key/value specifed.

Returns:DetailEndpoint
Examples:
>>> prefix = nb.ipam.prefixes.get(3)
>>> prefix
10.0.0.0/16
>>> prefix.available_prefixes.list()
[10.0.1.0/24, 10.0.2.0/23, 10.0.4.0/22, 10.0.8.0/21, 10.0.16.0/20, 10.0.32.0/19, 10.0.64.0/18, 10.0.128.0/17]

Creating a single child prefix:

>>> prefix = nb.ipam.prefixes.get(1)
>>> prefix
10.0.0.0/24
>>> new_prefix = prefix.available_prefixes.create(
...     {"prefix_length": 29}
... )
>>> new_prefix
10.0.0.16/29
class pynetbox.models.ipam.VlanGroups(values, api, endpoint)
available_vlans

Represents the available-vlans detail endpoint.

Returns a DetailEndpoint object that is the interface for viewing and creating VLANs inside a VLAN group.

Available since NetBox 3.2.0.

Returns:DetailEndpoint
Examples:
>>> vlan_group = nb.ipam.vlan_groups.get(1)
>>> vlan_group.available_vlans.list()
[10, 11, 12]

To create a new VLAN:

>>> vlan_group.available_vlans.create({"name": "NewVLAN"})
NewVLAN (10)