Postman collections for DellEMC block storage

Today I will be discussing the details and artefacts of Project Vision. This new Avengers' project leverages Postman's import collection capabilities to provide sample API calls. For more details about the IaC Avengers initiative you can read this other article:

http://anzpiper.blogspot.com/2019/12/confiure-vxflex-scaleio-api-with-python.html

This first release Project Vision provides API examples for the following products:

  • PowerMax
  • XtremIO
  • Unity
  • PowerFlex/VxFlex (formerly ScaleIO)
  • PowerStore - Added in June 2020
  • PowerOne - Added in June 2020
  • VPLEX - Added in June 2020 - Courtesy of Ankur Patel
The goal of the project is to help customers of these products to automate day 1 and day 2 operations by looking at handy examples. API reference guides can sometimes be many hundred pages long and take considerable effort to understand. So by looking at some of the most common operational examples one can kickstart coding efforts. Each collection has been built to provide sample calls in these areas:

  • Gather system and hardware information
  • Basic provisioning
  • Performance and event collection

The following screenshot shows part of the calls provided by the PowerMax collection


With Project Vision, one can learn by example how API authentication is undertaken and how parameters or JSON bodies are passed. Additionally every API call has been provided with a sample reply so that developers can more easily see what fields are relevant for their purpose and help fast tracking the coding effort

You can access Project Vision's Postman collections in the following GitHub repo:

https://github.com/cermegno/Project-Vision

Instructions on how to use these collections:

  • Download Postman for your operating system from here
  • Import the collections by clicking File > Import > Choose Files. The collection will appear in the left pane. At this point you can click on any of the calls to see the details

  • The collections don't use specific array information like IP address, password, etc. To use the collection to send calls to a real array you can create an "environment" and define that information as variables. The following screenshot shows how environment variables in Postman use the "double curly bracket" notation, ex: {{ ip }}


All collections require two variables: "ip" and "pwd". Additionally PowerMax requires "serial" as you can see in the previous screenshot.

To create a new environment for your array, click on the little "eye" icon at the top right, next to the "environment" drop-down menu. Then click "Add"

A form like the following will appear. Populate the variables as shown, using the "current value", not the "initial value". Then click Add

At this point you can select the environment using the drop-down menu. Once you do it you can hover your mouse over each of the variables in your API call to see what value will be used to make the API call. See example below

The VxFlex and PowerStore collections make use of a Postman "test" to create the "token" environment variable dynamically. Run the "login" call before running any other calls. If the token expires you will need to run the "login" call again to get a fresh token

The Unity API also uses CSRF tokens to secure POST, PUT and DELETE calls. The CSRF token is provided as part of GET calls. The Unity collection has been configured with a test in the first query (named "Get FC ports - set token). Run this call before attempting any other call or after the token expires

The PowerOne collection has been developed using a simulator as I don't have access to a real PowerOne. The simulator listens on 127.0.0.1:3000. The simulator doesn't require login. So all the parameters have been hard-coded. The only parameter required is "token" if you want to experience the "login" functionality. However, please note this collection will not work on a real PowerOne system as it requires additional header information.

The following table summarises the environment variables required for each collection

Array Variable Variable Variable
XtremIO ip pwd
Unity ip pwd csrfToken
PowerMax/VMAX ip pwd serial
PowerFlex/ScaleIO ip pwd token
PowerStore ip pwd token
PowerOne simulator

token

Every API call in Project Vision includes an example response. So even if you don't have access to a real storage array you can see how its API behaves. To see an example response, click on the "examples" drop-down menu just under the "environment" section, and them click on the example name


Now you can scroll down to the "Example Response" section to see the recorded response


Another great feature that Postman provides us with is the ability to generate sample code for many programming languages for every call in the collection. In order to use this feature you will need to create a free account with Postman. Once you do that you can click on the little triangle next to the collection name and then "View in web"

The web documentation for the API collection will appear in your Internet browser. The right tab shows the code for the language of choice. The following screenshot shows sample code for creating a volume in VxFlex (ScaleIO) using Python's requests library


Through this feature Postman provides coding samples in the following languages. Just use the "Search Language drop-down at the top of the right-pane:

  • cURL
  • C
  • C#
  • GO
  • Java
  • Javascript
  • NodeJs
  • Objective-C
  • PHP
  • Powershell
  • Python
  • Ruby
  • Shell
  • OCaml
  • Swift
You can see Project Vision in action in this other article
http://anzpiper.blogspot.com/2020/01/project-vision-in-action.html

Comments

Popular posts from this blog

Sending PowerStore alerts via SNMP

Electronic Nose - eNose

Use Vagrant to deploy to AWS