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;
if (nodeSet != null) {
for (Node node : nodeSet) {
Map<String, String> device = new HashMap<String, String>();
- device.put("nodeName", switchManager.getNodeDescription(node));
+ device.put("nodeName", getNodeDesc(node, switchManager));
device.put("nodeId", node.toString());
lines.add(device);
}
if (nodeSet != null) {
for (Node node : nodeSet) {
Map<String, String> device = new HashMap<String, String>();
- 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);
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()
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();
+ }
}