beautypg.com

Sample java code – Brocade Network Advisor REST API Guide (Supporting Network Advisor 12.3.0) User Manual

Page 56

background image

42

Brocade Network Advisor REST API Guide

53-1003160-01

Getting Traffic Flow Performance Data

4

,"mirrorPort":""},{"key":"fldbid-10","flowDefinitionName":"traffic_flow","feature

Type":"MONITOR","srcDevicePorts":["aa01ef"],"destDevicePorts":["031900"],"srcSwit

chPort":"","destSwitchPort":"0/25","bidirectional":false,"sfid":"","dfid":"","lun

Ids":[],"frameSize":0,"framePattern":"","subFlowMd5hash":"","mirrorPort":""},{"ke

y":"fldbid-16","flowDefinitionName":"traffic_flow","featureType":"MONITOR","srcDe

vicePorts":["032b01"],"destDevicePorts":["031900"],"srcSwitchPort":"","destSwitch

Port":"0/25","bidirectional":false,"sfid":"","dfid":"","lunIds":[],"frameSize":0,

"framePattern":"","subFlowMd5hash":"","mirrorPort":""},{"key":"fldbid-17","flowDe

finitionName":"traffic_flow","featureType":"MONITOR","srcDevicePorts":["010500"],

"destDevicePorts":["031900"],"srcSwitchPort":"","destSwitchPort":"0/25","bidirect

ional":false,"sfid":"","dfid":"","lunIds":[],"frameSize":0,"framePattern":"","sub

FlowMd5hash":"","mirrorPort":""},{"key":"fldbid-14","flowDefinitionName":"traffic

_flow","featureType":"MONITOR","srcDevicePorts":["*"],"destDevicePorts":["031900"

],"srcSwitchPort":"","destSwitchPort":"0/25","bidirectional":false,"sfid":"","dfi

d":"","lunIds":[],"frameSize":0,"framePattern":"","subFlowMd5hash":"","mirrorPort

":""}]}

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.

/resourcegroups/{rgkey}/fcswitches/{fcskey}/timeseriestxframerate?granularity=ue>&startdate=&enddate=

Sample Java code

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;

}