blob: cb712661a7623a551b72ff1175c1ed227e79e264 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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 Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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 Vachuska83e090e2014-10-22 14:25:35 -070015 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.intent;
Brian O'Connor66630c82014-10-02 21:08:19 -070017
Sho SHIMIZU64ae11c2014-12-03 15:17:47 -080018import org.onosproject.net.intent.BatchWrite.Operation;
Brian O'Connorabafb502014-12-02 22:26:20 -080019import org.onosproject.store.Store;
Brian O'Connor66630c82014-10-02 21:08:19 -070020
toma1d16b62014-10-02 23:45:11 -070021import java.util.List;
22
Brian O'Connor66630c82014-10-02 21:08:19 -070023/**
24 * Manages inventory of end-station intents; not intended for direct use.
25 */
26public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
27
28 /**
tom85258ee2014-10-07 00:10:02 -070029 * 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'Connor66630c82014-10-02 21:08:19 -070035 *
tom85258ee2014-10-07 00:10:02 -070036 * @param intent intent to be submitted
Brian O'Connor66630c82014-10-02 21:08:19 -070037 */
alshabiba9819bf2014-11-30 18:15:52 -080038 @Deprecated
39 void createIntent(Intent intent);
Brian O'Connor66630c82014-10-02 21:08:19 -070040
41 /**
42 * Removes the specified intent from the inventory.
43 *
44 * @param intentId intent identification
Brian O'Connor66630c82014-10-02 21:08:19 -070045 */
alshabiba9819bf2014-11-30 18:15:52 -080046 @Deprecated
Thomas Vachuskae4b6bb22014-11-25 17:09:43 -080047 void removeIntent(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070048
49 /**
50 * Returns the number of intents in the store.
Toshio Koided32809b2014-10-09 10:58:54 -070051 *
52 * @return the number of intents in the store
Brian O'Connor66630c82014-10-02 21:08:19 -070053 */
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 Koided32809b2014-10-09 10:58:54 -070064 * Returns the intent with the specified identifier.
Brian O'Connor66630c82014-10-02 21:08:19 -070065 *
66 * @param intentId intent identification
67 * @return intent or null if not found
68 */
69 Intent getIntent(IntentId intentId);
70
toma1d16b62014-10-02 23:45:11 -070071 /**
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'Connor66630c82014-10-02 21:08:19 -070078
79 /**
80 * Sets the state of the specified intent to the new state.
81 *
toma1d16b62014-10-02 23:45:11 -070082 * @param intent intent whose state is to be changed
Brian O'Connor66630c82014-10-02 21:08:19 -070083 * @param newState new state
84 */
alshabiba9819bf2014-11-30 18:15:52 -080085 void setState(Intent intent, IntentState newState);
Brian O'Connor66630c82014-10-02 21:08:19 -070086
toma1d16b62014-10-02 23:45:11 -070087 /**
Yuta HIGUCHI10a31c32014-10-28 14:42:06 -070088 * Sets the installable intents which resulted from compilation of the
toma1d16b62014-10-02 23:45:11 -070089 * specified original intent.
90 *
91 * @param intentId original intent identifier
92 * @param installableIntents compiled installable intents
toma1d16b62014-10-02 23:45:11 -070093 */
Yuta HIGUCHI10a31c32014-10-28 14:42:06 -070094 void setInstallableIntents(IntentId intentId, List<Intent> installableIntents);
Brian O'Connor66630c82014-10-02 21:08:19 -070095
toma1d16b62014-10-02 23:45:11 -070096 /**
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 Vachuskac96058a2014-10-20 23:00:16 -0700103 List<Intent> getInstallableIntents(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -0700104
toma1d16b62014-10-02 23:45:11 -0700105 /**
106 * Removes any installable intents which resulted from compilation of the
107 * specified original intent.
108 *
109 * @param intentId original intent identifier
toma1d16b62014-10-02 23:45:11 -0700110 */
Brian O'Connor66630c82014-10-02 21:08:19 -0700111 void removeInstalledIntents(IntentId intentId);
toma1d16b62014-10-02 23:45:11 -0700112
Yuta HIGUCHIa94c6e82014-11-28 18:49:54 -0800113 /**
114 * Execute writes in a batch.
Sho SHIMIZU2bb988b2015-01-20 13:45:35 -0800115 * If the specified BatchWrite is empty, write will not be executed.
Yuta HIGUCHIa94c6e82014-11-28 18:49:54 -0800116 *
117 * @param batch BatchWrite to execute
118 * @return failed operations
119 */
Sho SHIMIZU4c464fb2014-12-03 15:12:21 -0800120 List<Operation> batchWrite(BatchWrite batch);
Yuta HIGUCHIa94c6e82014-11-28 18:49:54 -0800121
Brian O'Connor66630c82014-10-02 21:08:19 -0700122}