blob: 5e5ac31cbc151c3940c1874c4594cff149deaeb7 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska83e090e2014-10-22 14:25:35 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Thomas Vachuska83e090e2014-10-22 14:25:35 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Thomas Vachuska83e090e2014-10-22 14:25:35 -070015 */
Brian O'Connorb876bf12014-10-02 14:59:37 -070016package org.onlab.onos.net.intent;
17
Brian O'Connorb876bf12014-10-02 14:59:37 -070018
Thomas Vachuska10d4abc2014-10-21 12:47:26 -070019import java.util.List;
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070020import java.util.concurrent.Future;
Thomas Vachuska10d4abc2014-10-21 12:47:26 -070021
Brian O'Connorb876bf12014-10-02 14:59:37 -070022/**
23 * Service for application submitting or withdrawing their intents.
24 */
25public interface IntentService {
26 /**
27 * Submits an intent into the system.
toma1d16b62014-10-02 23:45:11 -070028 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070029 * This is an asynchronous request meaning that any compiling or
30 * installation activities may be done at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070031 *
32 * @param intent intent to be submitted
33 */
34 void submit(Intent intent);
35
36 /**
37 * Withdraws an intent from the system.
toma1d16b62014-10-02 23:45:11 -070038 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070039 * This is an asynchronous request meaning that the environment may be
40 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070041 *
42 * @param intent intent to be withdrawn
43 */
44 void withdraw(Intent intent);
45
Thomas Vachuska83e090e2014-10-22 14:25:35 -070046 /**
47 * Replaces the specified intent with a new one.
48 *
49 * @param oldIntentId identifier of the old intent being replaced
50 * @param newIntent new intent replacing the old one
51 */
52 void replace(IntentId oldIntentId, Intent newIntent);
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070053
Brian O'Connorb876bf12014-10-02 14:59:37 -070054 /**
55 * Submits a batch of submit &amp; withdraw operations. Such a batch is
56 * assumed to be processed together.
toma1d16b62014-10-02 23:45:11 -070057 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070058 * This is an asynchronous request meaning that the environment may be
59 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070060 *
61 * @param operations batch of intent operations
62 */
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070063 Future<IntentOperations> execute(IntentOperations operations);
Brian O'Connorb876bf12014-10-02 14:59:37 -070064
65 /**
Brian O'Connor66630c82014-10-02 21:08:19 -070066 * Returns an iterable of intents currently in the system.
Brian O'Connorb876bf12014-10-02 14:59:37 -070067 *
68 * @return set of intents
69 */
Brian O'Connor66630c82014-10-02 21:08:19 -070070 Iterable<Intent> getIntents();
71
72 /**
73 * Returns the number of intents currently in the system.
74 *
75 * @return number of intents
76 */
77 long getIntentCount();
Brian O'Connorb876bf12014-10-02 14:59:37 -070078
79 /**
80 * Retrieves the intent specified by its identifier.
81 *
82 * @param id intent identifier
83 * @return the intent or null if one with the given identifier is not found
84 */
85 Intent getIntent(IntentId id);
86
87 /**
88 * Retrieves the state of an intent by its identifier.
89 *
90 * @param id intent identifier
Brian O'Connor66630c82014-10-02 21:08:19 -070091 * @return the intent state or null if one with the given identifier is not
toma1d16b62014-10-02 23:45:11 -070092 * found
Brian O'Connorb876bf12014-10-02 14:59:37 -070093 */
94 IntentState getIntentState(IntentId id);
95
96 /**
Thomas Vachuska10d4abc2014-10-21 12:47:26 -070097 * Returns the list of the installable events associated with the specified
98 * top-level intent.
99 *
100 * @param intentId top-level intent identifier
101 * @return compiled installable intents
102 */
103 List<Intent> getInstallableIntents(IntentId intentId);
104
105 /**
Brian O'Connorb876bf12014-10-02 14:59:37 -0700106 * Adds the specified listener for intent events.
107 *
108 * @param listener listener to be added
109 */
Brian O'Connor66630c82014-10-02 21:08:19 -0700110 void addListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -0700111
112 /**
113 * Removes the specified listener for intent events.
114 *
115 * @param listener listener to be removed
116 */
Brian O'Connor66630c82014-10-02 21:08:19 -0700117 void removeListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -0700118}