1 package org.openkilda.controller;
5 import org.apache.log4j.Logger;
12 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.http.HttpStatus;
14 import org.springframework.http.MediaType;
15 import org.springframework.stereotype.Controller;
16 import org.springframework.web.bind.annotation.PathVariable;
17 import org.springframework.web.bind.annotation.RequestBody;
18 import org.springframework.web.bind.annotation.RequestMapping;
19 import org.springframework.web.bind.annotation.RequestMethod;
20 import org.springframework.web.bind.annotation.ResponseBody;
21 import org.springframework.web.bind.annotation.ResponseStatus;
24 @RequestMapping(
value =
"/stats")
27 private static final Logger LOGGER = Logger.getLogger(
StatsController.class);
37 @RequestMapping(
value =
"/metrics")
38 @ResponseStatus(HttpStatus.OK)
39 public @ResponseBody List<String> getMetricDetail() {
55 value =
"isl/{srcSwitch}/{srcPort}/{dstSwitch}/{dstPort}/{startDate}/{endDate}/{downsample}/{metric}",
56 method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
57 @ResponseStatus(HttpStatus.OK)
59 public @ResponseBody String
getIslStats(@PathVariable String srcSwitch,
60 @PathVariable String srcPort, @PathVariable String dstSwitch,
61 @PathVariable String dstPort, @PathVariable String startDate,
62 @PathVariable String endDate, @PathVariable String downsample,
63 @PathVariable String metric)
throws Exception {
65 LOGGER.info(
"Inside StatsController method getIslStats ");
66 return statsService.getSwitchIslStats(startDate, endDate, downsample, srcSwitch,
67 srcPort, dstSwitch, dstPort, metric);
83 value =
"switchid/{switchid}/port/{port}/{startDate}/{endDate}/{downsample}/{metric}",
84 method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
85 @ResponseStatus(HttpStatus.OK)
87 public @ResponseBody String
getPortStats(@PathVariable String switchid,
88 @PathVariable String
port, @PathVariable String startDate,
89 @PathVariable String endDate, @PathVariable String downsample,
90 @PathVariable String metric)
throws Exception {
92 LOGGER.info(
"Inside StatsController method getPortStats ");
93 return statsService.getSwitchPortStats(startDate, endDate, downsample, switchid,
port,
108 @RequestMapping(
value =
"flowid/{flowid}/{startDate}/{endDate}/{downsample}/{metric}",
109 method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
110 @ResponseStatus(HttpStatus.OK)
113 @PathVariable String startDate, @PathVariable String endDate,
114 @PathVariable String downsample, @PathVariable String metric)
throws Exception {
116 LOGGER.info(
"Inside StatsController method getFlowStats ");
117 return statsService.getFlowStats(startDate, endDate, downsample, flowid, metric);
136 value =
"isl/losspackets/{srcSwitch}/{srcPort}/{dstSwitch}/{dstPort}/{startDate}/{endDate}/{downsample}/{metric}",
137 method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
138 @ResponseStatus(HttpStatus.OK)
141 @PathVariable String srcPort, @PathVariable String dstSwitch,
142 @PathVariable String dstPort, @PathVariable String startDate,
143 @PathVariable String endDate, @PathVariable String downsample,
144 @PathVariable String metric)
throws Exception {
146 LOGGER.info(
"Inside StatsController method getIslLossPacketStats ");
147 return statsService.getSwitchIslLossPacketStats(startDate, endDate, downsample, srcSwitch,
148 srcPort, dstSwitch, dstPort, metric);
163 value =
"flow/losspackets/{flowid}/{startDate}/{endDate}/{downsample}/{direction}",
164 method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
165 @ResponseStatus(HttpStatus.OK)
168 @PathVariable String startDate, @PathVariable String endDate,
169 @PathVariable String downsample, @PathVariable String direction)
throws Exception {
171 LOGGER.info(
"Inside StatsController method getFlowLossPacketStats ");
172 return statsService.getFlowLossPacketStats(startDate, endDate, downsample, flowid,
183 @RequestMapping(
value =
"flowpath", method = RequestMethod.POST,
184 produces = MediaType.APPLICATION_JSON_VALUE)
185 @ResponseStatus(HttpStatus.OK)
190 LOGGER.info(
"Inside StatsController method getFlowPathStat ");
191 return statsService.getFlowPathStats(flowPathStats);
204 @RequestMapping(
value =
"switchports/{switchid}/{startDate}/{endDate}/{downsample}",
205 method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
206 @ResponseStatus(HttpStatus.OK)
209 @PathVariable String startDate, @PathVariable String endDate,
210 @PathVariable String downsample)
throws Exception {
212 LOGGER.info(
"Inside StatsController method getSwitchPortsStats ");
213 return statsService.getSwitchPortsStats(startDate, endDate, downsample, switchid);
String getFlowPathStat(@RequestBody FlowPathStats flowPathStats)
static final String MENU_ISL
String getFlowStats(@PathVariable String flowid, @PathVariable String startDate, @PathVariable String endDate, @PathVariable String downsample, @PathVariable String metric)
String getPortStats(@PathVariable String switchid, @PathVariable String port, @PathVariable String startDate, @PathVariable String endDate, @PathVariable String downsample, @PathVariable String metric)
String getIslStats(@PathVariable String srcSwitch, @PathVariable String srcPort, @PathVariable String dstSwitch, @PathVariable String dstPort, @PathVariable String startDate, @PathVariable String endDate, @PathVariable String downsample, @PathVariable String metric)
String getFlowLossPacketStats(@PathVariable String flowid, @PathVariable String startDate, @PathVariable String endDate, @PathVariable String downsample, @PathVariable String direction)
String getIslLossPacketStats(@PathVariable String srcSwitch, @PathVariable String srcPort, @PathVariable String dstSwitch, @PathVariable String dstPort, @PathVariable String startDate, @PathVariable String endDate, @PathVariable String downsample, @PathVariable String metric)
static List< String > list()
static final String MENU_FLOWS
List< PortInfo > getSwitchPortsStats(@PathVariable String switchid, @PathVariable String startDate, @PathVariable String endDate, @PathVariable String downsample)
static final String MENU_SWITCHES