Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Running workflows using REST api

$
0
0

Hi experts,

I use vRO 7.0.1 with Radware's AdcVCOPlugin installed.

I'm trying to run one of  a workflows imported by plugin using REST api.

I used following article to get familiar with this process - How to use the REST API to Start a Workflow

 

I run the workflow manually once and it's terminated properly, then read its execution entity via REST , here it is ( Sorry for huge amount of text, I've marked red the point I've had problem with !)

 

 

{

  "href": "https://10.205.102.57:8281/vco/api/workflows/A5808080808080808080808080808080DB80808001294069284140341869828b6/executions/8a4de6b954ed46c301552b9cdc8d038f/",

  "relations": {

    "link": [

      {

        "href": "https://10.205.102.57:8281/vco/api/workflows/A5808080808080808080808080808080DB80808001294069284140341869828b6/executions/",

        "rel": "up"

      },

      {

        "href": "https://10.205.102.57:8281/vco/api/workflows/A5808080808080808080808080808080DB80808001294069284140341869828b6/executions/8a4de6b954ed46c301552b9cdc8d038f/",

        "rel": "remove"

      },

      {

        "href": "https://10.205.102.57:8281/vco/api/workflows/A5808080808080808080808080808080DB80808001294069284140341869828b6/executions/8a4de6b954ed46c301552b9cdc8d038f/logs/",

        "rel": "logs"

      },

      {

        "href": "https://10.205.102.57:8281/vco/api/workflows/A5808080808080808080808080808080DB80808001294069284140341869828b6/executions/8a4de6b954ed46c301552b9cdc8d038f/state/",

        "rel": "state"

      }

    ]

  },

  "id": "8a4de6b954ed46c301552b9cdc8d038f",

  "state": "completed",

  "start-date": 1465315548301,

  "end-date": 1465315634838,

  "started-by": "vcoadmin",

  "name": "createADC",

  "input-parameters": [

   {

      "value": {

        "sdk-object": {

          "type": "AdcVCOPlugin:AdcContainer",

          "href": "https://10.205.102.57:8281/vco/api/catalog/AdcVCOPlugin/AdcContainer/vmc-01/",

          "id": "vmc-01"

        }

      },

      "type": "AdcVCOPlugin:AdcContainer",

      "name": "container",

      "scope": "local"

    },

    {

      "value": {

        "sdk-object": {

          "type": "VC:VirtualMachine",

          "href": "https://10.205.102.57:8281/vco/api/catalog/VC/VirtualMachine/10.205.122.41%252Fvm-3779/",

          "id": "10.205.122.41/vm-3779"

        }

      },

      "type": "VC:VirtualMachine",

      "name": "adcTemplateVM",

      "scope": "local"

    },

    {

      "value": {

        "sdk-object": {

          "type": "VC:VmFolder",

          "href": "https://10.205.102.57:8281/vco/api/catalog/VC/VmFolder/10.205.122.41%252Fgroup-v270/",

          "id": "10.205.122.41/group-v270"

        }

      },

      "type": "VC:VmFolder",

      "name": "adcTargetFolder",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "vmc-01-inst-01"

        }

      },

      "type": "string",

      "name": "adcInstanceName",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "Network"

        }

      },

      "type": "string",

      "name": "managementNetworkType",

      "scope": "local"

    },

    {

      "value": {

        "sdk-object": {

          "type": "VC:Network",

          "href": "https://10.205.102.57:8281/vco/api/catalog/VC/Network/10.205.122.41%252Fnetwork-12/",

          "id": "10.205.122.41/network-12"

        }

      },

      "type": "VC:Network",

      "name": "managementNetwork",

      "scope": "local"

    },

    {

      "type": "VC:DistributedVirtualPortgroup",

      "name": "managementPortgroup",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "vDS"

        }

      },

      "type": "string",

      "name": "clientNetworkType",

      "scope": "local"

    },

    {

      "type": "VC:Network",

      "name": "clientNetwork",

      "scope": "local"

    },

    {

      "value": {

        "sdk-object": {

          "type": "VC:DistributedVirtualPortgroup",

          "href": "https://10.205.102.57:8281/vco/api/catalog/VC/DistributedVirtualPortgroup/10.205.122.41%252Fdvportgroup-315/",

          "id": "10.205.122.41/dvportgroup-315"

        }

      },

      "type": "VC:DistributedVirtualPortgroup",

      "name": "clientPortgroup",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "vDS"

        }

      },

      "type": "string",

      "name": "serverNetworkType",

      "scope": "local"

    },

    {

      "type": "VC:Network",

      "name": "serverNetwork",

      "scope": "local"

    },

    {

      "value": {

        "sdk-object": {

          "type": "VC:DistributedVirtualPortgroup",

          "href": "https://10.205.102.57:8281/vco/api/catalog/VC/DistributedVirtualPortgroup/10.205.122.41%252Fdvportgroup-314/",

          "id": "10.205.122.41/dvportgroup-314"

        }

      },

      "type": "VC:DistributedVirtualPortgroup",

      "name": "serverPortgroup",

      "scope": "local"

    },

    {

      "value": {

        "number": {

          "value": 516

        }

      },

      "type": "number",

      "name": "clientsVlan",

      "scope": "local"

    },

    {

      "value": {

        "number": {

          "value": 515

        }

      },

      "type": "number",

      "name": "serversVlan",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "192.168.13.130"

        }

      },

      "type": "string",

      "name": "adcClientIfAddress",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "255.255.255.0"

        }

      },

      "type": "string",

      "name": "adcClientIfMask",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "192.168.12.1"

        }

      },

      "type": "string",

      "name": "adcServerIfAddress",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "255.255.255.0"

        }

      },

      "type": "string",

      "name": "adcServerIfMask",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "192.168.13.1"

        }

      },

      "type": "string",

      "name": "adcGWAdress",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "Version 3"

        }

      },

      "type": "string",

      "name": "snmpVersion",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "public"

        }

      },

      "type": "string",

      "name": "readCommunity",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "private"

        }

      },

      "type": "string",

      "name": "writeCommunity",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "adminsha"

        }

      },

      "type": "string",

      "name": "authenticationPassword",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "adminsha"

        }

      },

      "type": "string",

      "name": "privacyPassword",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "admin"

        }

      },

      "type": "string",

      "name": "cliPassword",

      "scope": "local"

    },

    {

      "value": {

        "boolean": {

          "value": true

        }

      },

      "type": "boolean",

      "name": "useSSH",

      "scope": "local"

    },

    {

      "value": {

        "number": {

          "value": 161

        }

      },

      "type": "number",

      "name": "port",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "adminsha"

        }

      },

      "type": "string",

      "name": "userName",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "DES"

        }

      },

      "type": "string",

      "name": "privProtocol",

      "scope": "local"

    },

    {

      "value": {

        "string": {

          "value": "SHA"

        }

      },

      "type": "string",

      "name": "authProtocol",

      "scope": "local"

    }

  ],

  "output-parameters": [

    {

      "value": {

        "sdk-object": {

          "type": "AdcVCOPlugin:AdcInstance",

          "href": "https://10.205.102.57:8281/vco/api/catalog/AdcVCOPlugin/AdcInstance/vmc-01-inst-01/",

          "id": "vmc-01-inst-01"

        }

      },

      "type": "AdcVCOPlugin:AdcInstance",

      "name": "newAdcInstance",

      "scope": "local"

    }

  ]

}

 

Now to run this workflow using REST api this time I've built following execution-context xml :

I've tried to run it without scope attribute and different variations of scope attribute as well  {local, AdcVCOPlugin, AdcVCOPlugin:AdcContainer}.

I thougt I's a problem and plugin objects should refer to plugin scope, now I see It's not.

But workflow execution always failed because of returned status 400 , here is original exception :

java.lang.RuntimeException: Workflow execution failed. Reason - {"status":400,"message":"2 error(s) found: [ { ADC-VA Container - Unable to convert object, no sdk type defined for class : VMWare vmc-01 (https://10.205.122.41:443/sdk) }  { ADC-VA Container - This field is required. } ]"}


 

So using this example from manual run

 

{

      "value": {

        "sdk-object": {

          "type": "AdcVCOPlugin:AdcContainer",

          "href": "https://10.205.102.57:8281/vco/api/catalog/AdcVCOPlugin/AdcContainer/vmc-01/",

          "id": "vmc-01"

        }

      },

      "type": "AdcVCOPlugin:AdcContainer",

      "name": "container",

      "scope": "local"

    }

 

What is wrong with input parameter i use to build ? How can I build it properly ?

 

<parameter name="container" type="AdcVCOPlugin:AdcContainer" scope="AdcVCOPlugin">

            <sdk-object type="AdcVCOPlugin:AdcContainer" href="https://10.205.102.57:8281/vco/api/catalog/AdcVCOPlugin/AdcContainer/vmc-01/" id="vmc-01"/>

        </parameter>

 

 

 

 

