Automating vCloud Usage Meter Deployment & Configuration via API

In my last Post I covered manual steps of vCloud Usage Meter deployment & configuration. In this post I will show how we can leverage Usage Meter API’s to perform end to end configuration.

Usage Meter Deployment: There is no API for UM deployment and we have to stick to ovftool method for this step.

Once Usage meter boots up, we can leverage below API calls to perform end to end configuration. 

1: Get Authentication Token

Response Output: We need to grab value of “sessionid” from output response. Further API calls will be authenticated using sessionid. 

2: Accept Data Usage

3: Network Connection Configuration: In this step we are configuring direct internet access to usage meter. If in your environment, internet connectivity is via proxy, your payload will change accordingly.

4: Grab Usage Meter UUID for Registration

Cat /opt/vmware/cloudusagemetering/resources/ro.txt 

5: Register UM UUID with Commerce Portal

5a: Get Commerce Portal Auth Token

Response Output: We have to grab “XSRF-TOKEN” value from response output. In Postman client you can see this under cookies.

5b: List Contracts

Response Output: We need to find id associated with a contract#

5c: Get List of instance registered with a given contract

Sample Output (Trimmed):

5d: Add a new UM Instance to an existing contract

6: Register vCenter with Usage Meter

Response Output

I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing 🙂

Leave a Reply