blob: 3af59c134ce446e054ca6366dae6c4a4d1bc6ac0 [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'Connor66630c82014-10-02 21:08:19 -070016package org.onlab.onos.net.intent;
17
Brian O'Connor66630c82014-10-02 21:08:19 -070018import org.onlab.onos.store.Store;
19
toma1d16b62014-10-02 23:45:11 -070020import java.util.List;
21
Brian O'Connor66630c82014-10-02 21:08:19 -070022/**
23 * Manages inventory of end-station intents; not intended for direct use.
24 */
25public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
26
27 /**
tom85258ee2014-10-07 00:10:02 -070028 * Submits a new intent into the store. If the returned event is not
29 * null, the manager is expected to dispatch the event and then to kick
30 * off intent compilation process. Otherwise, another node has been elected
31 * to perform the compilation process and the node will learn about
32 * the submittal and results of the intent compilation via the delegate
33 * mechanism.
Brian O'Connor66630c82014-10-02 21:08:19 -070034 *
tom85258ee2014-10-07 00:10:02 -070035 * @param intent intent to be submitted
36 * @return event indicating the intent was submitted or null if no
37 * change resulted, e.g. duplicate intent
Brian O'Connor66630c82014-10-02 21:08:19 -070038 */
39 IntentEvent createIntent(Intent intent);
40
41 /**
42 * Removes the specified intent from the inventory.
43 *
44 * @param intentId intent identification
Brian O'Connor66630c82014-10-02 21:08:19 -070045 */
Thomas Vachuskae4b6bb22014-11-25 17:09:43 -080046 void removeIntent(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070047
48 /**
49 * Returns the number of intents in the store.
Toshio Koided32809b2014-10-09 10:58:54 -070050 *
51 * @return the number of intents in the store
Brian O'Connor66630c82014-10-02 21:08:19 -070052 */
53 long getIntentCount();
54
55 /**
56 * Returns a collection of all intents in the store.
57 *
58 * @return iterable collection of all intents
59 */
60 Iterable<Intent> getIntents();
61
62 /**
Toshio Koided32809b2014-10-09 10:58:54 -070063 * Returns the intent with the specified identifier.
Brian O'Connor66630c82014-10-02 21:08:19 -070064 *
65 * @param intentId intent identification
66 * @return intent or null if not found
67 */
68 Intent getIntent(IntentId intentId);
69
toma1d16b62014-10-02 23:45:11 -070070 /**
71 * Returns the state of the specified intent.
72 *
73 * @param intentId intent identification
74 * @return current intent state
75 */
76 IntentState getIntentState(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070077
78 /**
79 * Sets the state of the specified intent to the new state.
80 *
toma1d16b62014-10-02 23:45:11 -070081 * @param intent intent whose state is to be changed
Brian O'Connor66630c82014-10-02 21:08:19 -070082 * @param newState new state
toma1d16b62014-10-02 23:45:11 -070083 * @return state transition event
Brian O'Connor66630c82014-10-02 21:08:19 -070084 */
85 IntentEvent setState(Intent intent, IntentState newState);
86
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
Brian O'Connor66630c82014-10-02 21:08:19 -0700113}