Book Image

VMware NSX Cookbook

By : Bayu Wibowo, Tony Sangha
Book Image

VMware NSX Cookbook

By: Bayu Wibowo, Tony Sangha

Overview of this book

This book begins with a brief introduction to VMware's NSX for vSphere Network Virtualization solutions and how to deploy and configure NSX components and features such as Logical Switching, Logical Routing, layer 2 bridging and the Edge Services Gateway. Moving on to security, the book shows you how to enable micro-segmentation through NSX Distributed Firewall and Identity Firewall and how to do service insertion via network and guest introspection. After covering all the feature configurations for single-site deployment, the focus then shifts to multi-site setups using Cross-vCenter NSX. Next, the book covers management, backing up and restoring, upgrading, and monitoring using built-in NSX features such as Flow Monitoring, Traceflow, Application Rule Manager, and Endpoint Monitoring. Towards the end, you will explore how to leverage VMware NSX REST API using various tools from Python to VMware vRealize Orchestrator.
Table of Contents (19 chapters)
Title Page
Packt Upsell
Foreword
Contributors
Preface
Index

Using the REST API with cURL


The NSX REST API can also be consumed via command-line tools, such as cURL (c for Client). cURL is a free and open source software that can be downloaded from https://curl.haxx.se/. Most Linux- or Unix-based operating systems come pre-installed with cuRL, such as the vCenter Server Appliance, however Microsoft Windows typically requires it to be manually installed.

Getting ready

You should be logged in to a guest operating system with cURL installed. In this example, we will use cURL from the Git command prompt in a Windows workstation.

How to do it...

This recipe is divided into two parts of REST API requests using cURL: retrieving a configuration or information, and creating a logical switch.

Requesting the HTTP GET REST API via cURL

In this example, we will perform an HTTP GET REST API request via cURL script:

  1. To check whether cURL is available in the operating system, use the curl ---version command.
  1. Run the following cURL script:
curl -k -X GET -H "Accept: application...