Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 2 | * Copyright 2014 Open Networking Laboratory |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Thomas Vachuska | 83e090e | 2014-10-22 14:25:35 -0700 | [diff] [blame] | 15 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.intent; |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 17 | |
Sho SHIMIZU | 64ae11c | 2014-12-03 15:17:47 -0800 | [diff] [blame] | 18 | import org.onosproject.net.intent.BatchWrite.Operation; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 19 | import org.onosproject.store.Store; |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 20 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 21 | import java.util.List; |
| 22 | |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 23 | /** |
| 24 | * Manages inventory of end-station intents; not intended for direct use. |
| 25 | */ |
| 26 | public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { |
| 27 | |
| 28 | /** |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 29 | * Submits a new intent into the store. If the returned event is not |
| 30 | * null, the manager is expected to dispatch the event and then to kick |
| 31 | * off intent compilation process. Otherwise, another node has been elected |
| 32 | * to perform the compilation process and the node will learn about |
| 33 | * the submittal and results of the intent compilation via the delegate |
| 34 | * mechanism. |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 35 | * |
tom | 85258ee | 2014-10-07 00:10:02 -0700 | [diff] [blame] | 36 | * @param intent intent to be submitted |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 37 | */ |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 38 | @Deprecated |
| 39 | void createIntent(Intent intent); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Removes the specified intent from the inventory. |
| 43 | * |
| 44 | * @param intentId intent identification |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 45 | */ |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 46 | @Deprecated |
Thomas Vachuska | e4b6bb2 | 2014-11-25 17:09:43 -0800 | [diff] [blame] | 47 | void removeIntent(IntentId intentId); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 48 | |
| 49 | /** |
| 50 | * Returns the number of intents in the store. |
Toshio Koide | d32809b | 2014-10-09 10:58:54 -0700 | [diff] [blame] | 51 | * |
| 52 | * @return the number of intents in the store |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 53 | */ |
| 54 | long getIntentCount(); |
| 55 | |
| 56 | /** |
| 57 | * Returns a collection of all intents in the store. |
| 58 | * |
| 59 | * @return iterable collection of all intents |
| 60 | */ |
| 61 | Iterable<Intent> getIntents(); |
| 62 | |
| 63 | /** |
Toshio Koide | d32809b | 2014-10-09 10:58:54 -0700 | [diff] [blame] | 64 | * Returns the intent with the specified identifier. |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 65 | * |
| 66 | * @param intentId intent identification |
| 67 | * @return intent or null if not found |
| 68 | */ |
| 69 | Intent getIntent(IntentId intentId); |
| 70 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 71 | /** |
| 72 | * Returns the state of the specified intent. |
| 73 | * |
| 74 | * @param intentId intent identification |
| 75 | * @return current intent state |
| 76 | */ |
| 77 | IntentState getIntentState(IntentId intentId); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 78 | |
| 79 | /** |
| 80 | * Sets the state of the specified intent to the new state. |
| 81 | * |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 82 | * @param intent intent whose state is to be changed |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 83 | * @param newState new state |
| 84 | */ |
alshabib | a9819bf | 2014-11-30 18:15:52 -0800 | [diff] [blame] | 85 | void setState(Intent intent, IntentState newState); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 86 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 87 | /** |
Yuta HIGUCHI | 10a31c3 | 2014-10-28 14:42:06 -0700 | [diff] [blame] | 88 | * Sets the installable intents which resulted from compilation of the |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 89 | * specified original intent. |
| 90 | * |
| 91 | * @param intentId original intent identifier |
| 92 | * @param installableIntents compiled installable intents |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 93 | */ |
Yuta HIGUCHI | 10a31c3 | 2014-10-28 14:42:06 -0700 | [diff] [blame] | 94 | void setInstallableIntents(IntentId intentId, List<Intent> installableIntents); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 95 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 96 | /** |
| 97 | * Returns the list of the installable events associated with the specified |
| 98 | * original intent. |
| 99 | * |
| 100 | * @param intentId original intent identifier |
| 101 | * @return compiled installable intents |
| 102 | */ |
Thomas Vachuska | c96058a | 2014-10-20 23:00:16 -0700 | [diff] [blame] | 103 | List<Intent> getInstallableIntents(IntentId intentId); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 104 | |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 105 | /** |
| 106 | * Removes any installable intents which resulted from compilation of the |
| 107 | * specified original intent. |
| 108 | * |
| 109 | * @param intentId original intent identifier |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 110 | */ |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 111 | void removeInstalledIntents(IntentId intentId); |
tom | a1d16b6 | 2014-10-02 23:45:11 -0700 | [diff] [blame] | 112 | |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 113 | /** |
| 114 | * Execute writes in a batch. |
Sho SHIMIZU | 2bb988b | 2015-01-20 13:45:35 -0800 | [diff] [blame^] | 115 | * If the specified BatchWrite is empty, write will not be executed. |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 116 | * |
| 117 | * @param batch BatchWrite to execute |
| 118 | * @return failed operations |
| 119 | */ |
Sho SHIMIZU | 4c464fb | 2014-12-03 15:12:21 -0800 | [diff] [blame] | 120 | List<Operation> batchWrite(BatchWrite batch); |
Yuta HIGUCHI | a94c6e8 | 2014-11-28 18:49:54 -0800 | [diff] [blame] | 121 | |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 122 | } |