THE GAME HAS CHANGED

Introducing Infoblox Universal DDI ManagementTM

Watch the launch to discover the new era of management for critical network services. Watch Now

API & Integration, DevOps,NetOps,SecOps

Reply

Resize network with Infoblox API

New Member
Posts: 1
332     1

Hello,

 

I would like to know if it's possible to use the function " resize network " with the API ?

 

This function :

resize.PNG

 

I want to integrate this function into my Python script. 

An example curl command using this function would be a great help !

 

Thanks,

Florian

Re: Resize network with Infoblox API

[ Edited ]
Moderator
Moderator
Posts: 315
332     1

Suppose we have a network 10.1.10.0/24 in the "default" network view that needs to be resize to a /23. And assume it's clear to be resized, meaning there's no other networks within 10.1.10.0/23 that would interfere with the resizing.

Here's what the WAPI call with curl would look like. It can be done in two separate steps, or those steps can be combined into one WAPI call.

 

For two separate steps, first the _ref for the network is required.

 

curl -k -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.12/network?network=10.1.10.0/24&network_view=default'

returns

[
    {
        "_ref": "network/ZG5zLm5ldHdvcmskMTAuMS4xMC4wLzI0LzA:10.1.10.0/24/default",
        "network": "10.1.10.0/24",
        "network_view": "default"
    }
]

Now the resize function can be called:

curl -k -u admin:infoblox -X POST 'https://192.168.1.2/wapi/v2.12/network/ZG5zLm5ldHdvcmskMTAuMS4xMC4wLzI0LzA:10.1.10.0/24/default?_function=resize&prefix=23'

If successful, the result is empty:

 {}

If unsuccessful, such as if there's a network conflict in the new /23 address space, an error will be returned:

 

{ "Error": "AdmConDataError: None (IBDataConflictError: IB.Data.Conflict:Cannot resize a network smaller than /24.)",
  "code": "Client.Ibap.Data.Conflict",
  "text": "Cannot resize a network smaller than /24."
}

 

This same work be done in one step using a multibody request with variable substitution. Note that the subnet mask is sent as raw integer, not as a quoted string value.

curl -k1 -u admin:infoblox -X POST 'https://192.168.1.2/wapi/v2.12/request' -H "Content-Type: application/json" -d \
'[{
  "method":"GET",
  "object":"network",
  "data":{
	"network": "10.1.10.0/24",
	"network_view": "default"
  },
  "enable_substitution": true,
  "assign_state": {"my_net":"_ref"},
  "discard": true
},
{
  "method":"POST",
  "enable_substitution": true,
  "object": "##STATE:my_net:##",
  "args":{"_function":"resize"},
  "data":{
    "prefix":23
  }
}]'

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You