Overview
In this article we will walk through the advanced section to add additional information into Extensible Attributes for Host/A/PTR Records and Fixed Addresses.
Note: The Extensible Attribute must already exist in Infoblox.
Considerations
- Have licensed the Infoblox IPAM Module
- Confirmed the fields you wish to populate exist in your infoblox or use the existing available fields
Procedure
Where the advanced feature is located
Note: I will assume you already have an infoblox IPAM Endpoint already configured and wish to add additional information
- In vRA, click on Deployments (1) then click on the filter (2)
- In the filter on the left, under components look for SovLabs Infoblox endpoint and place a check next to this item
- On the right side you will see your infoblox endpoint/s. In the actions drop down (1) for the endpoint and select Update Infoblox Endpoint (2)
- In the Infoblox Endpoint, click on Advanced
- Under advanced options you will see the different areas you can update and add values/attributes.
Adding in extra attributes in JSON format
Note: In this example we will update the attribute named Site that already exists in the infoblox and this will be update in the Fixed Address template. Please see Additional information for links to Infoblox documentation on how to create additional attributes if / as required.
-
Whilst in the advanced options, copy out the text from the Fixed address template
{"name":"{{paramHostname}}","ipv4addr":"{{paramIpaddress}}","mac":"{{paramMac}}","network_view":"{{defaultNetworkView}}","comment":"Created by vRA SovLabs Extensibility Module"}
-
The format we want to add into this will be in the following format
"extattrs":{"FieldName":{"value":"{{FieldValue}}"}}
-
For the example, we will update an existing field called Site and we will populate that field with the mySite name located in the payload.
"extattrs":{"Site":{"value":"{{mySite}}"}}
-
The full code block would be the following
{"name":"{{paramHostname}}","ipv4addr":"{{paramIpaddress}}","mac":"{{paramMac}}","network_view":"{{defaultNetworkView}}","comment":"Created by vRA SovLabs Extensibility Module","extattrs":{"Site":{"value":"{{mySite}}"}}}
- Copy this text back into your Fixed Address template and click on Submit
- When you deploy your VM and it adds in the IP Address into infoblox, you should see the field Site has your Site name.
-
You could add multiple fields, for example you want to add Tenant, Owner (Email) the Site.
NOTE: I used the Infoblox documentation to create my own Extensible Attributes for Owner and Tenant-
The format of the multiple Extensible Attributes to amend would be like the following
"extattrs":{"FieldName1":{"value":"{{FieldValue1}}"},"FieldName2":{"value":"{{FieldValue2}}"},"FieldName3":{"value":"{{FieldValue3}}"}}}
-
The complete code that would be pasted into the template area in the infoblox advanced section would look like
{"name":"{{paramHostname}}","ipv4addr":"{{paramIpaddress}}","mac":"{{paramMac}}","network_view":"{{defaultNetworkView}}","comment":"Created by vRA SovLabs Extensibility Module", "extattrs":{"Owner":{"value":"{{ownerNameEmail}}"},"Site":{"value":"{{mySite}}"},"Tenant":{"value":"{{tenant}}"}}}
-
- So the Fixed Address template will look like the following
- When you deploy your VM you will see the extra information completed
Using template engine and logic to set field values dynamically
Inside your templates you can use not only template engine values but you can use the template engine logic. We will add in a simple IF statement for the site value to set a different value in the infoblox. We will make the value from mySite equal the regions of West, Midwest , Southwest, Southeast and Northeast.
- From the previous steps make a note of the values you have for sites and work out the region they are defined in
Note: I will only list the regions I will populate for this example- West
- Los Angeles
- Southeast
- Atlanta
- Washington DC
- Northeast
- New York
- West
-
Now we will build the IF statement that we will want to use.
{% if mySite == 'Los Angeles' %}West{% elsif mySite == 'Atlanta' or mySite == 'Washington DC' %}Southeast{% elsif mySite == 'New York' %}Northeast{% else %}New Undefined Site{% endif %}
-
The above should now put the region defined against each site opposed to the site name. If we selected Atlanta as the site we should see in infoblox the Site defined as Southeast. The complete code once you add this to your template is as follows
{"name":"{{paramHostname}}","ipv4addr":"{{paramIpaddress}}","mac":"{{paramMac}}","network_view":"{{defaultNetworkView}}","comment":"Created by vRA SovLabs Extensibility Module", "extattrs":{"Owner":{"value":"{{ownerNameEmail}}"},"Site":{"value":"{% if mySite == 'Los Angeles' %}West{% elsif mySite == 'Atlanta' or mySite == 'Washington DC' %}Southeast{% elsif mySite == 'New York' %}Northeast{% else %}New Undefined Site{% endif %}"},"Tenant":{"value":"{{tenant}}"}}}
-
Add this into your infoblox template as you have done in the previous steps
- Test a deploy and see if the logic we have used above has provided the output we expected. The example below was with site of Atlanta selected and the expected outcome should be Southeast
Additional information
Infoblox About Extensible Attributes: https://docs.infoblox.com/display/NAG8/About+Extensible+Attributes
SovLabs Template Engine : https://docs.sovlabs.com/latest/vRA/7.6/framework/sovlabs-template-engine/basics/intro/