Reply
Highlighted

next_available_ip()

community Employee
Employee
Posts: 73
9238     0

Does someone have an example on how to invoke the "next_available_ip" function via WAPI? Thanks.

Re: next_available_ip()

FTerlinck
Techie
Posts: 4
9239     0
Hi,1) get the network obj _ref for the network you want.e.g.https://x.x.x.x/wapi/v1.0/network?_return_type=json&_method=GET&comment=MYNETWORK2) invoke the function on this network obj _ref e.g.https://x.x.x.x/wapi/v1.0/network/ZG5zLm5ldHdvcmskMS4yLjMuMC8yNC8w:1.2.3.0%2F24/?_return_type=json&_... also had some troubles trying this, but it was just my syntax. Be sure double check this.

Re: next_available_ip()

user42
Techie
Posts: 35
9239     0
Thanks!Unless I overlooked it - which is very well possible - I didn't see "_function=" documented anywhere. That is where I got stuck. This looks promising! I will give it a shot.Thanks again!

Re: next_available_ip()

I-Team Employee
Employee
Posts: 186
9239     0
It's a bit hidden. Check the WAPI docs on the introduction page for the "function calls" section. I missed it the first couple of times I was digging into the docs, too.

Re: next_available_ip()

Adviser
Posts: 63
9239     0
@KBC : Thanks a lot ! (fellow countryman ?)@chuq : I really can't find a "function call section" on my introduction page. Was there an update I messed ?

Re: next_available_ip()

I-Team Employee
Employee
Posts: 186
9239     0
Axel -- I thought I was working with the same docs you have, but it looks like mine might be a newer internal version. (I'm working on some supplemental docs for WAPI...). Sorry about that.

Re: next_available_ip()

user42
Techie
Posts: 35
9239     0
chug; that explains a lot. I was pulling my hairs out trying to find that reference in my docs. Thought I was going crazy!. LOL.

Re: next_available_ip()

FTerlinck
Techie
Posts: 4
9239     0

@Axel: Yes. Seems like there are more people from the lowlands here. I suspect "rdevries" to be one too Smiley Happy

Re: next_available_ip()

user42
Techie
Posts: 35
9239     0

Hey Guys; yeah, I am originally from the Netherlands but currently live and work in the USA Smiley Happy

Re: next_available_ip()

Adviser
Posts: 63
9239     0

http://en.wikipedia.org/wiki/Le_Plat_Pays

So now we are definitly out of topic :-D

 

Re: next_available_ip()

community Employee
Employee
Posts: 73
9239     0

you guys are funny.

Re: next_available_ip()

Adviser
Posts: 63
9239     0

Well it depends : which sense do you put behind "funny" ? The good one or the bad one :-D

Re: next_available_ip()

HYildirim
Techie
Posts: 11
9239     0

Hi Guys,

 

I have tried same command against InfoBlox box, but could get successful result.

The first query was ok.

https://10.1.1.104/wapi/v1.0/networkview?_return_type=xml-pretty&name=default

it returns 

 

<?xml version="1.0"?><list>  <value type="object">    <is_default type="boolean">true</is_default>    <_ref>networkview/XXXXXXXXXXXXX:default/true</_ref>    <name>default</name>  </value></list>

Once I try to get next available IP in the range, it fails.

 

https://10.1.1.104/wapi/v1.0/network/XXXXXXXXXXX:10.0.0.0/24/default?_function=next_available_ip&num...

I build the URL as described in WAPI Doc v1.0.

Am I missing something? This is very important for us.

We are planing to develop .net client app which would talk to InfoBlox over WAPI ?

 

 

{ "Error": "AdmConProtoError: Function next_available_ip illegal with this method",   "code": "Client.Ibap.Proto",   "text": "Function next_available_ip illegal with this method"}

 

 

 

 

Re: next_available_ip()

HYildirim
Techie
Posts: 11
9239     0

Is there any specific reason to get unsaccesfull message ?

I did follow the rules written under 

1.4 General Syntax and Options.( WAPI doc v1.0 )

thanks

HY

Re: next_available_ip()

HYildirim
Techie
Posts: 11
9239     0

 

I jast wanted to let you guys know that
we have solved the issue...
It was totally my mistake... Unfortunlate, I was using wrong API Object...
now with the correct one, I can get all the information I need...
I got support from my manager... he helped us...
 
Anyway, thanks a lot ....
 
HY
 

what API

jPoyntz
Techie
Posts: 6
9239     0
Hi Hasan I am looking to pull in the next IP address for another system and when I am using https://:/24/default?_function=next_available_ip&num=3 I am getting the same error you reported. you said you were using the wrong API object. Can you provide an example that is working for you or what API Object you are using Cheers

you have to get the _ref

GHorne Community Manager
Community Manager
Posts: 254
9239     0

you have to get the _ref to the network before you can cal the function, so you can't use a GET and reference the network by name.

'_function' params only work with a POST ( not a GET ).

and you can only have the _function as a param. the 'num' field has to be passed in the body:

go you would need :

 GET /wapi/v1.4.1/network?network=1.2.3.0/24

 POST /wapi/v1.2/network/ZG5zLm5ldHdvcmskMS4xLjEuMC8yNC83?_function=next_available_ip
 Content-Type: application/json

  {"num": 1}

Hi Geoff

jPoyntz
Techie
Posts: 6
9239     0

Hi Geoff

I am trying to integrate this into our helpdesk system so that when a user requets a new VM we can provision as soon as it is approved.

Getting the next IP address if the current issue Smiley Happy

taking what you have explained above, I now have the system sending our a GET command for a subnet and returning good data

*** Script: [
    {
        "_ref": "network/1234567890:10.193.152.0/24/default",
        "comment": "something goes here",
        "network": "10.193.152.0/24",
        "network_view": "default"
    }
]

 

I then try a post

var r = new RESTMessageScripted("post","https://<server>/wapi/v1.4.1/network/1234567890?function=next_available_ip");
r.addHeader("Content-Type", "application/json");
r.addRequestParameter("num","1");
r.execute()

I am getting no returned data, but looking at the XML that is retrieved I am getting

 

<results error="Method failed: (/wapi/v1.4.1/network/1234567890) with code: 400" probe_time="125">
<result error="Method failed: (/wapi/v1.4.1/network/1234567890) with code: 400">
<output>
{ "Error": "AdmConProtoError: JSON Decoding: No JSON object could be decoded", "code": "Client.Ibap.Proto.JSONDecoding", "text": "JSON Decoding: No JSON object could be decoded" }
</output>

 

I assume it is to do with the content that is sent, but I have tried numerous values with no success so far

I shall persevere, but if you have any suggestions they would be appreciated

I have it working now.  I had

jPoyntz
Techie
Posts: 6
9239     0

I have it working now.  I had two issues.

First, the app I am using was truncating the url.  I have shortened the URL by removing the FQDN and that is good. I have asked how to increase in case I get more issues with long URL's

the second is that I had ?function and not ?_function

 

Cheers

Showing results for 
Search instead for 
Do you mean 

Recommended for You