Are you interested in our Early Access Program (EAP)? This program allows you to preview code, test in your lab and provide feedback prior to General Availability (GA) release of all Infoblox products. If so, please click the link here.

API & Integration, DevOps,NetOps,SecOps

Reply

How to Create reservations with REST and PowerShell

Techie
Posts: 3
7818     0

Instead of creating Host entries, we create IPv4 reservations - Data Management->DHCP->SubNet->Add->Reservation

 

I would like to do this via PowerShell but have been unable to find anything that explains how to do it.

 

Reading the code in the most excellent module "Posh-IBWAPI" (Available from the PowerShell gallery), as well as The Definitive Guide To Rest Examples (https://community.infoblox.com/t5/API-Integration/The-definitive-list-of-REST-examples/td-p/1214)  I have figured out a lot about how to manipulate Infoblox with REST; except for how to create IPv4 DHCP Reservations.

 

I realise this could also be a case of not knowing the terminology as I am not super au fait with Infoblox.

 

Any direct links to this specific information or code examples would be very much appreciated.

Re: How to Create reservations with REST and PowerShell

Adviser
Posts: 179
7819     0

Hi,

 

You can do this by creating a fixed address reservation.

 

Here is a sample curl command. You can modify it according to your need.

curl -k -u admin:Infoblox -H 'content-type: application/json' -X POST "https://127.0.0.1/wapi/v2.9/fixedaddress?_return_fields%2B=ipv4addr,mac&_return_as_object=1" -d '{"ipv4addr":"172.26.1.200","mac":"00:00:00:00:00:00"}'

Hope this is helpful,

Krishna

Re: How to Create reservations with REST and PowerShell

Techie
Posts: 3
7819     0

Hi Kvasudevan,

 

Thanks, but as I don't know curl, it isn't really useful for me, but thanks for trying.

Re: How to Create reservations with REST and PowerShell

Adviser
Posts: 179
7819     0

Hi,

 

Here is a powershell code snippet

$url = "https://127.0.0.1/wapi/v2.9/fixedaddress?_return_fields%2B=ipv4addr,mac&_return_as_object=1"
$pwd = ConvertTo-SecureString "Infoblox" -AsPlainText -Force
$creds = New-Object Management.Automation.PSCredential ('admin', $pwd)
$reservation_details = @{
  ipv4addr="172.26.1.100"
  mac="00:00:00:00:00:00"}
$body = $reservation_details | ConvertTo-Json
Invoke-RestMethod -Uri $url -Method POST -Credential $creds -ContentType 'application/json' -Body $body

Re: How to Create reservations with REST and PowerShell

Techie
Posts: 3
7819     0

Thanks, that looks like something I recognise and can put into our environment. :-)

Re: How to Create reservations with REST and PowerShell

[ Edited ]
Guru
Posts: 20
7819     0

How would one add Extensible Attibutes to this script.  Assume EA1 = a number 999, and EA2 = "text"

Showing results for 
Search instead for 
Did you mean: 

Recommended for You