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