Using ASD to deploy vRealize Automation Center blueprints

Deploying vRealize Automation blueprints using ASD is a useful technique. It gives you flexibility by creating drop down lists and interactive forms. What is also very handy, is building up request logic based on human readable inputs and passing this in to the request. As you might know, some request values are only applicable when making the request, typically allocation (vrm.datacenter.location and __reservationPolicyID for example).

You can achieve this by first creating a vRO workflow that calls the catalog item. Here is an example workflow that I have written to do this.

Screen Shot 2015-02-17 at 14.24.51

The below script shows an example of the javascript to request a catalog items

System.log(&Getting catalog item & + item.getName() + ' request form...);
var form = vCACCAFERequestsHelper.getRequestFormForCatalogItem(item);

System.log(Expected inputs:);
var fields = vCACCAFERequestsHelper.getFormKeys(form);
for (var i = 0; i < 0; fields.length; i++) {
    System.log( " - " + fields[i]);

System.log("Filling in catalog item request...");
form = vCACCAFERequestsHelper.setFormValues(form, inputs);

System.log("Sending catalog item request...");
var request = vCACCAFERequestsHelper.requestCatalogItem(item, form);

System.log("Catalog item request " + request.getId() + " sent!");

Running through this, we can see a couple of key lines of code. The item is actually the blueprint you are calling.

var form = vCACCAFERequestsHelper.getRequestFormForCatalogItem(item);

You can actually hard code this as an attribute or determine this on the fly depending on the options that user has selected.

The next key line is creating the form object. The form object is submitted as part of the request, along with the item.

form = vCACCAFERequestsHelper.setFormValues(form, inputs);

The form is what information you are submitting as part of the request.

And now here is the request.

var request = vCACCAFERequestsHelper.requestCatalogItem(item, form);

Once you have this bit of code ready, you need to create the form values. You can actually get these using firbug and capture the POST values when submitting a catalogue item. Here is an example:

//Build up the request form for the new VM
properties = new Properties();

properties.put("provider-provisioningGroupId", provisioningGroupId);
properties.put("provider-Cafe.Shim.VirtualMachine.NumberOfInstances", new vCACCAFEIntegerLiteral(numberOfInstances).getValue());
properties.put("provider-Cafe.Shim.VirtualMachine.TotalStorageSize", new vCACCAFEDecimalLiteral(totalStorageSize).getValue());
properties.put("provider-VirtualMachine.LeaseDays", new vCACCAFEIntegerLiteral(leaseDays).getValue());
properties.put("provider-VirtualMachine.CPU.Count", new vCACCAFEIntegerLiteral(cpuCount).getValue());
properties.put("provider-VirtualMachine.Memory.Size", new vCACCAFEIntegerLiteral(memorySize).getValue());
properties.put("provider-VirtualMachine.Disk0.Size", disk0Size);
properties.put("provider-VirtualMachine.Disk0.IsClone", disk0IsClone ? true : false);
properties.put("provider-VMware.VirtualCenter.OperatingSystem", vmOS);
properties.put("provider-VirtualMachine.Network0.Name", fullNetworkName);

The provider inputs are the required inputs for a generic catalogue request. You can dynamically populate this form based on ASD input parameters. However you can also add to this form whatever values you wish by passing in a properties object. For example:

customProperties.put("", value1);
customProperties.put("virtualdevops.custom.props.two", value2);
customProperties.put("virtualdevops.custom.props.three", value3);
customProperties.put("virtualdevops.custom.props.four&", value4);

Then you can add these custom properties to the properties object you pass into the request

for each (var k in customProperties.keys) {properties.put(&provider-&+k,customProperties.get(k));};

Now, you can pass the properties object in to the default action as part of the request., or use the script above taken from the action item.

actionResult = System.getModule(com.vmware.library.vcaccafe.request).requestCatalogItem(item, properties)

Now you can use any blueprint and build up a property object that consists of request values adding to your blueprint profile. There is a caveat around this. If you use vRA to request catalogue items, the owner of the resources will be the user configured when you added the plugin. But that’s ok as we can change the owner to the VM as part of the ASD workflow, which is next up!



  1. Thank you very much for this very detailed explanation.
    I was wondering if there is anyway to make the properties fill in the request form that is visible in the vra web portal.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s