cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
662
Views
0
Helpful
2
Replies

Query for available IP address

eubebe
Cisco Employee
Cisco Employee

Hi team

We are working on an NSO DNS service for a customer to provision DNS host record (mapping hostname to IP address) using NSO. The service is expected to:

a. Query a DHCP server for a subnet range (e.g. 1.0.0.0/24). REST API like below;

GET  https://136.180.226.10/wapi/v2.2.2/network?network=1.0.0.0/24

b. And from the output a. (below), request an available IP address from the subnet range

curl -i -k -X POST -H "Content-Type:application/json" https://136.180.226.10/wapi/v2.2.2//network/ZG5zLm5ldHdvcmskMS4wLjAuMC8yNC8w?_function=next_available_ip {"num": 1}

c. Then use the provided / available IP (in this case "1.0.0.2") to provision DNS host records to a DNS server (Infoblox)

Can anyone help with python code (or any code) that we can reuse to achieve the above please?

================================================

Output from a:

HTTP/1.1 200 OK

Date: Fri, 09 Jun 2017 12:39:09 GMT

Cache-Control: no-cache, no-store

Pragma: no-cache

Content-Type: application/json

set-cookie: ibapauth="client=API,group=test_anuta_editor,ctime=1497011949,timeout=28800,mtime=1497011949,ip=146.180.225.84,auth=LOCAL,user=anuta,+/OBWOFyOmA+qShxVmkrPNQzju1d3lqIDJU"; httponly; Path=/; secure

Transfer-Encoding: chunked

[

    {

        "_ref": "network/ZG5zLm5ldHdvcmskMS4wLjAuMC8yNC8w:1.0.0.0/24/default",

        "comment": "Anuta testing",

        "network": "1.0.0.0/24",

        "network_view": "default"

    }

]nsoadmin@vm-225-84-ubuntu:~$

Output from b:

HTTP/1.1 200 OK

Date: Fri, 09 Jun 2017 12:53:42 GMT

Cache-Control: no-cache, no-store

Pragma: no-cache

Content-Type: application/json

set-cookie: ibapauth="client=API,group=test_anuta_editor,ctime=1497012822,timeout=28800,mtime=1497012822,ip=146.180.225.84,auth=LOCAL,user=anuta,w6u/GN9                 V4Aa0/UXSS3aKnzIHJpTKswTIq/M"; httponly; Path=/; secure

Transfer-Encoding: chunked

{

    "ips": [

        "1.0.0.2"

    ]

}curl: (3) [globbing] unmatched brace in column 1

Thanks, Eroms

1 Accepted Solution

Accepted Solutions

rogaglia
Cisco Employee
Cisco Employee

Hi Eroms,

Our infoblox NED shoudl be able to handle this usecase. It uses the Infoblox REST API.

Have you tried it? BTW, such a simple service should be a simple tempate-only service.

Roque

View solution in original post

2 Replies 2

rogaglia
Cisco Employee
Cisco Employee

Hi Eroms,

Our infoblox NED shoudl be able to handle this usecase. It uses the Infoblox REST API.

Have you tried it? BTW, such a simple service should be a simple tempate-only service.

Roque

Hi Roque,

Not sure template alone would be needed for this service. The DNS service should allow the user to either provide a static IP address or request an available IP address from DHCP, to provision DNS host records on Infoblox.

At the moment the service takes static IP address from user and provision the host record on infoblox, which works ok, and we use template for that. But if we are to query DHCP for available IP in a subnet before provisioning the host record, i think we would need some python code here, right?.

Eroms

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: