VMware Cloud Community
SeanKohler
Expert
Expert

vRO Configuration Element Attribute Action


If you have worked with Configuration Elements and workflows, you know you can bind Configuration Element Attributes (CEAs) to workflows.  This is useful when moving workflows across vRO environments because you set all of your localized variables in the Elements and when workflows sync across environments they just use the Element Attribute in the environment the workflow lands in.  You can also UPDATE configuration element attributes programmatically allowing for variables that live external to workflow execution. (world variables)

At any rate...

After passing in vCACCafe:VCACHost, vCAC:VCACHost, and other objects into my Actions time and again... I decided I needed a similar mechanism within vRO Actions to bind variables found in Configuration Elements: so I wrote one.  (I am sure I am not the first, but I haven't seen it shared in the communities)

There are two relatively significant capabilities enabled by this action:

1. Pull any configuration element attribute into any vRO Action.

2. Access the data in any vRO configuration element (including arrays of string) from ANY ASD workflow form field.

Please note that I didn't put any error checking in the action.  It could be improved with try/catch/throws and possibly default returns.

Here is a quick demo...

Environment

This is the configuration element being worked with.  I chose a simple string array because I cannot share some data in our lab, although the intent is that ANY variable object is possible.  It means you can take less in as method execution inputs where applicable.  Your Café and VCAC hosts would be good examples: as would any other plugin library object where the variable is static.  (or semi-static.. because you can update the "configuration element attribute" out of band)

elementActionBind1.jpg

1. Pull any configuration element attribute into any vRO Action

a. Create an action and simply call the getAnyConfigElementAttributeValue(categoryName, elementName, attributeName)  action to assign an externally sourced configuration element to a variable during execution.

elementActionBind2.jpg

b. Example workflow runtime of 1) my demoAction action  2) which calls the getAnyConfigElementAttributeValue action 3) which gets the configuration element object to deliver back to the demoAction.  The workflow just provides the input and then Syslogs the output.

elementActionBind3.jpg

elementActionBind4.jpg

2. Access the data in any vRO configuration element attribute (including arrays of string) from ANY ASD workflow form field.

In vRA 6.2 ASD you can call "External" vRO Actions to give you data on form load for Custom Resources, Service Blueprints, and Resource Actions.  With the attached action, you can pull Configuration Element Attribute strings and array of strings into form fields by specifying the configuration element attribute target UP in the form field.

a. Added aString CEA.

elementActionBind8.jpg

b. Selecting the same workflow as before...

elementActionBind5.jpg

c. Set the default value of the string to that found in the CEA.

elementActionBind9.jpg

d.  The form presentation pulls the CEA data into the field.

elementActionBind10.jpg

Enjoy!  Improve it if you are able, and continue to share when you can. There are certainly some capabilities that can be built directly into the product that would make such an action unnecessary, but for now... at least for supplying VCAC Host and Café Host to my actions, I will be using this action against a CEA... and I welcome you to do the same.

Regards,

Sean Kohler

0 Kudos
2 Replies
poorem
Enthusiast
Enthusiast

Nice!

The project that I'm on has been using exactly this approach for many of the Configuration values that are in use. The major advantage with this approach from our perspective has been that the workflows and actions we've created both for use as vCAC stubs and as ASD catalog items can retrieve different values depending a number of different factors. For example, we can use a different NSX REST host depending on the datacenter location that is selected or have different default values depending on which tenant organisation a request comes from. And, as in your example, we store tenant specific vCAC:Host connections.

0 Kudos
magander3
Enthusiast
Enthusiast

Thanks for sharing. What if i have multiple attributes and would like to present them (their Names) in a drop-down list plus sending the selected Name value to the vRO workflow?

Something like:

Name: Network1 Value: 11-22-33-44

Name: Network2 Value: 22-33-44-55

Thanks

0 Kudos