Broadcom Brocade Network Advisor REST API, 14.4.2 User guide

  • Hello! I am an AI chatbot trained to assist you with the Broadcom Brocade Network Advisor REST API, 14.4.2 User guide. I’ve already reviewed the document and can help you find the information you need or explain it in simple terms. Just ask your questions, and providing more details will help me assist you more effectively!
Supporting Brocade Network Advisor 14.4.2
API REFERENCE GUIDE
Brocade Network Advisor REST API Guide,
14.4.2
53-1005402-01
06 April 2018
Copyright
©
2018 Brocade Communications Systems LLC. All Rights Reserved. Brocade and the stylized B logo are among the trademarks of Brocade
Communications Systems LLC. Broadcom, the pulse logo, and Connecting everything are among the trademarks of Broadcom. The term "Broadcom"
refers to Broadcom Inc. and/or its subsidiaries.
Brocade, a Broadcom Inc. Company, reserves the right to make changes without further notice to any products or data herein to improve reliability,
function, or design. Information furnished by Brocade is believed to be accurate and reliable. However, Brocade does not assume any liability arising out of
the application or use of this information, nor the application or use of any product or circuit described herein, neither does it convey any license under its
patent rights nor the rights of others.
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 nd 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.broadcom.com/support/bre-channel-networking/tools/oscd.
Brocade Network Advisor REST API Guide, 14.4.2
2 53-1005402-01
Contents
Overview of the Brocade Network Advisor REST API................................................................................................................................................7
Introduction to the Management application REST API............................................................................................................................................................7
Management application URIs............................................................................................................................................................................................................. 8
Protocol and edition support.................................................................................................................................................................................................................8
Default HTTPS port (443)............................................................................................................................................................................................................8
Non-default HTTPS port.............................................................................................................................................................................................................. 8
Edition support...................................................................................................................................................................................................................................8
Getting Started..................................................................................................................................................................................................................11
Introduction................................................................................................................................................................................................................................................11
Before you begin.....................................................................................................................................................................................................................................11
Logging in.................................................................................................................................................................................................................................................. 11
Login URI................................................................................................................................................................................................................................................... 12
Login request headers.................................................................................................................................................................................................................13
Login response header................................................................................................................................................................................................................13
Logging out............................................................................................................................................................................................................................................... 13
Logout request header................................................................................................................................................................................................................ 13
Python client..............................................................................................................................................................................................................................................13
Python code example for fabric discovery..........................................................................................................................................................................20
Python code example to retrieve FC ports......................................................................................................................................................................... 23
Python code example to get the list of the last 15 Syslog events from a specic switch.............................................................................. 33
Python code example to get the last 15 trap events......................................................................................................................................................38
Python code example to list the current contents of the Zoning DB.......................................................................................................................43
Python code example for adding zoning objects to CFG (zoneset).........................................................................................................................46
Python code example for deleting zoning objects...........................................................................................................................................................56
Python code example for performance statistics and other metrics........................................................................................................................66
Using the Management Application REST API..........................................................................................................................................................71
Retrieving resource groups................................................................................................................................................................................................................. 71
Retrieving FC fabrics............................................................................................................................................................................................................................. 72
Retrieving a specic FC fabric...........................................................................................................................................................................................................73
Retrieving switches in the context of a fabric...............................................................................................................................................................................74
Retrieving switches and ports............................................................................................................................................................................................................ 76
Specifying the content type................................................................................................................................................................................................................ 77
Accept HTTP request header...................................................................................................................................................................................................77
Content-type HTTP request header......................................................................................................................................................................................78
Enabling or disabling FC switch ports............................................................................................................................................................................................78
Port persistent enable or persistent disable operation............................................................................................................................................................ 81
Setting switch port names...................................................................................................................................................................................................................83
Setting switch port speed.................................................................................................................................................................................................................... 85
Read Diagnostics Parameters (RDP) metrics support............................................................................................................................................................ 88
Versioning (backward compatibility)................................................................................................................................................................................................ 97
Using the Topology API....................................................................................................................................................................................................................... 97
Using the SAN Fabric Discovery API............................................................................................................................................................................................. 98
Notes About the SAN Fabric Discovery API URIs.......................................................................................................................................................... 98
Limitations for the SAN Fabric Discovery API.................................................................................................................................................................. 99
Using the Traî„»c Flow API...................................................................................................................................................................................................................99
Brocade Network Advisor REST API Guide, 14.4.2
53-1005402-01 3
Using the Summary Data API........................................................................................................................................................................................................... 99
Using the Events API..........................................................................................................................................................................................................................100
Using the Zoning API.........................................................................................................................................................................................................................100
Zoning URIs..................................................................................................................................................................................................................................101
Zoning operations...................................................................................................................................................................................................................... 101
Using the Historical Performance Data API..............................................................................................................................................................................101
Using the Real Time Performance Statistics API................................................................................................................................................................... 101
Using the Search API......................................................................................................................................................................................................................... 102
Search responses....................................................................................................................................................................................................................... 103
Search rules and regulations..................................................................................................................................................................................................104
FC fabric search rules............................................................................................................................................................................................................... 106
FC switch search rules..............................................................................................................................................................................................................106
Physical switch search rules...................................................................................................................................................................................................107
FC port search rules.................................................................................................................................................................................................................. 108
End device search rules........................................................................................................................................................................................................... 109
F_Port trunking and connected ports.................................................................................................................................................................................110
MAPS........................................................................................................................................................................................................................................................111
MAPS policies..............................................................................................................................................................................................................................111
MAPS rules................................................................................................................................................................................................................................... 112
MAPS groups...............................................................................................................................................................................................................................114
MAPS error codes......................................................................................................................................................................................................................115
Fibre Channel Routing....................................................................................................................................................................................................................... 115
Handling errors......................................................................................................................................................................................................................................116
URI error return behavior.................................................................................................................................................................................................................. 121
Use Cases........................................................................................................................................................................................................................123
Login and logout.................................................................................................................................................................................................................................. 123
Login request Java code sample......................................................................................................................................................................................... 123
Login response JSON code sample.................................................................................................................................................................................. 124
Login response XML code sample.....................................................................................................................................................................................124
Login error response sample.................................................................................................................................................................................................124
Logout request Python code sample.................................................................................................................................................................................125
Logout request Java code sample...................................................................................................................................................................................... 125
Zoning.......................................................................................................................................................................................................................................................126
Sample request payload.......................................................................................................................................................................................................... 126
Sample Java code for performing the attach operation............................................................................................................................................. 126
Sample JSON responses........................................................................................................................................................................................................127
Getting trac ow performance data.......................................................................................................................................................................................... 128
Sample Java code for retrieving ow information.........................................................................................................................................................128
Sample JSON response..........................................................................................................................................................................................................129
Retrieving performance data for the Transmit Frame Rate measure....................................................................................................................130
Sample Java code...................................................................................................................................................................................................................... 130
Sample JSON response..........................................................................................................................................................................................................130
Getting the top N CRC errors port summary...........................................................................................................................................................................131
SAN fabric discovery..........................................................................................................................................................................................................................132
Discovering an FC fabric.........................................................................................................................................................................................................132
Deleting an FC fabric................................................................................................................................................................................................................ 134
Binding the schema............................................................................................................................................................................................................................135
API Reference.................................................................................................................................................................................................................137
Topology..................................................................................................................................................................................................................................................137
Brocade Network Advisor REST API Guide, 14.4.2
4 53-1005402-01
ResourceGroups......................................................................................................................................................................................................................... 138
Fabrics.............................................................................................................................................................................................................................................140
FC Switch.......................................................................................................................................................................................................................................143
PhysicalSwitch............................................................................................................................................................................................................................. 145
Access Gateway.......................................................................................................................................................................................................................... 149
Blades..............................................................................................................................................................................................................................................151
FCPorts...........................................................................................................................................................................................................................................154
GigEPorts.......................................................................................................................................................................................................................................161
Connected-switch ports...........................................................................................................................................................................................................163
End-device ports........................................................................................................................................................................................................................ 165
Trunks.............................................................................................................................................................................................................................................. 167
ISL Connections..........................................................................................................................................................................................................................169
IFL Connections..........................................................................................................................................................................................................................171
EndDeviceConnection..............................................................................................................................................................................................................173
Access Gateway connection.................................................................................................................................................................................................. 175
End devices...................................................................................................................................................................................................................................177
SAN fabric discovery..........................................................................................................................................................................................................................179
Fabric discovery.......................................................................................................................................................................................................................... 180
Fabric deletion..............................................................................................................................................................................................................................184
Switch credentials update........................................................................................................................................................................................................185
Summary data.......................................................................................................................................................................................................................................187
Status summary..........................................................................................................................................................................................................................188
Asset classication summary................................................................................................................................................................................................190
Network object count summary........................................................................................................................................................................................... 194
Events summary.........................................................................................................................................................................................................................195
Bottleneck violations summary............................................................................................................................................................................................ 197
Port health violations summary............................................................................................................................................................................................200
VM violations summary...........................................................................................................................................................................................................202
Port summaries...........................................................................................................................................................................................................................204
Product summaries................................................................................................................................................................................................................... 217
Trac ow summaries..............................................................................................................................................................................................................223
SummaryResponse................................................................................................................................................................................................................... 228
Events....................................................................................................................................................................................................................................................... 228
Event retrieval............................................................................................................................................................................................................................... 229
Event count....................................................................................................................................................................................................................................231
Event acknowledgement......................................................................................................................................................................................................... 232
EventsResponse......................................................................................................................................................................................................................... 233
Syslog and Traps forwarding..................................................................................................................................................................................................235
Zoning.......................................................................................................................................................................................................................................................237
Zone DBs.......................................................................................................................................................................................................................................238
Zones ..............................................................................................................................................................................................................................................240
Zone aliases .................................................................................................................................................................................................................................242
Renaming alias using REST API .........................................................................................................................................................................................244
Zone sets ...................................................................................................................................................................................................................................... 245
Zone transactions....................................................................................................................................................................................................................... 247
Zone transaction management ............................................................................................................................................................................................248
Zoning object creation .............................................................................................................................................................................................................250
Zoning object deletion..............................................................................................................................................................................................................252
Zoning object updating ........................................................................................................................................................................................................... 253
Zone set activation ....................................................................................................................................................................................................................255
Brocade Network Advisor REST API Guide, 14.4.2
53-1005402-01 5
Initiator target zoning ................................................................................................................................................................................................................256
Peer Zones.................................................................................................................................................................................................................................... 257
Target Driven Zone support................................................................................................................................................................................................... 263
Historical performance data............................................................................................................................................................................................................ 267
Port-related performance data URIs.................................................................................................................................................................................. 267
Product-related performance data URIs...........................................................................................................................................................................272
Trac ow-related performance data URIs.....................................................................................................................................................................273
PerformanceDataResponse...................................................................................................................................................................................................276
Authentication and session management................................................................................................................................................................................. 277
Login................................................................................................................................................................................................................................................ 278
Logout............................................................................................................................................................................................................................................. 279
LoginResponse............................................................................................................................................................................................................................279
Brocade Network Advisor REST API Guide, 14.4.2
6 53-1005402-01
Overview of the Brocade Network Advisor
REST API
• Introduction to the Management application REST API...................................................................................................................... 7
• Management application URIs........................................................................................................................................................................8
• Protocol and edition support............................................................................................................................................................................8
Introduction to the Management application REST
API
The Management application REST API provides you with a web-services interface for conguring and monitoring Brocade switches.
The REST APIs are organized into various services such as Topology, Authentication, and Zoning.
You can use the Management application REST API to build your own Management application clients. You can also use third-party
REST API clients to interact with the Management application.
FIGURE 1 Architectural overview
The Management application REST API provides GET and POST uniform resource identiers (URIs) that you can use to retrieve
information and perform certain management and conguration tasks.
NOTE
This release of the Management application REST API supports only SAN fabrics.
Brocade Network Advisor REST API Guide, 14.4.2
53-1005402-01 7
Management application URIs
Management application URIs consists of two parts:
• Base URI: The base URI is specic to the Management application 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 Management application servers.
All REST operations are provided at the following base context path.
http://<Network Advisor Server IP>/rest/
The following are examples of Management application URIs (the text in bold is the base URI part, and the remainder is the request part):
• POST URI examples:
– http://10.24.48.103/rest/resourcegroups/All/fcfabrics/10:00:00:05:1E:90:52:07/createzoningobject
– http://10.24.48.103/rest/resourcegroups/All/fcfabrics/10:00:00:05:1E:90:52:07/deletezoningobject
– http://10.24.48.103/rest/resourcegroups/All/fcfabrics/10:00:00:05:1E:90:52:07/updatezoningobject
– http://10.24.48.103/rest/resourcegroups/All/fcfabrics/10:00:00:05:1E:90:52:07/activatezoneset
• GET URI examples:
– http://10.24.48.103/rest/resourcegroups
– http://10.24.48.103/rest/resourcegroups/All/fcfabrics
NOTE
URIs are case-sensitive.
Protocol and edition support
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 Management application 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 shown in the following two example URIs. In the
HTTP case, the request is redirected to HTTPS.
http://<Network Advisor Server IP>/rest/resourcegroups
https://<Network Advisor 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, Management application refuses connection requests.
https://<Network Advisor Server IP>:<non-default_port_number>/rest/resourcegroups
Edition support
The following table lists the REST API support for the Management application editions.
Management application URIs
Brocade Network Advisor REST API Guide, 14.4.2
8 53-1005402-01
Management application edition REST API availability
Enterprise Yes
Professional Plus Yes
Professional No
Headless Yes
Protocol and edition support
Brocade Network Advisor REST API Guide, 14.4.2
53-1005402-01 9
Brocade Network Advisor REST API Guide, 14.4.2
10 53-1005402-01
Getting Started
• Introduction.......................................................................................................................................................................................................... 11
• Before you begin................................................................................................................................................................................................11
• Logging in.............................................................................................................................................................................................................11
• Login URI..............................................................................................................................................................................................................12
• Logging out..........................................................................................................................................................................................................13
• Python client........................................................................................................................................................................................................ 13
Introduction
This chapter describes how to use the Management application REST API by logging in and performing 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 Management application REST API:
• Make sure that version 14.0.1 or later is installed on your network.
• Obtain a user name and password for accessing Management application 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.
Logging in
The Management application REST API provides URIs for logging in and out.
To log in to Management application, complete the following steps.
1. Enter the following URI in the URL
eld of your REST client tool.
http://<ip_address>/rest/login
2. Dene the following HTTP request headers.
Header name Value
WSUsername
The user name supplied by your management application administrator.
WSPassword
The password supplied by your Management application administrator.
Accept
The content type of the returned data.
Specify the following content type to receive the response data in JSON format:
application/vnd.brocade.networkadvisor+json;version=v1
If you prefer XML format, enter the following value:
application/vnd.brocade.networkadvisor+xml;version=v1
Brocade Network Advisor REST API Guide, 14.4.2
53-1005402-01 11
3. Set the HTTP request method to POST.
4. Send the request. The following is an example of login request headers sent to Management application:
Request headers
Accept: application/vnd.brocade.networkadvisor+json;version=v1
WSUsername: Administrator
Origin: chrome-extension://hgmloofddffdnphfgcellkdfbfbjeloo
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/32.0.1700.102 Safari/537.36
WSPassword: password
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
NOTE
If the request is successful, Management application creates a new client session and returns, in the response headers,
the token WStoken, which identies the session.
The following is an example of the output of a successful request:
Status
200 OK Show explanation Loading time: 5592
Response headers
Via: 1.1 Secure Proxy
Connection: Keep-Alive
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
Date: Mon, 03 Feb 2014 06:01:39 GMT
Content-Type: application/vnd.brocade.networkadvisor+json;version="v1"
Server: Apache-Coyote/1.1
WStoken: ghe/4Q//I0EJcxD6UPdO9/fvI94=
Raw
JSON
The JSON content of the response should look like the following:
{
serverName: "DCM-x3650-103"
serverIp: "10.24.48.103"
}
This response returns the name of the Management application and its IP address.
NOTE
Dierent tools may display the JSON or XML responses
dierently.
5. Record the value of the WStoken response header.
In this example, the value of the WStoken eld is ghe/4Q//I0EJcxD6UPdO9/fvI94=. You need this token for all subsequent
Management application REST API requests.
NOTE
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.
Login URI
Use the /login POST URI to log in. This URI returns the Management application server credentials in a LoginResponse.
Login URI
Brocade Network Advisor REST API Guide, 14.4.2
12 53-1005402-01
<BASE_URI>/login
Login request headers
A valid user name and password are required for login, and this information is sent through the HTTP request headers. You must add the
headers while forming the HTTP POST request.
The following are the header names and values. The password must be passed in as cleartext.
TABLE 1 Login request headers
Request header name Request header value
Accept
The content type.
WSusername
The valid Management application user name.
WSpassword
The 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
identies the client’s Management application session and must be used for all subsequent web service requests. The token expires after
10 minutes of no activity.
TABLE 2 Login response header
Response header name Response header value
WStoken
The token.
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
Logout request header
A valid token is required for logout, and this information is sent through the HTTP request header. You must add the header while
forming the HTTP POST request.
TABLE 3 Logout request header
Request header name Request header value
WStoken
The token obtained from login.
Python client
Python client explains how to create a sample Management application REST API Python client. Python version 3.3.3 for Windows
(MSC v.1600 64 bit (AMD64)) is used for creating the client.
Python client
Brocade Network Advisor REST API Guide, 14.4.2
53-1005402-01 13
This sample client logs in to Management application 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 le using your favorite Python editor.
Python client
Brocade Network Advisor REST API Guide, 14.4.2
14 53-1005402-01
2. Add the following code to the le, and replace the example IP address 10.24.41.138 with the IP address of your Management
application server.
import http.client
import json
# Create HTTPConnection object and connect to the server.
connection = http.client.HTTPConnection("10.24.41.138")
###########################
# Log in to Network Advisor
###########################
# Send login requrest
connection.request('POST', 'http://10.24.41.138/rest/login',
headers={"WSUsername":"Administrator",
"WSPassword":"password",
"Accept":"application/vnd.brocade.networkadvisor+json;version=v1"})
print()
print("Sending login request to Network Advisor...")
# Get the response
response = connection.getresponse()
# Display the response status
print()
print ("Status= ", response.status)
# If successful (status = 200), display the returned Network Advisor session
token
if response.status == 200:
WStoken = response.getheader('WStoken')
print()
print("Login successful!")
print("WStoken: ", WStoken)
else:
print()
print (response.status, response.reason)
connection.close()
###########################
# Retrieve fabrics
###########################
# Send GET requrest
connection.connect()
connection.request('GET',
'http://10.24.41.138/rest/resourcegroups/All/fcfabrics',
headers={"WStoken":WStoken,
"Accept":"application/vnd.brocade.networkadvisor+json;version=v1"})
print()
print("--------------------------------------------------------------------")
print("Getting list of all fabrics...")
# 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 fabrics:")
json_response_bytes = response.read()
json_response_string = str(json_response_bytes, encoding='utf8')
list_of_fabrics_dict=json.loads(json_response_string)
print(json.dumps(list_of_fabrics_dict, indent=4))
print("Number of FC fabrics: ", len(list_of_fabrics_dict["fcFabrics"]))
else:
print()
print (response.status, response.reason)
connection.close()
##############################
# Retrieve details of a fabric
##############################
# Get the key of the first fabric in the list
fabric_key = list_of_fabrics_dict["fcFabrics"][0]["key"]
# Send GET requrest
connection.connect()
connection.request('GET',
Python client
Brocade Network Advisor REST API Guide, 14.4.2
53-1005402-01 15
'http://10.24.41.138/rest/resourcegroups/All/fcfabrics/'+fabric_key,
headers={"WStoken":WStoken,
"Accept":"application/vnd.brocade.networkadvisor+json;version=v1"})
print()
print("--------------------------------------------------------------------")
print("Get fabric '+fabric_key+'details...")
# 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
######################################################
# Send GET requrest
connection.connect()
connection.request('GET',
'http://10.24.41.138/rest/resourcegroups/All/fcfabrics/'+fabric_key+'/fcswitc
hes',
headers={"WStoken":WStoken,
"Accept":"application/vnd.brocade.networkadvisor+json;version=v1"})
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)
connection.close()
3. Save the
le as my_na_client.py.
Python client
Brocade Network Advisor REST API Guide, 14.4.2
16 53-1005402-01
4. Run the program by entering the C:\Python33>python my_na_client.py command at the command prompt.
If successful, you should see output similar to the following:
Sending login request to Network Advisor...
Status= 200
Login successful!
WStoken: RPTZz0z5ayVkvqIuy7quIEbjap8=
-----------------------------------------------------------------------------
Getting list of all fabrics...
Status= 200
List of fabrics:
{
"fcFabrics": [
{
"seedSwitchWwn": "10:00:00:05:33:A6:B6:17",
"name": "10:00:00:05:33:A6:B6:17",
"secure": false,
"principalSwitchWwn": "10:00:00:05:33:A6:B6:17",
"fabricName": "****8G FABRIC FOR REST******",
"seedSwitchIpAddress": "10.24.33.191",
"virtualFabricId": -1,
"contact": null,
"key": "10:00:00:05:33:A6:B6:17",
"adEnvironment": false,
"description": null,
"location": null
},
{
"seedSwitchWwn": "10:00:00:05:1E:A7:1F:EB",
"name": "10:00:00:05:1E:A7:1F:EB",
"secure": false,
"principalSwitchWwn": "10:00:00:05:1E:A7:1F:EB",
"fabricName": "",
"seedSwitchIpAddress": "10.24.33.195",
"virtualFabricId": -1,
"contact": null,
"key": "10:00:00:05:1E:A7:1F:EB",
"adEnvironment": false,
"description": null,
"location": null
},
{
"seedSwitchWwn": "10:00:00:05:1E:DB:1E:1E",
"name": "10:00:00:05:1E:DB:1E:1E",
"secure": false,
"principalSwitchWwn": "10:00:00:05:1E:DB:1E:1E",
"fabricName": "",
"seedSwitchIpAddress": "10.24.33.193",
"virtualFabricId": -1,
"contact": null,
"key": "10:00:00:05:1E:DB:1E:1E",
"adEnvironment": false,
"description": null,
"location": null
}
]
}
Number of FC fabrics: 3
-----------------------------------------------------------------------------
Get fabric '+fabric_key+'details...
Status= 200
Fabric details:
{
"fcFabrics": [
{
"seedSwitchWwn": "10:00:00:05:33:A6:B6:17",
"name": "10:00:00:05:33:A6:B6:17",
"secure": false,
"principalSwitchWwn": "10:00:00:05:33:A6:B6:17",
"fabricName": "****8G FABRIC FOR REST******",
Python client
Brocade Network Advisor REST API Guide, 14.4.2
53-1005402-01 17
"seedSwitchIpAddress": "10.24.33.191",
"virtualFabricId": -1,
"contact": null,
"key": "10:00:00:05:33:A6:B6:17",
"adEnvironment": false,
"description": null,
"location": null
}
]
}
-----------------------------------------------------------------------------
Get the list of switches under fabric 10:00:00:05:33:A6:B6:17...
Status= 200
List of switches:
{
"fcSwitches": [
{
"statusReason": null,
"fcipLicensed": false,
"autoSnmpEnabled": true,
"state": "UNKNOWN",
"persistentDidEnabled": false,
"lfEnabled": false,
"fcipCapable": false,
"fcsRole": "None",
"maxFcipTunnels": -1,
"maxFcipCircuits": -1,
"wwn": "50:00:51:ED:B1:E5:EF:04",
"type": 41,
"fcrCapable": false,
"portBasedRoutingPresent": false,
"cryptoCapable": false,
"fmsMode": false,
"name": "fcr_xd_1_30",
"defaultLogicalSwitch": false,
"fcipCircuitCapable": false,
"baseSwitch": false,
"virtualFabricId": -1,
"adCapable": false,
"key": "50:00:51:ED:B1:E5:EF:04",
"operationalStatus": "UNKNOWN",
"role": "SUBORDINATE",
"domainId": 1,
"inOrderDeliveryCapable": false,
"dynamicLoadSharingCapable": false
},
{
"statusReason": null,
"fcipLicensed": false,
"autoSnmpEnabled": true,
"state": "UNKNOWN",
"persistentDidEnabled": false,
"lfEnabled": false,
"fcipCapable": false,
"fcsRole": "None",
"maxFcipTunnels": -1,
"maxFcipCircuits": -1,
"wwn": "50:00:51:ED:B1:E1:EE:14",
"type": 40,
"fcrCapable": false,
"portBasedRoutingPresent": false,
"cryptoCapable": false,
"fmsMode": false,
"name": "fcr_fd_160",
"defaultLogicalSwitch": false,
"fcipCircuitCapable": false,
"baseSwitch": false,
"virtualFabricId": -1,
"adCapable": false,
"key": "50:00:51:ED:B1:E1:EE:14",
"operationalStatus": "UNKNOWN",
"role": "SUBORDINATE",
Python client
Brocade Network Advisor REST API Guide, 14.4.2
18 53-1005402-01
"domainId": 160,
"inOrderDeliveryCapable": false,
"dynamicLoadSharingCapable": false
},
{
"statusReason": null,
"fcipLicensed": false,
"autoSnmpEnabled": true,
"state": "UNKNOWN",
"persistentDidEnabled": false,
"lfEnabled": false,
"fcipCapable": false,
"fcsRole": "None",
"maxFcipTunnels": -1,
"maxFcipCircuits": -1,
"wwn": "50:00:51:ED:B1:E5:EF:06",
"type": 41,
"fcrCapable": false,
"portBasedRoutingPresent": false,
"cryptoCapable": false,
"fmsMode": false,
"name": "fcr_xd_1_30",
"defaultLogicalSwitch": false,
"fcipCircuitCapable": false,
"baseSwitch": false,
"virtualFabricId": -1,
"adCapable": false,
"key": "50:00:51:ED:B1:E5:EF:06",
"operationalStatus": "UNKNOWN",
"role": "SUBORDINATE",
"domainId": 1,
"inOrderDeliveryCapable": false,
"dynamicLoadSharingCapable": false
},
{
"statusReason": "Switch Status is MARGINAL. Contributors:\n* Power
Supply: 1 bad. (MARGINAL).\n* Fan: 1 bad (MARGINAL).",
"fcipLicensed": false,
"autoSnmpEnabled": true,
"state": "ONLINE",
"persistentDidEnabled": false,
"lfEnabled": false,
"fcipCapable": false,
"fcsRole": "None",
"maxFcipTunnels": 0,
"maxFcipCircuits": 0,
"wwn": "10:00:00:14:C9:E5:56:AB",
"type": 133,
"fcrCapable": false,
"portBasedRoutingPresent": false,
"cryptoCapable": false,
"fmsMode": false,
"name": "REST_6520_33_189",
"defaultLogicalSwitch": true,
"fcipCircuitCapable": false,
"baseSwitch": false,
"virtualFabricId": -1,
"adCapable": true,
"key": "10:00:00:14:C9:E5:56:AB",
"operationalStatus": "MARGINAL",
"role": "SUBORDINATE",
"domainId": 2,
"inOrderDeliveryCapable": false,
"dynamicLoadSharingCapable": true
},
{
"statusReason": "Switch Status is HEALTHY.",
"fcipLicensed": false,
"autoSnmpEnabled": true,
"state": "ONLINE",
"persistentDidEnabled": false,
"lfEnabled": false,
Python client
Brocade Network Advisor REST API Guide, 14.4.2
53-1005402-01 19
"fcipCapable": false,
"fcsRole": "None",
"maxFcipTunnels": 0,
"maxFcipCircuits": 0,
"wwn": "10:00:00:05:33:A6:B6:17",
"type": 118,
"fcrCapable": false,"portBasedRoutingPresent": false,
"cryptoCapable": false,
"fmsMode": false,
"name": "REST_6505_33_191",
"defaultLogicalSwitch": true,
"fcipCircuitCapable": false,
"baseSwitch": false,
"virtualFabricId": -1,
"adCapable": true,
"key": "10:00:00:05:33:A6:B6:17",
"operationalStatus": "UNKNOWN",
"role": "PRINCIPAL",
"domainId": 191,
"inOrderDeliveryCapable": false,
"dynamicLoadSharingCapable": true
}
]
}
Python code example for fabric discovery
Following is the Python code example for fabric discovery and its output.
import http.client
import json
# Create HTTPConnection object and connect to the server.
connection = http.client.HTTPConnection(<BNA SERVER IP ADDRESS>)
###########################
# Log in to Network Advisor
###########################
# Send login request
connection.request('POST', 'http://<bnaserver>/rest/login',
headers={"WSUsername":"Administrator",
"WSPassword":"password",
"Accept":"application/vnd.brocade.networkadvisor+json;version=v1"})
print()
print("Sending login request to Network Advisor...")
# Get the response
response = connection.getresponse()
# Display the response status
print()
print ("Status= ", response.status)
# If successful (status = 200), display the returned Network Advisor session
token
if response.status == 200:
WStoken = response.getheader('WStoken')
print()
print("Login successful!")
print("WStoken: ", WStoken)
else:
print()
print (response.status, response.reason)
connection.close()
###########################
# Send Fabric Discovery request
###########################
# Send Fabric Discovery request
print()
print("--------------------------------------------------------------------")
print("Sending Fabric Discovery request with the following values:")
print(" IP Addres: <SWITCH IP ADDRESS>")
print(" Username: <SWITCH USERNAME>")
Python client
Brocade Network Advisor REST API Guide, 14.4.2
20 53-1005402-01
/