In my demo vCD environment I often find that after a power-up the Edge Gateways don’t function properly. Options like “Upgrade to Full Configuration” don’t exist, traffic doesn’t flow or rules can’t be changed. A redeploy always fixed it so I started looking for a way to redeploy them automatically when the system started up.
I started with PowerCLI and after figuring out you need to select the vCloud Director plugin during the installation for commands like connect-ciserver to showup I realized it didn’t really address vSheild/VMware vCloud Networking and Security. That led me to Alan Renouf’s VMware vShield PowerShell Module which contains mostly GET commands for vShield but also has an Invoke routine that I played with for awhile before moving on to cURL
cURL ultimatly had what I needed, the final piece coming from a VMware Blog on using cURL with the vShield Rest API.
Step 1: Download cURL for your platform of choice and extract the executable into a suitable directory
Step 2: Find the identifier of the Edge Gateway to redeploy. Since I’m resetting the same gateways on a set install I just used the vShield Manager GUI:
Step 3: Execute the command (all on one line):
curl -k -u username:password –header “Content-Type:application/xml” -X POST https://vshieldmanagerip/api/3.0/edges/edge id?action=redeploy
I then added the commands to a batch file that executes on my vCenter server at start up. Works great!