Exploring PowerNSX in Lab

These days I am busy exploring NSX Rest API in my lab and during the process I came to know about a cool tool named PowerNSX and decided to dedicate a blog on this to give respect to creator of this tool.

What is PowerNSX

PowerNSX is a PowerShell module that abstracts the NSX API to a set of easily used PowerShell functions. PowerNSX enables NSX administrators to drive their infrastructure programmatically.

PowerNSX add additional functionality to extend the capabilities of NSX along with exposing the existing Update, Remove and Get operations for all key NSX functions beyond the native UI or API.

PowerNSX have been developed by Nick Bradford. PowerNSX is available for download on GitHub and can be downloaded as the branch or zipfile.

Note: VMware does not support this module, and PowerNSX comes with no warranties express or implied. It is advisable to test this in Lab before using in a production environment.Read More

Retrieving NSX Manager System Info Using Rest API

In this post we will explore how NSX manager system info can be retrieved via Rest API. NSX manager appliance home page is itself very descriptive and provides all system info. 

In this post we will learn how the same system info can be explored via API calls. Let’s get started.

Query NSX Manager Information

Below API query will provide you info like what is the major and minor version of NSX appliance you are running along with patch number and build number

Example: curl -k -u “vcadmin@corp.local” -X GET https://nsxmgr-01a.corp.local/api/1.0/appliance-management/global/info | tidy -xml -indent -quiet

Read More

Managing NSX Manager Network Settings via Rest API

In this post we will learn how can we configure some of the network settings like DNS/Syslog and NTP configurations in NSX manager via Rest API.

We can do all this from NSX manager GUI also but if you are thinking about automating NSX manager deployment, then these Rest API knowledge can be pretty handy for configuring the appliance post its deployment.

Lets get started.

Query Network Settings

Below API query will give you an overview of NSX Manager IP settings, Hostname, DNS settings and domain name

# curl -k -u “admin:adminpwd” -X GET https://nsxmgr.alex.local/api/1.0/appliance-management/system/network/ | xmllint –format –

Read More

NSX Certificate Management Using Rest API

In this post We will learn how to view generate self-signed certificate for NSX and replace the certificates after getting them signed from CA. We will be doing this via Rest API.

I wrote a post in past on how to replace SSL certs for NSX from GUI. In this post I am trying to achieve the same via Rest API

Following are the API queries which you need to execute in order to generate and replace certs.

Generate CSR Certificate

# curl -k -u “admin:passwd” -d @csr.xml -X PUT https://nsxmgr.alex.local/api/1.0/appliance-management/certificatemanager/csr/nsx

Read More

Enable Disable HA on Edge GW via NSX Rest API

In this post I will be demonstrating how to enable and disable high availability on NSX edge gateway using Rest API.

If you are new to NSX and do not know what edge gateway high availability means then I would recommend to read this Blog by Gabe Rosas.

We can enable disable high availability on edge gateway from vSphere Web Client by navigating to Home  > Networking & Security > NSX Edges > Selecting Edge > Manage > HA Configuration

Enabling HA on edge gateway will create a new vse vm in vCenter and both VM start exchanging heartbeat and exchanging other configuration etc.

Now we will see how to achieve this via NSX Rest API.

Step 1: Query HA Status

# curl -k -u “admin:passwd” -X GET https://nsxmgr.alex.local/api/4.0/edges/edge-2/highavailability/config | xmllint –format –

Read More

Redeploy NSX Edge Gateway Using Rest API

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-28e1de5e9809Read More

Detaching and Deleting Independent Disks in vCloud Director via REST API

Yesterday while working on one of the production issue where we had to deprovision a tenant environment in vCloud Air, I noticed that independent disks were preventing automated deprovision of the environment and the error messages were loud and clear in the log files.

It was a new issue for me so I started reading about independent disks in vCloud Director and want to share few things about this.

First of all independent Disk feature in vCD is completely different from an Independent Disk in vSphere. Independent disks can be shared across multiple vApps/VM’s in vCloud Director. This feature was first introduced in vCD v5.1.

Following quote from vCloud Architecture Toolkit document rightly explains about independent disks

The use of independent disks with vCloud Director allows updates of virtual machines without impacting the underlying data.

The feature is designed to enable users to create virtual disks which can be attached to and detached from virtual machines.Read More

Replacing vCD SSL Certificates in a Multi Cell Environment

After a long wait I finally got chance to work on vCloud Director ssl certificates. This was the only component in my lab which was still using self-signed certs and that encouraged me to do something new in lab.

A note on vCD SSL certificates

vCloud Director like any other VMware product needs a certificate to be installed on the device that it uses for communication with the other products. By default vCD uses a self-signed certificate. If you have a certificate authority in your environment then you can get the certs created in advance before installing vCloud director and save your self from pain of messing with certificates at later stages.

vCD has 2 IP address which allows support for 2 different SSL endpoints (http and consoleproxy). Each endpoint requires its own SSL certificate. vCloud Director uses a java keystore to read its SSL certificates from.  In a Multi-cell environment you need to create 2 certificates for each cell and import the certificates into vcd java keystore.… Read More