In the last post we covered how to create Filters and Finders in WFA so that we could access WFA data through a RESTful interface. This creates a nice separation between the two systems and decouples the dependency on the WFA database for dynamically populating data in vRealize Orchestrator workflows.
Let’s look at how to take the result of the last post, query the data from vRO, and incorporate it into vRO workflows.
I’m going to be using the same workflow as before, “Create a Clustered Data ONTAP Volume”, so we will once again need four inputs:
- Cluster Name – A string with valid values being clustered Data ONTAP systems configured in WFA
- Storage Virtual Machine Name – A string with valid values being SVMs belonging to the cluster selected above.
- Volume Name – A string provided by the user.
- Volume Size (in GB) – A number provided by the user.
To get started, we are going to create vRO actions which execute REST operations against the WFA filters/finders to return the same data that we used direct SQL queries for previously. These actions will then be executed/used from the workflow presentation.
- Make sure you have added the WFA host as a vRO REST host. Reference this post, but you don’t need to create a workflow or worry about all that scripting at the bottom.
- If you haven’t yet, use the last post as a reference to create WFA filters and finders to make the data we want available via REST.
- Let’s switch back to vCO’s interface now. There will be three parts to our action script:
- Get the finder UUID
- Execute the finder
- Parse the result and do something with it
Getting the UUID is much like before, we simply query WFA for all of the finders, then loop through them until we find the one we want and extract it’s UUID. Likewise, executing the finder is a standard REST GET operation. Once we get the response, we simply read the XML and extract the values in the
Since this will be executed in an action and the result will be used to populate a drop down field, we want to return an array of strings.
Below is the code for our action,
- Now that we have the action we need to use it. If you have not created the workflow from this post, we need to do that now. Also, make sure you follow the directions in the “Integrating the Action with workflow inputs” section of this post. (Note that we don’t need to create the action from that post because we will be using the one just created.)
Just like before, edit the
ClusterNameinput’s presentation, add the “Predefined Answers” property, and change the source to OGNL. Click the purple puzzle piece and search for the action we just created.
- Test the workflow using the debug method to validate that the inputs are being populated from the REST query to the WFA finder.
That’s it. The only difference here is that the SQL stays inside of WFA, and we use REST to retrieve the results of the query.
vRO Example Package
I have created a vRO package which contains the workflow we created and the actions used.
Download the package here.
The package also contains some extra actions which break out the code above into reusable components. To see them in action look at the action
getSvmsFromFinder and how it is populating the drop down for SVM names.
With the actions in the
com.netapp.oncommand.wfa.rest.core action module (a part of the package above), it’s now very easy to use REST to get the result of a filter/finder and incorporate those results into your vRO workflows. Be sure to look at them, experiment with them, and if you need help…let me know!
Now we are starting to really see how well we can integrate WFA workflows with vRO. If you are using vRealize Automation (vRA), these workflows are surfaced into that interface as well, and the actions to query the data continue to work supplying dynamic data from WFA.
If you want to know more about WFA/vRO integration, if you have questions and/or suggestions about the WFA package for vRO, or if you encounter a bug in the package, please let me know via the comments section here, the NetApp Communities page, or using the NetApp Communities private message function (my username is asulliva). I will also happily respond to emails…my email address is the same as my Communities username at netapp.com.
Questions and comments are always welcome below. If you have any suggestions for, or need help with, NetApp/VMware integration, automation, and solutions, please let me know using the comments!