blob: 6b89a680f970fa265e6594f633073b3a10e9bab5 [file] [log] [blame]
Thomas Vachuska83e090e2014-10-22 14:25:35 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
Brian O'Connorb876bf12014-10-02 14:59:37 -070019package org.onlab.onos.net.intent;
20
Brian O'Connorb876bf12014-10-02 14:59:37 -070021
Thomas Vachuska10d4abc2014-10-21 12:47:26 -070022import java.util.List;
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070023import java.util.concurrent.Future;
Thomas Vachuska10d4abc2014-10-21 12:47:26 -070024
Brian O'Connorb876bf12014-10-02 14:59:37 -070025/**
26 * Service for application submitting or withdrawing their intents.
27 */
28public interface IntentService {
29 /**
30 * Submits an intent into the system.
toma1d16b62014-10-02 23:45:11 -070031 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070032 * This is an asynchronous request meaning that any compiling or
33 * installation activities may be done at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070034 *
35 * @param intent intent to be submitted
36 */
37 void submit(Intent intent);
38
39 /**
40 * Withdraws an intent from the system.
toma1d16b62014-10-02 23:45:11 -070041 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070042 * This is an asynchronous request meaning that the environment may be
43 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070044 *
45 * @param intent intent to be withdrawn
46 */
47 void withdraw(Intent intent);
48
Thomas Vachuska83e090e2014-10-22 14:25:35 -070049 /**
50 * Replaces the specified intent with a new one.
51 *
52 * @param oldIntentId identifier of the old intent being replaced
53 * @param newIntent new intent replacing the old one
54 */
55 void replace(IntentId oldIntentId, Intent newIntent);
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070056
Brian O'Connorb876bf12014-10-02 14:59:37 -070057 /**
58 * Submits a batch of submit &amp; withdraw operations. Such a batch is
59 * assumed to be processed together.
toma1d16b62014-10-02 23:45:11 -070060 * <p/>
Brian O'Connor66630c82014-10-02 21:08:19 -070061 * This is an asynchronous request meaning that the environment may be
62 * affected at later time.
Brian O'Connorb876bf12014-10-02 14:59:37 -070063 *
64 * @param operations batch of intent operations
65 */
Thomas Vachuska1fb982f2014-10-22 14:09:17 -070066 Future<IntentOperations> execute(IntentOperations operations);
Brian O'Connorb876bf12014-10-02 14:59:37 -070067
68 /**
Brian O'Connor66630c82014-10-02 21:08:19 -070069 * Returns an iterable of intents currently in the system.
Brian O'Connorb876bf12014-10-02 14:59:37 -070070 *
71 * @return set of intents
72 */
Brian O'Connor66630c82014-10-02 21:08:19 -070073 Iterable<Intent> getIntents();
74
75 /**
76 * Returns the number of intents currently in the system.
77 *
78 * @return number of intents
79 */
80 long getIntentCount();
Brian O'Connorb876bf12014-10-02 14:59:37 -070081
82 /**
83 * Retrieves the intent specified by its identifier.
84 *
85 * @param id intent identifier
86 * @return the intent or null if one with the given identifier is not found
87 */
88 Intent getIntent(IntentId id);
89
90 /**
91 * Retrieves the state of an intent by its identifier.
92 *
93 * @param id intent identifier
Brian O'Connor66630c82014-10-02 21:08:19 -070094 * @return the intent state or null if one with the given identifier is not
toma1d16b62014-10-02 23:45:11 -070095 * found
Brian O'Connorb876bf12014-10-02 14:59:37 -070096 */
97 IntentState getIntentState(IntentId id);
98
99 /**
Thomas Vachuska10d4abc2014-10-21 12:47:26 -0700100 * Returns the list of the installable events associated with the specified
101 * top-level intent.
102 *
103 * @param intentId top-level intent identifier
104 * @return compiled installable intents
105 */
106 List<Intent> getInstallableIntents(IntentId intentId);
107
108 /**
Brian O'Connorb876bf12014-10-02 14:59:37 -0700109 * Adds the specified listener for intent events.
110 *
111 * @param listener listener to be added
112 */
Brian O'Connor66630c82014-10-02 21:08:19 -0700113 void addListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -0700114
115 /**
116 * Removes the specified listener for intent events.
117 *
118 * @param listener listener to be removed
119 */
Brian O'Connor66630c82014-10-02 21:08:19 -0700120 void removeListener(IntentListener listener);
Brian O'Connorb876bf12014-10-02 14:59:37 -0700121}