PyNSXv-Powerful tool for NSX Automation

Like last post of NSX series, this post is also focused on exploring a new tool which helps automatic NSX stuffs in your infrastructure. I first came across this tool when I was watching a VMworld 2016 Session titled NET7514 – PowerNSX and PyNSXv, but never got chance to play around this tool.

Now since I am exploring NSX automation these days, I decided to deploy the tool, in lab and use it. 

This post will be focused on just installation/configuration part and some examples on how to use this tool.

So what is PyNSXv?

PyNSXv is a high python based library that exposes ready to use work-flows and a CLI tool that can be used to control and automate NSXv in your infrastructure. 

It an opensource tool and is not supported by VMware and before using this in production, it is recommended to test it thoroughly in lab deployments. Read More

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

Troubleshooting Failed Org Network Creation in vCloud Director

Today while working in my lab, I observed that while creating a new VDC in vCD was failing because org network failed to create.

On navigating to Org VDC list and clicking on error, it read the error load and clear that org vdc network can’t be created.

vcd-1

On navigating to Org VDC Networks section and clicking on error, I was able to identify what has caused the network creation failure.

vcd-2

The error stack was reading as below:

Read More

Learning NSX-Part-11-Replacing NSX default SSL Certficates with CA Signed Certificates

I am a big advocate of not using the default SSL certs on any VMware products and I prefer using Signed certs from my CA server on my lab components. I have my CA server running in Windows Server 2012.

Earlier in my lab I had replaced the vSphere (Esxi + vCenter) SSL certs and if you want to know how to do it, you can read them from below links:

1: Replacing Esxi SSL Certificates

2: Replacing vCenter Server SSL Certs

If you are like me and new to replacing SSL certs and looking for how to setup a CA server, you can read it from Here for a step by step installation/configuration of CA server.

1: Introduction to VMware NSX

2: Installing and Configuring NSX Manager

3: Deploying NSX Controllers

4: Preparing Esxi Hosts and Cluster

5: Configure VXLAN on the ESXi Hosts

6: Logical Switching

7: Distributed Logical Router Tidbits

8: Installing Distributed Logical Router

9: NSX Edge Services Gateway

10: Upgrade NSX Manager From 6.2 to 6.2.4

All right lets dive into lab and look into how to replace the default SSL certs of VMware NSX.… Read More

Learning NSX-Part-10-Upgrade NSX Manager From 6.2 to 6.2.4

This week I was trying my hands on upgrading NSX to version 6.2.4 which was released earlier this year in August.

I had no experience earlier with upgrading NSX manager and associated components, so I spent a lot of time in reading blogs and watching videos on how to perform the upgrade.

Before starting with upgrade process please consult the NSX 6.2.4 Release Notes and also follow VMware KB-2144295 which explains recommended minimum versions for VMware NSX for vSphere, ESXi, vCenter Server and Guest Introspection Driver (GID).

To keep track of latest versions you can use vTracker or the Latest Versions page hosted on www.virten.net

You can follow the below upgrade matrix to find out the upgrade path available in your environment.

nsx_614_upgrade_3

While going through the blogs on how to start upgrading NSX to 6.2.4, I came across screenshot of a cool table which Anthony has posted on his Blog.… Read More