NSX Visio Diagramming Tool

At VMworld US and Europe this year, Nick Bradford and I presented on PowerNSX. PowerNSX provides a PowerShell module featuring a substantial number of cmdlets that cover the NSX API. Working in concert with PowerCLI it becomes possible to interact via a command line or programmatically with the NSX for vSphere API.

One section Nick provided a bit of an ad-lib to the session with regards to PowerNSX. He showed off the Visio Diagramming tool. When asked if this was something “needed” – all hands were up and people were out of their seats. Claps and Cheers went up! Well – now here it is – ready for anyone to use.

The NSX Visio Diagramming tool provides everyone the chance to diagram their network programmatically. This removes the human time and error elements from documentation. Run the tool and within a minute (if not seconds) you have the data you need to visualise your environments current state.

The Tool

The tool is broken into two parts – a bundle capture script and a digram script.

The Bundle script allows thePowerNSX diagramming tool will automatically go off and gather the logical topology and components from NSX and vCenter to determine what a logical topology looks like. This includes but is not limited to NSX Edges, Attached Logical Switches, Distributed Logical Routers, Distributed Port Groups, Virtual Switches and the Virtual Machines that are attached to these networks. It also supports the documentation of multi-vNIC Virtual Machines. It will collect all these, store the contents in respect

The Diagram script will take a defined bundle and the data contained with the aforementioned bundle and build the topology. By using PowerShell to read and interpret the bundle it will use Visio’s API’s via PowerShell to build out the topology. Using “pretty and shiny” icons the tool will place down the respective devices and topology captured in the bundle. It will then make auto-distance objects to ensure it is readable.

The reason the capture and diagram functions were split out was usability. It allows capture to take place on a machine ‘in production’ through a scheduled task or administrator running it. These machines may or may not have Vision installed. This could be due to the box not having a Visio license or the device (such as an admin desktop) does not have access to production. The bundles can be accessed via a share or central repo and the diagram tool can be run from the administrators laptop.

By time stamping the .ZIP bundle this allows for a point in time capture of the environment. Performed weekly, daily, or hourly, this provides a repository of “as is” topology maps that can be used for diagrams, troubleshooting, charts, or aiding GSS when ticket issues arise.

Using the Tool

First step is to run the NsxObjectCapture.ps1 script. This script requires an existing connection to NSX Manager and vCenter. (Connect-NsxServer and Connect-ViServer)

screenshot-2016-10-20-13-03-32

This will go off and collection all NSX Objects related to the logical topology and store it in a bundle.

screenshot-2016-10-20-16-07-09

Running the NsxObjectDiagram.ps1 script with the defined -CaptureBundle it will Launch Visio and turn the content of the bundle into a logical diagram. It will step through each component and stack it on the canvas. Based on the data inside the bundle it will process what an object is, select the right icon, and apply its connected members to it.

And below is the result of a basic 3 Tier application being drawn by the tool. It will auto-format the layout as the last step it does.

screenshot-2016-10-20-16-07-47

Bonus:

  • Within the shape data itself there the XML that represents the object. For example if you select an NSX Edge it has the relevant XML for the given edge. A Logical Switch includes the API output of that is the Edge
  • Multi-vNIC VM’s are supported
  • Use your own icons by modifying the contents of nsxdiagram.vssx

From one switch to hundreds. A logical router to dozens of edges. Ten VMs to ten thousand. This tool can handle this! Diagram with ease thanks to NSX Visio Diagramming tool! Get it today and as always, open an Issue if you want to see a feature added.

5 thoughts on “NSX Visio Diagramming Tool

  1. Nick says:

    I can’t get this to work, i get the following errors

    At C:\DiagramNSX\NsxObjectCapture.ps1:116 char:13
    + <a href="/open-source" class="js-selected-navigation-item …
    + ~
    The '<' operator is reserved for future use.
    At C:\DiagramNSX\NsxObjectCapture.ps1:118 char:13
    + <a href="/business" class="js-selected-navigation-item na …
    + ~
    The '<' operator is reserved for future use.
    At C:\DiagramNSX\NsxObjectCapture.ps1:120 char:13
    + <a href="/explore" class="js-selected-navigation-item nav …
    + ~
    The '<' operator is reserved for future use.
    At C:\DiagramNSX\NsxObjectCapture.ps1:122 char:11
    +
    + ~
    The ‘<input name="utf8" type="hidden" value="✓" …
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
    quotation marks ("&") to pass it as part of a string.
    At C:\DiagramNSX\NsxObjectCapture.ps1:1460 char:11
    + © 2016 <span title="0.06268s from github-fe154-cp1-prd …
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
    quotation marks ("&") to pass it as part of a string.
    At C:\DiagramNSX\NsxObjectCapture.ps1:1460 char:23
    + © 2016 <span title="0.06268s from github-fe154-cp1-prd …
    + ~
    The '<' operator is reserved for future use.
    At C:\DiagramNSX\NsxObjectCapture.ps1:1460 char:29
    + … 2016 GitHub’ in expression or statement.
    At C:\DiagramNSX\NsxObjectCapture.ps1:1460 char:100
    + … 268s from github-fe154-cp1-prd.iad.github.net”>GitHub, Inc.</l …
    + ~
    Missing argument in parameter list.
    At C:\DiagramNSX\NsxObjectCapture.ps1:1479 char:14
    + You can't perform that action at this time.
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The string is missing the terminator: '.
    + CategoryInfo : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : RedirectionNotSupported

  2. Venkata says:

    Hi Pandom

    I trying to run this script and i get the following errors. I am launching from the powershell

    C:\Scripts> .\NsxObjectCapture.ps1
    At C:\Scripts\NsxObjectCapture.ps1:115 char:13
    + <a href="/open-source" class="js-selected-navigation-item …
    + ~
    The '<' operator is reserved for future use.
    At C:\Scripts\NsxObjectCapture.ps1:117 char:13
    + <a href="/business" class="js-selected-navigation-item na …
    + ~
    The '<' operator is reserved for future use.
    At C:\Scripts\NsxObjectCapture.ps1:119 char:13
    + <a href="/explore" class="js-selected-navigation-item nav …
    + ~
    The '<' operator is reserved for future use.
    At C:\Scripts\NsxObjectCapture.ps1:121 char:11
    +
    + ~
    The ‘<input name="utf8" type="hidden" value="✓" …
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
    quotation marks ("&") to pass it as part of a string.
    At C:\Scripts\NsxObjectCapture.ps1:1474 char:11
    + © 2017 <span title="0.06649s from github-fe-fdcdb84.cp …
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
    quotation marks ("&") to pass it as part of a string.
    At C:\Scripts\NsxObjectCapture.ps1:1474 char:23
    + © 2017 <span title="0.06649s from github-fe-fdcdb84.cp …
    + ~
    The '<' operator is reserved for future use.
    At C:\Scripts\NsxObjectCapture.ps1:1474 char:29
    + … 2017 GitHub’ in expression or statement.
    At C:\Scripts\NsxObjectCapture.ps1:1474 char:101
    + … 49s from github-fe-fdcdb84.cp1-iad.github.net”>GitHub, Inc.</l …
    + ~
    Missing argument in parameter list.
    At C:\Scripts\NsxObjectCapture.ps1:1493 char:14
    + You can't perform that action at this time.
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The string is missing the terminator: '.
    + CategoryInfo : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : RedirectionNotSupported

Leave a Reply to pandom Cancel reply

Your email address will not be published. Required fields are marked *

*