VMware Cloud Community
Czernobog
Expert
Expert

[vRA7.2] Automate assigning custom properties to blueprint components - how? Properties from property group not loaded

Hello,

I want to leverage the EBS to launch various port-provisioning vRO workflows.

For this, I have created a global (x-tenant) property group, that included several event properties with value *, like Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.MachineProvisioned etc.

Afterwards, I have assigned this property group to several blueprint components and have configured & published the appropriate events in the EBS and created a test workflow in vRO, to just list the various properties which are delivered with the Payload. After requesting the Blueprint, the vRO workflow gets triggered, however no machine.properties are included in the payload, only some basic information.

After some troubleshooting I have found out, that this only works, if the Extensibility.Lifecycle.Properties are put in the component blueprint as a single custom property - when added as a property gorup, this props do not get loaded!

This represents a problem, because there is no way (that I know of) to automate assigning a custom prop to a blueprint component. There are 2 vRO workflows that assign props to composite blueprints, but when the properties are placed there, they do not get loaded during the event trigger either.

So - is there a way to automate this taks - assign custom properties (which are already globally defined) to a blueprint component?

Tags (2)
0 Kudos
1 Reply
jasongarland
Contributor
Contributor

Two things:

1.  I have 7.1, and I add these extensibility properties to VM components in my blueprints as a property group and it works fine.

2.  I have written a workflow for adding property groups to VM components inside composite blueprints.  I'm sure with a little effort you could tweak it to add single custom properties rather than groups.

The code in my workflow looks like this:

var client = host.createCompositionClient();

var service = client.getCompositionCompositeBlueprintService();

var components = blueprint.getComponents();

for each(key in components.keys){

     var component = components.get(key);

     if(component.type == "Infrastructure.CatalogItem.Machine.Virtual.vSphere"){

          component.setPropertyGroups(groups);

     }

}

service.updateBlueprint(blueprint);

You need to provide the host (vCACcAFE:VCACHost), blueprint (vCACCAFE:CompositeBlueprint) and an array of groups to add (listed by their IDs as they appear in vRA under Property Groups) which will be an array of strings.

The tricky part is that you have to list all the groups you want attached to the VM.  You can't add to what's already there. It's like a wipe and reassign, so your array should contain every group you expect to see attached to that VM.

If you need to do this against lots of blueprints in one go, it's not that difficult to have the workflow loop through an array of composite blueprints.