From ada8e4b22b9fa1e83d76c7e0d786782669bb9781 Mon Sep 17 00:00:00 2001 From: lakshya Date: Thu, 22 Aug 2013 17:42:41 -0700 Subject: [PATCH] Change nodeconnector string shown on the troubleshoot tab when clicked on ports to show node name if it is available and node id otherwise. Change-Id: I7ccb73ac56f963feaf31380ddbd87417c905804e Signed-off-by: lakshya --- .../controller/troubleshoot/web/Troubleshoot.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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..71ba687f2d 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 @@ -208,7 +208,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 +220,19 @@ 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())); -- 2.36.6