Vmware VRO (VCO) :How to design workflow :Basic Workflow[series3]

In this section, We will try to write a workflow from scratch… When we start writing any workflow, we need to start from following:

  • What needs to be developed, means understand the requirement properly
  • Perform manually what parameters are require, possibly from virtual center.

Lets start for a workflow, where we are get virtual machine snapshots. When we do manually, we connect to esx(i) host (using VIC/web client), for a particular vm right click and snapshot manager.

Lets have a api search in vRo, searching

snapshot2

In Api search, we will find lot snapshot related stuff such as revert,create.. We need to select what we are looking for “get vm snapshot”.

snapshot3

There are methods or attribute define in different object. In VcPlugin, getAllVirtualMachineSnapshots method is available. Lets have a look into this method:

snapshot

This method has two parameters and one return type value.

  • Parameters
    • additonalPropertyFilters(array of String)
    • query(string) /*Xpath query*/
    • Return Type: Array of VcVirtualMachineSnapshot

First parameter additional property filters, its a big topic to discuss, “PropertyFilter is actually applying a filter to each result, as in, return the following fields for each result instead of filtering the results set based on the PropertyFilter.  So it will return the properties as the result of filter.

Xpath query will be used to search the result from vCo side.

Lets start writing the workflow, we create a workflow and go in schema , we see the below figure.

snapshot1\

In this workflow we need the list of virtual Machines which snapshots need to be searched. So first input is “List of Virtual Machines: So our input is Vc:VirtualMachine array type. Output is “Array of VcVirtualMachineSnapshot”. So we define Snapshot output type VC:VirtualMachineSnapshot.

Currently in schema we select the scriptable task.

snapshot5

Visual binding of the inputs and output in schema:

snapshot6

The Scripting part :

for(i in VMs) {
var vmpattern = VMs[i];
var XPath = "xpath://name[starts-with(.,'"+vmpattern+"')]";
ListSnapshot = VcPlugin.getAllVirtualMachineSnapshots(null,XPath);
Snapshot=ListSnapshot;
System.log (Snapshot);
}

Above is scripting part, which is working state,tried to use all the parameters defined above..

Below is the presentation layer, when we start executing the workflow, this is the layer will give the front end. It will ask the list of the array which we need

snapshot7

snapshot4

In upcoming series, we will try to understand more about propertyfilter… it will help for further coding…

 

Vmware VRO (VCO) :How to design workflow [series2]

In this series, will explain about the workflow. We will take one of the predefined workflow in vRo, will try to understand the requirement.

As a system admin,when we have to use VMware vSphere environment, we will login into virtual center instance and manage our environment.In case of vRo, any workflow will be execute on Datacenter,cluster,host or VM , which will be accessed through the Virtual center instance. In that case, SA has to execute Add virtual center instance  first to connect virtual center to Orchestrator.Its a predefined workflow in vRo.

Lets start from : How we login to virtual center, what parameters are require? Here we are trying to create an UML.  The parameters are :User Name,Domain,Port number,Password, and Certificate.  When we provide the following information, its combine all these information, import certificate, validate information, and Connect the VC.

SA inputs->import certificate (if true)->Validate all the information->Connect to Virtual center instance.

So following are our standard inputs: Username,password,port,certificate path,domain.

Standard output: Return value (Whether VC registered or not)

Now lets see the predefined workflow and try to understand, how it is co-related to our standard login.

vRo-screen5

 

Lets understand icon used in workflow:

vRo-screen6

In above workflow the first stuff is scriptable task, which is “combining the host and port”.  When we give in virtual client we provide “host ip:port number” . So for this scriptable task the inputs are: host (ip or name):type string ,port :type number. We need to store the output as well,since it will be used as input in the workflow.

Note: When we need to use the one scriptable task output as input in  next scriptable task in same workflow,we store as attribute.

In this case the attribute hostAndPort:type string (output).

Scripting: hostAndPort = host + “:” + port;

Next stuff in workflow, import certificate. We want to ignore the certificate, its a true/false condition which is Boolean. If ignore is false, we need the url to download, which is our attribute:hostAndPort. In this task we will use hostAndPort attribute as input.

Next stuff is scriptable task “Validate”. As the name says, here we validate all the must input,such as Vcenter enable for vRo,username,password,sdk path,host,port.

vRo-screen7

Scripting:

if (enabled) {
VcPlugin.validateConnection(host , port , path , userName , password);
}

enabled=True, then above code will execute.

Note: API search is availble in vRo

VcPlugin: This is object (type scripting class), which used to entry point for vCenter to access the objects from vCenter can be accessed.

vRo-screen8

In left hand side pane, one which is empty square is properties. The one which has black square are methods of objects.

In above scripting, we are using methods, explored the method:

vRo-screen9

Its shows what inputs,and return type:void.

If validation fails, it will terminate the Workflow, else it will go to next scriptable task which is “Register the Virtual Center”.

Scripting: newInstance = VcPlugin.registerVCenterServerInstance(enabled, host, port, path,sessionPerUser, userName, password, domain);

In above case also we are using VcPlugin object and the method is registerVCenterServerInstance.Lets explore this method:

vRo-screen10

By seeing this method, we can make out what are the inputs require, and what output its giving to us. The output return type is VcSDKConnection. So the “new intance” type we need to define is VcSDKConnection.

In this series we got to know about input,output,objects,methods. We will explore more in upcoming series, will try to understand rest of the parameters …

Vmware VRO (VCO) :How to design workflow [series1]

In this blog,  will cover the basic of VMware VCO.Installtion and configuration of VMware VCO can be done using vmware vRO guide.We will be covering more about:

  • VMware VCO overview
  • API
  • Basic WorkflowOnce a setup is deployed, When we connect to VMware vRO we get the below setup. We can login using vRo client.

Note: Default login and password for vRo (vcoadmin/vcoadmin)

vRo-screen1When we connect to VMware vRO, we get three options: Run, Design and Administrator.

In case for writing the workflow, we need to select Design Option. Once We select the Design option, we enable to write the workflow. Before we start with workflow, we need to understand API structure in vRo. For this we will writing a basic workflow and check the approach.

How to create a Workflow??

Connect to vRo ,and select the Design Mode, and perform below step to create a workflow.

vRo-screen3

Once we create the Workflow, we have following screen, which has lot of option, which we will discuss one by one in this series.

vRo-screen4

In vRo workflow, we get the tab of General,inputs,outputs,schema,Presentation,Workflow tokens,events,Permission. In this section, will give overview of each section. Later On we will use in-details.

General: As name mentioned, its cover all the general information, such as name,id,version,icon,any generic behavior,author signature,and attribute.

Inputs: Provide inputs to the workflow

Outputs: Any expected output from the workflow

Schema: It contains the workflow, where we create all the flow, such as loops,condition,action etc.

Presentation: When we execute the workflow, the front-end or steps comes to execute is controlled by presentation layer.

These are the main tabs, rest of tabs will be cover during the examples.