Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

API & Integration, DevOps,NetOps,SecOps

Reply

error while configuring next_available_IP for IPv6 using request method single call

Techie
Posts: 9
7260     0

So, I wanted to configure next available IP address using request single call.

 

Here's my IPv4 call: https://{{grid_ip}}/wapi/v2.9.5/request

 

and then I'm passing all parameters as follow: (apologies if I'm not using correct terminology)

 

[{
    "method": "POST",
    "object": "record:host",
    "data": { "configure_for_dns": false,
                  "ipv4addrs":[{"configure_for_dhcp": false,
                                        "ipv4addr":{"_object_function":"next_available_ip",
                                                           "_result_field":"ips",
                                                           "_object" : "network",
                                                           "_object_parameters":{"network":"10.10.10.0/24"}}}],
                "name": "CPE_1",
                "network_view": "sandbox"},
    "args": { "_return_fields": "name" }
}] 

and this one works perfectly fine and I'm able to configure next available IPv4 address. now, I'm trying to do same thing for IPv6

[{
    "method": "POST",
    "object": "record:host",
    "data": { "configure_for_dns": false,
                  "ipv6addrs":[{"configure_for_dhcp": false,
                                        "ipv6addr":{"_object_function":"next_available_ip",
                                                           "_result_field":"ips",
                                                           "_object" : "ipv6network",
                                                           "_object_parameters":{"network":"2600:6801:1106:f00::f00/120"}}}],
                "name": "CPE_1",
                "network_view": "sandbox"},
    "args": { "_return_fields": "name" }
}] 

 

but when i run this query, I got following error:

{
"Error": "AdmConProtoError: The search parameters {\"network\": \"2600:6801:1106:f00::f00/120\"} for object ipv6network returned multiple objects",
"code": "Client.Ibap.Proto",
"text": "The search parameters {\"network\": \"2600:6801:1106:f00::f00/120\"} for object ipv6network returned multiple objects"
}

according to this document:
https://infoblox-use1.viasat.cloud/wapidoc/objects/record.host_ipv6addr.html
but example provided here is for Ipv4 and not for ipv6 and when I try to do same for IPv6 I got above error.
 
Can anyone try out and point me as to what i am doing wrong here?
 

 

Re: error while configuring next_available_IP for IPv6 using request method single call

Adviser
Posts: 181
7260     0

Hi,

 

Do you have the same IPv6 network(2600:6801:1106:f00::f00/120) in different network views on your grid?

 

If yes, please add the network_view parameter in your list of _object_parameters like below:

'_object_parameters': {
        'network': '2600:6801:1106:f00::f00/120',
        'network_view': 'replace_with_your_network_view',
    }

Hope this helps,

Krishna Vasudevan

Re: error while configuring next_available_IP for IPv6 using request method single call

Techie
Posts: 9
7260     0

YES!!! You're right


That one worked. However, I have to define Network_View twice in the body part. 

[{
"method": "POST",
"object": "record:host",
"data": { "configure_for_dns": false,
"ipv6addrs":[{"configure_for_dhcp": false,
"ipv6addr":{"_object_function":"next_available_ip",
"_result_field":"ips",
"_object" : "ipv6network",
"_object_parameters":{"network":"2600:6801:1106:f00::f00/120", "network_view": "sandbox"}}}],
"network_view": "sandbox",
"name": "Loopback-4"},
"args": { "_return_fields": "name,ipv6addrs,network_view" }
}]

 

Is It because I have the same subnet in 2 different network Views? If you can explain as to why I need to use twice I would make things clear.

 

Just to test it out I created a dummy IPv6 network and it worked fine. So, I guess it was the issue with conflicting IPv6 addresses in 2 different views. 

[{
"method": "POST",
"object": "record:host",
"data": { "configure_for_dns": false,
"ipv6addrs":[{"configure_for_dhcp": false,
"ipv6addr":{"_object_function":"next_available_ip",
"_result_field":"ips",
"_object" : "ipv6network",
"_object_parameters":{"network":"2600:6801:1106:f00::e00/126"}}}],
"network_view": "sandbox",
"name": "Loopback-5"},
"args": { "_return_fields": "name,ipv6addrs,network_view" }
}]

 

Thanks,

Harsh

 

 

Re: error while configuring next_available_IP for IPv6 using request method single call

Adviser
Posts: 181
7261     0

Hi,

 

The first network view (in the _object_parameters) indicates that the network you are looking for is in the network view 'sandbox'.

 

The second network view (network_view) indicates that the host record you are creating is created within the network view 'sandbox'.

 

I hope this makes sense,

Krishna Vasudevan

