Reply

IPAM IPv4 DHCP options python script

[ Edited ]
Member
Posts: 2
3252     0

IPv4 DHCP Options.PNGMember Assignment.PNG

Hello

I am trying to write a script in Pyhton using API Calls. I want to set following parameters: Lease time, Routers, Domain Name, DNS Servers and I have two members to assign for multiple networks in IPAM. Is this possible and could someone give me an example? I searched through the documentation but didn't find examples nor do I know how those parameters are called. Thanks in advance!

Re: IPAM IPv4 DHCP options python script

Authority
Posts: 18
3253     0

Hello,

 

I believe you are looking for the below API calls (using curl examples):

 

1. To call the mentioned object parameters (Lease time, DNS Servers, Domain Name, Routers and Members):

 

curl -k -u admin:infoblox -X GET https://infoblox.local/wapi/v2.7/network?_return_fields%2B=options,members

 

2. To modify the parameters using API (with curl):

 

curl -k -u admin:infoblox -X PUT https://infoblox.local/wapi/v2.7/network/ZG5zLm5ldHdvcmskMS4xLjEwLjAvMjQvMA:1.1.10.0/24/default -d '{"options":[{"name": "dhcp-lease-time","use_option": true,"value":"7777"},{"name": "domain-name-servers", "use_option": true, "value": "12.12.12.12,78.78.78.78"},{"name": "domain-name", "use_option": true, "value": "abc.com"},{"name": "routers", "use_option": true, "value": "1.1.10.100"}], "members":[{"_struct":"dhcpmember","ipv4addr":"10.192.16.247"}]}' -H "content-type: application/json"

 

 

Hope this helps.

 

Regards

Showing results for 
Search instead for 
Did you mean: 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin