X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fweb%2Ftroubleshoot%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Ftroubleshoot%2Fweb%2FTroubleshoot.java;h=f145c568b58b18bf62efdda84eadbadefb5934b7;hb=refs%2Fchanges%2F49%2F449%2F1;hp=dfa21075ea845eaf3140a701cf99d706553c41dc;hpb=ad006d06631b11a20507749689921ee5d8859eff;p=controller.git diff --git a/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java b/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java index dfa21075ea..f145c568b5 100644 --- a/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java +++ b/opendaylight/web/troubleshoot/src/main/java/org/opendaylight/controller/troubleshoot/web/Troubleshoot.java @@ -16,6 +16,8 @@ import java.util.HashMap; import java.util.List; import java.util.Set; +import javax.servlet.http.HttpServletRequest; + import org.opendaylight.controller.sal.action.Action; import org.opendaylight.controller.sal.action.Output; import org.opendaylight.controller.sal.action.SetVlanId; @@ -36,6 +38,7 @@ import org.opendaylight.controller.sal.utils.NetUtils; import org.opendaylight.controller.sal.utils.ServiceHelper; import org.opendaylight.controller.statisticsmanager.IStatisticsManager; import org.opendaylight.controller.switchmanager.ISwitchManager; +import org.opendaylight.controller.web.DaylightWebUtil; import org.opendaylight.controller.web.IDaylightWeb; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -50,7 +53,6 @@ public class Troubleshoot implements IDaylightWeb { private final String WEB_NAME = "Troubleshoot"; private final String WEB_ID = "troubleshoot"; private final short WEB_ORDER = 4; - private final String containerName = GlobalConstants.DEFAULT.toString(); public Troubleshoot() { ServiceHelper.registerGlobalService(IDaylightWeb.class, this, null); @@ -78,7 +80,8 @@ public class Troubleshoot implements IDaylightWeb { @RequestMapping(value = "/existingNodes", method = RequestMethod.GET) @ResponseBody - public TroubleshootingJsonBean getExistingNodes() { + public TroubleshootingJsonBean getExistingNodes(HttpServletRequest request, @RequestParam(required = false) String container) { + String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); ISwitchManager switchManager = (ISwitchManager) ServiceHelper .getInstance(ISwitchManager.class, containerName, this); List> lines = new ArrayList>(); @@ -108,7 +111,8 @@ public class Troubleshoot implements IDaylightWeb { @RequestMapping(value = "/uptime", method = RequestMethod.GET) @ResponseBody - public TroubleshootingJsonBean getUptime() { + public TroubleshootingJsonBean getUptime(HttpServletRequest request, @RequestParam(required = false) String container) { + String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); ISwitchManager switchManager = (ISwitchManager) ServiceHelper .getInstance(ISwitchManager.class, containerName, this); List> lines = new ArrayList>(); @@ -144,15 +148,17 @@ public class Troubleshoot implements IDaylightWeb { @RequestMapping(value = "/flowStats", method = RequestMethod.GET) @ResponseBody public TroubleshootingJsonBean getFlowStats( - @RequestParam("nodeId") String nodeId) { + @RequestParam("nodeId") String nodeId, + HttpServletRequest request, @RequestParam(required = false) String container) { Node node = Node.fromString(nodeId); List> cells = new ArrayList>(); + String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); IStatisticsManager statisticsManager = (IStatisticsManager) ServiceHelper .getInstance(IStatisticsManager.class, containerName, this); List statistics = statisticsManager.getFlows(node); for (FlowOnNode stats : statistics) { - cells.add(this.convertFlowStatistics(node, stats)); + cells.add(this.convertFlowStatistics(node, stats, containerName)); } List columnNames = new ArrayList(); columnNames.addAll(Arrays.asList(new String[] { "Node", "In Port", @@ -169,9 +175,11 @@ public class Troubleshoot implements IDaylightWeb { @RequestMapping(value = "/portStats", method = RequestMethod.GET) @ResponseBody public TroubleshootingJsonBean getPortStats( - @RequestParam("nodeId") String nodeId) { + @RequestParam("nodeId") String nodeId, + HttpServletRequest request, @RequestParam(required = false) String container) { Node node = Node.fromString(nodeId); List> cells = new ArrayList>(); + String containerName = DaylightWebUtil.getAuthorizedContainer(request, container, this); IStatisticsManager statisticsManager = (IStatisticsManager) ServiceHelper .getInstance(IStatisticsManager.class, containerName, this); List statistics = statisticsManager @@ -216,7 +224,8 @@ public class Troubleshoot implements IDaylightWeb { } private HashMap convertFlowStatistics(Node node, - FlowOnNode flowOnNode) { + FlowOnNode flowOnNode, + String containerName) { HashMap row = new HashMap(); Flow flow = flowOnNode.getFlow(); Match match = flow.getMatch();