Search tricks in vRO

One of my customers asked me what is the most efficient way to find VM’s in vCenter based on UUID/moRef/IP/Name with vRO… Well… this is a good question! and this post will show you how you can do it.

The most inefficient way to find VM by IP/Name/ID is like this:

  1. vms = VcPlugin.getAllVirtualMachines();
  2.  
  3. for each (vm in vms) {
  4.     if (vm.guest.ipAddress == ip) {
  5.         System.log(“VM name: “+vm.name);
  6.     }
  7. }

 

In large environments this could take some time.

Continue reading

vRO XML & JSON Gotcha! – Part 2

In the first post, I showed you the basics syntax to work with XML and JSON within vRO.

We learn how to create, update and delete values in XML and JSON object, but in real life we some more complex objects such as arrays or we need to convert string to XML or JSON. In this post, I’ll show you some more advanced tricks.

First, let’s see how to work with arrays within XML and JSON objects.

Continue reading

vRO XML & JSON Gotcha! – Part 1

When integrating vRealize Orchestrator with external systems using REST API, knowing how to work with XML and JSON is a must!

During my work on the NSX Firewall as a Service Package and on the F5 LTM Dynamic Types plugin, I noticed that we have a lot of “gotchas” that are not very well documented.

Basically, this isn’t vRO special syntax, it’s JavaScript syntax that I’ll show you how to use in this post.

My code samples for both XML and JSON will be based on a custom object that we will call it “Pool”. This “Pool” object as attributes such as name, version, and members of this pool. Continue reading

F5 Dynamic Types Plugin – Ready to Extend Part 2

In F5 Dynamic Types Plugin – Ready to Extend Part 1, I showed you how you can extend the creation of some objects such as Pool and Virtual Server.

For some other objects, such as Profile and Monitor, you will need to do some “tricks”.

Let’s take a look in the “Create Client SSL Profile” workflow schema: Continue reading