Brocade, the B-wing symbol, Brocade Assurance, ADX, AnyIO, DCX, Fabric OS, FastIron, HyperEdge, ICX, MLX, MyBrocade, NetIron,
OpenScript, VCS, VDX, and Vyatta are registered trademarks, and The Effortless Network and the On-Demand Data Center are
trademarks of Brocade Communications Systems, Inc., in the United States and in other countries. Other brands and product
names mentioned may be trademarks of others.
Notice: This document is for informational purposes only and does not set forth any warranty, expressed or implied, concerning
any equipment, equipment feature, or service offered or to be offered by Brocade. Brocade reserves the right to make changes to
this document at any time, without notice, and assumes no responsibility for its use. This informational document describes
features that may not be currently available. Contact a Brocade sales office for information on feature and product availability.
Export of technical data contained in this document may require an export license from the United States government.
The authors and Brocade Communications Systems, Inc. assume no liability or responsibility to any person or entity with respect
to the accuracy of this document or any loss, cost, liability, or damages arising from the information contained herein or the
computer programs that accompany it.
The product described by this document may contain open source software covered by the GNU General Public License or other
open source license agreements. To find out which open source software is included in Brocade products, view the licensing
terms applicable to the open source software, and obtain a copy of the programming source code, please visit
http://www.brocade.com/support/oscd.
Brocade Communications Systems, Incorporated
Corporate and Latin American Headquarters
Brocade Communications Systems, Inc.
130 Holger Way
San Jose, CA 95134
Tel: 1-408-333-8000
Fax: 1-408-333-8101
E-mail: info@brocade.com
European Headquarters
Brocade Communications Switzerland Sàrl
Centre Swissair
Tour B - 4ème étage
29, Route de l'Aéroport
Case Postale 105
CH-1215 Genève 15
Switzerland
Tel: +41 22 799 5640
Fax: +41 22 799 5641
E-mail: emea-info@brocade.com
Asia-Pacific Headquarters
Brocade Communications Systems China HK, Ltd.
No. 1 Guanghua Road
Chao Yang District
Units 2718 and 2818
Beijing 100020, China
Tel: +8610 6588 8888
Fax: +8610 6588 9999
E-mail: china-info@brocade.com
Asia-Pacific Headquarters
Brocade Communications Systems Co., Ltd. (Shenzhen WFOE)
Citic Plaza
No. 233 Tian He Road North
Unit 1308 – 13th Floor
Guangzhou, China
Tel: +8620 3891 2000
Fax: +8620 3891 2111
E-mail: china-info@brocade.com
Document History
TitlePublication numberSummary of changesDate
Brocade Network Advisor REST API
Guide
53-1003160-01New documentJuly 2014
Contents
About This Document
How this document is organized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
This document is organized to help you find the information that you want as quickly and easily as
possible.
The document contains the following components:
•Chapter 1, “Overview of the Network Advisor REST API,” provides a high-level overview of the
API.
•Chapter 2, “Getting Started,” provides steps for getting started using the API in a tutorial
format.
•Chapter 3, “Using the Brocade Network Advisor REST API,” explains how to use the API.
•Chapter 5, “API Reference,” describes the calls supported by the API.
•Appendix A, “Request and Response Schemas,” lists the request and response schemas used
by the API calls.
Brocade Network Advisor REST API Guideix
53-1003160-01
Document conventions
NOTE
This section describes text formatting conventions and important notice formats used in this
document.
Text formatting
The narrative-text formatting conventions that are used are as follows:
bold textIdentifies command names
italic textProvides emphasis
code textIdentifies CLI output
For readability, command names in the narrative portions of this guide are presented in mixed
lettercase: for example, switchShow. In actual examples, command lettercase is all lowercase.
Identifies the names of user-manipulated GUI elements
Identifies keywords and operands
Identifies text to enter at the GUI or CLI
Identifies variables
Identifies paths and Internet addresses
Identifies document titles
Identifies command syntax examples
Command syntax conventions
Command syntax in this manual follows these conventions:
ConventionDescription
[ ]Keywords or arguments that appear within square brackets are optional. For example:
command [active | standby | disabled] = One (and only one) of this set of keywords may be
used.
command [active] [standby] [disabled] = Three independent options, and one or more may
be used on the same command line.
{ x | y | z }A choice of required keywords appears in braces separated by vertical bars. You must
select one. For example:
command {active | standby | disabled} = One (and only one) of this set of keywords must
be used.
screen fontExamples of information displayed on the screen.
< > Nonprinting characters, for example, passwords, appear in angle brackets.
[ ] Default responses to system prompts appear in square brackets.
italic textIdentifies variables.
bold textIdentifies literal command options and keywords.
In standalone mode, interfaces are identified using slot/port notation. In Brocade VCS Fabric
technology® mode, interfaces are identified using switch/slot/port notation.
xBrocade Network Advisor REST API Guide
53-1003160-01
Nesting square brackets and curly braces
NOTE
ATTENTION
CAUTION
DANGER
When reading a command entry, optional keywords are surrounded by square brackets and
mandatory keywords are surrounded by curly braces. Refer to “Command syntax conventions” on
page x for complete details.
In some cases, these brackets can be nested. In the following example, rbridge-id is optional as
denoted by the square brackets, but if you use it, then you must follow it with either a specific
rbridge-id or the word “all.”
command [rbridge-id {rbridge-id | all}]
However, square brackets can appear within curly braces, showing that while a keyword is
mandatory, supporting operands may be optional, as shown in the following example:
command {security [active] [standby] [disabled]}
command {security [active | standby | disabled]
}
Notes, cautions, and warnings
The following notices and statements are used in this manual. They are listed below in order of
increasing severity of potential hazards.
A note provides a tip, guidance, or advice, emphasizes important information, or provides a
reference to related information.
An Attention statement indicates potential damage to hardware or data.
A Caution statement alerts you to situations that can be potentially hazardous to you or cause
damage to hardware, firmware, software, or data.
A Danger statement indicates conditions or situations that can be potentially lethal or extremely
hazardous to you. Safety labels are also attached directly to products to warn of these conditions
or situations.
Key terms
For definitions specific to Brocade and Fibre Channel, see the technical glossaries on MyBrocade.
Refer to “Brocade resources” on page xii for instructions on accessing MyBrocade.
For definitions of SAN-specific terms, visit the Storage Networking Industry Association online
dictionary at:
http://www.snia.org/education/dictionary
Brocade Network Advisor REST API Guidexi
53-1003160-01
Notice to the reader
This document may contain references to the trademarks of the following corporations. These
trademarks are the properties of their respective companies and corporations.
These references are made for informational purposes only.
CorporationReferenced Trademarks and Products
Microsoft CorporationWindows, Windows NT, Internet Explorer
Oracle CorporationOracle, Java
Netscape Communications CorporationNetscape
Red Hat, Inc.Red Hat, Red Hat Network, Maximum RPM, Linux Undercover
Additional information
This section lists additional Brocade and industry-specific documentation that you might find
helpful.
Brocade resources
To get up-to-the-minute information, go to http://my.brocade.com to register at no cost for a user ID
and password.
White papers, online demonstrations, and data sheets are available through the Brocade website
at:
For additional Brocade documentation, visit the Brocade website:
http://www.brocade.com
Release notes are available on the MyBrocade website.
Other industry resources
For additional resource information, visit the Technical Committee T11 website. This website
provides interface standards for high-performance and mass storage applications for Fibre
Channel, storage management, and other applications:
http://www.t11.org
For information about the Fibre Channel industry, visit the Fibre Channel Industry Association
website:
http://www.fibrechannel.org
xiiBrocade Network Advisor REST API Guide
53-1003160-01
Getting technical help
Contact your switch support supplier for hardware, firmware, and software support, including
product repairs and part ordering. To expedite your call, have the following information available:
1. General Information
• Switch model
• Switch operating system version
• Software name and software version, if applicable
• Error numbers and messages received
• Detailed description of the problem, including the switch or fabric behavior immediately
following the problem, and specific questions
• Description of any troubleshooting steps already performed and the results
• Serial console and Telnet session logs
• syslog message logs
2. Switch Serial Number
The switch serial number and corresponding bar code are provided on the serial number label,
as illustrated below:
The serial number label is located on the switch ID pull-out tab located on the bottom of the
port side of the switch.
3. World Wide Name (WWN)
Use the show license id command to display the WWN of the chassis.
If you cannot use the show license id command because the switch is inoperable, you can get
the WWN from the same place as the serial number, except for the Brocade DCX. For the
Brocade DCX, access the numbers on the WWN cards by removing the Brocade logo plate at
the top of the nonport side of the chassis.
Document feedback
Quality is our first concern at Brocade and we have made every effort to ensure the accuracy and
completeness of this document. However, if you find an error or an omission, or you think that a
topic needs further development, we want to hear from you. Forward your feedback to:
documentation@brocade.com
Provide the title and version number of the document and as much detail as possible about your
comment, including the topic heading and page number and your suggestions for improvement.
Brocade Network Advisor REST API Guidexiii
53-1003160-01
The Network Advisor REST API provides you with a Web services interface for configuring and
monitoring Brocade switches. Brocade Network Advisor 12.3.0 has been updated to provide a
REST API for storage area network (SAN) provisioning. The REST APIs are organized into various
services such as Topology, Authentication, and Zoning.
1
You can use the Network Advisor REST API to build your own Network Advisor clients. You can also
use third-party REST API clients to interact with Network Advisor.
FIGURE 1Architectural overview
The Network Advisor REST API provides GET and POST uniform resource identifiers (URIs) that you
can use to retrieve information and perform certain management and configuration tasks.
This release of the Network Advisor REST API supports only SAN fabrics.
Brocade Network Advisor REST API Guide1
53-1003160-01
Network Advisor URIs
NOTE
1
Network Advisor URIs
Network Advisor URIs consists of two parts:
• Base URI: The base URI is specific to the Network Advisor server. All URIs accessing the same
server use the same base URI.
• Request URI: The request URI is the URI that you use to perform a GET or POST request. This
part of the URI is the same across all Network Advisor servers.
The following are examples of Network Advisor URIs (the text in bold is the base URI part and the
rest is the request part).
The Network Advisor REST API supports HTTP and HTTPS, unlike Network Advisor which only
supports HTTPS.
All REST HTTP requests are redirected to the HTTPS port. By default, the HTTPS port number is
443. However, this port can be changed during the installation of Network Advisor or after
installation through the server management console.
Default HTTPS port (443)
If the HTTPS port is 443 (default), you can use the HTTP and HTTPS protocols as show in the
following two example URIs. In the HTTP case, the request is redirected to HTTPS.
http://<server_IP>/rest/resourcegroups
https://<server_IP>/rest/resourcegroups
Non-Default HTTPS port
If the HTTPS port is changed to a non-default value, the REST URI must specify HTTPS as the
protocol and must also specify the port number to send the requests to, as shown in the following
example. If not, Network Advisor refuses connection requests.
This chapter describes how to log in to Network Advisor using its REST API and perform a few basic
information retrieval operations. In addition, this chapter shows you how to build a sample client
application using the Python programming language.
Before you begin
This chapter assumes that you are familiar with the concept of REST APIs.
Before you can use the Network Advisor REST API:
• Make sure that Network Advisor 12.3.0 or later is installed on your network.
• Obtain a username and password for accessing Network Advisor through the REST API.
• Make sure that you have a tool for interacting with REST APIs.
The Advanced Rest Console application is used in this chapter, but you can use any other REST
API tool.
Brocade Network Advisor REST API Guide5
53-1003160-01
Logging in
2
Logging in
To log in to Network Advisor, complete the following steps.
1. Enter the following URI in the URL field of your REST client tool.
http://<ip_address>/rest/login
2. Define the following HTTP request headers.
TABLE 1Request headers
Header nameValue
WSUsernameThe user name supplied by your Network Advisor administrator.
WSPasswordThe password supplied by your Network Advisor administrator.
AcceptThe content type of the returned data.
Specify the following content type to receive the response data in the JSON format:
This response returns the name of the Network Advisor and its IP address.
Different tools may display the JSON or XML responses differently.
5. Record the value of the WStoken response header.
In this example, the value of the WStoken field is ghe/4Q//I0EJcxD6UPdO9/fvI94=. You need
this token for all subsequent Network Advisor REST API requests.
A client session has a default idle timeout of 10 minutes after which the token is no longer
valid. If you try to use an invalid token, an error message is returned:
errorCode=4009, errorMsg=Invalid token in header.
2
Retrieving resource groups
To retrieve resource groups defined in Network Advisor, complete the following steps.
1. Enter the following URI in the URL field:
http://<ip_address>/rest/resourcegroups
2. Define the following HTTP request headers.
TABLE 2Request headers
Header nameValue
WStokenThe session token header returned after a successful login.
Retrieving switches and ports in the context of a resource group is similar to retrieving fabrics (refer
to“Retrieving FC fabrics”). The only difference is the URI that you use.
Brocade Network Advisor REST API Guide11
53-1003160-01
Creating a sample Python client
2
...
portIndex: 34
areaId: 34
type: "U_PORT"
status: "DISABLED"
statusMessage: ""
lockedPortType: "U_PORT"
speed: "8"
speedsSupported: "1,2,4,8"
maxPortSpeed: 8
desiredCredits: 0
bufferAllocated: 0
estimatedDistance: 0
actualDistance: 0
longDistanceSetting: 0
remoteNodeWwn: ""
remotePortWwn: ""
licensed: false
swapped: false
trunked: false
trunkMaster: false
persistentlyDisabled: false
ficonSupported: true
blocked: false
prohibitPortNumbers: null
prohibitPortCount: 0
npivCapable: true
npivEnabled: true
fcFastWriteEnabled: false
islRrdyEnabled: false
rateLimitCapable: false
rateLimited: false
qosCapable: false
qosEnabled: false
fcrFabricId: 0
state: "OFFLINE"
occupied: false
masterPortNumber: -1
}
Creating a sample Python client
This section shows you how to create a sample Network Advisor REST API Python client. Python
version 3.3.3 for Windows (MSC v.1600 64 bit (AMD64)) is used for creating the client.
This sample client logs in to Network Advisor and uses the returned session token to retrieve a list
of all FC fabrics.
To create a sample client using the Python programming language, complete the following steps.
1. Create a new file using you favorite Python editor.
2. Add the following code to the file and replace the example IP address 10.24.41.138 with the IP
address of your Network Advisor server.
import http.client
import json
# Create HTTPConnection object and connect to the server.
# Get the response
response = connection.getresponse()
# Display the response status
print()
print ("Status= ", response.status)
# If successful (status = 200), display the returned list in JSON format
if response.status == 200:
print()
print("Fabric details:")
json_response_bytes = response.read()
json_response_string = str(json_response_bytes, encoding='utf8')
fabric_details_dict=json.loads(json_response_string)
print(json.dumps(fabric_details_dict, indent=4))
else:
print()
print (response.status, response.reason)
connection.close()
######################################################
# Retrieve list of switches in the context of a fabric
######################################################
print()
print("--------------------------------------------------------------------")
print("Get the list of switches under fabric "+fabric_key+" ...")
# Get the response
response = connection.getresponse()
# Display the response status
print()
print ("Status= ", response.status)
# If successful (status = 200), display the returned list in JSON format
if response.status == 200:
print()
print("List of switches:")
json_response_bytes = response.read()
json_response_string = str(json_response_bytes, encoding='utf8')
list_of_fabric_switches_dict=json.loads(json_response_string)
print(json.dumps(list_of_fabric_switches_dict, indent=4))
else:
print()
print (response.status, response.reason)
2
connection.close()
3. Save the file as my_na_client.py.
4. Run the program by entering the following command at the command prompt:
C:\Python33>python my_na_client.py
If successful, you should see output similar to the following: