VMware Cloud Community
Henrique_Cicuto
Enthusiast
Enthusiast
Jump to solution

Workflow - Retrieve vCAC Virtual Machine Properties

Hello everyone,

I´m far from being an Orchestrator with vCAC expert but right now I´m trying to do a simple task and I´m hitting a wall.

I´m trying to do the following:

1) vCAC provision a VM;

2) After the machine is provisioned, run a vCO workflow;

3) That workflow will simply retrieve the VM name and IP address;

Parts 1 and 2 are working ok.

Part 3 is the problem.

I created the workflow with the following:

Attributes:

       - vCACIaaS: Type vCAC:vCACHost - Value: <my_vcac_iaas_server>

       - VMName: Type String

       - VMAddress: Type String

Input:

        - vCACVM: Type vCAC:Entity

The workflow has only 1 Scriptable Task:

     - Inputs: vCACVM and vCACIaaS

     - Outputs: VMName and VMAddress

Scripting:

var VMName = vCACVM.getProperty("VirtualMachine.Admin.Hostname");

var VMAddress = vCACVM.getProperty("VirtualMachine.Network0.Address");

Server.log(VMName);

Server.log(VMAddress);

Result: Both VMName and VMAddress are returning "null"

I checked the content of vCACVM and it shows a VirtualMachines Entity Set Name.

I´m most likely not doing some very basic thing.

Could someone please point me out what exactly I´m not doing? 😞

1 Solution

Accepted Solutions
qc4vmware
Virtuoso
Virtuoso
Jump to solution

For the address you'll need to go to the extended properties:

var vCACVmExtendedProps = System.getModule("com.vmware.library.vcac").getPropertiesFromVirtualMachine(vCACHost,vCACVm);

var address = vCACVmExtendedProps.get("VirtualMachine.Network0.Address");

For hostname you left out a method call to retrieve the entity:

var VMName = vCACVM.getEntity().getProperty("VirtualMachine.Admin.Hostname");


I feel your pain.  There is a fairly steep learning curve for most of the plugins not to mention vRO itself.  Hang in there though as it is a great tool to have at your disposal and you'll find a ton of help here in the forums.  If you read through the plugin documentation there are actually some pretty decent samples for the vCAC plugin.  I'd say this plugin has the best documentation i've seen so far.


Paul.

View solution in original post

Reply
0 Kudos
3 Replies
qc4vmware
Virtuoso
Virtuoso
Jump to solution

For the address you'll need to go to the extended properties:

var vCACVmExtendedProps = System.getModule("com.vmware.library.vcac").getPropertiesFromVirtualMachine(vCACHost,vCACVm);

var address = vCACVmExtendedProps.get("VirtualMachine.Network0.Address");

For hostname you left out a method call to retrieve the entity:

var VMName = vCACVM.getEntity().getProperty("VirtualMachine.Admin.Hostname");


I feel your pain.  There is a fairly steep learning curve for most of the plugins not to mention vRO itself.  Hang in there though as it is a great tool to have at your disposal and you'll find a ton of help here in the forums.  If you read through the plugin documentation there are actually some pretty decent samples for the vCAC plugin.  I'd say this plugin has the best documentation i've seen so far.


Paul.

Reply
0 Kudos
Craig_G2
Hot Shot
Hot Shot
Jump to solution

Hey,

You could use the Workflow Template that comes with the vCAC plugin.

You can find it in vCO\Library\vCloud Automation Center\Infrastructure Administration\Extensibility\Workflow template

Duplicate it and rename it to what ever you want.. I like to do it this way because that workflow already has the inputs you need... then you can build the rest of your workflow around it.

Edit the scriptable task and you can access any of the properties and assign them to vCO attributes...

vmIP = vCACVmProperties.get('VirtualMachine.Network0.Address');

vmMacAddress = vCACVmProperties.get('VirtualMachine.Network0.DnsSuffix');

vmDnsSuffix = vCACVmProperties.get('VirtualMachine.Network0.DnsSuffix');

Like qc4vmware said, hang in there.. once you get used to how things fit together it's a great tool.

🙂

Henrique_Cicuto
Enthusiast
Enthusiast
Jump to solution

Thank you very much people for the answers and the emotional support 😄

Here´s how it ended:

Input: vCACVM (vCAC:VirtualMachine)

Attributes: vCACIaaSHost (vCAC:vCACHost)

Outputs: VMHostname and VMIPAddress (both String)

Scripting: Get vCAC Virtual Machine Name (this one was actually quite easy. I needed the Guest DNS Name, not the actual VM name):

VMHostname = vCACVM.vmDNSName;

(Yes, only that!!! Thank you 'Workflow Template' and 'eatVM')

Scripting: Get vCAC Virtual Machine IP Address (the thing here was that the IP address it not provided by vCAC, but by a DHCP)

vCACVmExtendedProps = System.getModule("com.vmware.library.vcac").getPropertiesFromVirtualMachine(vCACIaaSHost,vCACVM);

VMIPAddress = vCACVmExtendedProps.get("__datacollected_ipaddress");

(Thank you qc4vmware, only the property parameter was different)

Reply
0 Kudos