Bug fixes and styling 86/586/1
authorYevgeny Khodorkovsky <ykhodork@cisco.com>
Wed, 10 Jul 2013 22:04:10 +0000 (15:04 -0700)
committerYevgeny Khodorkovsky <ykhodork@cisco.com>
Wed, 10 Jul 2013 22:04:10 +0000 (15:04 -0700)
- 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 <ykhodork@cisco.com>
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceShim.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/ReadServiceFilter.java
opendaylight/sal/implementation/src/main/java/org/opendaylight/controller/sal/implementation/internal/ReadService.java

index a6d5a15..024549d 100644 (file)
@@ -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<Property> props = InventoryServiceHelper.OFPortToProps(m
-                    .getDesc());
+            Set<Property> props = InventoryServiceHelper.OFPortToProps(m.getDesc());
             notifyInventoryShimListener(nodeConnector, type, props);
         }
     }
index dbcd5c8..b8f6ab4 100644 (file)
@@ -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<NodeConnector>());
+                containerToNc.put(containerName,
+                    Collections.newSetFromMap(new ConcurrentHashMap<NodeConnector,Boolean>()));
             }
             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:
index ed0394d..869dc81 100644 (file)
@@ -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 <sid> <cached>  - Read all the (cached) flows from the openflow switch <sid>\n");
-        help
-        .append("\t readflow  <sid> <cached>  - Read the (cached) sample flow from the openflow switch <sid>\n");
-        help
-        .append("\t readdesc  <sid> <cached>  - Read the (cached) description from openflow switch <sid>\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 <sid> <cached> - Read all the (cached) flows from the openflow switch <sid>\n");
+        help.append("\t readflow  <sid> <cached> - Read the (cached) sample flow from the openflow switch <sid>\n");
+        help.append("\t readdescr <sid> <cached> - Read the (cached) description from openflow switch <sid>\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 <sid> <port>    - Read port statistics for the specified port\n");
+        help.append("\t readports <sid>          - Read port statistics for all ports of specified switch\n");
+        help.append("\t readtable <sid> <tableid>- Read specified table statistics\n");
+
         return help.toString();
     }