Use Swagger to execute a vRO Workflow with a REST Call like as postman and firefox rest client

With vRO 7.2 it is possible to use SwaggerSwagger is a powerful open source framework backed by a largecosystem of tools that helps you design, build, document,and consume your RESTful APIs. to test the execution of a vRealize Orchestrator Workflow via REST Call. For this you need to enable basic authentication over sso.This happens by adding the following property to vmo.properties configuration file via the control center.

Open the vRO Homepage: https://<vRO Server>:8281/vco/

VMware vRealize• Orchestrator• Getting Started with vRealize Orchestrator To create and modiffworkflows. orto perform administrative tasks. startthe Orchestrator client by using Java VVeb Start: • Start Orchestrator Client To use the Orchestrator client on your local machine. install the Orchestrator client After you complete the installation, start the Orchestrator client and connectto the Orchestrator server • Download Orchestrator Client application Configure the Orchestrator Server TO make additional configuration changes to the Orchestrator server, use the Orchestrator configuration interlace; • Orchestrator Control Center

Open the link Orchestrator Control Center

Authentication Required A user rmne and password are beirq requested by <a href=

Enter your credential

Orchestrator Control Center Man age Startup Options Configure Authentication Provider Advanced Options JMX Console Licensing Troubleshooting Certificates File System Bro ws er Export:lmport Configuratio n System Properties Orchestra tor Cluster M onagement_ Validate Configuration Monitor and Control Inspect Workflows Runtime Metrics

Click on Server Properties

KVO dold 01 sabuoup aua JO spadsu saujad0id Lija igÅs

Click on New button

Prop ert-y NEW PROPERTY Descri CANCEL com vmware. olln .ss ena enat.*es basic authentication rm•er ADO

Enter values as shown above and click ADD

System Properties Many aspects of the Orchestrator sevver and plug-ins are controlled by system properties. Add or remove custom system propertie changes to take effect. Changes saved Prop erty c-authentication_enabled: true (enables basic authentication over sso) NEW After any modification, the server IVLlSt be restarted for the Rem ove

Restart the vRO Server

Manage بط Startup Cvtions

Naviagte to HOME -> Startup Options

Startup Options Control the Orch estrntor server service. Server restart is required because of not Current Status: RUNNING ST O p

Click on RESTART

Test Workflow for the REST Call

First you should create a small test Worfklow to test the REST Call via SwaggerSwagger is a powerful open source framework backed by a largecosystem of tools that helps you design, build, document,and consume your RESTful APIs.

Create a new Workflow with the following Inputs and name it „REST Client Test with Swagger“ (without quotes).

Add a Scribtable Task to the Schema

Here the Script as text

Get the ID from your created Workflow under the General TAB of the Workflow . This ID is needed later on (below shows only an example ID).

Browse back to vRO Homepage

VMware vRealize• Orchestrator• Getting Started with vRealize Orchestrator To create and modiffworkflows. orto perform administrative tasks. startthe Orchestrator client by using Java VVeb Start • Start Orchestrator Client To use the Orchestrator client on your local machine. install the Orchestrator client After you complete the installation, start the Orchestrator client and connectto the Orchestrator server • Download Orchestrator Client application Configure the Orchestrator Server TO make additional configuration changes to the Orchestrator server. use the Orchestrator configuration interlace; Orchestrator Control Center Develop with the Orchestrator Server Contains the necessary materials for developing an Orchestrator plug-in and information about using the Orchestrator REST APIs. • Develop with the Orchestrator Server

After the restart is completed open the link Develop with the Orchstrator Server

VMware vRealize• Orchestrator• Develop with the Orchestrator Server Integrate With Orchestrator by using REST. • REST API Documentation

Click on the REST API Documantation link

content-controller : Content Con troller custom-event-contoroller : Custom Event Contoroller user-interaction-con troller : User Interaction Controller inventory-service-controller : Inventory sen.'ice controller package-con troller : Package Controller plugin-con troller : Plugin Controller resource-controller : Resource Con troller server-object-controller : server Object controller server-config-controller : Server Config Controller tagging-controller : Tagging Controller task-con troller : Task Controller users-controller : Users Controller workflow-controller : Workflow Controller execution-controller : Execution Controller

Navigate to execution-controller: Execution Controller

execution-controller : Execution con troller Show/Hide List Operations Expand Operations Get all executions DELETE POST DELETE /api/workfiows/{workfl owld}/exe cutio ns /api/workfiows/{workfiowld}/executions /api/workfiows/{workfl la pi/workfi ows/{wo rkfl owld}/exe cut o ns/{exe cut o nteracti on la pi/workfi ows/{workfl owld}/exe cuti o ns/{exe cuti o ntd}/i nter acti on /api/workfiows/{workfi ogs /api/workfiows/{workfl /api/workfiows/{workfl Start workflow execution Delete workflow run Get workflow execution Get user interaction Answers user interaction Get workflow run logs Cancel workflow run Get workflow execution state

Click on POST link as shown above

  1. Enter the Workflow ID from your previous created Workflow
  2. Add the executionContent as shown below
  3. Set the parameter content type to application/json
  4. Click on Try it out buttom

 

Execution Content:

 

 

Now the Worflow should be executed via The SwaggerSwagger is a powerful open source framework backed by a largecosystem of tools that helps you design, build, document,and consume your RESTful APIs. REST Call

The RESPONSE CODE should be 202

The RESONSE Header should be like

{

„location“: „https://vco001:8281/vco/api/workflows/4d6577b3-2ba7-4529-a4b6-8a7d972a0605/executions/ff8080815a6fad17015a893652d3055f/„,

„cache-control“: „no-cache, no-store, max-age=0, must-revalidate“,

„pragma“: „no-cache“,

„expires“: „0“,

„strict-transport-security“: „max-age=31536000 ; includeSubDomains“,

„x-xss-protection“: „1; mode=block“,

„x-frame-options“: „DENY“,

„x-content-type-options“: „nosniff“,

„content-length“: „0“,

„date“: „Wed, 01 Mar 2017 09:32:02 GMT“,

„content-type“: null

}

Here you can find the location URL with this URL you can get the Status of your Workflow

The first green marked rectangle shows the Workflow ID and the second the Execution ID

To get the Status of the executed Workflow you have to open the REST Call as shown below

Enter the Workflow ID and Execution ID

Click on Try it out buttom

The RESPONSE CODE should be 200

Now you can see in the RESPONSE BODY the following like this

{

„href“: „https://vco001:8281/vco/api/workflows/4d6577b3-2ba7-4529-a4b6-8a7d972a0605/executions/ff8080815a6fad17015a893652d3055f/„,

„relations“: {

„link“: [

{

„href“: „https://vco001:8281/vco/api/workflows/4d6577b3-2ba7-4529-a4b6-8a7d972a0605/executions/„,

„rel“: „up“

},

{

„href“: „https://vco001:8281/vco/api/workflows/4d6577b3-2ba7-4529-a4b6-8a7d972a0605/executions/ff8080815a6fad17015a893652d3055f/„,

„rel“: „remove“

},

{

„href“: „https://vco001:8281/vco/api/workflows/4d6577b3-2ba7-4529-a4b6-8a7d972a0605/executions/ff8080815a6fad17015a893652d3055f/logs/„,

„rel“: „logs“

},

{

„href“: „https://vco001:8281/vco/api/workflows/4d6577b3-2ba7-4529-a4b6-8a7d972a0605/executions/ff8080815a6fad17015a893652d3055f/state/„,

„rel“: „state“

}

]

},

„id“: „ff8080815a6fad17015a893652d3055f“,

„state“: „completed“,

„start-date“: 1488360723155,

„end-date“: 1488360723215,

„started-by“: „hferch@lab.hf.de„,

„name“: „REST Client Test with Swagger“,

„input-parameters“: [

{

„value“: {

„string“: {

„value“: „testVM002“

}

},

„type“: „string“,

„name“: „vmName“,

„scope“: „local“

},

{

„value“: {

„string“: {

„value“: „sles12_64Guest“

}

},

„type“: „string“,

„name“: „vmGuestOs“,

„scope“: „local“

},

{

„value“: {

„number“: {

„value“: 4096

}

},

„type“: „number“,

„name“: „vmMemorySizeMB“,

„scope“: „local“

},

{

„value“: {

„number“: {

„value“: 2

}

},

„type“: „number“,

„name“: „vmNumberOfCpus“,

„scope“: „local“

},

{

„value“: {

„string“: {

„value“: „VM Network“

}

},

„type“: „string“,

„name“: „network“,

„scope“: „local“

},

{

„value“: {

„string“: {

„value“: „“

}

},

„type“: „string“,

„name“: „backupNetwork“,

„scope“: „local“

},

{

„value“: {

„boolean“: {

„value“: false

}

},

„type“: „boolean“,

„name“: „vmMemoryReservation“,

„scope“: „local“

},

{

„value“: {

„string“: {

„value“: „oracle“

}

},

„type“: „string“,

„name“: „serverType“,

„scope“: „local“

},

{

„value“: {

„string“: {

„value“: „{ „hdds“:[ {„size“:“10″},{„size“:“15″},{„size“:“5″}]}“

}

},

„type“: „string“,

„name“: „hdds“,

„scope“: „local“

}

],

„output-parameters“: []

}

Under state you can see completed. All Inputs are provided as well. If you have also output paremeters on your Workflow then the output are also provided if the Workflow status completed.


         

hferch has written 76 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">