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=6d79f3cb05cc7faf2469e3144fb6be44d9d21e81;hb=80887bb706a758b78cae70fcdb7531661139256c;hp=337d721696b8003713fe3805563c091760d1852b;hpb=5db7ed90dcf16bf3d533befd238020805d28b426;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 337d721696..6d79f3cb05 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 @@ -21,7 +21,15 @@ 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.SetDlDst; +import org.opendaylight.controller.sal.action.SetDlSrc; +import org.opendaylight.controller.sal.action.SetNwDst; +import org.opendaylight.controller.sal.action.SetNwSrc; +import org.opendaylight.controller.sal.action.SetNwTos; +import org.opendaylight.controller.sal.action.SetTpDst; +import org.opendaylight.controller.sal.action.SetTpSrc; import org.opendaylight.controller.sal.action.SetVlanId; +import org.opendaylight.controller.sal.action.SetVlanPcp; import org.opendaylight.controller.sal.authorization.Privilege; import org.opendaylight.controller.sal.authorization.UserLevel; import org.opendaylight.controller.sal.core.Description; @@ -54,9 +62,9 @@ import org.springframework.web.bind.annotation.ResponseBody; public class Troubleshoot implements IDaylightWeb { private static final UserLevel AUTH_LEVEL = UserLevel.CONTAINERUSER; private static final List flowStatsColumnNames = Arrays.asList("Node", "In Port", - "DL Src", "DL Dst", "DL Type", "DL Vlan", "NW Src", "NW Dst", + "DL Src", "DL Dst", "DL Type", "DL Vlan", "NW Src", "NW Dst","ToS Bits", "NW Proto", "TP Src", "TP Dst", "Actions", "Bytes", "Packets", - "Time (s)", "Timeout (s)", "Out Port(s)", "Out Vlan", + "Time (s)", "Timeout (s)", "Priority"); private static final List portStatsColumnNames = Arrays.asList("Node Connector", "Rx Pkts", "Tx Pkts", "Rx Bytes", "Tx Bytes", "Rx Drops", @@ -208,7 +216,7 @@ public class Troubleshoot implements IDaylightWeb { List statistics = statisticsManager .getNodeConnectorStatistics(node); for (NodeConnectorStatistics stats : statistics) { - cells.add(this.convertPortsStatistics(stats)); + cells.add(this.convertPortsStatistics(stats, containerName)); } } } @@ -220,11 +228,20 @@ public class Troubleshoot implements IDaylightWeb { } private Map convertPortsStatistics( - NodeConnectorStatistics ncStats) { + NodeConnectorStatistics ncStats, String containerName) { + Map row = new HashMap(); + ISwitchManager switchManager = (ISwitchManager) ServiceHelper + .getInstance(ISwitchManager.class, containerName, this); + NodeConnector nodeConnector = ncStats.getNodeConnector(); + Description description = (Description) switchManager.getNodeProp(nodeConnector.getNode(), Description.propertyName); + String desc = (description == null) ? "" : description.getValue(); + String nodeName = desc.equalsIgnoreCase("none") ? nodeConnector.getNode().getNodeIDString() : desc; + String nodeConnectorDisplayName = nodeConnector.getType() + "|" + nodeConnector.getID() + "@" + nodeName; row.put("nodeConnector", - String.valueOf(ncStats.getNodeConnector().toString())); + String.valueOf(nodeConnectorDisplayName)); + row.put("rxPkts", String.valueOf(ncStats.getReceivePacketCount())); row.put("txPkts", String.valueOf(ncStats.getTransmitPacketCount())); row.put("rxBytes", String.valueOf(ncStats.getReceiveByteCount())); @@ -309,6 +326,12 @@ public class Troubleshoot implements IDaylightWeb { } else { row.put(MatchType.NW_DST.id(), "*"); } + if (match.isPresent(MatchType.NW_TOS)) { + row.put(MatchType.NW_TOS.id(), ((Byte) flow.getMatch() + .getField(MatchType.NW_TOS).getValue()).toString()); + } else { + row.put(MatchType.NW_TOS.id(), "*"); + } if (match.isPresent(MatchType.NW_PROTO)) { row.put(MatchType.NW_PROTO.id(), IPProtocols.getProtocolName(((Byte) flow.getMatch() @@ -338,29 +361,49 @@ public class Troubleshoot implements IDaylightWeb { StringBuffer actions = new StringBuffer(); StringBuffer outPorts = new StringBuffer(); - String outVlanId = null; for (Action action : flow.getActions()) { - actions.append(action.getType().toString() + "\n"); + if (action instanceof Output) { Output ao = (Output) action; if (outPorts.length() > 0) { outPorts.append(" "); } - outPorts.append(ao.getPort().getNodeConnectorIdAsString()); + actions.append(action.getType().toString()).append(" = ").append(ao.getPort().getNodeConnectorIdAsString()).append("
"); } else if (action instanceof SetVlanId) { SetVlanId av = (SetVlanId) action; - outVlanId = String.valueOf(av.getVlanId()); + String outVlanId = String.valueOf(av.getVlanId()); + actions.append(action.getType().toString()).append(" = ").append(outVlanId).append("
"); + } else if (action instanceof SetDlSrc) { + SetDlSrc ads = (SetDlSrc) action; + actions.append(action.getType().toString()).append(" = ").append(HexEncode.bytesToHexStringFormat(ads.getDlAddress())).append("
"); + } else if (action instanceof SetDlDst) { + SetDlDst add = (SetDlDst) action; + actions.append(action.getType().toString()).append(" = ").append(HexEncode.bytesToHexStringFormat(add.getDlAddress())).append("
"); + } else if (action instanceof SetNwSrc) { + SetNwSrc ans = (SetNwSrc) action; + actions.append(action.getType().toString()).append(" = ").append(ans.getAddressAsString()).append("
"); + } else if (action instanceof SetNwDst) { + SetNwDst and = (SetNwDst) action; + actions.append(action.getType().toString()).append(" = ").append(and.getAddressAsString()).append("
"); + } else if (action instanceof SetNwTos) { + SetNwTos ant = (SetNwTos) action; + actions.append(action.getType().toString()).append(" = ").append(ant.getNwTos()).append("
"); + } else if (action instanceof SetTpSrc) { + SetTpSrc ads = (SetTpSrc) action; + actions.append(action.getType().toString()).append(" = ").append(ads.getPort()).append("
"); + } else if (action instanceof SetTpDst) { + SetTpDst atd = (SetTpDst) action; + actions.append(action.getType().toString()).append(" = ").append(atd.getPort()).append("
"); + } else if (action instanceof SetVlanPcp) { + SetVlanPcp avp = (SetVlanPcp) action; + actions.append(action.getType().toString()).append(" = ").append(avp.getPcp()).append("
"); + // } else if (action instanceof SetDlSrc) { + // SetDlSrc ads = (SetDlSrc) action; + } else { + actions.append(action.getType().toString()).append("
"); } } - if (outPorts.length() == 0) { - outPorts.append("*"); - } - if (outVlanId == null) { - outVlanId = "*"; - } row.put("actions", actions.toString()); - row.put("outPorts", outPorts.toString()); - row.put("outVlanId", outVlanId); row.put("durationSeconds", ((Integer) flowOnNode.getDurationSeconds()).toString()); row.put("idleTimeout", ((Short) flow.getIdleTimeout()).toString());