In this how to we will cover how to dynamically select an IPAM Profile by using a custom property with a case/when statement on your blueprint and linking that custom property to a drop down on your blueprint ie; Environment to dynamically select the appropriate IPAM profile for your environment.



  • Have licensed and installed the SovLabs foundations modules



Property definition to base your custom property off

You have to decide what value you want to base your IPAM selection off.  For me I have a value defined in my custom naming for environments.  I will base my IPAM profile selection based off this drop down selection.  You may want to create a new property definition for this.

  1. Select an existing OR create a new Property Definition for the user-selectable dropdown, for example; In this example,  I have a drop down defined as part of my custom naming. This is called Naming_Environments and provides each of the different environments I need on my blueprint.

Building your case statement

  1. From the property definition, make a note of your values.  These values will be used to switch between the different IPAM profiles. (Make note of the property definition name)
    In my example I have the following values:
    1. D
    2. T
    3. E
    4. P
  2. Make a note of the Nic0 IPAM Name for the different IPAM profiles you wish to use.  If you are unsure on what they are called please see the sub steps, else skip to step 3
    1. In vRA, click on Administration (1) → Property Dictionary (2) → Property Groups (3)
    2. On the right side, look for a group that is similar to SovLabs-IPAMProfile-<TenantName>_<IPAMProfileName>.  See the image below as an example:
    3. The text after the <TenantName>_ is the profile name.  Write these down as you will need these for the case statement.  For example, mine could be ADDNS_IPAM, BTDiamon-Ipam-Profile and CustomProperty
  3. Now you have your Property Definition name, Values and IPAM profile names.  We can build the statement (Please see additional notes for a link to case/when statement usage)
  4. The case statement should be formatted like the following:

    {% case <what to compare to> %}{% when '<value>' %}Ipam Profile Name{% when '<value>' %}Ipam Profile Name{% when '<value>' %}Ipam Profile Name{% else %}Ipam Profile Name{% endcase %}
  5. The last statement {% else %} could also be a {% when ‘<value>’ %} if you like, I have put this in since I have 4 different options and if the value does not evaluate the first 3 as true, then it must be false and match the last value.
  6.  Now you have your case statement, construct it based on the information you have noted. Mine will look like the following when completed:

    {% case Naming_Environments %}{% when 'P' %}InfoBlox_IPAM{% when 'D' %}BTDiamon-Ipam-Profile{% when 'T' %}IPAM_BlueCat90_profile{% else %}MenMice-IPAM-Profile{% endcase %}
  7. Now you are ready to move onto adding this to your blueprint.


Adding a custom property with your case statement to your blueprint

NOTE:  I will assume that you already have a blueprint that is ready to be modified or have started a new blueprint.  I will also assume you have the properties already attached that you want to set your custom property against defined and available on your blueprint.  I will start from inside the blueprint and where to add the custom property

  1. From inside your blueprint, click on Properties (1) → Property Groups (2)
  2. In the property groups make sure you do not have an IPAM Profile attached.  If you do please delete this from your blueprint
  3. inside properties, click on Custom Properties (1) → New (2)
  4. In the name field, type in SovLabs_IPAMProfile_nic0 (Since we are doing this for a single Nic VM it is the first network card in VMWare)
  5. In the value, enter the case statement you have built then click on OK
  6. You now have your custom property and case statement defined in your blueprint
  7. Click on Finish and make sure you have published your blueprint

Example Deploying your blueprint

  1. When you deploy your blueprint, you will be able to use the drop down you have defined. In my example it is labelled Environments.
  2. A test deploy to the Environment of Test should see my VM setup on my IPAM_BlueCat90_Profile.
  3. In vRO browse to SovLabs → IPAM → IPAM machineBuilding
  4. In the logs for my VMBuild, I can see that the appropriate IPAM profile has been select and run


Additional information

Template Engine – Case/When : http://docs.sovlabs.com/latest/vRA/7.6/framework/sovlabs-template-engine/tags/case-when/
Template Engine Intro : http://docs.sovlabs.com/latest/vRA/7.6/framework/sovlabs-template-engine/basics/intro/ 

Recommended Reading