Project

General

Profile

Task #6998

Install & Setup netbox on an IPv6 only VM and find out how to get / reserve the next free ip address

Added by Ahmed Bilal 3 months ago. Updated 6 days ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
07/25/2019
Due date:
% Done:

0%

Estimated time:
PM Check date:

Description

Checkout whether getting "the next free IP address" works nicely via API for IPv6 and IPv4
If yes, we can use netbox as an IPAM backend


Related issues

Related to Open Infrastructure - Task #7129: Turn the netbox installation into a production setupClosed09/10/201909/15/2019

Actions

History

#1

Updated by Ahmed Bilal 3 months ago

  • Assignee changed from Ahmed Bilal to Nico Schottelius
  • Status changed from Seen to Feedback
#2

Updated by Nico Schottelius about 2 months ago

  • Assignee changed from Nico Schottelius to Ahmed Bilal
  • Status changed from Feedback to Seen
  • Subject changed from Install & Setup netbox on an IPv6 only VM to Install & Setup netbox on an IPv6 only VM and find out how to get / reserve the next free ip address

ping. please create a proof of concept for getting the next free ip address of a network via the API. Test it for IPv6 and IPv4. Document the commands used.

#3

Updated by Ahmed Bilal about 2 months ago

Nico Schottelius wrote:

ping. please create a proof of concept for getting the next free ip address of a network via the API. Test it for IPv6 and IPv4. Document the commands used.

OK.

#4

Updated by Ahmed Bilal about 2 months ago

  • Assignee changed from Ahmed Bilal to Nico Schottelius
  • Status changed from Seen to Feedback

For credentials, see channel org-ahmedbilal

I created a prefix 2a0a:e5c1:144:1::/64 using netbox web interface. It can be seen at http://netbox-dev.ungleich.ch/ipam/prefixes/1/ then use netbox's official Python library pynetbox to get and consume next free ip

import pynetbox

# Create connection
nb = pynetbox.api('http://netbox-dev.ungleich.ch/', 
                  token='6042908243ca4b3cb81040064165eb187af48b6f')

# Get prefix of which we want to get
# next free ip address of
prefix = nb.ipam.prefixes.get(1)

# Get free IP
free_ip = prefix.available_ips.list()[0]
print("Free IP", free_ip)

# Consume or Mark that IP as used
prefix.available_ips.create(data={"address": free_ip["address"]})

print("Free IP after using last", prefix.available_ips.list()[0])

Output:

Free IP {'family': 6, 'address': '2a0a:e5c1:144:1::/64', 'vrf': None}
Free IP after using last {'family': 6, 'address': '2a0a:e5c1:144:1::1/64', 'vrf': None}
#5

Updated by Nico Schottelius about 1 month ago

  • Related to Task #7129: Turn the netbox installation into a production setup added
#6

Updated by Ahmed Bilal 21 days ago

Related task is also complete.

#7

Updated by ll nu 6 days ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF