Connect vCO to Nutanix API – Part 1
Connect vCO to Nutanix API – Foundation
Here you can find more about Nutanix Foundation. However in this post I will explain how to connect vCenter Orchestrator to Nutanix API. Nutanix foundation API accept and return information in JSON format. JSON is very easy to learn, even such a coding lame as myself can easily operate and build JSON code.
- vCenter Orchestrator deployed and configured
- Nutanix Foundation deployed and configured
Let’s get started then.
Log in to vCenter Orchestrator using vCO client. From main vCO client window switch over to workflow view and from there, expand HTTP-REST –> Configuration a–> run workflow called Add a Rest host.
Provide name for HTTP-REST API host, url under which API call can be found by vCO. For Nutanix foundation it would be http://IP_ADDRESS_FOUNDATION_VM:8000/foundation/ . Remain options leave unchanged – also those for authentication – you don’t need to authenticate to use API on Foundation 1.2.1. Submit workflow to execute.
2014-08-07 22:24:07.729] [I] url: http://:8000/foundation/ [2014-08-07 22:24:07.729] [I] Certificate information: null [2014-08-07 22:24:07.791] [I] Certificate info is null, not an HTTPS [2014-08-07 22:24:07.963] [I] REST host: DynamicWrapper (Instance) : [RESTHost]-[class com.vmware.o11n.plugin.rest.RESTHost] -- VALUE : [email protected] [2014-08-07 22:24:07.978] [I] REST host authentication: DynamicWrapper (Instance) : [RESTAuthentication]-[class com.vmware.o11n.plugin.rest.Authentication] -- VALUE : NONE [2014-08-07 22:24:08.540] [I] REST host added: DynamicWrapper (Instance) : [RESTHost]-[class com.vmware.o11n.plugin.rest.RESTHost] -- VALUE : [email protected]
When workflow finis, switch over to Inventory view and from there click on HTTP-REST. Under HTTP-REST section you should see brand new API target\host which you can play with.
Build workflows which one can use to run against Nutanix Foundation API. First what we have to do is Add rest operation. There are several HTTP REST operations:
- GET – pul information from host
- POST – push configuration to host
- PUT – upload files on HTTP-REST host
- DELETE – delete files from
Connect vCO to Nutanix API – Add rest operation
For test I we will add GET operation which will list all the hypervisor ISOs available on Foundation VM.
Right click on HTTP-Rest host –> Run Workflow and from new window choose Add rest operation.
- Choose API target
- Name: GEThypervisorISO
- Template URL; in our example would be /enumerate_hypervisor_isos
- from drop down menu choose GET as method
After WF is completed you should see the new item just right below HTTP-REST target – see picture above.
Connect vCO to Nutanix API – Generate WF based on REST operation
So, now we can generate new workflow based on REST operation we just created.
Right click on Rest operation –> Run Workflow –> Generate new workflow from REST operation. Make sure the under REST operation to be used for the call you have correct REST operation selected, On next screen provide Workflow name and set folder for new workflow –> Submit
Switch to workflow tab in vCO client and browse to folder with new workflow. Let’s test it then. Simply run workflow and in workflow LOG tab you should see a list of the ISOs available on Foundation VM – assuming you have uploaded hypervisor ISOs on Foundation VM 🙂
[2014-08-07 22:48:35.248] [I] Request: DynamicWrapper (Instance) : [RESTRequest]-[class com.vmware.o11n.plugin.rest.Request] -- VALUE : [email protected] [2014-08-07 22:48:35.248] [I] Request URL: http://10.1.222.146:8000/foundation/enumerate_hypervisor_isos [2014-08-07 22:48:38.868] [I] Response: DynamicWrapper (Instance) : [RESTResponse]-[class com.vmware.o11n.plugin.rest.Response] -- VALUE : [email protected] [2014-08-07 22:48:38.868] [I] Status code: 200 [2014-08-07 22:48:38.868] [I] Content as string: [ "9600.16384.WINBLUE_RTM.130821-1623_X64FRE_SERVERHYPERCORE_EN-US-IRM_SHV_X64FRE_EN-US_DV5.ISO", "VMware-VMvisor-Installer-5.5.0-1331820.x86_64.iso", "VMware-VMvisor-Installer-5.1.0-799733.x86_64.iso", "VMware-VMvisor-Installer-5.1.0.update01-1065491.x86_64.iso" ]
Connect vCO to Nutanix API – Part 2 – I will show how you can connect to Prism API