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=337d721696b8003713fe3805563c091760d1852b;hb=0b203f52cbe128efa17a6c400b6653c8e6a84ba8;hp=f5fda3d1bc8fe245323d3cb8666a185e9753472a;hpb=84ca16196357ad899e00eceae27ef75eaf899d14;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 f5fda3d1bc..337d721696 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 @@ -24,6 +24,7 @@ import org.opendaylight.controller.sal.action.Output; import org.opendaylight.controller.sal.action.SetVlanId; import org.opendaylight.controller.sal.authorization.Privilege; import org.opendaylight.controller.sal.authorization.UserLevel; +import org.opendaylight.controller.sal.core.Description; import org.opendaylight.controller.sal.core.Node; import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.core.TimeStamp; @@ -109,7 +110,7 @@ public class Troubleshoot implements IDaylightWeb { if (nodeSet != null) { for (Node node : nodeSet) { Map device = new HashMap(); - device.put("nodeName", switchManager.getNodeDescription(node)); + device.put("nodeName", getNodeDesc(node, switchManager)); device.put("nodeId", node.toString()); lines.add(device); } @@ -139,7 +140,7 @@ public class Troubleshoot implements IDaylightWeb { if (nodeSet != null) { for (Node node : nodeSet) { Map device = new HashMap(); - device.put("nodeName", switchManager.getNodeDescription(node)); + device.put("nodeName", getNodeDesc(node, switchManager)); device.put("nodeId", node.toString()); TimeStamp timeStamp = (TimeStamp) switchManager.getNodeProp( node, TimeStamp.TimeStampPropName); @@ -251,10 +252,9 @@ public class Troubleshoot implements IDaylightWeb { Match match = flow.getMatch(); ISwitchManager switchManager = (ISwitchManager) ServiceHelper .getInstance(ISwitchManager.class, containerName, this); - String desc = (switchManager == null)? - "" : switchManager.getNodeDescription(node); - desc = (desc.isEmpty() || desc.equalsIgnoreCase("none"))? - node.toString(): desc; + String desc = getNodeDesc(node, switchManager); + desc = (desc == null || desc.isEmpty() || desc.equalsIgnoreCase("none"))? + node.toString() : desc; row.put("nodeName", desc); if (match.isPresent(MatchType.IN_PORT)) { row.put(MatchType.IN_PORT.id(), ((NodeConnector) flow.getMatch() @@ -368,4 +368,11 @@ public class Troubleshoot implements IDaylightWeb { return row; } + private String getNodeDesc(Node node, ISwitchManager switchManager) { + if (switchManager == null) { + return null; + } + Description desc = (Description) switchManager.getNodeProp(node, Description.propertyName); + return (desc == null) ? "" : desc.getValue(); + } }