1 package org.openkilda.controller;
3 import org.springframework.beans.factory.annotation.Autowired;
4 import org.springframework.http.HttpStatus;
5 import org.springframework.stereotype.Controller;
6 import org.springframework.web.bind.annotation.PathVariable;
7 import org.springframework.web.bind.annotation.RequestBody;
8 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RequestMethod;
10 import org.springframework.web.bind.annotation.ResponseBody;
11 import org.springframework.web.bind.annotation.ResponseStatus;
12 import org.springframework.web.servlet.ModelAndView;
14 import java.util.List;
16 import javax.servlet.http.HttpServletRequest;
36 @RequestMapping(
value =
"/switch")
55 public ModelAndView
switchList(
final HttpServletRequest request) {
67 @RequestMapping(
value =
"/details")
68 public ModelAndView switchDetails(final HttpServletRequest request) {
80 @RequestMapping(
value =
"/portdetails", method = RequestMethod.GET)
81 public ModelAndView portDetails(final HttpServletRequest request) {
93 @RequestMapping(
value =
"/isllist", method = RequestMethod.GET)
95 public ModelAndView
islList(
final HttpServletRequest request) {
106 @RequestMapping(
value =
"/isl", method = RequestMethod.GET)
107 public ModelAndView islDetails(final HttpServletRequest request) {
117 @RequestMapping(
value =
"/list")
118 @ResponseStatus(HttpStatus.OK)
120 return serviceSwitch.getSwitches();
129 @RequestMapping(
value =
"/links", method = RequestMethod.GET)
130 @ResponseStatus(HttpStatus.OK)
132 return serviceSwitch.getIslLinks();
141 @RequestMapping(
path =
"/link/props", method = RequestMethod.GET)
142 @ResponseStatus(HttpStatus.OK)
144 return serviceSwitch.getLinkProps(keys);
153 @RequestMapping(
path =
"/link/props", method = RequestMethod.PUT)
154 @ResponseStatus(HttpStatus.OK)
155 public @ResponseBody String updateLinkProps(@RequestBody final List<
LinkProps> keys) {
157 return serviceSwitch.updateLinkProps(keys);
166 @RequestMapping(
path =
"/{switchId}/rules", method = RequestMethod.GET)
167 @ResponseStatus(HttpStatus.OK)
168 public @ResponseBody String getSwitchRules(@PathVariable final String switchId) {
170 return serviceSwitch.getSwitchRules(switchId);
181 @RequestMapping(
path =
"/{switchId}/{port}/config", method = RequestMethod.PUT)
182 @ResponseStatus(HttpStatus.OK)
185 @PathVariable
final String switchId, @PathVariable
final String
port) {
187 return serviceSwitch.configurePort(switchId,
port, configuration);
static final String MENU_ISL
static final String SWITCH
static final String PORT_DETAILS
ModelAndView switchList(final HttpServletRequest request)
static final String SW_PORT_CONFIG
ModelAndView islList(final HttpServletRequest request)
static final String SWITCH_LIST
ConfiguredPort configureSwitchPort(@RequestBody final PortConfiguration configuration, @PathVariable final String switchId, @PathVariable final String port)
static final String MENU_SWITCHES
static final String ISL_LIST