pages

Thursday, November 24, 2011

vCO - wavemaker, your cloud webservice (part II)

Based on the first article I will show you how to interact with the workflows and give them parameters and receive results. As you might assume this is more complex than only a short "getAllWorkflows", but with wavemaker and some instructions it is much easier than develop web-clients in higher programming languages.

First thing we will need is the workflowId which was displayed in the first tab. To copy the ID from the workflow "getFreeDvPorts" you have to change the options of the dojoGrid.














So the "selectionMode" has to be "extended" which allows you to copy the ID of the workflow. Next thing you have to do is to change the IN parameter of the "getFreeDvPorts" workflow into "dvSwitchName" as String and "NumPorts" as Number. I also added an "CriticalGroups" as Array/String OUT parameter. So the inputs are the name of the dvSwitch and the minimum of free ports the port-groups must have. The output shows all critical port-groups without enough ports.














In wavemaker, under the tab "getInventory" you can now add 4 textfields:
  • username
  • password
  • dvSwitchName
  • FreePorts
and a button called "Submit". I also add a TokenID field to control if the workflow is started. Next button is called "Result" and the "dataGrid" is used to show the OUT results of the workflow. I entered the username and password fixed which makes it a bit easier. The page should look like this:




















First step is to select the submit button and select a new "Service" for the OnClick event. This service I named "executeWf" and select the reference "vCOlab" and the "executeWorkflow" operation. Now the Submit button is linked with the "executeWorkflow" operation. 




As you can see the "executeWorkflow" operation needs different input parameters. The first two: username and password are easy, cause you only have to bind them to the text fields created in the beginning. The third one is the workflow ID of the "getFreeDvPorts" workflow you can copy from the first "getAllWorkflows" tab (extended editor).

The fourth parameter is very special and William Lam (http://www.virtuallyghetto.com/) and I had some sleepless nights to get the right method. The input parameters "workflowInputs" are set as an expression not as Array/List or something. So you have to insert the following in the expression field:
















As you can see the value is linked to the text .dataValue from "dvSwitchName" and "FreeDvPorts". So the name and the ports are defined with the text fields. For the control field you have to link the dataValue of the TokenID field to the return value "id" of the executeWf operation.














This will show the TokenID also when pressing "Submit" and this indicates that the workflow is executed in vCenter Orchestrator.

The next step is to create a new Service for the "Result" button. This is the "getWorkflowTokenResult" operation which also needs some input parameters: username, password and workflowTokenId. The first and second is bind to the appropriate text field. The third one is linked to the TokenId dataValue:












At last you have to bind the dataGrid to the return value of the "getResult" operation. As you can the the empty dataGrid is changed to a name, type and value separation.

If everything is right the execution should look like:
















So, I hope this more complex scenario helps you to speed up your personal cloud portal with wavemaker and vCO.

Have fun!


2 comments:

  1. Hi,
    any idea how to bind a vCO-Array/number value in Wavemaker? A simple text.dataValue did not work out. Am I missing any delimiters or other fancy things?

    Thanks

    ReplyDelete
  2. Hi Thomas,

    just give this a try:

    [
    {
    "name": "dvSwitchName",
    "value": [
    "vm01",
    "vm02"
    ],
    "type": "String"
    }
    ]

    and check this one out:
    http://jsonlint.com/

    Cheers

    ReplyDelete