Setting Extensible Attributes Dynamically - Infoblox

Sam Richards
by Sam Richards

Categories

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

  1. In vRA, click on Deployments (1) then click on the filter (2)


  2. In the filter on the left, under components look for SovLabs Infoblox endpoint and place a check next to this item


  3. 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)


  4. In the Infoblox Endpoint, click on Advanced


  5. 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.

  1. Whilst in the advanced options, copy out the text from the Fixed address template

    {"name":"","ipv4addr":"","mac":"","network_view":"","comment":"Created by vRA SovLabs Extensibility Module"}
  2. The format we want to add into this will be in the following format

    "extattrs":{"FieldName":{"value":""}}
  3. 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":""}}
  4. The full code block would be the following

    {"name":"","ipv4addr":"","mac":"","network_view":"","comment":"Created by vRA SovLabs Extensibility Module","extattrs":{"Site":{"value":""}}}
  5. Copy this text back into your Fixed Address template and click on Submit


  6. When you deploy your VM and it adds in the IP Address into infoblox, you should see the field Site has your Site name. 


  7. 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

    1. The format of the multiple Extensible Attributes to amend would be like the following

      "extattrs":{"FieldName1":{"value":""},"FieldName2":{"value":""},"FieldName3":{"value":""}}}
    2. The complete code that would be pasted into the template area in the infoblox advanced section would look like

      {"name":"","ipv4addr":"","mac":"","network_view":"","comment":"Created by vRA SovLabs Extensibility Module",
      "extattrs":{"Owner":{"value":""},"Site":{"value":""},"Tenant":{"value":""}}}
  8. So the Fixed Address template will look like the following


  9. 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.

  1. 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
    1. West
      1. Los Angeles
    2.  Southeast
      1. Atlanta
      2. Washington DC
    3. Northeast
      1. New York
  2. Now we will build the IF statement that we will want to use.

    New Undefined Site
  3. 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":"","ipv4addr":"","mac":"","network_view":"","comment":"Created by vRA SovLabs Extensibility Module", "extattrs":{"Owner":{"value":""},"Site":{"value":"New Undefined Site"},"Tenant":{"value":""}}}



  4. Add this into your infoblox template as you have done in the previous steps


  5. 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 : http://docs.sovlabs.com/latest/vRA/7.6/framework/sovlabs-template-engine/basics/intro/

The first step in providing reliable self-service automation for your CMP is starting a free trial.

Free Trial
Wave One Wave One
Wave Two Wave Two