blob: 8c098a3357d384cd008c36699c6902f40cc62dc2 [file] [log] [blame]
Brian O'Connorb876bf12014-10-02 14:59:37 -07001package org.onlab.onos.net.intent;
2
Brian O'Connorb876bf12014-10-02 14:59:37 -07003
Thomas Vachuska10d4abc2014-10-21 12:47:26 -07004import java.util.List;
Thomas Vachuska1fb982f2014-10-22 14:09:17 -07005import java.util.concurrent.Future;
Thomas Vachuska10d4abc2014-10-21 12:47:26 -07006
Brian O'Connorb876bf12014-10-02 14:59:37 -07007/**
8 * Service for application submitting or withdrawing their intents.
9 */
10public interface IntentService {
11 /**
12 * Submits an intent into the system.
toma1d16b62014-10-02 23:45:11 -070013 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070014 * This is an asynchronous request meaning that any compiling or
15 * installation activities may be done at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070016 *
17 * @param intent intent to be submitted
18 */
19 void submit(Intent intent);
20
21 /**
22 * Withdraws an intent from the system.
toma1d16b62014-10-02 23:45:11 -070023 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070024 * This is an asynchronous request meaning that the environment may be
25 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070026 *
27 * @param intent intent to be withdrawn
28 */
29 void withdraw(Intent intent);
30
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070031 // void replace(IntentId oldIntentId, Intent newIntent);
32
Brian O'Connorb876bf12014-10-02 14:59:37 -070033 /**
34 * Submits a batch of submit &amp; withdraw operations. Such a batch is
35 * assumed to be processed together.
toma1d16b62014-10-02 23:45:11 -070036 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070037 * This is an asynchronous request meaning that the environment may be
38 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070039 *
40 * @param operations batch of intent operations
41 */
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070042 Future<IntentOperations> execute(IntentOperations operations);
Brian O'Connorb876bf12014-10-02 14:59:37 -070043
44 /**
Brian O'Connor66630c82014-10-02 21:08:19 -070045 * Returns an iterable of intents currently in the system.
Brian O'Connorb876bf12014-10-02 14:59:37 -070046 *
47 * @return set of intents
48 */
Brian O'Connor66630c82014-10-02 21:08:19 -070049 Iterable<Intent> getIntents();
50
51 /**
52 * Returns the number of intents currently in the system.
53 *
54 * @return number of intents
55 */
56 long getIntentCount();
Brian O'Connorb876bf12014-10-02 14:59:37 -070057
58 /**
59 * Retrieves the intent specified by its identifier.
60 *
61 * @param id intent identifier
62 * @return the intent or null if one with the given identifier is not found
63 */
64 Intent getIntent(IntentId id);
65
66 /**
67 * Retrieves the state of an intent by its identifier.
68 *
69 * @param id intent identifier
Brian O'Connor66630c82014-10-02 21:08:19 -070070 * @return the intent state or null if one with the given identifier is not
toma1d16b62014-10-02 23:45:11 -070071 * found
Brian O'Connorb876bf12014-10-02 14:59:37 -070072 */
73 IntentState getIntentState(IntentId id);
74
75 /**
Thomas Vachuska10d4abc2014-10-21 12:47:26 -070076 * Returns the list of the installable events associated with the specified
77 * top-level intent.
78 *
79 * @param intentId top-level intent identifier
80 * @return compiled installable intents
81 */
82 List<Intent> getInstallableIntents(IntentId intentId);
83
84 /**
Brian O'Connorb876bf12014-10-02 14:59:37 -070085 * Adds the specified listener for intent events.
86 *
87 * @param listener listener to be added
88 */
Brian O'Connor66630c82014-10-02 21:08:19 -070089 void addListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -070090
91 /**
92 * Removes the specified listener for intent events.
93 *
94 * @param listener listener to be removed
95 */
Brian O'Connor66630c82014-10-02 21:08:19 -070096 void removeListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -070097}