In one of my previous blog posts, I talked about some of the benefits of using the Advanced Service Designer (ASD). Examples include the possibility to improve the mockup of the request form, to create request form tabs and to create dynamically populated fields.
All ASD service blueprint mockup customization can be performed using the Advanced Services tab in the vRA (vRealize Automation) portal and selecting the Service Blueprint section. But many of the layout configurations and logic of the mockup can also be performed via the presentation tab in vRO (vRealize Orchestrator). An advantage of this is that when a service blueprint form is reloaded (for example when an extra input parameter is added in the original vRO workflow), the configuration of the presentation tab is persistent.
However vRO has its limitations. An example of this is telling vRA to use sliders on a particular input parameter or to force checkboxes on Boolean values instead of the default Yes/No dropdown box. Though if there are any readers who know if this is possible, feel free to let me know via the comment section below.
In this blog post I will demonstrate some of the possibilities offered by the presentation tab by building a simple workflow that makes use of the presentation tab. The purpose of the workflow is to create a simple virtual machine. The user needs to give following input parameters:
- Number of CPUs
- Amount of memory
- Amount of storage
- DHCP (yes or no)
- IP address (only if DHCP is not selected)
- Default gateway (only if DHCP is not selected)
- Subnet mask (only if DHCP is not selected)
If all parameters are entered, the user will see a short summary of the selected values.
Finally we will use tabs to structure all input parameters in a general VM information tab, a network tab and a summary tab
Building vRO the workflow
The first step is to create a new empty workflow. In this case our new workflow is called “Presentation Demo”.
On the empty input tab, we will create our first input parameter to allow the user to select a certain amount of CPU’s. Clicking the yellow arrow marked in red in the image above creates a new input parameter.
A new entry will be listed which we will rename to “CPU” and will change the type to “Number” instead of “String”.
Next we will change our view to the presentation tab.
This view now contains our newly added input parameter called “CPU”. When clicking the “CPU” parameter, two small tabs appear:
We will skip the General tab for now and focus on the Properties tab because this is where the magic begins.
By clicking the icon marked in red, we get to see a box containing all possible attributes we can set to the input parameter. For the “CPU” input parameter we will start by choosing the “Predefined answers” attribute. The icon marked in green means that we will use static values as predefined answers. Later in this post we will use OGNL statements to create dynamic values populated by a vRO action. In this example we only want users to select one to four CPU’s. We can insert these values by clicking on the “Not set” text.
By default we want to have two CPU’s so we add the “Default value” attribute and give it value two.
Our first input parameter is added and all necessary presentation configurations have been performed. Next we go back to the input tab and add the “Memory” parameter.
There will now be two entries on the presentation tab. First we will click on the “Memory” entry and select the General tab. Here we can enter a description with value “In GB”. The purpose of the description differs based on the product that runs the workflow. When the workflow is run from vRO itself, the description is used as label of the input parameter, when the workflow is run from within vRA, a little question mark will be visible next to the input parameter. The description (in this case “In GB”) will be visible when hovering over the question mark.
We will not use a dropdown box for the memory input parameter. Instead we will use a vRA slider. To make the slider configuration easier to configure, we can choose the minimum, maximum and default values for the slider. We will just use statically defined values for the memory as seen below.
The next input parameter is used for storage. The process for adding the input parameter is analogous to the previously illustrated. In the presentation tab we can also add a description like we did for the “Memory” input parameter.
The user will be able to select the amount of storage in GB via a drop-down box. We will populate these predefined answers using an OGNL statement. OGNL can be selected using the yellow array illustrated below.
To use OGNL, we need to create an action. The action we will use is shown here:
- Max storage capacity
- Min storage capacity
- Default increment value to be used
The return value is an array of numbers. The action is basically just a loop that pushes numeric values in an array. These values are the different storage sizes a user can select.
Next, we will create new attributes in the workflow in order to have values for the input parameters of the action.
It now is time to use OGNL since we have an action and matching attributes. We can now add the OGNL statement to the “Storage” entry in the presentation tab. We can select an icon by pressing the icon marked in the green. In the filter bar enter the name of the newly created action. If the corresponding action is selected, all input parameters of that action are listed. By pressing the pencil icon it is possible to select the added workflow attributes or input parameters. Press on the apply button after all parameters are set.
For setting the default values, we have again two possibilities. First we can set the default value by using a static value or we can use the OGNL statement.
In this case we will assign the first value of the returned action array as default value by adding  at the end of the OGNL statement. Using square brackets and an index is one way of retrieving a value from an array.
After this we start configuring the network input parameters. All needed input parameters are listed in following screenshot.
We restart configuring the presentation attributes for the “DHCP” parameter. We want to have virtual machines to receive their network configuration via DHCP by default so we set the default value attribute to true.
Next step are the “IP”, “Gateway” and “Subnet mask” parameters. Recall that we only want to see the parameters if the value of “DHCP” is set to false. If for example the “IP” parameter is visible, it is also required that it is filled in. This can be forced using the “Mandatory input” attribute. In addition to that we can also use the “Valid internet address” attribute to force the correct formatting of the IP address, subnet mask and gateway. Refer to the image below for the complete configuration.
Finally we need to add the “Summary” input parameter and configure it. For this parameter we will use the “Data binding” presentation attribute. Its value will be modified based on all other parameters.
The action we will use to create the “Summary” string is illustrated above. It takes all input parameters and creates and returns a string value.
After the action is created we can use it for the “Data binding” OGNL statement.
The last vRO step that we need to perform is to create different sections (“VM information”, “Network information” and “Summary”) to order the input parameters.
Tabs can be created by selecting the presentation header and clicking the green marked icon in the image below (normally not blanked out). It is then possible to drag and drop parameters into their respective tab.
This step concludes all vRO configurations. Now we need to add the workflow in the vRA so it can be requested via the portal.
Editing and testing the service blueprint
When looking in the “Blueprint form” we can see that the tabs defined in vRO are automatically configured in the service blueprint form.
The only thing we need to do in the VM information tab is to add the slider to the “Memory in GB” field. Hovering over the field, pressing the pencil icon and editing the “Type” field can do this. The minimum, maximum and default values are automatically loaded from vRO. This “Type” field can also be used to change to “DHCP” field in the network information tab to a checkbox instead of a drop-down box.
On the “Summary” tab it is also advised to change the summary field to text area, as shown in the image below, in order to make the summary string more readable:
All configuration is finished now and we can request the new service blueprint. The results can be viewed below:
When changing values of input parameters, the Summary string will adapt itself immediately. It is also cool to note that changes in the vRO backend (for example the chosen default values) are adapted instantly when refreshing the request of the service blueprint.