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:
This chapter describes how to use the Brocade Network Advisor REST API.
Logging in and out
The Network Advisor REST API provides URIs for logging in and out.
Logging in
Use the /login POST URI to log in. This URI returns the BNA Server credentials in a LoginResponse.
<BASE_URI>/login
Login request headers
A valid user name and password are required for login and this is sent through the HTTP request
headers. You must add the headers while forming the HTTP POST request.
Brocade Network Advisor REST API Guide21
53-1003160-01
Logging in and out
3
The following are the header names and values. The password must be passed in as clear text.
TABLE 5Login request headers
Request header nameRequest header value
AcceptThe content type
WSusernameThe valid Network Advisor user name
WSpasswordThe password
Login response header
Upon successful authentication, a new client session is created and a token is returned through
the HTTP response header. The token identifies the client’s Network Advisor session and must be
used for all subsequent web service requests. The token expires after 10 minutes of no activity.
TABLE 6Login response header
Response header nameRequest header value
WStokenThe token
For information about the login response schema, refer to “LoginResponse.”
Sample login request (Java)
The following is sample Java code for establishing a REST API session with Network Advisor. For a
Python example, see “Creating a sample Python client.”
HttpURLConnection con = null;
try {
/**
* Create the HTTP connection object with the URI, method and headers
*/
URL obj = new URL("http://10.24.48.103/rest/login");
con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.addRequestProperty("WSusername", "Administrator");
con.addRequestProperty("WSpassword", "password");
con.addRequestProperty("Accept",
"application/vnd.brocade.networkadvisor+json;version=v1");
System.out.println("CALLING POST http://10.24.48.103/rest/login");
/**
* Make the HTTP call
*/
int responseCode = con.getResponseCode();
System.out.println("Response code is " + responseCode);
if (HttpURLConnection.HTTP_OK != responseCode) {
PRINT_ERROR(con);
assert false : "REST FAILED for login, responseCode = " + responseCode;
}
String token = con.getHeaderField("WStoken");
if (null != token) {
System.out.println("GOT TOKEN FROM RS RESPONSE = " + token);
PRINT_RESPONSE(con);
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(Serv
letContainerDispatcher.java:208)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServl
etDispatcher.java:55)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServl
etDispatcher.java:50)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)</pre></p><p><b>JBWEB
000072: note</b> <u>JBWEB000073: The full stack trace of the root cause is
available in the JBoss Web/7.2.0.Final logs.</u></p><HR size="1"
noshade="noshade"><h3>JBoss Web/7.2.0.Final</h3></body></html>
Logging out
Use the /logout POST URI to log out. Successful completion of the request results in the deletion of
the client session. The logout request does not require any request payload except for the session
token, which must be passed in an HTTP header parameter. Because there is no return value to
this request, an HTTP status code of 204 (No Content) is returned upon success.
<BASE_URI>/logout
24Brocade Network Advisor REST API Guide
53-1003160-01
Specifying content type
3
Logout request headers
A valid token is required for logout and this is sent through the HTTP request header. You must add
the header while forming the HTTP POST request.
TABLE 7Logout request headers
Request header nameRequest header value
WStokenThe token obtained from login
Sample logout request (Python)
The following is an example of an HTTP POST request for logout sent using Python.
HttpClient hc = new HttpClient();
method = new PostMethod("http://10.24.48.103/rest/logout");
method.addRequestHeader("WStoken", token);
Sample logout request (Java)
The following is sample Java code for terminating a REST API session with Network Advisor.
HttpURLConnection con = null;
try {
/**
* Create the HTTP connection object with the URI, method and headers
*/
URL obj = new URL("http://10.24.48.103/rest/logout");
con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.addRequestProperty("WStoken", "wppCy/NGdC4o5gGFJjXRMv7blhc=");
System.out.println("CALLING POST http://10.24.48.103/rest/logout");
/**
* Make the HTTP call
*/
int responseCode = con.getResponseCode();
System.out.println("Response code is " + responseCode);
if (HttpURLConnection.HTTP_NO_CONTENT != responseCode) {
PRINT_ERROR(con);
assert false : "REST FAILED for logout, responseCode = " + responseCode;
}
} catch (IOException ie) {
System.out.println(ie.toString());
} finally {
if (null != con) {
con.disconnect();
}
}
Specifying content type
All Brocade Network Advisor REST API requests that return data support both XML and JSON
formats. Depending on the content type you request, the proper data format is returned.
Brocade Network Advisor REST API Guide25
53-1003160-01
Versioning (backward compatibility)
3
Accept HTTP request header
In the case of GET requests, your client must specify the format of the data of the responses. You
do this by providing the HTTP header information. The content type for the response data is
specified through the HTTP request header named “Accept”.
The value for the content type has the following format:
The Network Advisor REST API provides backward compatibility. However, not all API changes allow
for backward compatibility.
26Brocade Network Advisor REST API Guide
53-1003160-01
Using the Topology API
The Topology API provides GET URIs for retrieving information about the network resource shown in
the following figure.
Using the Topology API
3
FIGURE 1Topology API URI hierarchy
Using the SAN Fabric Discovery API
The SAN Fabric Discovery API provides POST URIs for discovering, updating, and deleting SAN
fabrics.
Notes about the SAN Fabric Discovery API URIs
• All SAN Fabric Discovery API URIs are POST requests.
• You can discover all types of SAN fabrics supported by the Brocade Network Advisor.
• You can update the switch credentials and the SNMP configuration used to discover the fabric
after the fabric is discovered.
• You can delete a fabric based on the fabric key.
• In the event that discovery of one of the virtual fabrics fails, the response payload contains the
Fabric Identifier (FID) of the fabric that failed to get discovered.
• All the contexts are discovered by default in the VF setup. You cannot select the contexts to be
discovered, but you can delete the unwanted contexts through the “deletefabric” URI.
• The value for snmpRetries should be from 1 through 5. The default is 3.
• The value for snmpTimeout should be from 3 through 999. The default is 5.
• In the event that SNMP registration fails, the discovery of the fabric still succeeds. However,
you can retrieve the events to check for any specific SNMP registration failure messages.
Brocade Network Advisor REST API Guide27
53-1003160-01
Using the Traffic Flow API
3
• In the case of SNMP V3, if the privacy protocol is specified, the authorization protocol is
required; it cannot be null.
• The default user name is “admin”.
• The default password is “password”.
Limitations for the SAN Fabric Discovery API
• There is no support for monitoring or unmonitoring a discovered fabric.
• There is no provision to change the seed switch.
• There is no support for discovering M model switches.
Using the Traffic Flow API
The Traffic Flow API provides URIs for retrieving traffic flow information. Basically, in the context of a
specific FC Switch, you can get the flow definitions and the flows.
The flow definition and flow supports the minimum required properties needed to correlate with
the traffic flow summary data.
Using the Summary Data API
In support of Fabric Vision, Network Advisor calculates and publishes various kinds of summary
data. You can retrieve these summaries through the REST API. They can be obtained in the context
of a resource group, fabric, switch, or port.
The Summary Data API supports the URIs shown in the following figure.
FIGURE 2Summary Data API URI hierarchy
28Brocade Network Advisor REST API Guide
53-1003160-01
Using the Events API
The Events API provides URIs that you can use to retrieve Network Advisor events. The URIs provide
query parameters that allow you to filter the results.
For example, to retrieve the first 100 special trap events, you could use the following URI:
In this example, you instruct the server to send 100 events that are categorized as specialEvents
and that originated as TARP events.
Using the Zoning API
The Zoning API provides GET and POST URIs for zone administration.
Zoning URIs
The HTTP request header “Accept” must be specified to indicate the content type of the response
payload. For more information, refer to “Specifying content type.”
Using the Events API
3
The HTTP request header “WSToken” must be specified with the token received from login. For
more information, refer to “Logging in and out.”
Zoning operations
When performing POST zoning operations for creating, deleting, and updating zoning objects, note
the following:
• All POST zoning operations are valid only within the context of a zoning transaction.
• The appropriate request instance must be formed and sent through the POST request.
• All operations within the context of a zoning transaction are local to Network Advisor. Only on
the commit of a zoning transaction, the data is pushed as a big blob to the switch.
• Multiple zoning objects can be created, deleted, or updated in one call.
• Unlike on the switch, Network Advisor does support the creation of empty zoning objects.
Before data can be committed to the switch, the zoning objects must contain data.
• Operations such as CreateZoningObject map to multiple operations within Network Advisor.
Failure of such an operation could internally be partial success. As a best practice, check the
contents of the zoning database before proceeding or abort the transaction and proceed with a
new transaction.
• Because in the case of a commit, there could be multiple reasons for failure, the REST API
returns the exact same error messages returned by the switch in response to commit failures.
• For LSAN zoning, zone names must start with LSAN_. And the members must be identified by
WWNs only.
• Empty LSAN zones cannot be created.
• LSAN zoning is supported only in the context of a backbone fabric.
Brocade Network Advisor REST API Guide29
53-1003160-01
Using the Historical Performance Data API
3
Using the Historical Performance Data API
You can use the URIs provided by the Historical Performance Data API to retrieve historical
performance data for ports, switches, and flows based on a measure.
Fibre Channel Routing
This section describes important aspects of Fibre Channel Routing (FCR) setup.
All the URIs related to fabrics, switches, ports, end devices, connections, and connected ports are
applicable.
The Backbone and Edge fabrics are returned in the fabric URIs (refer to “Fabrics”).
The FC switches including the Front and Xlate phantom switches are returned in the switch URIs
(refer to “FC Switch”). The type parameter in FcSwitch contains the values 40 and 41 for the Front
and Xlate phantoms, respectively.
The FC ports, including the ports on the phantom switches, are returned in the port URIs (refer to
“FCPorts”). Front phantom switches are created in the Edge fabric for every EX-port connection to
the Backbone. Xlate phantom switches are created in the Edge fabric for every other Edge fabric
from which an end device is imported.
Within each Edge fabric, the Front phantom is connected to an Xlate phantom and a real switch
(one connected to the BB via the EX-port) in the fabric. The Front phantom port, which connects to
the real switch in the Edge fabric, has a WWN that is the same as the EX-port in the Backbone
fabric. So, in order to make the Front phantom port key unique, it is prefixed with FF.
Similarly the Xlate phantom port keys are prefixed with XF. These connections are E-port to E-port
ISLs and are returned in the connection URIs (refer to “ISL Connections”). The connected switch
ports to the Front phantom port can also be retrieved by the connected switch port URIs (refer to
“FCPorts”).
The imported devices in an Edge fabric are returned in the end device URIs (refer to “End devices”).
These imported devices are connected to the Xlate phantom via end device connections (refer to
“ISL Connections”).
The connected end device ports to the Xlate phantom port can also be retrieved by the end device
port URIs (refer to “FCPorts”).
The physical connection between a switch in the Backbone and a switch in the Edge is an
Inter-Fabric link and this is returned via the IFL URIs (refer to “ISL Connections”). These IFLS are
visible only when all the Backbone and Edge fabrics are discovered. The complete FCR topology
can only be returned when all Backbone and Edge fabrics are discovered.
Handling errors
The exception for all REST errors is RSException. This exception contains an integer error code and
a string error message. The exception is a string of the following format:
RSException [errorCode=<int>, errorMsg=<string>]
REST operations are HTTP requests, so the execution of an operation returns an HTTP status code.
30Brocade Network Advisor REST API Guide
53-1003160-01
Handling errors
3
For successful operations the status code is usually 200 (OK) or 204 (No Content). In the case of
an error, depending on the reason for failure, any of the HTTP status codes may be returned.
However, in the case of an API error, the HTTP status code is 500 (Internal Server Error). More
details on the server error can be obtained from the RSException embedded in the HTTP response.
Tab le 10 describes the RSException error codes.
TABLE 10Error codes
Error codeError message
1000Interval server error
1001Invalid filter type
1002Invalid filter operation
1003Invalid filter value
1004Filter value is null or empty
1005Invalid key property format
1006Key property is null or empty
1007Key property number format exception
1008Mismatch in number of elements in filter properties
1009Input request object is null
1010Invalid request object
1011Filter value number format exception
1012Exception while getting information from database
1013Key parameter is null or empty
1014Adapter error while marshalling bound type to value type
1015Adapter error while unmarshalling value type to bound type
2000Fabric not found
2001Switch not found
2002Resource group not found
2003Port not found
2004Blade not found
2005End device not found
2006Connection not found
2007Node not found
2008End device connection not found
2009Host not found
2010HBA not found
2011Access Gateway not found
2012Flow Definition not found
2013Flow not found
3001Invalid zone name prefix
3002Initiator is null or empty
Brocade Network Advisor REST API Guide31
53-1003160-01
Handling errors
3
TABLE 10Error codes (Continued)
Error codeError message
3003Target is null or empty
3004Initiator is an invalid wwn
3005Target is an invalid wwn
3006Only inactive zoneset can be activated
3007Only active zoneset can be deactivated
3008Invalid lsan zone name
3009Zoning object name is null or empty
3010Update action is invalid
3011EdgeFabricWwns is null or empty
3012Cannot create empty lsan zone
3013Operation supported on backbone fabric only.
10003Common DCFM error
16001Zone does not exist
16002Zoneset does not exist
16003Zonealias does not exist
16004Member does not exist
16101Unknown error
16102Unknown interop mode
16103Transaction does not exist
16104Not the owner of the transaction
16105Password encryption error
16106Session authentication error
16107Hostname error
16108Transaction already exists
16109Transaction commit error
16110Empty zoning objects
16111Save zone database to switch failed
16112Save imported zone database failed
16113Zoning object already exists
16114Parent does not exist
16115Not supported in zone transaction
16116Null zone database
16117Not supported
16118Transaction start failed
16119Transaction abort failed
16120Activate failed
32Brocade Network Advisor REST API Guide
53-1003160-01
TABLE 10Error codes (Continued)
Error codeError message
16121Deactivate failed
16122Clear zone database failed
16123Unable to retrieve zone database
16124Online member does not exist
16125Invalid backbone fabric
16126Activation failed
16301Database error
20301Dao exception while getting managed BB fabrics
20101Unknown exception while getting managed BB fabrics
4001Token in header is null or empty
4002User name in header is null or empty
4003Password in header is null or empty
4004Failed to get token
4005Invalid user name or password
4006Failed to parse soap header
4007Failed to create session
4008Failed to add token outbound
4009Invalid token in header
4010Unknown host exception
4011Client limit exceeded
5000Action not supported
5001Event not found
6000Switch IP address is null or empty
6001Snmp version is invalid. Valid values are v3 or v1.
6002Snmp timeout is invalid. Valid values are 3 to 999.
6003Snmp retries is invalid. Valid values are 1 to 5.
6004Operation supported only under resource group All.
6005Authentication protocol is invalid.
6006Privacy protocol is invalid.
6007Privacy password is null or empty.
6008Authentication password is null or empty.
6009Failed to delegate request.
6010Invalid queue for this operation.
6011Error in queue creation.
6012Error in encrypting switch password.
6013Operation not supported on this switch.
Handling errors
3
Brocade Network Advisor REST API Guide33
53-1003160-01
8003End date is null or empty. Please provide enddate for startdate.
8004Start date is null or empty. Please provide startdate for enddate.
8005Duration exceeds limit for given granularity.
Handling errors
3
Brocade Network Advisor REST API Guide35
53-1003160-01
Handling errors
NOTE
3
TABLE 10Error codes (Continued)
Error codeError message
8006Range from start date to end date exceeds limit for given granularity.
8007Start date is beyond end date.
99010Opaque key value not found
URI error return behavior
This section explains the error a user can expect when a URI fails. Parsing of the URI follows a
pattern and returns an error in the following order.
1. The server checks the URI, including the path parameters, for correctness. If the URI is not
valid (for example, a word in the URI is misspelled), the resource cannot be found and you get
back an HTTP status code of 404 (Not Found).
2. If the URI is correct, the server checks the query parameter values for correctness. If the query
parameters are invalid, the REST operation fails with HTTP status code of 500 (Internal Server
Error) and an RSException. The value of the error code depends on the exact error.
3. If the previous two steps succeed, which means that the URI is syntactically correct, the server
parses the URI from left to right. If any resource corresponding to the path parameters is not
present, then the appropriate “Does Not Exist” or “Not Found” error is reported. For example:
In the example URI, if the resource group specified by rgkey does not exist, you receive the
appropriate error code. If rgkey is valid, then the server checks whether fcskey exists. If not, the
appropriate error code is generated.
4. The server returns “Not Found” errors if you are looking for a specific object that cannot be
found.
5. In the case of a collection like fcswitches, the response is either a populated or empty list. The
return of an empty list indicates that there are no instances within the requested collection.
6. If you are using a filter like “/fcswitches?property1=<value>,” and if there is no switch in the
fabric with that property, an empty response is returned.
Filtering is not the same as using a key. Filters let you sift out a smaller list from a larger one.
The smaller list could be an empty list.
The following is an example of an exception generated due to a REST operation failure:
REST FAILED WITH HTTPSTATUS = 500
RSException [errorCode=2001, errorMsg=Switch not found]
36Brocade Network Advisor REST API Guide
53-1003160-01
Chapter
NOTE
Use Cases
In this chapter
Introduction
This chapter discusses common use cases for the Network Advisor REST API.
Zoning is the means by which administrators partition their SAN into logical groups of devices that
can access each other.
When zoning a SAN, it is best to implement 1-to-1 zoning, where each zone contains a single
initiator and a single target. Single-initiator zoning has the advantage of eliminating host-to-host
visibility, which results in less RSCN traffic.
You can use the REST API to carry out single-initiator to single- or multiple-target zoning using the
attach/detach URIs.
To attach a single initiator with one or more targets, perform the following steps.
1. Establish a REST session with Network Advisor (refer to “Logging in”).
The network consisting of the initiator and targets is assumed to be discovered in Network
Advisor. If not, you can use the Network Advisor client or the Network Advisor REST API to
discover the fabrics of interest (refer to “SAN fabric discovery”).
2. Create the InitiatorTargetsRequest.xml file with the payload information consisting of the
initiator and target WWNs and other properties defined in the REST schema of the
InitiatorTargetsRequest request object (refer to the “InitiatorTargetsRequest”).
The InitiatorTargetsRequest REST schema is published in the directory
<INSTALL-DIR>/conf/rest-schema, where <INSTALL-DIR> is the Network Advisor installation
directory.
Brocade Network Advisor REST API Guide37
53-1003160-01
4
Zoning
3. Perform the attach operation by calling the following POST URI.
Sample Java code for performing the attach operation
The following is the sample Java code for performing the attach operation. This sample code
assumes that some tool has been used to generate the required code for the requests (refer to
“Binding the schema”).
HttpURLConnection con = null;
try {
URL obj = new
URL("http://10.24.48.103/rest/resourcegroups/All/fcfabrics/10:00:00:27:F8:42:B4:0D/attach");
con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.addRequestProperty("WStoken", "wppCy/NGdC4o5gGFJjXRMv7blhc=");
con.addRequestProperty("Accept",
"application/vnd.brocade.networkadvisor+json;version=v1");
con.addRequestProperty("Content-type",
"application/vnd.brocade.networkadvisor+xml;version=v1");
JAXBContext jaxbContext =
JAXBContext.newInstance(InitiatorTargetsRequest.class);
Unmarshaller u = jaxbContext.createUnmarshaller();
Object element = u.unmarshal(new File("./InitiatorTargetsRequest.xml"));
Marshaller m = jaxbContext.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
m.marshal(element, con.getOutputStream());
System.out.println("CALLING POST
http://10.24.48.103/rest/resourcegroups/All/fcfabrics/10:00:00:27:F8:42:B4:0D
/attach");
int responseCode = con.getResponseCode();
System.out.println("REQUEST HTTPSTATUS = " + responseCode);
if (responseCode != HttpURLConnection.HTTP_OK
&& responseCode != HttpURLConnection.HTTP_NO_CONTENT
&& responseCode != HttpURLConnection.HTTP_PARTIAL
&& responseCode != HttpURLConnection.HTTP_ACCEPTED) {
CALLING POST http://10.24.48.103/rest/logout
REQUEST HTTPSTATUS = 204
The text in bold shows that a zone with the requested initiator and targets has been created
and activated.
Getting Traffic Flow Performance Data
Network Advisor collects and persists performance data for the various SCSI and
Frame measures related to traffic flows. You can use the Network Advisor REST
API to retrieve this historical performance data.
To collect performance data for traffic flows, perform the following steps.
1. Establish a REST API session with Network Advisor (refer to “Logging in”).
The network consisting of the initiator and targets is assumed to be discovered in Network
Advisor. If not, you can use the Network Advisor client or the Network Advisor REST API to
discover the fabrics of interest (refer to “SAN fabric discovery”).
2. Set up the monitor flows between the initiator and target ports using the Network Advisor client
flow dialogs.
For more information about setting up monitor flows, refer to the Network Advisor
documentation.
After you create the flow definitions for the initiator and target, Network Advisor starts
collecting the performance data for the flows.
3. Use the following GET URI and pseudo code for retrieving flow information.
The following is sample Java code for retrieving flow information.
HttpURLConnection con = null;
try {
/**
* Create the HTTP connection object with the URI, method and headers
*/
URL obj = new
URL("http://10.24.48.103/rest/resourcegroups/All/fcswitches/10:00:00:05:33:13:78:7E/flows");
con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.addRequestProperty("WStoken", "wppCy/NGdC4o5gGFJjXRMv7blhc=");
40Brocade Network Advisor REST API Guide
53-1003160-01
Getting Traffic Flow Performance Data
System.out.println("CALLING GET
http://10.24.48.103/rest/resourcegroups/All/fcswitches/10:00:00:05:1E:40:40:00/fl
ows");
/**
* Make the HTTP call
*/
int responseCode = con.getResponseCode();
System.out.println("Response code is " + responseCode);
if (HttpURLConnection.HTTP_SUCCESS != responseCode) {
PRINT_ERROR(con);
assert false : "REST FAILED, responseCode = " + responseCode;
}
} catch (IOException ie) {
System.out.println(ie.toString());
} finally {
if (null != con) {
con.disconnect();
}
}
4
Sample JSON response
The following is the JSON response.
/**
* Getting the list of flows on a specific switch
*/
CALLING GET
http://10.24.48.103/rest/resourcegroups/All/fcswitches/10:00:00:05:33:13:78:7E/fl
ows
REQUEST HTTPSTATUS = 200
{"flows":[{"key":"fldbid-7","flowDefinitionName":"web_server_flow","featureType":
"MONITOR","srcDevicePorts":["031900"],"destDevicePorts":["011a00"],"srcSwitchPort
":"0/25","destSwitchPort":"","bidirectional":false,"sfid":"","dfid":"","lunIds":[
],"frameSize":0,"framePattern":"","subFlowMd5hash":"","mirrorPort":""},{"key":"fl
dbid-11","flowDefinitionName":"traffic_flow","featureType":"MONITOR","srcDevicePo
rts":["aa01e2"],"destDevicePorts":["031900"],"srcSwitchPort":"","destSwitchPort":
"0/25","bidirectional":false,"sfid":"","dfid":"","lunIds":[],"frameSize":0,"frame
Pattern":"","subFlowMd5hash":"","mirrorPort":""},{"key":"fldbid-8","flowDefinitio
nName":"traffic_flow","featureType":"MONITOR","srcDevicePorts":["aa01e4"],"destDe
vicePorts":["031900"],"srcSwitchPort":"","destSwitchPort":"0/25","bidirectional":
false,"sfid":"","dfid":"","lunIds":[],"frameSize":0,"framePattern":"","subFlowMd5
hash":"","mirrorPort":""},{"key":"fldbid-9","flowDefinitionName":"traffic_flow","
featureType":"MONITOR","srcDevicePorts":["aa01e8"],"destDevicePorts":["031900"],"
srcSwitchPort":"","destSwitchPort":"0/25","bidirectional":false,"sfid":"","dfid":
"","lunIds":[],"frameSize":0,"framePattern":"","subFlowMd5hash":"","mirrorPort":"
"},{"key":"fldbid-12","flowDefinitionName":"traffic_flow","featureType":"MONITOR"
,"srcDevicePorts":["011a00"],"destDevicePorts":["031900"],"srcSwitchPort":"","des
tSwitchPort":"0/25","bidirectional":false,"sfid":"","dfid":"","lunIds":[],"frameS
ize":0,"framePattern":"","subFlowMd5hash":"","mirrorPort":""},{"key":"fldbid-13",
"flowDefinitionName":"traffic_flow","featureType":"MONITOR","srcDevicePorts":["01
1b00"],"destDevicePorts":["031900"],"srcSwitchPort":"","destSwitchPort":"0/25","b
idirectional":false,"sfid":"","dfid":"","lunIds":[],"frameSize":0,"framePattern":
"","subFlowMd5hash":"","mirrorPort":""},{"key":"fldbid-15","flowDefinitionName":"
traffic_flow","featureType":"MONITOR","srcDevicePorts":["fffcaa"],"destDevicePort
s":["031900"],"srcSwitchPort":"","destSwitchPort":"0/25","bidirectional":false,"s
fid":"","dfid":"","lunIds":[],"frameSize":0,"framePattern":"","subFlowMd5hash":""
Brocade Network Advisor REST API Guide41
53-1003160-01
Retrieving performance data for the Transmit Frame Rate measure
Depending on the desired measure, you can choose the appropriate URI to get the historical
performance data for the traffic flows within the scope of the switch. If Transmit Frame Rate is the
measure of interest, the following GET URI returns the performance data for this measure.
The following is sample java code for retrieving performance data for the Transmit Frame Rate
measure.
HttpURLConnection con = null;
try {
/**
* Create the HTTP connection object with the URI, method and headers
*/
URL obj = new
URL("http://10.24.48.103/rest/resourcegroups/All/fcswitches/10:00:00:05:33:13:78:
7E/timeseriestxframerate?startdate=1402012800000&enddate=1402023600000&granularit
y=GRANULARITY_30MIN");
con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.addRequestProperty("WStoken", "wppCy/NGdC4o5gGFJjXRMv7blhc=");
System.out.println("CALLING GET
http://10.24.48.103/rest/resourcegroups/All/fcswitches/10:00:00:05:33:13:78:7E/ti
meseriestxframerate?startdate=1402012800000&enddate=1402023600000&granularity=GRA
NULARITY_30MIN");
/**
* Make the HTTP call
*/
int responseCode = con.getResponseCode();
System.out.println("Response code is " + responseCode);
if (HttpURLConnection.HTTP_SUCCESS != responseCode) {
PRINT_ERROR(con);
assert false : "REST FAILED, responseCode = " + responseCode;
}
In this response, you can see the value for Transmit Frame Rate within the provided start and end
times. Each entry has the target key specified and this can be used in combination with the flow
data you received from the previous flows response to plot the data.
Getting the Top N CRC errors port summary
Physical layer errors cause signal degradation on the transmitter or receiver end and results in loss
of transmitted data. The most common physical layer error reported is the CRC error which
indicates frame corruption. CRC errors along with “encode out” errors usually point to a cabling or
SFP-related problem.
The Network Advisor REST API supports the retrieval of summary information for various
performance measures such as CRC errors, C3 discards, and BB credit zero.
For example, if you are interested in getting the top 10 ports reporting CRC errors, perform the
following steps.
1. Establish a REST API session with Network Advisor (refer to “Logging in”).
The network consisting of the fabrics is assumed to be discovered in Network Advisor. If not,
you can use the Network Advisor client or the Network Advisor REST API to discover the fabrics
of interest (refer to “SAN fabric discovery”).
2. Use the following GET URI for retrieving the top 10 ports reporting CRC errors.
The Network Advisor REST API provides support for SAN Fabric discovery through the following
POST URI:
<Base_URI>/resourcegroups/All/discoverfabric
When calling this URI, you must pass the following:
• Session token
This token is returned in an HTTP header (WSToken) after a successful login request.
44Brocade Network Advisor REST API Guide
53-1003160-01
SAN fabric discovery
NOTE
4
• XML file (DiscoverFabricRequest.xml) containing the payload DiscoverFabricRequest object.
The payload object specifies the parameters that are needed for FC fabric discovery
(for example, user name, password, and the seed switch IP address. For more information
about the parameters defined by the DiscoverFabricRequest object, refer to
DiscoverFabricRequest.
The REST XML schema for DiscoverFabricRequest is published in the directory
<INSTALL-DIR>/conf/rest-schema, where <INSTALL-DIR> is the installation directory of Network
Advisor. The schema for DiscoverFabricRequest provides more details on the default values for
some of the properties.
Sample DiscoverFabricRequest.xml file contents
The following is an example of XML payload for SAN fabric discovery.
The following is an example of Java code for SAN fabric discovery. This sample code assumes that
some tool has been used to generate the required code for the requests (refer to “Binding the
schema”)
HttpURLConnection con = null;
try {
/**
* Create the HTTP connection object with the URI, method, and headers
*/
URL obj = new
URL("http://10.24.48.103/rest/resourcegroups/All/discoverfabric");
con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.addRequestProperty("WStoken", "wppCy/NGdC4o5gGFJjXRMv7blhc=");
con.addRequestProperty("Accept",
"application/vnd.brocade.networkadvisor+json;version=v1");
con.addRequestProperty("Content-type",
"application/vnd.brocade.networkadvisor+xml;version=v1");
/**
* Unmarshal the XML data into the Java content object
*/
JAXBContext jaxbContext = JAXBContext.newInstance(DiscoverFabricRequest.class);
Unmarshaller u = jaxbContext.createUnmarshaller();
Object element = u.unmarshal(new File("./DiscoverFabricRequest.xml"));
/**
* Marshal the java object into the connection o/p stream
*/
Brocade Network Advisor REST API Guide45
53-1003160-01
SAN fabric discovery
4
Marshaller m = jaxbContext.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
m.marshal(element, con.getOutputStream());
System.out.println("CALLING POST
http://10.24.48.103/rest/resourcegroups/All/discoverfabric");
/**
* Make the HTTP call
*/
int responseCode = con.getResponseCode();
System.out.println("Response code is " + responseCode);
if (responseCode != HttpURLConnection.HTTP_OK
&& responseCode != HttpURLConnection.HTTP_NO_CONTENT
&& responseCode != HttpURLConnection.HTTP_PARTIAL
&& responseCode != HttpURLConnection.HTTP_ACCEPTED) {
PRINT_ERROR(con);
assert false : "Fabric Discovery FAILED, responseCode = " + responseCode;
}
if (responseCode == HttpURLConnection.HTTP_PARTIAL) {
String location = con.getHeaderField("Location");
if (null != location) {
System.out.println("URI FOR NEXT PAGE = " + location);
}
}
PRINT_RESPONSE(con);
} catch (IOException ie) {
System.out.println(ie.toString());
} finally {
if (null != con) {
con.disconnect();
}
}
Sample SAN fabric discovery JSON response
The following is an example of a SAN fabric discovery JSON response.
/**
* Establishing REST Session
*/
CALLING POST http://10.24.41.138/rest/login
Response code is 200
GOT TOKEN FROM RS RESPONSE = Yh8veQHgxR6v6KgNR9Eioeg7168=
This POST operation does not require any request payload except for the session token which is
passed back in an HTTP header parameter after a successful login.
This POST operation is performed on the fabric specified by fcfkey.
Sample Java code for deleting an FC fabric
The following is the sample Java code for deleting an FC fabric.
HttpURLConnection con = null;
try {
/**
* Create the HTTP connection object with the URI, method and headers
*/
URL obj = new
URL("http://10.24.48.103/rest/resourcegroups/All/fcfabrics/10:00:00:05:1E:40:40:00/deletefabric");
con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.addRequestProperty("WStoken", "wppCy/NGdC4o5gGFJjXRMv7blhc=");
Brocade Network Advisor REST API Guide47
53-1003160-01
Binding the schema
4
System.out.println("CALLING POST
http://10.24.48.103/rest/resourcegroups/All/fcfabrics/10:00:00:05:1E:40:40:00/del
etefabric");
/**
* Make the HTTP call
*/
int responseCode = con.getResponseCode();
System.out.println("Response code is " + responseCode);
if (HttpURLConnection.HTTP_NO_CONTENT != responseCode) {
PRINT_ERROR(con);
assert false : "Delete Fabric FAILED, responseCode = " + responseCode;
}
} catch (IOException ie) {
System.out.println(ie.toString());
} finally {
if (null != con) {
con.disconnect();
}
}
Binding the schema
Most of the POST operations supported by the Network Advisor REST API require input data. This
data is passed in the form of an XML payload.
To access the XML payload using Java, this example uses the Java Architecture for XML (JAXB)
binding. JAXB simplifies access to an XML document from a Java program by presenting the XML
document to the program in a Java format. As part of the JAXB framework, JAXB provides APIs for
unmarshaling and marshalling XML data.
To bind the schema, perform the following steps.
1. Unmarshal the XML data into a Java object, as shown in the following Java code example.
JAXBContext jaxbContext =
JAXBContext.newInstance(InitiatorTargetsRequest.class);
Unmarshaller u = jaxbContext.createUnmarshaller();
Object element = u.unmarshal(new File("./InitiatorTargetsRequest.xml"));
In this example, you can see that in order to unmarshal the XML data into Java objects, you
first need the Java class that represents the XML data, meaning binding the XML schema to
the Java class. That means that you need to generate the set of Java classes that represent the
REST XML schema.
2. Marshal the jaxbContext object into the HttpURLConnection output stream, as shown in the
following Java code example.
Marshaller m = jaxbContext.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
m.marshal(element, con.getOutputStream());
The REST schema is published in the directory <INSTALL-DIR>/conf/rest-schema, where
<INSTALL-DIR> is the Network Advisor installation directory.
In this example, the standard JDK’s xjc application which is the XML-to-Java compiler was used to
generate the needed Java classes from the REST XML schema (xjc is included as part of JDK since
Java SE 6). Shown below is the ant target to use xjc to generate the java artifacts.
Brocade Network Advisor REST API Guide51
53-1003160-01
5
Topology
ResourceGroups
Network Advisor supports “network scopes.” A network scope is a grouping of resources, a sort of
a convenience mechanism to enable you to retrieve data for any grouping of your choice. In the
Network Advisor REST API, a “resource group” is the equivalent of a “network scope.”
Resource groups can be predefined system groups or they can be user-defined groups. They are
keyed by unique names. Each resource group, whether system-defined or user-defined, is of a
particular type as defined by the enumeration
enables you to differentiate user-defined groups from other groups.
The system-defined resource group named “All” encompasses all resources. The resource group is
the starting point for all of the supported URIs in the Network Advisor REST API.
GET URIs
URIDescription
<BASE_URI>/resourcegroupsReturns all the resource groups in the system.
<BASE_URI>/resourcegroups/rgkeyReturns the specified resource group.
NetworkScopeType. The resource group type
Path parameters
NameDescription
rgkeyResource group identifier.
Response parameters
PropertyDescription
keyThe unique identifier for the resource group. The key is the unique resource group
name with spaces encoded.
nameThe unique name of the resource group.
typeThe type of resource group.
Notes
The response schema is ResourceGroupsResponse.
52Brocade Network Advisor REST API Guide
53-1003160-01
Topology
Fabrics
Retrieves information about FC fabrics.
GET URIs
URIDescription
<BASE_URI>/resourcegroups/rgkey/fcfabricsRetrieves FC fabrics for the given resource group.
<BASE_URI>/resourcegroups/rgkey/fcfabrics/fcfkeyRetrieves the details of the specified FC fabric.
Path parameters
NameDescription
rgkeyResource group identifier.
fcfkeyFC fabric identifier.
Response parameters
5
PropertyDescription
keyUnique identifier for the fabric. The key is the principal switch WWN.
seedSwitchWwnWWN of the switch used as the seed switch to discover the fabric.
nameThe name of the fabric as configured in Network Advisor.
secureWhether the fabric is running secure Fabric OS.
adEnvironmentThe admin domain environment of the fabric.
contactUser-assigned fabric contact.
locationUser-assigned fabric location.
descriptionUser-assigned fabric description.
principalSwitchWwnWWN of the principal fabric switch.
fabricNameFabric name persisted on switches running Fabric OS 7.0 and later.
virtualFabricIdVirtual fabric ID. A positive value indicates VF is enabled; otherwise -1.
seedSwitchIpAddressIP address of the seed switch. Could be either an IPv4 or IPv6 address.
Notes
• The resource group “All” encompasses all fabrics while the resource group FC_FABRIC
retrieves a subset of the fabrics.
• Even though a user-defined resource group can be a group of fabrics, products, or ports, FC
fabrics can be retrieved in the context of an FC fabric or user-defined resource group of only
fabrics. As there is no containment hierarchy within products or ports for FC fabrics, for a
PRODUCT_GROUP, PORT_GROUP, or USER_DEFINED resource group of products or ports, the
list is empty.
• The fabric is keyed by its unique principal switch WWN.
Brocade Network Advisor REST API Guide53
53-1003160-01
5
Topology
FC Switch
Retrieves information about FC switches.
GET URIs
URIDescription
<BASE_URI>/resourcegroups/rgkey/fcswitchesRetrieves the FC switches of the given resource
group.
<BASE_URI>/resourcegroups/rgkey/fcswitches/fcskeyRetrieves information about the specified FC switch.
Retrieves information about the specified FC switch.
rgkeyResource group identifier.
fcfkeyFC fabric identifier.
fcskeyFC switch identifier.
Response parameters
PropertyDescription
keyThe unique identifier for the switch, which is the switch WWN.
typeThe switch type, the sw_bd_type of the switch.
nameThe switch name.
wwnThe switch WWN.
virtualFabricIdThe virtual fabric ID. A positive value indicates VF is enabled; otherwise -1.
domainIdThe domain ID of the switch.
baseSwitchIndicates whether it is a base switch.
roleThe role of the switch. Refer to RoleType.
fcsRoleThe FCS role of the switch. This is applicable only when FCS policy is on.
adCapableIndicates the switch’s capability for Admin domain.
operationalStatusThe operational status of the switch. Refer to OperStatusType.
stateThe state of the switch. Refer to StateType.
statusReasonThe status reason, the contributors to the status.
lfEnabledIndicates if logical fabric is enabled on the switch.
defaultLogicalSwitchIndicates if the switch is the default logical switch.
fmsModeIndicates the FMS mode in FICON environment.
54Brocade Network Advisor REST API Guide
53-1003160-01
Topology
PropertyDescription
dynamicLoadSharingCapableIndicates the switch’s capability for dynamic load sharing.
portBasedRoutingPresentIndicates the switch’s capability for port-based routing.
inOrderDeliveryCapableIndicates whether in order delivery is enabled.
persistentDidEnabledIndicates whether persistent domain ID is enabled.
autoSnmpEnabledIndicates if automatic SNMP configuration is enabled.
5
Notes
• The resource group “All” encompasses all switches while a ResourceGroup of type
PRODUCT_GROUP scopes a subset of the switches. Even though a USER_DEFINED resource
group can be a group of fabrics, products or ports, FC switches can be retrieved at the context
of a USER_DEFINED resource group of fabrics or products only. As there is no containment
hierarchy within ports for FC switches, for a USER_DEFINED resource group of ports, the list is
empty.
• In the cases where the URI contains the FC fabric, FC fabrics can be retrieved at the context of
FC_FABRIC or USER_DEFINED resource groups of fabrics only. As there is no containment
hierarchy within products or ports for FC fabrics, for a PRODUCT_GROUP, PORT_GROUP or
USER_DEFINED resource group of products of ports, the URIs with FC fabric key will return an
empty list of FC switches.
• The FC switch is keyed by its unique switch WWN. The result is FcSwitchesResponse
containing a list of FcSwitch.
Brocade Network Advisor REST API Guide55
53-1003160-01
5
Topology
PhysicalSwitch
Retrieves information about physical switches. This includes properties such as IP address, switch
serial number, model, and so on.
Retrieves the PhysicalSwitch for a given FC switch.
Retrieves the physical switch of the given FC switch.
Path parameters
NameDescription
rgkeyResource group identifier.
fcfkeyFC fabric identifier.
fcskeyFC switch identifier.
Response parameters
PropertyDescription
keyThe unique identifier for the switch, which is the WWN.
wwnThe WWN of the switch.
ipAddressThe IP address of the switch. Could be either IPv4 or IPv6 address.
userIdThe Telnet user name used to log in to switch.
firmwareVersionThe firmware version of the switch.
vendorThe vendor information of the switch
supplierSerialNumberThe supplier serial number of the switch.
partNumberThe part number of the switch.
modelNumberThe model of the switch, such as Brocade 6505 and Brocade 6520.
manufacturerThe manufacturer for the switch.
switchSerialNumberThe factory serial number of the switch.
vendorVersionThe vendor version of the switch.
vendorPartNumberThe vendor part number of the switch.
snmpInformsEnabledIndicates if the SNMP informs is enabled.
contactThe contact details of the switch. Syscontact from the RFC 1213 MIB.
locationThe location details for the switch. Syslocation from RFC 1213 MIB.
descriptionThe description of the switch. Sysdescr from RFC 1213 MIB.
56Brocade Network Advisor REST API Guide
53-1003160-01
Topology
5
Notes
• The physical switch is keyed by the physical switch WWN.
• This resource contains the properties that depict the physical nature of a logical FC switch.
• The response schema is PhysicalSwitchesResponse.
• There is no physical switch for Front and Xlate phantom switches.
Brocade Network Advisor REST API Guide57
53-1003160-01
5
Topology
AccessGateway
Retrieves Access Gateway information.
GET URIs
URIDescription
<BASE_URI>/resourcegroups/ALL/accessgatewaysReturns a list of Access Gateways.
<BASE_URI>/resourcegroups/ALL/accessgateways/agkeyReturns the details of the given gateway.
Path parameters
NameDescription
agkeyAccess gateway identifier.
Response parameters
PropertyDescription
keyThe unique identifier for the access gateway, which is the WWN.
nameThe AG name.
wwnThe AG WWN.
operationalStatusThe operational status of the AG. Refer to OperStatusType.
stateThe state of the AG. Refer to StateType.
statusReasonThe status reason, the contributors to the status.
firmwareVersionThe firmware version of the AG.
Notes
• When a switch is in Access Gateway mode, it does not possess a domain ID and is not part of
any fabric. It acts as a gateway for multiple devices to log in to a specific switch, which is part
of a fabric, via a single F_Port. The N_Port on the Access Gateway connects to the FC switch’s
F_Port and end devices are connected to the Access Gateway’s F_Port. These ports can be
retrieved in the context of that Access Gateway. For information about port URIs related to
Access Gateway, refer to “FCPorts.”
• The end devices and their ports can also be retrieved in the context of an Access Gateway. For
information, refer to “Connected-switch ports” and “End devices”.
• The connection between an FC switch and the Access Gateway is represented as an
AgConnection object. For more information about the AgConnection-related URIs, refer to
“Access Gateway connection”.
• Access Gateways can be retrieved only in the context of the resource group “All.” They cannot
be retrieved with respect to any other resource group such as fabric, product, or port.
• An Access Gateway is keyed by its unique WWN.
• The response schema is AccessGatewaysResponse.
58Brocade Network Advisor REST API Guide
53-1003160-01
Topology
FCPorts
Retrieves information about FC ports.
GET URIs
URIDescription
<BASE_URI>/resourcegroups/rgkey/fcportsReturns a list of FC ports for the given resource
group.
<BASE_URI>/resourcegroups/rgkey/fcports/fcpkeyReturns details of the given port.
Returns a list of FC ports for the given FC switch.
Returns details of the given port.
Returns a list of FC ports for the given FC switch
under the given FC fabric.
Returns details of the given port.
Returns a list of FC ports for the given access
gateway.
Returns details of the given port of the given access
gateway.
5
Path parameters
NameDescription
rgkeyResource group identifier.
fcfkeyFC fabric identifier.
fcskeyFC switch identifier.
fcpkeyFC port identifier.
agkeyAccess gateway identifier.
Response parameters
PropertyDescription
keyThe unique identifier for the port, which is the WWN.
NOTE: The key of the Front phantom port is FF-wwn.
The key of Xlate phantom port is XF-wwn.
wwnThe WWN of the port.
nameThe user-assigned port name.
slotNumberThe slot number. The default value is 0.
portNumberThe logical port number within the slot. In case of directors, this port number is unique
within the slot.
userPortNumberThe user port number. This is a unique port number within a chassis.
Brocade Network Advisor REST API Guide59
53-1003160-01
5
Topology
PropertyDescription
portIdThe port ID.
portIndexThe port index, number used in identifying port in zoning.
areaIdThe area number of the port.
typeThe port type. The specific mode currently enabled for the port.
statusThe status of the port. Refer to PortStatusType.
statusMessageAny additional port level status similar to what is seen in CLI, like Segmented, Speed
Mismatch, Trunk master, and so on.
lockedPortTypeIndicates the locked port type. Ports can be locked down so that they can come up
only in that mode.
speedThe port speed currently configured on the switch.
speedsSupportedThe supported port speed as a list of comma-separated values.
maxPortSpeedThe maximum supported speed on the switch.
desiredCreditsThe number of BB credits desired by the port.
bufferAllocatedThe number of BB credits allocated to the port.
estimatedDistanceThe estimated distance of the link.
actualDistanceThe actual distance of the link.
longDistanceSettingIndicates if long distance setting is enabled.
remoteNodeWwnWWN of the node at the remote end of this switch port.
remotePortWwnWWN of the port at the remote end of this switch port.
licensedIndicates if the port is licensed.
swappedIndicates if the port is swapped.
trunkedIndicates if the port is trunked.
trunkMasterIndicates if the port is trunk master. Applicable only if the port is trunked.
persistentlyDisabledIndicates if the port is persistently disabled.
ficonSupportedIndicates if the port is FICON supported.
blockedIndicates if the port is blocked.
prohibitPortNumbersIndicates the ports prohibited with the current port as configured in the “Allow”
prohibit metric (PDCM).
prohibitPortCountThe count of prohibited ports.
npivCapableIndicates if port is NPIV-capable.
npivEnabledIndicates if is NPIV-capable is enabled.
fcFastWriteEnabledIndicates if FC Fast Write is enabled.
islRrdyEnabledIndicates if ISL receiver ready is enabled.
rateLimitCapableIndicates if the port is capable of rate limiting.
rateLimitedIndicates if the port has rate limiting enabled.
qosCapableIndicates if the port is QOS-capable.
qosEnabledIndicates if the port is QOS-enabled.
fcrFabricIdThe FCR fabric ID. Applicable if the port is configured as an EX_Port.
60Brocade Network Advisor REST API Guide
53-1003160-01
Topology
NOTE
PropertyDescription
stateThe state of the port. The state type is in the schema.
occupiedIndicates if the port is occupied.
masterPortNumberThe trunk’s master port number for the trunk member ports. For trunk master port, it
will be its own port number. For non-trunk ports, it will have the default value -1.
5
Notes
• This release supports only FC and GigE ports.
• The ports can be retrieved in the context of a resource group, a switch, or an access gateway.
The resource group “All” encompasses all ports while a resource group of type PORT_GROUP
or USER_DEFINED scopes a subset of the ports.
In the cases where the URI contains an FC fabric, the FC fabrics can be retrieved in the context
of the FC_FABRIC or USER_DEFINED resource group of fabrics only.
• As there is no containment hierarchy within products or ports for FC fabrics, for a
PRODUCT_GROUP, PORT_GROUP or USER_DEFINED resource group, the URIs with an FC
fabric key return an empty list of FC ports.
On a similar note, in the cases where the URI contains the FC switch, FC switches can be
retrieved at the context of FC_FABRIC, PRODUCT_GROUP or USER_DEFINED resource group of
fabrics or products only. As there is no containment hierarchy within ports for FC switches, for
a PORT_GROUP or USER_DEFINED resource group or ports, the URIs with FC switch key return
an empty list of FC ports.
The FC port is keyed by its unique port WWN. The result is FcPortsResponse containing a list
of FcPorts. The responses are paginated.
Brocade Network Advisor REST API Guide61
53-1003160-01
5
Topology
GigePorts
Retrieves information about GigE ports.
GET URIs
URIDescription
<BASE_URI>/resourcegroups/rgkey/gigeportsReturns a list of GigE ports for the given resource
group.
<BASE_URI>/resourcegroups/rgkey/gigeports/gpkeyReturns details of the given GigE port.
Updates switch credentials and SNMP configurations
for the specified FC switch.
Path parameters
NameDescription
fcfkeyFC fabric identifier.
Request parameters
PropertyDescription
userNameThe user name to be updated.
passwordThe password to be updated.
fabricNameThe user-defined name of the fabric to be updated.
snmpVersionThe SNMP version to be updated.
snmpTimeoutThe SNMP timeout to be updated.
snmpRetriesThe number of SNMP retries to be updated.
snmpReadCommunityStringThe SNMP read community string to be updated.
snmpWriteCommunityStringThe SNMP write community string to be updated.
snmpUserNameThe SNMP user name to be updated.
snmpContextNameThe SNMP context name for discovering the fabric.
snmpAuthorizationProtocolThe SNMP authorization protocol to be updated.
snmpAuthorizationPasswordThe SNMP authorization password to be updated.
snmpPrivacyProtocolThe SNMP privacy protocol to be updated.
snmpPrivacyPasswordThe SNMP privacy protocol password to be updated.
Notes
• The request schema is UpdateCredentialsRequest, which is an XML payload sent with the
POST request.
Brocade Network Advisor REST API Guide79
53-1003160-01
Summary data
5
Summary data
You can use the URIs in this section to retrieve summary data. They can be obtained in the context
of a resource group, fabric, switch, or port.
Depending on the scope of the context, the relevant summary data is returned. There are various
query parameters such as timeline, timescope, limit, and so on, that can be used to further filter
the summary data as shown in the following table.
TABLE 1Query parameters for Summary URIs
NameTypeDefault value
Timeline (Date expressed as a long
milliseconds value) (limit of 30 days past
current time)
timescopeTimeScopeTHIRTY_MINUTES
portscopeMonitorPortTypeALL
Limit (max value is 10)Integer10
descendingBooleantrue
The URIs return a SummaryResponse containing the requested summary.
longCurrent time (which is set as -1)
TABLE 2Response parameters for Summary URIs
PropertyDescription
summaryThe requested summary.
summaryNameThe name of the summary returned.
timeLineThe requested timeline for the summary.
timeScopeThe requested timescope for the summary. Refer to TimeScope.
limitThe requested limit for the summary.
portScopeThe requested port scope for the summary. Refer to MonitorPortType.
descendingThe requested order for the summary.
• “Status summary”
• “Asset classification summary”
• “Network object count summary”
• “Events summary”
• “Bottleneck violations summary”
• “Out-of-range violations summary”
• “Port health violations summary”
• “VM violations summary”
• “Port summaries”
• “Product summaries”
• “Traffic flow summaries”
80Brocade Network Advisor REST API Guide
53-1003160-01
Summary data
5
Status summary
Retrieves status summary data for all the discovered products.
The returned summary is StatusSummary. This contains a list of entries, one for each status. Each
entry shows the number of products for that particular status.
GET URIs
URIDescription
<BASE_URI>/resourcegroups/rgkey/statussummaryRetrieves status summary data for the specified
Brocade Network Advisor REST API Guide81
53-1003160-01
5
Summary data
Asset classification summary
Retrieves asset classification summary data. The returned summary is
AssetClassificationSummary. This contains a list of entries, one for each ClassificationCategory.
Each entry shows the AssetClassification for that particular ClassificationCategory.