blob: 550fa44860d0668e63f01e8de4bb3020dfc16296 [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 Koidea03915e2014-07-01 18:39:52 -07009import net.onrc.onos.api.flowmanager.IFlow;
10import net.onrc.onos.api.flowmanager.IFlowManagerService;
11
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 */
18public class FlowManagerModule implements IFlowManagerService {
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
29 public boolean addFlow(IFlow 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 Koide025a9152014-07-21 11:00:34 -070043 public IFlow getFlow(FlowId id) {
Toshio Koidea03915e2014-07-01 18:39:52 -070044 // TODO Auto-generated method stub
45 return null;
46 }
47
48 @Override
49 public Collection<IFlow> getFlows() {
50 // 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}