Add 'TableStatistics' to SAL and Northbound Statistics API.
[controller.git] / opendaylight / protocol_plugins / stub / src / main / java / org / opendaylight / controller / protocol_plugins / stub / internal / ReadService.java
index 68bd3af751036c6a7c7a120e0813844efe4b0ed8..27ba897fdfc57b44e0d2d4c2ae391ffeae9364c3 100644 (file)
@@ -36,6 +36,7 @@ import org.opendaylight.controller.sal.action.SwPath;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.NodeTable;
 import org.opendaylight.controller.sal.flowprogrammer.Flow;
 import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchType;
@@ -43,7 +44,7 @@ import org.opendaylight.controller.sal.reader.FlowOnNode;
 import org.opendaylight.controller.sal.reader.IPluginInReadService;
 import org.opendaylight.controller.sal.reader.NodeConnectorStatistics;
 import org.opendaylight.controller.sal.reader.NodeDescription;
-
+import org.opendaylight.controller.sal.reader.NodeTableStatistics;
 /**
  * Stub Implementation for IPluginInReadService used by SAL
  * 
@@ -233,4 +234,33 @@ public class ReadService implements IPluginInReadService {
         return 100;
     }
 
+    @Override
+    public NodeTableStatistics readNodeTable(NodeTable table, boolean b) {
+        NodeTableStatistics stats = new NodeTableStatistics();
+        stats.setNodeTable(table);
+        stats.setActiveCount(4);
+        stats.setLookupCount(4);
+        stats.setMatchedCount(4);
+
+        return stats;
+    }
+
+    @Override
+    public List<NodeTableStatistics> readAllNodeTable(Node node, boolean cached) {
+        NodeTableStatistics stats = new NodeTableStatistics();
+        try {
+            NodeTable nt = new NodeTable(NodeTable.NodeTableIDType.OPENFLOW, Byte.valueOf("10"), node);
+            stats.setNodeTable(nt);
+        } catch (ConstructionException e) {
+            // couldn't create nodetable.
+        }
+
+        stats.setActiveCount(4);
+        stats.setLookupCount(4);
+        stats.setMatchedCount(4);
+
+        List<NodeTableStatistics> result = new ArrayList<NodeTableStatistics>();
+        result.add(stats);
+        return result;
+    }
 }