Redeploy NSX Edge Gateway Using Rest API

By | 21/06/2017

In this post I will demonstrate how to redeploy edge gateway in vCloud Director using Rest API

Disclaimer: This is not any fancy post and I am going to perform very simple task here. Most of you may be already aware of this. This post is for those who are new to API and also a reference post for me for future.

Lets get started.

We have to follow below steps for redeploying an edge gateway using API calls

Step 1: Generate Auth Token

# curl -sik -H “Accept:application/*+xml;version=5.6” -u “admin@system” -X POST https://vcd-b.alex.local/api/sessions | grep auth
Enter host password for user ‘admin@system’:

x-vcloud-authorization: 3fc8a5425f804c9d94eeff04e0272ed7

Step 2: Get Org UUID

# curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization:3fc8a5425f804c9d94eeff04e0272ed7” -X GET https://vcd-a.alex.local/api/org/

Step 3: Get vDC UUID

# curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization:3fc8a5425f804c9d94eeff04e0272ed7” -X GET https://vcd-a.alex.local/api/org/58d92de4-4aa5-4a14-9b39-28e1de5e9809 | grep vdc

Step 4: Get Edge Gateway UUID

# curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization:3fc8a5425f804c9d94eeff04e0272ed7” -X GET https://vcd-a.alex.local/api/vdc/1c32832c-e4db-48b0-9cfc-116fbb302625 | grep edgeGateways

Step 5: Get Edge Gateway UUID

# curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization:3fc8a5425f804c9d94eeff04e0272ed7” -X GET https://vcd-a.alex.local/api/admin/vdc/1c32832c-e4db-48b0-9cfc-116fbb302625/edgeGateways | grep GW_Name

Step 6: Redeploy Edge Gateway

# curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization:3fc8a5425f804c9d94eeff04e0272ed7” -X POST

And that’s it. If you have access to vCenter Server, you can watch sequence of events happening there

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

Category: NSX Tags: ,

About Alex Hunt

Hi All I am Manish Jha. I am currently working in OVH US as Operations Support Engineer (vCloud Air Operations). I have around 7 Years of IT experience and have exposure on VMware vSphere, vCloud Director,vSphere Replication, vRealize Automation, NSX and RHEL. If you find any post informational to you please press like and share it across social media and leave your comments if you want to discuss further on any post. Disclaimer: All the information on this website is published in good faith and for general information purpose only. I don’t make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information you find on this blog is strictly at your own risk. The Views and opinions published on this blog are my own and not the opinions of my employer or any of the vendors of the product discussed.