Project

General

Profile

Actions

Task #6998

closed

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

Added by Ahmed Bilal over 4 years ago. Updated over 4 years 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 1 (0 open1 closed)

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

Actions
Actions #1

Updated by Ahmed Bilal over 4 years ago

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

Updated by Nico Schottelius over 4 years ago

  • 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
  • Status changed from Feedback to Seen
  • Assignee changed from Nico Schottelius to Ahmed Bilal

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.

Actions #3

Updated by Ahmed Bilal over 4 years 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.

Actions #4

Updated by Ahmed Bilal over 4 years ago

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

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}
Actions #5

Updated by Nico Schottelius over 4 years ago

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

Updated by Ahmed Bilal over 4 years ago

Related task is also complete.

Actions #7

Updated by ll nu over 4 years ago

  • Status changed from Feedback to Closed
Actions

Also available in: Atom PDF