<execution-context

    xmlns="http://www.vmware.com/vco">

    <parameters>

       <parameter name="container" type="AdcVCOPlugin:AdcContainer" scope="AdcVCOPlugin">

            <sdk-object type="AdcVCOPlugin:AdcContainer" href="https://10.205.102.57:8281/vco/api/catalog/AdcVCOPlugin/AdcContainer/vmc-01/" id="vmc-01"/>

        </parameter>

        <parameter name="adcTemplateVM" type="VC:VirtualMachine" scope="local">

            <sdk-object type="VC:VirtualMachine" href="https://10.205.102.57:8281/vco/api/catalog/VC/VirtualMachine/10.205.122.41%252Fvm-3782/" id="10.205.122.41/vm-3782"/>

        </parameter>

        <parameter name="adcTargetFolder" type="VC:VmFolder" scope="local">

            <sdk-object type="VC:VmFolder" href="https://10.205.102.57:8281/vco/api/catalog/VC/VmFolder/10.205.122.41%252Fgroup-v270/" id="10.205.122.41/group-v270"/>

        </parameter>

        <parameter name="adcInstanceName" type="string" scope="local">

            <string>vmc-01-inst-01</string>

        </parameter>

        <parameter name="managementNetworkType" type="string" scope="local">

            <string>Network</string>

        </parameter>

        <parameter name="managementNetwork" type="VC:Network" scope="local">

            <sdk-object type="VC:Network" href="https://10.205.102.57:8281/vco/api/catalog/VC/Network/10.205.122.41%252Fnetwork-12/" id="10.205.122.41/network-12"/>

        </parameter>

        <parameter name="clientNetworkType" type="string" scope="local">

            <string>vDS</string>

        </parameter>

        <parameter name="clientPortgroup" type="VC:DistributedVirtualPortgroup" scope="local">

            <sdk-object type="VC:DistributedVirtualPortgroup" href="https://10.205.102.57:8281/vco/api/catalog/VC/DistributedVirtualPortgroup/10.205.122.41%252Fdvportgroup-315/" id="10.205.122.41/dvportgroup-315"/>

        </parameter>

        <parameter name="serverNetworkType" type="string" scope="local">

            <string>vDS</string>

        </parameter>

        <parameter name="serverPortgroup" type="VC:DistributedVirtualPortgroup" scope="local">

            <sdk-object type="VC:DistributedVirtualPortgroup" href="https://10.205.102.57:8281/vco/api/catalog/VC/DistributedVirtualPortgroup/10.205.122.41%252Fdvportgroup-314/" id="10.205.122.41/dvportgroup-314"/>

        </parameter>

        <parameter name="clientsVlan" type="number" scope="local">

            <number>516</number>

        </parameter>

        <parameter name="serversVlan" type="number" scope="local">

            <number>515</number>

        </parameter>

        <parameter name="adcClientIfAddress" type="string" scope="local">

            <string>192.168.13.130</string>

        </parameter>

        <parameter name="adcClientIfMask" type="string" scope="local">

            <string>255.255.255.0</string>

        </parameter>

        <parameter name="adcServerIfAddress" type="string" scope="local">

            <string>192.168.12.1</string>

        </parameter>

        <parameter name="adcServerIfMask" type="string" scope="local">

            <string>255.255.255.0</string>

        </parameter>

        <parameter name="adcGWAdress" type="string" scope="local">

            <string>192.168.13.1</string>

        </parameter>

        <parameter name="snmpVersion" type="string" scope="local">

            <string>Version 3</string>

        </parameter>

        <parameter name="port" type="number" scope="local">

            <number>161</number>

        </parameter>

        <parameter name="userName" type="string" scope="local">

            <string>adminsha</string>

        </parameter>

        <parameter name="authProtocol" type="string" scope="local">

            <string>SHA</string>

        </parameter>

        <parameter name="authenticationPassword" type="string" scope="local">

            <string>adminsha</string>

        </parameter>

        <parameter name="privProtocol" type="string" scope="local">

            <string>DES</string>

        </parameter>

        <parameter name="privacyPassword" type="string" scope="local">

            <string>adminsha</string>

        </parameter>

        <parameter name="cliPassword" type="string" scope="local">

            <string>admin</string>

        </parameter>

    </parameters>

</execution-context>

 

 

Thanks


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>