blob: c234b0ff1a7e112d8cfe9e84c6fac9ea0d228e5e [file] [log] [blame]
Brian O'Connor66630c82014-10-02 21:08:19 -07001package org.onlab.onos.net.intent;
2
Brian O'Connor66630c82014-10-02 21:08:19 -07003import org.onlab.onos.store.Store;
4
toma1d16b62014-10-02 23:45:11 -07005import java.util.List;
6
Brian O'Connor66630c82014-10-02 21:08:19 -07007/**
8 * Manages inventory of end-station intents; not intended for direct use.
9 */
10public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
11
12 /**
tom85258ee2014-10-07 00:10:02 -070013 * Submits a new intent into the store. If the returned event is not
14 * null, the manager is expected to dispatch the event and then to kick
15 * off intent compilation process. Otherwise, another node has been elected
16 * to perform the compilation process and the node will learn about
17 * the submittal and results of the intent compilation via the delegate
18 * mechanism.
Brian O'Connor66630c82014-10-02 21:08:19 -070019 *
tom85258ee2014-10-07 00:10:02 -070020 * @param intent intent to be submitted
21 * @return event indicating the intent was submitted or null if no
22 * change resulted, e.g. duplicate intent
Brian O'Connor66630c82014-10-02 21:08:19 -070023 */
24 IntentEvent createIntent(Intent intent);
25
26 /**
27 * Removes the specified intent from the inventory.
28 *
29 * @param intentId intent identification
toma1d16b62014-10-02 23:45:11 -070030 * @return removed state transition event or null if intent was not found
Brian O'Connor66630c82014-10-02 21:08:19 -070031 */
toma1d16b62014-10-02 23:45:11 -070032 IntentEvent removeIntent(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070033
34 /**
35 * Returns the number of intents in the store.
Toshio Koided32809b2014-10-09 10:58:54 -070036 *
37 * @return the number of intents in the store
Brian O'Connor66630c82014-10-02 21:08:19 -070038 */
39 long getIntentCount();
40
41 /**
42 * Returns a collection of all intents in the store.
43 *
44 * @return iterable collection of all intents
45 */
46 Iterable<Intent> getIntents();
47
48 /**
Toshio Koided32809b2014-10-09 10:58:54 -070049 * Returns the intent with the specified identifier.
Brian O'Connor66630c82014-10-02 21:08:19 -070050 *
51 * @param intentId intent identification
52 * @return intent or null if not found
53 */
54 Intent getIntent(IntentId intentId);
55
toma1d16b62014-10-02 23:45:11 -070056 /**
57 * Returns the state of the specified intent.
58 *
59 * @param intentId intent identification
60 * @return current intent state
61 */
62 IntentState getIntentState(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070063
64 /**
65 * Sets the state of the specified intent to the new state.
66 *
toma1d16b62014-10-02 23:45:11 -070067 * @param intent intent whose state is to be changed
Brian O'Connor66630c82014-10-02 21:08:19 -070068 * @param newState new state
toma1d16b62014-10-02 23:45:11 -070069 * @return state transition event
Brian O'Connor66630c82014-10-02 21:08:19 -070070 */
71 IntentEvent setState(Intent intent, IntentState newState);
72
toma1d16b62014-10-02 23:45:11 -070073 /**
74 * Adds the installable intents which resulted from compilation of the
75 * specified original intent.
76 *
77 * @param intentId original intent identifier
78 * @param installableIntents compiled installable intents
toma1d16b62014-10-02 23:45:11 -070079 */
Thomas Vachuskac96058a2014-10-20 23:00:16 -070080 void addInstallableIntents(IntentId intentId, List<Intent> installableIntents);
Brian O'Connor66630c82014-10-02 21:08:19 -070081
toma1d16b62014-10-02 23:45:11 -070082 /**
83 * Returns the list of the installable events associated with the specified
84 * original intent.
85 *
86 * @param intentId original intent identifier
87 * @return compiled installable intents
88 */
Thomas Vachuskac96058a2014-10-20 23:00:16 -070089 List<Intent> getInstallableIntents(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070090
toma1d16b62014-10-02 23:45:11 -070091 // TODO: this should be triggered from with the store as a result of removeIntent call
92
93 /**
94 * Removes any installable intents which resulted from compilation of the
95 * specified original intent.
96 *
97 * @param intentId original intent identifier
toma1d16b62014-10-02 23:45:11 -070098 */
Brian O'Connor66630c82014-10-02 21:08:19 -070099 void removeInstalledIntents(IntentId intentId);
toma1d16b62014-10-02 23:45:11 -0700100
Brian O'Connor66630c82014-10-02 21:08:19 -0700101}