blob: 8d550e87e9a7bed0edb46f13eb6c583d77c7901a [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
4/**
5 * Service for application submitting or withdrawing their intents.
6 */
7public interface IntentService {
8 /**
9 * Submits an intent into the system.
10 *
Brian O'Connor66630c82014-10-02 21:08:19 -070011 * This is an asynchronous request meaning that any compiling or
12 * installation activities may be done at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070013 *
14 * @param intent intent to be submitted
15 */
16 void submit(Intent intent);
17
18 /**
19 * Withdraws an intent from the system.
20 *
Brian O'Connor66630c82014-10-02 21:08:19 -070021 * This is an asynchronous request meaning that the environment may be
22 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070023 *
24 * @param intent intent to be withdrawn
25 */
26 void withdraw(Intent intent);
27
28 /**
29 * Submits a batch of submit & withdraw operations. Such a batch is
30 * assumed to be processed together.
31 *
Brian O'Connor66630c82014-10-02 21:08:19 -070032 * This is an asynchronous request meaning that the environment may be
33 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070034 *
35 * @param operations batch of intent operations
36 */
37 void execute(IntentOperations operations);
38
39 /**
Brian O'Connor66630c82014-10-02 21:08:19 -070040 * Returns an iterable of intents currently in the system.
Brian O'Connorb876bf12014-10-02 14:59:37 -070041 *
42 * @return set of intents
43 */
Brian O'Connor66630c82014-10-02 21:08:19 -070044 Iterable<Intent> getIntents();
45
46 /**
47 * Returns the number of intents currently in the system.
48 *
49 * @return number of intents
50 */
51 long getIntentCount();
Brian O'Connorb876bf12014-10-02 14:59:37 -070052
53 /**
54 * Retrieves the intent specified by its identifier.
55 *
56 * @param id intent identifier
57 * @return the intent or null if one with the given identifier is not found
58 */
59 Intent getIntent(IntentId id);
60
61 /**
62 * Retrieves the state of an intent by its identifier.
63 *
64 * @param id intent identifier
Brian O'Connor66630c82014-10-02 21:08:19 -070065 * @return the intent state or null if one with the given identifier is not
66 * found
Brian O'Connorb876bf12014-10-02 14:59:37 -070067 */
68 IntentState getIntentState(IntentId id);
69
70 /**
71 * Adds the specified listener for intent events.
72 *
73 * @param listener listener to be added
74 */
Brian O'Connor66630c82014-10-02 21:08:19 -070075 void addListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -070076
77 /**
78 * Removes the specified listener for intent events.
79 *
80 * @param listener listener to be removed
81 */
Brian O'Connor66630c82014-10-02 21:08:19 -070082 void removeListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -070083}