From: Yevgeny Khodorkovsky Date: Wed, 10 Jul 2013 22:04:10 +0000 (-0700) Subject: Bug fixes and styling X-Git-Tag: releasepom-0.1.0~296 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=fed417771af8b003686a0f1083f95e59d9db301b Bug fixes and styling - Fix using skiplistset on a non-comparable - Add missing help in SAL Read Service - Remove incorrect throws clause Change-Id: I4c3c192124e03f84d3ba5ac97e2c69ca7defdd03 Signed-off-by: Yevgeny Khodorkovsky --- diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceShim.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceShim.java index a6d5a15313..024549de59 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceShim.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceShim.java @@ -168,23 +168,18 @@ public class InventoryServiceShim implements IContainerListener, @Override public void receive(ISwitch sw, OFMessage msg) { - try { - if (msg instanceof OFPortStatus) { - handlePortStatusMessage(sw, (OFPortStatus) msg); - } - } catch (ConstructionException e) { - logger.error("",e); + if (msg instanceof OFPortStatus) { + handlePortStatusMessage(sw, (OFPortStatus) msg); } return; } - protected void handlePortStatusMessage(ISwitch sw, OFPortStatus m) - throws ConstructionException { + protected void handlePortStatusMessage(ISwitch sw, OFPortStatus m) { Node node = NodeCreator.createOFNode(sw.getId()); - NodeConnector nodeConnector = PortConverter.toNodeConnector(m.getDesc() - .getPortNumber(), node); - UpdateType type = null; + NodeConnector nodeConnector = PortConverter.toNodeConnector( + m.getDesc().getPortNumber(), node); + UpdateType type = null; if (m.getReason() == (byte) OFPortReason.OFPPR_ADD.ordinal()) { type = UpdateType.ADDED; } else if (m.getReason() == (byte) OFPortReason.OFPPR_DELETE.ordinal()) { @@ -197,8 +192,7 @@ public class InventoryServiceShim implements IContainerListener, if (type != null) { // get node connector properties - Set props = InventoryServiceHelper.OFPortToProps(m - .getDesc()); + Set props = InventoryServiceHelper.OFPortToProps(m.getDesc()); notifyInventoryShimListener(nodeConnector, type, props); } } diff --git a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java index dbcd5c8f37..b8f6ab4715 100644 --- a/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java +++ b/opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java @@ -10,6 +10,7 @@ package org.opendaylight.controller.protocol_plugin.openflow.internal; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -17,7 +18,6 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ConcurrentSkipListSet; import org.opendaylight.controller.protocol_plugin.openflow.IOFStatisticsListener; import org.opendaylight.controller.protocol_plugin.openflow.IOFStatisticsManager; @@ -437,7 +437,8 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener switch (type) { case ADDED: if (!containerToNc.containsKey(containerName)) { - containerToNc.put(containerName, new ConcurrentSkipListSet()); + containerToNc.put(containerName, + Collections.newSetFromMap(new ConcurrentHashMap())); } containerToNc.get(containerName).add(p); if (!containerToNode.containsKey(containerName)) { @@ -467,7 +468,6 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener nodeSet.remove(node); } } - } break; case CHANGED: diff --git a/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/ReadService.java b/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/ReadService.java index ed0394d209..869dc81f8d 100644 --- a/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/ReadService.java +++ b/opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/ReadService.java @@ -383,16 +383,15 @@ public class ReadService implements IReadService, CommandProvider, IPluginOutRea public String getHelp() { StringBuffer help = new StringBuffer(); help.append("---SAL Reader testing commands---\n"); - help - .append("\t readflows - Read all the (cached) flows from the openflow switch \n"); - help - .append("\t readflow - Read the (cached) sample flow from the openflow switch \n"); - help - .append("\t readdesc - Read the (cached) description from openflow switch \n"); - help - .append("\t cached=true/false. If false or not specified, the protocol plugin cached info\n"); - help - .append("\t is returned. If true, the info is directly retrieved from the switch\n"); + help.append("\t readflows - Read all the (cached) flows from the openflow switch \n"); + help.append("\t readflow - Read the (cached) sample flow from the openflow switch \n"); + help.append("\t readdescr - Read the (cached) description from openflow switch \n"); + help.append("\t\t cached = (true|false). If false or not specified, the plugin cached info\n"); + help.append("\t\t is returned. If true, the info is directly retrieved from the switch\n"); + help.append("\t readport - Read port statistics for the specified port\n"); + help.append("\t readports - Read port statistics for all ports of specified switch\n"); + help.append("\t readtable - Read specified table statistics\n"); + return help.toString(); }