blob: 3d85d03f5819bd2d30ade1532094bc353f66bf74 [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.core.flowmanager;
2
3import java.util.Collection;
4import java.util.EventListener;
5
Toshio Koidea03915e2014-07-01 18:39:52 -07006import net.onrc.onos.api.flowmanager.ConflictDetectionPolicy;
Toshio Koide4ea84192014-07-31 12:10:12 -07007import net.onrc.onos.api.flowmanager.FlowBatchOperation;
Toshio Koide025a9152014-07-21 11:00:34 -07008import net.onrc.onos.api.flowmanager.FlowId;
Toshio Koidefad1cd52014-08-07 17:10:07 -07009import net.onrc.onos.api.flowmanager.Flow;
10import net.onrc.onos.api.flowmanager.FlowManagerService;
Toshio Koidea03915e2014-07-01 18:39:52 -070011
12/**
13 * Manages a set of IFlow objects, computes and maintains a set of Match-Action
14 * entries based on the IFlow objects, and executes Match-Action plans.
15 * <p>
16 * TODO: Make all methods thread-safe
17 */
Toshio Koidefad1cd52014-08-07 17:10:07 -070018public class FlowManagerModule implements FlowManagerService {
Toshio Koided46b66d2014-07-21 10:27:27 -070019 private ConflictDetectionPolicy conflictDetectionPolicy;
20
21 /**
22 * Constructor.
23 */
24 public FlowManagerModule() {
25 this.conflictDetectionPolicy = ConflictDetectionPolicy.FREE;
26 }
27
Toshio Koidea03915e2014-07-01 18:39:52 -070028 @Override
Toshio Koidefad1cd52014-08-07 17:10:07 -070029 public boolean addFlow(Flow flow) {
Toshio Koide4ea84192014-07-31 12:10:12 -070030 FlowBatchOperation ops = new FlowBatchOperation();
31 ops.addAddFlowOperation(flow);
Toshio Koidea03915e2014-07-01 18:39:52 -070032 return executeBatch(ops);
33 }
34
35 @Override
Toshio Koide025a9152014-07-21 11:00:34 -070036 public boolean removeFlow(FlowId id) {
Toshio Koide4ea84192014-07-31 12:10:12 -070037 FlowBatchOperation ops = new FlowBatchOperation();
38 ops.addRemoveFlowOperation(id);
Toshio Koidea03915e2014-07-01 18:39:52 -070039 return executeBatch(ops);
40 }
41
42 @Override
Toshio Koidefad1cd52014-08-07 17:10:07 -070043 public Flow getFlow(FlowId id) {
Toshio Koidea03915e2014-07-01 18:39:52 -070044 // TODO Auto-generated method stub
45 return null;
46 }
47
48 @Override
Toshio Koidefad1cd52014-08-07 17:10:07 -070049 public Collection<Flow> getFlows() {
Toshio Koidea03915e2014-07-01 18:39:52 -070050 // TODO Auto-generated method stub
51 return null;
52 }
53
54 @Override
Toshio Koide4ea84192014-07-31 12:10:12 -070055 public boolean executeBatch(FlowBatchOperation ops) {
Toshio Koidea03915e2014-07-01 18:39:52 -070056 // TODO Auto-generated method stub
57 return false;
58 }
59
60 @Override
61 public void setConflictDetectionPolicy(ConflictDetectionPolicy policy) {
Toshio Koided46b66d2014-07-21 10:27:27 -070062 if (policy == ConflictDetectionPolicy.FREE) {
63 conflictDetectionPolicy = policy;
64 } else {
65 throw new UnsupportedOperationException(
66 policy.toString() + " is not supported.");
67 }
Toshio Koidea03915e2014-07-01 18:39:52 -070068 }
69
70 @Override
71 public ConflictDetectionPolicy getConflictDetectionPolicy() {
Toshio Koided46b66d2014-07-21 10:27:27 -070072 return conflictDetectionPolicy;
Toshio Koidea03915e2014-07-01 18:39:52 -070073 }
74
75 @Override
76 public void addEventListener(EventListener listener) {
77 // TODO Auto-generated method stub
78
79 }
80
81 @Override
82 public void removeEventListener(EventListener listener) {
83 // TODO Auto-generated method stub
84
85 }
86}