Reply

Create Fixed Address - Web Api

Not applicable
Posts: 1
11882     0

I am looking to create a new Fixed Address using the Infoblox API but I am running into a problem. I know it is possible to create a Fixed Address using the PERL API, but the Web API documentation says that ipv4address object is restricted from inserts and updates.

How can I go about creating a Fixed Address using the Web API if the ipv4address object cannot be used?

Thank you in advance for your help!

Re: Create Fixed Address -

Techie
Posts: 3
11882     0

An ipv4address object is not the same as an ipv4 fixed address object. It doesn't look like WAPI provides an object for a fixed address. Maybe Infoblox hasn't built that yet?

It also looks like you can't get around it using a host record. You can search the MAC field there, but not set it.

 

Sorry I don't have a "make-it-work" answer.

Re: Create Fixed Address -

Employee
Employee
Posts: 171
11882     0

no, it doesn't exist at this time. I'd suggest talking to your rep or support and make sure an RFE gets filed requesting this. That way we can track interest and you'll get updates on its status. I'll also pass this along to the product manager. 

No support for Fixed Address in API?

Adviser
Posts: 75
11882     0

So to be clear, there is no support to create a DHCP Fixed Address via the Web API?  Further, there is no support to create a fix address inside of a host?  We do this today via the Perl API.

The online API guide (at <gm>/wapidoc/objects/record.host.html) says this:

record:host : DNS Host record object.

A host record defines attributes for a node, such as the name-to-address and address-to-name mapping. This alleviates having to specify an A record and a PTR record separately for the same node. A host can also define aliases and DHCP fixed address nodes. The zone must be created first before adding a host record for the zone.

 

Am I to understand that this is NOT available??

Creating a host record with DHCP fixed address

Adviser
Posts: 138
11882     0

I was intrigued by this question, so I did some testing on my lab system (running NIOS 6.11). Apparently it is possible to create a host record with an associated DHCP fixed address in version 1.0 and later of the Infoblox Web API (corresponding to NIOS 6.6 or later). You can also create a DHCP fixed address by itself (i.e., not as part of a host record), but this requires WAPI version 1.1 or later (NIOS 6.7 or later).

Here is example code in Python, including some basic error checking; the code uses the Python requests module, which I think is one of the cleaner ways to do web API programming:

# Import the required Python modules.                                           
import sys
import requests
import json

# IP address and corresponding MAC address, network, and name.                         
ip = '192.168.201.7'
mac = '01:23:45:67:89:ab'
fqdn = 'fixed-test-2.example.com'

# Create a new host record using a DHCP fixed address.                          
host_data = {'name': fqdn,
             'ipv4addrs': [{'ipv4addr': ip,
                            'configure_for_dhcp': True,
                            'mac': mac}]}
r = requests.post('https://gm.example.com/wapi/v1.0/record:host',
                  data=json.dumps(host_data),
                  auth=('admin', 'infoblox'),
                  verify=False)
if r.status_code != requests.codes.created:
    sys.exit('Error {} creating host: {}'.format(r.status_code, r.reason))

If you don't use host records then note that it's also possible in WAPI 1.1+ to create a plain old DHCP fixed address. In the above code you'd replace the final section of code with the following:

# Create a DHCP fixed address for the specified IP and MAC address.
data = {'name': fqdn,
        'ipv4addr': ip,
        'match_client': 'MAC_ADDRESS',
        'mac': mac}
r = requests.post('https://gm.example.com/wapi/v1.1/fixedaddress',
                  data=json.dumps(data),
                  auth=('admin', 'infoblox'),
                  verify=False)
if r.status_code != requests.codes.created:
    sys.exit('Error {} creating fixed address'.format(r.status_code, r.reason))

Need to create a fixed address

Not applicable
Posts: 1
11882     0
New to Infoblox and network. Using version 1.6. Need to create a static address record. I am using BMC Atrium Orchstration REST workflows. I am able to search networks and obtain next availalbe IP. With the next available IP I would like to assign this IP to a Hostname. I have tried using https://###.###.##/wapi/v1.6/fixedaddress and I receive an error that fixedaddress is an unknown object. Also, I find the documentation very difficult to follow. Any help is welcomed. Thanks Update, I believe I was able to get passed the unknown object issue, can someone give me values for match_client? My customers (internal) do not plan to pass a mac address. Thanks

Are you using actual DHCP fixed addresses, or static addresses?

Adviser
Posts: 138
11882     0

@Gus Navas: Just to clarify, do you want to create an actual DHCP fixed address (whether in conjunction with a host record or not), or a host record for a statically-assigned IP address?

A DHCP fixed address assumes that the end host in question is going to use DHCP to get an IP address, and will pass some information in the DHCP request (e.g., a MAC address) that the Infoblox system will use to determine which (fixed) address to use for the DHCP lease. You can create a DHCP fixed address in one of two ways:

  1. Create a plain DHCP fixed address object (using a POST request to https://###.###.##/wapi/1.6/fixedaddress) independent of any host record or A record created. See my code above for how to do this in Python using WAPI 1.1 or later. The data submitted with the POST request should have a match_client field and a field supplying a corresponding value used for matching; <value> is a string with the appropriate field value:
    • match_client = "MAC_ADDRESS", mac = <value>
    • match_client = "CIRCUIT_ID", agent_circuit_id = <value>
    • match_client = "REMOTE_ID", agent_remote_id = <value>
    • match_client = "CLIENT_ID", dhcp_client_identifier = <value>
  2. Create a host record (using a POST request to https://###.###.##/wapi/1.6/record:host) with configure_for_dhcp set to True. Again, see my example Python code above. I haven't done much testing of this, but from the API document it appears that this method would only work if you're using a MAC address when matching clients.

Now, if the end host is not using DHCP at all, but rather has a statically-assigned IP address, then you can just create a standard host record for the end host (again, using a POST request to https://###.###.##/wapi/1.6/record:host) using the following Python code (which works in all WAPI versions from 1.0 on):

# Create a new host record using a static IP address.
host_data = {'name': fqdn, 'ipv4addrs': [{'ipv4addr': ip}]}
r = requests.post('https://###.###.##/wapi/v1.0/record:host',
                    data=json.dumps(host_data),
                    auth=('admin', 'infoblox'),
                    verify=False)

Re: Are you using actual DHCP fixed addresses, or static addresses?

Techie
Posts: 3
11882     0

My question is related to the same, however lets say there is already a DHCP range setup, and I just want to statically assign IP's (hosts) based on a MAC address (DHCP static reservation) but I want to also assign specific option codes, and want to force the option codes to be pushed regarless of if the client requests the option codes or not. There is a button you have to select this for and the option codes will be pushed. 

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You