blob: 9abb58454b4dbbbd0c92b620e81d21b4829d8505 [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;
20
Brian O'Connorb876bf12014-10-02 14:59:37 -070021/**
22 * Service for application submitting or withdrawing their intents.
23 */
24public interface IntentService {
25 /**
26 * Submits an intent into the system.
Thomas Vachuska4b420772014-10-30 16:46:17 -070027 * <p>
Brian O'Connor66630c82014-10-02 21:08:19 -070028 * This is an asynchronous request meaning that any compiling or
29 * installation activities may be done at later time.
Thomas Vachuska4b420772014-10-30 16:46:17 -070030 * </p>
Brian O'Connorb876bf12014-10-02 14:59:37 -070031 * @param intent intent to be submitted
32 */
33 void submit(Intent intent);
34
35 /**
36 * Withdraws an intent from the system.
Thomas Vachuska4b420772014-10-30 16:46:17 -070037 * <p>
Brian O'Connor66630c82014-10-02 21:08:19 -070038 * This is an asynchronous request meaning that the environment may be
39 * affected at later time.
Thomas Vachuska4b420772014-10-30 16:46:17 -070040 * </p>
Brian O'Connorb876bf12014-10-02 14:59:37 -070041 * @param intent intent to be withdrawn
42 */
43 void withdraw(Intent intent);
44
Thomas Vachuska83e090e2014-10-22 14:25:35 -070045 /**
46 * Replaces the specified intent with a new one.
47 *
48 * @param oldIntentId identifier of the old intent being replaced
49 * @param newIntent new intent replacing the old one
50 */
51 void replace(IntentId oldIntentId, Intent newIntent);
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070052
Brian O'Connorb876bf12014-10-02 14:59:37 -070053 /**
54 * Submits a batch of submit &amp; withdraw operations. Such a batch is
55 * assumed to be processed together.
Thomas Vachuska4b420772014-10-30 16:46:17 -070056 * <p>
Brian O'Connor66630c82014-10-02 21:08:19 -070057 * This is an asynchronous request meaning that the environment may be
58 * affected at later time.
Thomas Vachuska4b420772014-10-30 16:46:17 -070059 * </p>
Brian O'Connorb876bf12014-10-02 14:59:37 -070060 * @param operations batch of intent operations
61 */
Brian O'Connorfa81eae2014-10-30 13:20:05 -070062 void execute(IntentOperations operations);
Brian O'Connorb876bf12014-10-02 14:59:37 -070063
64 /**
Brian O'Connor66630c82014-10-02 21:08:19 -070065 * Returns an iterable of intents currently in the system.
Brian O'Connorb876bf12014-10-02 14:59:37 -070066 *
67 * @return set of intents
68 */
Brian O'Connor66630c82014-10-02 21:08:19 -070069 Iterable<Intent> getIntents();
70
71 /**
72 * Returns the number of intents currently in the system.
73 *
74 * @return number of intents
75 */
76 long getIntentCount();
Brian O'Connorb876bf12014-10-02 14:59:37 -070077
78 /**
79 * Retrieves the intent specified by its identifier.
80 *
81 * @param id intent identifier
82 * @return the intent or null if one with the given identifier is not found
83 */
84 Intent getIntent(IntentId id);
85
86 /**
87 * Retrieves the state of an intent by its identifier.
88 *
89 * @param id intent identifier
Brian O'Connor66630c82014-10-02 21:08:19 -070090 * @return the intent state or null if one with the given identifier is not
toma1d16b62014-10-02 23:45:11 -070091 * found
Brian O'Connorb876bf12014-10-02 14:59:37 -070092 */
93 IntentState getIntentState(IntentId id);
94
95 /**
Thomas Vachuska10d4abc2014-10-21 12:47:26 -070096 * Returns the list of the installable events associated with the specified
97 * top-level intent.
98 *
99 * @param intentId top-level intent identifier
100 * @return compiled installable intents
101 */
102 List<Intent> getInstallableIntents(IntentId intentId);
103
104 /**
Brian O'Connorb876bf12014-10-02 14:59:37 -0700105 * Adds the specified listener for intent events.
106 *
107 * @param listener listener to be added
108 */
Brian O'Connor66630c82014-10-02 21:08:19 -0700109 void addListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -0700110
111 /**
112 * Removes the specified listener for intent events.
113 *
114 * @param listener listener to be removed
115 */
Brian O'Connor66630c82014-10-02 21:08:19 -0700116 void removeListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -0700117}