blob: 037f1795ae58cbbace771e0c7c197ddb2fcf6bc7 [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 /**
13 * Creates a new intent.
14 *
15 * @param intent intent
16 * @return appropriate event or null if no change resulted
17 */
18 IntentEvent createIntent(Intent intent);
19
20 /**
21 * Removes the specified intent from the inventory.
22 *
23 * @param intentId intent identification
toma1d16b62014-10-02 23:45:11 -070024 * @return removed state transition event or null if intent was not found
Brian O'Connor66630c82014-10-02 21:08:19 -070025 */
toma1d16b62014-10-02 23:45:11 -070026 IntentEvent removeIntent(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070027
28 /**
29 * Returns the number of intents in the store.
Brian O'Connor66630c82014-10-02 21:08:19 -070030 */
31 long getIntentCount();
32
33 /**
34 * Returns a collection of all intents in the store.
35 *
36 * @return iterable collection of all intents
37 */
38 Iterable<Intent> getIntents();
39
40 /**
41 * Returns the intent with the specified identifer.
42 *
43 * @param intentId intent identification
44 * @return intent or null if not found
45 */
46 Intent getIntent(IntentId intentId);
47
toma1d16b62014-10-02 23:45:11 -070048 /**
49 * Returns the state of the specified intent.
50 *
51 * @param intentId intent identification
52 * @return current intent state
53 */
54 IntentState getIntentState(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070055
56 /**
57 * Sets the state of the specified intent to the new state.
58 *
toma1d16b62014-10-02 23:45:11 -070059 * @param intent intent whose state is to be changed
Brian O'Connor66630c82014-10-02 21:08:19 -070060 * @param newState new state
toma1d16b62014-10-02 23:45:11 -070061 * @return state transition event
Brian O'Connor66630c82014-10-02 21:08:19 -070062 */
63 IntentEvent setState(Intent intent, IntentState newState);
64
toma1d16b62014-10-02 23:45:11 -070065 /**
66 * Adds the installable intents which resulted from compilation of the
67 * specified original intent.
68 *
69 * @param intentId original intent identifier
70 * @param installableIntents compiled installable intents
71 * @return compiled state transition event
72 */
73 IntentEvent addInstallableIntents(IntentId intentId,
74 List<InstallableIntent> installableIntents);
Brian O'Connor66630c82014-10-02 21:08:19 -070075
toma1d16b62014-10-02 23:45:11 -070076 /**
77 * Returns the list of the installable events associated with the specified
78 * original intent.
79 *
80 * @param intentId original intent identifier
81 * @return compiled installable intents
82 */
Brian O'Connor66630c82014-10-02 21:08:19 -070083 List<InstallableIntent> getInstallableIntents(IntentId intentId);
84
toma1d16b62014-10-02 23:45:11 -070085 // TODO: this should be triggered from with the store as a result of removeIntent call
86
87 /**
88 * Removes any installable intents which resulted from compilation of the
89 * specified original intent.
90 *
91 * @param intentId original intent identifier
92 * @return compiled state transition event
93 */
Brian O'Connor66630c82014-10-02 21:08:19 -070094 void removeInstalledIntents(IntentId intentId);
toma1d16b62014-10-02 23:45:11 -070095
Brian O'Connor66630c82014-10-02 21:08:19 -070096}