Warning: count(): Parameter must be an array or an object that implements Countable in /home/customer/www/vmguru.com/public_html/wp-content/plugins/amp-plugin-filter/amp-plugin-filter.php on line 24

Warning: Illegal string offset 'width' in /home/customer/www/vmguru.com/public_html/wp-content/plugins/amp-plugin-filter/amp-plugin-filter.php on line 28

Warning: Illegal string offset 'height' in /home/customer/www/vmguru.com/public_html/wp-content/plugins/amp-plugin-filter/amp-plugin-filter.php on line 28

Warning: Illegal string offset 'width' in /home/customer/www/vmguru.com/public_html/wp-content/plugins/amp-plugin-filter/amp-plugin-filter.php on line 28
Introducing the VMware NSX for vSphere PHP Framework

Introducing the VMware NSX for vSphere PHP Framework

Over the last few weeks, I have been working on a VMware NSX integration with one of my existing PHP applications. This application is tied into a development process with a new testing schematic which needed to use a the NSX features to test the code inside a tiered network setup. Of course, this needed to be automated and available on demand; enter the NSX API. Using the NSX API, I’ve been able to integrate network deployment and configuration inside the existing application (with not a lot of effort).

After getting a few requests from fellow NSX enthusiasts, I’ve decided to put the bits I had into a framework and open source it. And with that, I’d like to introduce the VMware NSX for vSphere PHP Framework! (or nsx-v-php for short)

It’s available on GitHub for downloading, forking, pulling and feature requests. It currently contains functions for the NSX Controllers, Edge Services Gateways, Logical Switches and Transport Zones.

It’s in its early stages and I haven’t ported every function to it yet, simply due to time available for this project — stay tuned for more cool functions!

Using nsx-v-php

Using the framework is pretty simple. There is an examples.php file in the repository that outlines examples of all available functions, but just to quickly show how simple it is; here’s how to create a new NSX Logical Switch:

<?php

  require("nsx-v.class.php");

  /**
   * Instantiate NSX_v_API object and set the login credentials for the NSX Manager
   */
  $nsxv = new NSX_v_API;
  $nsxv->setLoginDetails("my-nsx-manager.domain.local", "admin", "mysecretpassword");

  // Create a Logical Switch
  var_dump($nsxv->LogicalSwitch()->Create("new_switch"));
?>

 

 

Related posts

PowerShell Friday: Setting Reservations with PowerCLI

by Anne Jan Elsinga
8 years ago

VMware NSX PowerShell Extension Open Sourced

by Martijn Smit
8 years ago

Introducing PowervRNI

by Martijn Smit
6 years ago
Exit mobile version