blob: 7a62d61dd43d6445830a85cf54564d3d8105d419 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
Brian O'Connor66630c82014-10-02 21:08:19 -070019package org.onlab.onos.net.intent;
20
Brian O'Connor66630c82014-10-02 21:08:19 -070021import org.onlab.onos.store.Store;
22
toma1d16b62014-10-02 23:45:11 -070023import java.util.List;
24
Brian O'Connor66630c82014-10-02 21:08:19 -070025/**
26 * Manages inventory of end-station intents; not intended for direct use.
27 */
28public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
29
30 /**
tom85258ee2014-10-07 00:10:02 -070031 * Submits a new intent into the store. If the returned event is not
32 * null, the manager is expected to dispatch the event and then to kick
33 * off intent compilation process. Otherwise, another node has been elected
34 * to perform the compilation process and the node will learn about
35 * the submittal and results of the intent compilation via the delegate
36 * mechanism.
Brian O'Connor66630c82014-10-02 21:08:19 -070037 *
tom85258ee2014-10-07 00:10:02 -070038 * @param intent intent to be submitted
39 * @return event indicating the intent was submitted or null if no
40 * change resulted, e.g. duplicate intent
Brian O'Connor66630c82014-10-02 21:08:19 -070041 */
42 IntentEvent createIntent(Intent intent);
43
44 /**
45 * Removes the specified intent from the inventory.
46 *
47 * @param intentId intent identification
toma1d16b62014-10-02 23:45:11 -070048 * @return removed state transition event or null if intent was not found
Brian O'Connor66630c82014-10-02 21:08:19 -070049 */
toma1d16b62014-10-02 23:45:11 -070050 IntentEvent removeIntent(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070051
52 /**
53 * Returns the number of intents in the store.
Toshio Koided32809b2014-10-09 10:58:54 -070054 *
55 * @return the number of intents in the store
Brian O'Connor66630c82014-10-02 21:08:19 -070056 */
57 long getIntentCount();
58
59 /**
60 * Returns a collection of all intents in the store.
61 *
62 * @return iterable collection of all intents
63 */
64 Iterable<Intent> getIntents();
65
66 /**
Toshio Koided32809b2014-10-09 10:58:54 -070067 * Returns the intent with the specified identifier.
Brian O'Connor66630c82014-10-02 21:08:19 -070068 *
69 * @param intentId intent identification
70 * @return intent or null if not found
71 */
72 Intent getIntent(IntentId intentId);
73
toma1d16b62014-10-02 23:45:11 -070074 /**
75 * Returns the state of the specified intent.
76 *
77 * @param intentId intent identification
78 * @return current intent state
79 */
80 IntentState getIntentState(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -070081
82 /**
83 * Sets the state of the specified intent to the new state.
84 *
toma1d16b62014-10-02 23:45:11 -070085 * @param intent intent whose state is to be changed
Brian O'Connor66630c82014-10-02 21:08:19 -070086 * @param newState new state
toma1d16b62014-10-02 23:45:11 -070087 * @return state transition event
Brian O'Connor66630c82014-10-02 21:08:19 -070088 */
89 IntentEvent setState(Intent intent, IntentState newState);
90
toma1d16b62014-10-02 23:45:11 -070091 /**
92 * Adds the installable intents which resulted from compilation of the
93 * specified original intent.
94 *
95 * @param intentId original intent identifier
96 * @param installableIntents compiled installable intents
toma1d16b62014-10-02 23:45:11 -070097 */
Thomas Vachuskac96058a2014-10-20 23:00:16 -070098 void addInstallableIntents(IntentId intentId, List<Intent> installableIntents);
Brian O'Connor66630c82014-10-02 21:08:19 -070099
toma1d16b62014-10-02 23:45:11 -0700100 /**
101 * Returns the list of the installable events associated with the specified
102 * original intent.
103 *
104 * @param intentId original intent identifier
105 * @return compiled installable intents
106 */
Thomas Vachuskac96058a2014-10-20 23:00:16 -0700107 List<Intent> getInstallableIntents(IntentId intentId);
Brian O'Connor66630c82014-10-02 21:08:19 -0700108
toma1d16b62014-10-02 23:45:11 -0700109 // TODO: this should be triggered from with the store as a result of removeIntent call
110
111 /**
112 * Removes any installable intents which resulted from compilation of the
113 * specified original intent.
114 *
115 * @param intentId original intent identifier
toma1d16b62014-10-02 23:45:11 -0700116 */
Brian O'Connor66630c82014-10-02 21:08:19 -0700117 void removeInstalledIntents(IntentId intentId);
toma1d16b62014-10-02 23:45:11 -0700118
Brian O'Connor66630c82014-10-02 21:08:19 -0700119}