blob: fc023bb7567d0dd7402673770ddcc715c6097566 [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.
Brian O'Connor66630c82014-10-02 21:08:19 -070036 */
37 long getIntentCount();
38
39 /**
40 * Returns a collection of all intents in the store.
41 *
42 * @return iterable collection of all intents
43 */
44 Iterable<Intent> getIntents();
45
46 /**
47 * Returns the intent with the specified identifer.
48 *
49 * @param intentId intent identification
50 * @return intent or null if not found
51 */
52 Intent getIntent(IntentId intentId);
53
toma1d16b62014-10-02 23:45:11 -070054 /**
55 * Returns the state of the specified intent.
56 *
57 * @param intentId intent identification
58 * @return current intent state
59 */
60 IntentState getIntentState(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070061
62 /**
63 * Sets the state of the specified intent to the new state.
64 *
toma1d16b62014-10-02 23:45:11 -070065 * @param intent intent whose state is to be changed
Brian O'Connor66630c82014-10-02 21:08:19 -070066 * @param newState new state
toma1d16b62014-10-02 23:45:11 -070067 * @return state transition event
Brian O'Connor66630c82014-10-02 21:08:19 -070068 */
69 IntentEvent setState(Intent intent, IntentState newState);
70
toma1d16b62014-10-02 23:45:11 -070071 /**
72 * Adds the installable intents which resulted from compilation of the
73 * specified original intent.
74 *
75 * @param intentId original intent identifier
76 * @param installableIntents compiled installable intents
toma1d16b62014-10-02 23:45:11 -070077 */
tom85258ee2014-10-07 00:10:02 -070078 void addInstallableIntents(IntentId intentId,
79 List<InstallableIntent> installableIntents);
Brian O'Connor66630c82014-10-02 21:08:19 -070080
toma1d16b62014-10-02 23:45:11 -070081 /**
82 * Returns the list of the installable events associated with the specified
83 * original intent.
84 *
85 * @param intentId original intent identifier
86 * @return compiled installable intents
87 */
Brian O'Connor66630c82014-10-02 21:08:19 -070088 List<InstallableIntent> getInstallableIntents(IntentId intentId);
89
toma1d16b62014-10-02 23:45:11 -070090 // TODO: this should be triggered from with the store as a result of removeIntent call
91
92 /**
93 * Removes any installable intents which resulted from compilation of the
94 * specified original intent.
95 *
96 * @param intentId original intent identifier
97 * @return compiled state transition event
98 */
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}