Update FlowManager's API design and define batch operation map's API.
- FlowManager returns FlowBatchHandle as a handler to the batch execution.
-- addFlow(), removeFlow() and executeBatch() methods are executed asynchronously.
-- Users can get the current state of the batch via the FlowBatchHandle.
- Defined FlowOperationMap's inital API designs.
This task is a part of ONOS-1687, ONOS-1842, and ONOS-1692.
Change-Id: Ic9e8ce3ab0378615d9d3016b7755ee6d15e1e47c
diff --git a/src/main/java/net/onrc/onos/core/flowmanager/FlowOperationMap.java b/src/main/java/net/onrc/onos/core/flowmanager/FlowOperationMap.java
index 744c65e..e9d66c3 100644
--- a/src/main/java/net/onrc/onos/core/flowmanager/FlowOperationMap.java
+++ b/src/main/java/net/onrc/onos/core/flowmanager/FlowOperationMap.java
@@ -1,8 +1,49 @@
package net.onrc.onos.core.flowmanager;
+import net.onrc.onos.api.flowmanager.FlowBatchHandle;
+import net.onrc.onos.api.flowmanager.FlowBatchId;
+import net.onrc.onos.api.flowmanager.FlowBatchOperation;
+import net.onrc.onos.api.flowmanager.FlowBatchState;
+
/**
* Manages the set of flow operations throughout the ONOS instances.
*/
public class FlowOperationMap {
- // TODO implement it
+ public FlowBatchHandle putOperation(FlowBatchOperation ops) {
+ FlowBatchId id = getUniqueBatchOperationId();
+ if (id == null) {
+ return null;
+ }
+ if (putBatchOperation(id, ops)) {
+ return null;
+ }
+
+ return new FlowBatchHandle(this, id);
+ }
+
+ public void setState(long id, FlowBatchState state) {
+ // TODO implement it
+ }
+
+ public FlowBatchOperation getOperation(long id) {
+ // TODO implement it
+ return null;
+ }
+
+ public FlowBatchState getState(FlowBatchId id) {
+ // TODO implement it
+ return null;
+ }
+
+ // ====== private methods
+
+ private FlowBatchId getUniqueBatchOperationId() {
+ // TODO implement it
+ return null;
+ }
+
+ private boolean putBatchOperation(FlowBatchId id, FlowBatchOperation ops) {
+ // TODO implement it
+ return false;
+ }
}