Re: error while configuring next_available_IP for IPv6 using request method single call

Techie
Posts: 9
7261     0

It absolutely does. Many Thanks, Krishna.

Re: error while configuring next_available_IP for IPv6 using request method single call

New Member
Posts: 2
7261     0

Hi,

I'm trying to get next available ip from 10.10.1.0.0/24 network in specific view.
However im keep getting following error:

{ "Error": "AdmConProtoError: JSON Decoding: Expecting property name: line 2 column 1 (char 3)",
"code": "Client.Ibap.Proto.JSONDecoding",
"text": "JSON Decoding: Expecting property name: line 2 column 1 (char 3)"



Im not sure anymore if this is formating issue or Im doing something wrong?

My code below:


curl -k -u admin:password -H "Content-Type: application/json" -X POST "https://ipam.local.net/wapi/v2.10.3/request" -d \
'[{
	"method": "POST",
	"object": "record:host",
	"data": {
		"configure_for_dns": false,
		"ipv4addrs": [{
			"configure_for_dhcp": false,
			"ipv4addr": {
				"_object_function": "next_available_ip",
				"_result_field": "ips",
				"_object": "network",
				"_object_parameters": {
					"network": "10.10.10.0/24"
					"network_view": "TEST",
					"extattrs":{"VLAN":{"value":"11"}, "Site":{"value": "CHTES"}}
				}
			}
		}],
		"name": "test1",
		"comment": "Test Object"
		"network_view": "TEST"
	},
	"args": {
		"_return_fields": { "_return_fields": "name,ipv4addr,network_view,extattrs" }
	}
}]'


Kindly let me know what is the issue, as it drives me mad Smiley Happy

Thx!

Re: error while configuring next_available_IP for IPv6 using request method single call

Moderator
Moderator
Posts: 287
7261     0

Yeah this can be frustrating!  Try the version below.

 

A few notes:

- I've found that spaces work better than tabs for indenting, at least on Mac OSX

- the extattrs are not needed to select the network.

- _return_fields is inside of itself, it's only needed once

- added a missing comma after the comment

 

curl -k1 -u admin:infoblox -X POST 'https://ipam.local.net/wapi/v2.10.3/request' -H "Content-Type: application/json" -d \
'[{
  "method": "POST",
  "object": "record:host",
  "data": {
    "configure_for_dns": false,
    "ipv4addrs": [{
      "configure_for_dhcp": false,
      "ipv4addr": {
        "_object_function": "next_available_ip",
        "_result_field": "ips",
        "_object": "network",
        "_object_parameters": {
          "network": "10.10.10.0/24",
          "network_view": "TEST"
        }
      }
    }],
    "name": "test1",
    "comment": "Test Object",
    "network_view": "TEST"
  },
  "args": {
    "_return_fields": "name,ipv4addrs,network_view,extattrs"
  }
}]'

 

 

 

 

Re: error while configuring next_available_IP for IPv6 using request method single call

New Member
Posts: 2
7261     0

Mr/Mrs MRichard Community Manager

 
You are the life saver Smiley Happy

It does work. I have need to get "next_available_ip" by extattrs - for example: VLAN and Site code.
I will play with it and try to get this working also.

For now this works!

Do you know how I can create lets say 5 next_available_ip? Can I just use:

"_parameters": {"num": 5, "exclude": ["10.3.0.1"]}
Just cant get my head around how I will pass name object?

Below is working code, Thx once again Smiley Happy


curl -k -u admin-ansible:password -H "Content-Type: application/json" -X POST "https://ipam.glencore.net/wapi/v2.10.3/request" -d \
'[{
  "method": "POST",
  "object": "record:host",
  "data": {
    "configure_for_dns": false,
    "ipv4addrs": [{
      "configure_for_dhcp": false,
      "ipv4addr": {
        "_object_function": "next_available_ip",
        "_result_field": "ips",
        "_object": "network",
        "_parameters": {"exclude": ["10.10.10.1"]},
        "_object_parameters": {
          "network": "10.10.10.0/24",
          "network_view": "TEST"
        }
      }
    }],
    "name": "test1",
    "comment": "Test Object",
    "network_view": "TEST"
  },
  "args": {
    "_return_fields": "name,ipv4addrs,network_view,extattrs"
  }
}]'

Re: error while configuring next_available_IP for IPv6 using request method single call

[ Edited ]
Moderator
Moderator
Posts: 287
7261     0

In this case we're making a single host record, and then assigning the IP address using the next_available_ip function.  so the "num" parameter doesn't have any effect.

 

You could use separate calls for each host, or you could use one multibody-request call with requests for each host.

 

Here's a different multibody-request example.

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You