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()
[{u'vrf': None, u'family': 4, u'address': u'10.1.1.49/30'}...]

To create a single IP:

>>> prefix = nb.ipam.prefixes.get(24)
>>> prefix.available_ips.create()
{u'status': 1, u'description': u'', u'nat_inside': None...}

To create multiple IPs:

>>> prefix = nb.ipam.prefixes.get(24)
>>> create = prefix.available_ips.create([{} for i in range(2)])
>>> len(create)
2
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.available_prefixes.list()
[{u'prefix': u'10.1.1.44/30', u'vrf': None, u'family': 4}]

Creating a single child prefix:

>>> prefix = nb.ipam.prefixes.get(1)
>>> new_prefix = prefix.available_prefixes.create(
...    {'prefix_length': 29}
...)
>>> new_prefix['prefix']
u'10.1.1.56/29'