Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.newintent; |
| 2 | |
| 3 | import java.util.Collection; |
| 4 | import java.util.EventListener; |
| 5 | |
| 6 | import net.onrc.onos.api.batchoperation.BatchOperation; |
| 7 | import net.onrc.onos.api.flowmanager.ConflictDetectionPolicy; |
| 8 | import net.onrc.onos.api.flowmanager.IFlow; |
| 9 | import net.onrc.onos.api.intent.IIntentRuntimeService; |
| 10 | import net.onrc.onos.api.intent.Intent; |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 11 | import net.onrc.onos.api.intent.IntentId; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 12 | |
| 13 | /** |
| 14 | * Implementation of Intent-Runtime Service. |
| 15 | * <p> |
| 16 | * TODO: Make all methods thread-safe. <br> |
| 17 | * TODO: Design methods to support the ReactiveForwarding and the SDN-IP. |
| 18 | */ |
| 19 | public class IntentRuntimeModule implements IIntentRuntimeService { |
| 20 | |
| 21 | @Override |
| 22 | public boolean addIntent(Intent intent) { |
| 23 | BatchOperation<Intent> ops = new BatchOperation<Intent>(); |
| 24 | ops.addAddOperation(intent); |
| 25 | return executeBatch(ops); |
| 26 | } |
| 27 | |
| 28 | @Override |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 29 | public boolean removeIntent(IntentId id) { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 30 | BatchOperation<Intent> ops = new BatchOperation<Intent>(); |
| 31 | ops.addRemoveOperation(id); |
| 32 | return executeBatch(ops); |
| 33 | } |
| 34 | |
| 35 | @Override |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 36 | public boolean updateIntent(IntentId id, Intent intent) { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 37 | BatchOperation<Intent> ops = new BatchOperation<Intent>(); |
| 38 | ops.addUpdateOperation(id, intent); |
| 39 | return executeBatch(ops); |
| 40 | } |
| 41 | |
| 42 | @Override |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 43 | public Intent getIntent(IntentId id) { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 44 | // TODO Auto-generated method stub |
| 45 | // - retrieves intents from global distributed maps |
| 46 | return null; |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | public Collection<Intent> getIntents() { |
| 51 | // TODO Auto-generated method stub |
| 52 | // - retrieves intents from global distributed maps |
| 53 | return null; |
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public boolean executeBatch(BatchOperation<Intent> ops) { |
| 58 | // TODO Auto-generated method stub |
| 59 | // - gets flow operations using compile() method for each Intent object. |
| 60 | // - allocates resources |
| 61 | // - combines and executes flow operations using FlowManager Service. |
| 62 | // - updates global distributed maps |
| 63 | return false; |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public Collection<IFlow> getFlows(String intentId) { |
| 68 | // TODO Auto-generated method stub |
| 69 | return null; |
| 70 | } |
| 71 | |
| 72 | @Override |
| 73 | public Intent getIntentByFlow(String flowId) { |
| 74 | // TODO Auto-generated method stub |
| 75 | return null; |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public void setConflictDetectionPolicy(ConflictDetectionPolicy policy) { |
| 80 | // TODO Auto-generated method stub |
| 81 | |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public ConflictDetectionPolicy getConflictDetectionPolicy() { |
| 86 | // TODO Auto-generated method stub |
| 87 | return null; |
| 88 | } |
| 89 | |
| 90 | @Override |
| 91 | public void addEventListener(EventListener listener) { |
| 92 | // TODO Auto-generated method stub |
| 93 | // - listener for addition/removal of intents, |
| 94 | // and states changes of intents |
| 95 | } |
| 96 | |
| 97 | @Override |
| 98 | public void removeEventListener(EventListener listener) { |
| 99 | // TODO Auto-generated method stub |
| 100 | |
| 101 | } |
| 102 | } |