blob: cb8860e1f29319cae10fcd8cad11f837266bf869 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001/**
Ray Milkey269ffb92014-04-03 14:43:30 -07002 * Copyright 2011, Big Switch Networks, Inc.
3 * Originally created by David Erickson, Stanford University
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License. You may obtain
7 * a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations
15 * under the License.
16 **/
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080017
18package net.floodlightcontroller.core.web;
19
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080020
21/**
22 * Return switch statistics information for specific switches
Ray Milkey269ffb92014-04-03 14:43:30 -070023 *
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080024 * @author readams
25 */
26public class SwitchStatisticsResource extends SwitchResourceBase {
Jonathan Hartc78b8f62014-08-07 22:31:09 -070027 /*protected final static Logger log =
Ray Milkey269ffb92014-04-03 14:43:30 -070028 LoggerFactory.getLogger(SwitchStatisticsResource.class);
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080029
30 @Get("json")
31 public Map<String, Object> retrieve() {
Ray Milkey269ffb92014-04-03 14:43:30 -070032 HashMap<String, Object> result = new HashMap<String, Object>();
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080033 Object values = null;
Ray Milkey269ffb92014-04-03 14:43:30 -070034
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080035 String switchId = (String) getRequestAttributes().get("switchId");
36 String statType = (String) getRequestAttributes().get("statType");
Ray Milkey269ffb92014-04-03 14:43:30 -070037
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080038 if (statType.equals("port")) {
39 values = getSwitchStatistics(switchId, OFStatisticsType.PORT);
40 } else if (statType.equals("queue")) {
41 values = getSwitchStatistics(switchId, OFStatisticsType.QUEUE);
42 } else if (statType.equals("flow")) {
43 values = getSwitchStatistics(switchId, OFStatisticsType.FLOW);
44 } else if (statType.equals("aggregate")) {
45 values = getSwitchStatistics(switchId, OFStatisticsType.AGGREGATE);
46 } else if (statType.equals("desc")) {
47 values = getSwitchStatistics(switchId, OFStatisticsType.DESC);
48 } else if (statType.equals("table")) {
49 values = getSwitchStatistics(switchId, OFStatisticsType.TABLE);
50 } else if (statType.equals("features")) {
51 values = getSwitchFeaturesReply(switchId);
52 }
53
54 result.put(switchId, values);
55 return result;
Jonathan Hartc78b8f62014-08-07 22:31:09 -070056 }*/
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080057}