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