blob: 700066d4ab03364fb5756853553624918b05af7b [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;
5
Brian O'Connorb876bf12014-10-02 14:59:37 -07006/**
7 * Service for application submitting or withdrawing their intents.
8 */
9public interface IntentService {
10 /**
11 * Submits an intent into the system.
toma1d16b62014-10-02 23:45:11 -070012 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070013 * This is an asynchronous request meaning that any compiling or
14 * installation activities may be done at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070015 *
16 * @param intent intent to be submitted
17 */
18 void submit(Intent intent);
19
20 /**
21 * Withdraws an intent from the system.
toma1d16b62014-10-02 23:45:11 -070022 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070023 * This is an asynchronous request meaning that the environment may be
24 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070025 *
26 * @param intent intent to be withdrawn
27 */
28 void withdraw(Intent intent);
29
30 /**
31 * Submits a batch of submit &amp; withdraw operations. Such a batch is
32 * assumed to be processed together.
toma1d16b62014-10-02 23:45:11 -070033 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070034 * This is an asynchronous request meaning that the environment may be
35 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070036 *
37 * @param operations batch of intent operations
38 */
39 void execute(IntentOperations operations);
40
41 /**
Brian O'Connor66630c82014-10-02 21:08:19 -070042 * Returns an iterable of intents currently in the system.
Brian O'Connorb876bf12014-10-02 14:59:37 -070043 *
44 * @return set of intents
45 */
Brian O'Connor66630c82014-10-02 21:08:19 -070046 Iterable<Intent> getIntents();
47
48 /**
49 * Returns the number of intents currently in the system.
50 *
51 * @return number of intents
52 */
53 long getIntentCount();
Brian O'Connorb876bf12014-10-02 14:59:37 -070054
55 /**
56 * Retrieves the intent specified by its identifier.
57 *
58 * @param id intent identifier
59 * @return the intent or null if one with the given identifier is not found
60 */
61 Intent getIntent(IntentId id);
62
63 /**
64 * Retrieves the state of an intent by its identifier.
65 *
66 * @param id intent identifier
Brian O'Connor66630c82014-10-02 21:08:19 -070067 * @return the intent state or null if one with the given identifier is not
toma1d16b62014-10-02 23:45:11 -070068 * found
Brian O'Connorb876bf12014-10-02 14:59:37 -070069 */
70 IntentState getIntentState(IntentId id);
71
72 /**
Thomas Vachuska10d4abc2014-10-21 12:47:26 -070073 * Returns the list of the installable events associated with the specified
74 * top-level intent.
75 *
76 * @param intentId top-level intent identifier
77 * @return compiled installable intents
78 */
79 List<Intent> getInstallableIntents(IntentId intentId);
80
81 /**
Brian O'Connorb876bf12014-10-02 14:59:37 -070082 * Adds the specified listener for intent events.
83 *
84 * @param listener listener to be added
85 */
Brian O'Connor66630c82014-10-02 21:08:19 -070086 void addListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -070087
88 /**
89 * Removes the specified listener for intent events.
90 *
91 * @param listener listener to be removed
92 */
Brian O'Connor66630c82014-10-02 21:08:19 -070093 void removeListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -070094}