Merge "Bug 509: Improve logging in InMemoryDataStore."
[controller.git] / opendaylight / protocol_plugins / openflow / src / main / java / org / opendaylight / controller / protocol_plugin / openflow / internal / ReadServiceFilter.java
index d7bf2e22586188f578c72e02d9c453551a380ccd..e1b244f2c1ede4330d9bda67df4ae693c97af162 100644 (file)
@@ -189,7 +189,7 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
         List<FlowOnNode> flowOnNodeList = new FlowStatisticsConverter(ofList).getFlowOnNodeList(node);
         List<FlowOnNode> filteredList = filterFlowListPerContainer(container, node, flowOnNodeList);
 
-        return (filteredList == null || filteredList.isEmpty()) ? null : filteredList.get(0);
+        return (filteredList.isEmpty()) ? null : filteredList.get(0);
     }
 
     @Override
@@ -203,10 +203,8 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
 
         // Convert and filter the statistics per container
         List<FlowOnNode> flowOnNodeList = new FlowStatisticsConverter(ofList).getFlowOnNodeList(node);
-        List<FlowOnNode> filteredList = filterFlowListPerContainer(container, node, flowOnNodeList);
-
-        return (filteredList == null) ? null : filteredList;
 
+        return filterFlowListPerContainer(container, node, flowOnNodeList);
     }
 
     @Override
@@ -233,10 +231,10 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
      * @param list
      * @return
      */
-    public List<FlowOnNode> filterFlowListPerContainer(String container,
+    private List<FlowOnNode> filterFlowListPerContainer(String container,
             Node nodeId, List<FlowOnNode> list) {
         if (list == null) {
-            return null;
+            return Collections.emptyList();
         }
 
         // Create new filtered list of flows
@@ -260,9 +258,9 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
      * @param list
      * @return
      */
-    public List<OFStatistics> filterPortListPerContainer(String container, long switchId, List<OFStatistics> list) {
+    private List<OFStatistics> filterPortListPerContainer(String container, long switchId, List<OFStatistics> list) {
         if (list == null) {
-            return null;
+            return Collections.emptyList();
         }
 
         // Create new filtered list of flows
@@ -281,10 +279,10 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
     }
 
 
-    public List<OFStatistics> filterTableListPerContainer(
+    private List<OFStatistics> filterTableListPerContainer(
             String container, long switchId, List<OFStatistics> list) {
         if (list == null) {
-            return null;
+            return Collections.emptyList();
         }
 
         // Create new filtered list of node tables
@@ -517,7 +515,7 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
         long sid = (Long) node.getID();
         List<OFStatistics> ofList = (cached == true) ? statsMgr
                 .getOFPortStatistics(sid) : statsMgr.queryStatistics(sid,
-                        OFStatisticsType.FLOW, null);
+                        OFStatisticsType.PORT, null);
 
         List<OFStatistics> filteredList = filterPortListPerContainer(containerName, sid, ofList);
 
@@ -557,7 +555,7 @@ public class ReadServiceFilter implements IReadServiceFilter, IContainerListener
     public List<NodeTableStatistics> readAllNodeTable(String containerName, Node node, boolean cached) {
         long sid = (Long) node.getID();
         List<OFStatistics> ofList = (cached == true) ?
-                statsMgr.getOFTableStatistics(sid) : statsMgr.queryStatistics(sid, OFStatisticsType.FLOW, null);
+                statsMgr.getOFTableStatistics(sid) : statsMgr.queryStatistics(sid, OFStatisticsType.TABLE, null);
 
         List<OFStatistics> filteredList = filterTableListPerContainer(containerName, sid, ofList);