3a6c6043505dac89fc599a9cfb01a9de76cbf18b
[genius.git] / mdsalutil / mdsalutil-api / src / main / java / org / opendaylight / genius / mdsalutil / interfaces / IMdsalApiManager.java
1 /*
2  * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.genius.mdsalutil.interfaces;
9
10 import com.google.common.util.concurrent.FluentFuture;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import java.util.concurrent.ExecutionException;
13 import org.opendaylight.genius.infra.Datastore.Configuration;
14 import org.opendaylight.genius.infra.TypedReadWriteTransaction;
15 import org.opendaylight.genius.infra.TypedWriteTransaction;
16 import org.opendaylight.genius.mdsalutil.FlowEntity;
17 import org.opendaylight.genius.mdsalutil.GroupEntity;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
23 import org.opendaylight.yangtools.yang.common.Uint64;
24
25 public interface IMdsalApiManager {
26
27     /**
28      * Adds a flow.
29      *
30      * @param flowEntity The flow entity.
31      * @deprecated Use {@link #addFlow(TypedWriteTransaction, FlowEntity)}.
32      * @return
33      */
34     @Deprecated
35     FluentFuture<Void> installFlow(FlowEntity flowEntity);
36
37     /**
38      * Adds a flow.
39      *
40      * @param dpId The DPN identifier.
41      * @param flowEntity The flow entity.
42      * @deprecated Use {@link #addFlow(TypedWriteTransaction, Uint64, Flow)}.
43      * @return
44      */
45     @Deprecated
46     FluentFuture<Void> installFlow(Uint64 dpId, Flow flowEntity);
47
48     /**
49      * Adds a flow.
50      *
51      * @param dpId The DPN identifier.
52      * @param flowEntity The flow entity.
53      * @deprecated Use {@link #addFlow(TypedWriteTransaction, FlowEntity)}.
54      * @return
55      */
56     @Deprecated
57     FluentFuture<Void> installFlow(Uint64 dpId, FlowEntity flowEntity);
58
59     /**
60      * Adds the given flow.
61      *
62      * @param tx The transaction to use.
63      * @param flowEntity The flow entity.
64      */
65     void addFlow(TypedWriteTransaction<Configuration> tx, FlowEntity flowEntity);
66
67     /**
68      * Adds the given flow.
69      *
70      * @param tx The transaction to use.
71      * @param dpId The DPN identifier.
72      * @param flow The flow.
73      */
74     void addFlow(TypedWriteTransaction<Configuration> tx, Uint64 dpId, Flow flow);
75
76     /**
77      * Removes a flow.
78      *
79      * @param dpId The DPN identifier.
80      * @param tableId The table identifier.
81      * @param flowId The flow identifier.
82      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, Uint64, String, short)}.
83      * @return
84      */
85     @Deprecated
86     ListenableFuture<Void> removeFlow(Uint64 dpId, short tableId, FlowId flowId);
87
88     /**
89      * Removes a flow.
90      *
91      * @param flowEntity The flow entity.
92      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, FlowEntity)}.
93      * @return
94      */
95     @Deprecated
96     FluentFuture<Void> removeFlow(FlowEntity flowEntity);
97
98     /**
99      * Removes a flow.
100      *
101      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, Uint64, Flow)}.
102      */
103     @Deprecated
104     FluentFuture<Void> removeFlow(Uint64 dpId, Flow flowEntity);
105
106     /**
107      * Removes the given flow.
108      *
109      * @param tx The transaction to use.
110      * @param dpId The DPN identifier.
111      * @param flow The flow.
112      * @throws ExecutionException in case of a technical (!) error while reading
113      * @throws InterruptedException in case of a technical (!) error while reading
114      */
115     void removeFlow(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, Flow flow)
116         throws ExecutionException, InterruptedException;
117
118     /**
119      * Removes the given flow.
120      *
121      * @param tx The transaction to use.
122      * @param flowEntity The flow entity.
123      * @throws ExecutionException in case of a technical (!) error while reading
124      * @throws InterruptedException in case of a technical (!) error while reading
125      */
126     void removeFlow(TypedReadWriteTransaction<Configuration> tx, FlowEntity flowEntity)
127         throws ExecutionException, InterruptedException;
128
129     /**
130      * Removes the given flow.
131      *
132      * @param tx The transaction to use.
133      * @param dpId The DPN identifier.
134      * @param flowKey The flow key.
135      * @param tableId The table identifier.
136      * @throws ExecutionException in case of a technical (!) error while reading
137      * @throws InterruptedException in case of a technical (!) error while reading
138      */
139     void removeFlow(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, FlowKey flowKey, short tableId)
140         throws ExecutionException, InterruptedException;
141
142     /**
143      * Removes the given flow.
144      *
145      * @param tx The transaction to use.
146      * @param dpId The DPN identifier.
147      * @param flowId The flow identifier.
148      * @param tableId The table identifier.
149      * @throws ExecutionException in case of a technical (!) error while reading
150      * @throws InterruptedException in case of a technical (!) error while reading
151      */
152     void removeFlow(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, String flowId, short tableId)
153         throws ExecutionException, InterruptedException;
154
155     /**
156      * Adds the given group using the given transaction.
157      *
158      * @param tx The transaction to use.
159      * @param groupEntity The group to add.
160      */
161     void addGroup(TypedWriteTransaction<Configuration> tx, GroupEntity groupEntity);
162
163     /**
164      * Adds the given group using the given transaction.
165      *
166      * @param tx The transaction to use.
167      * @param dpId The DPN identifier.
168      * @param group The group to add.
169      */
170     void addGroup(TypedWriteTransaction<Configuration> tx, Uint64 dpId, Group group);
171
172     /**
173      * Remove a group.
174      *
175      * @param groupEntity The group to remove.
176      * @deprecated Use {@link #removeGroup(TypedReadWriteTransaction, GroupEntity)}
177      */
178     @Deprecated
179     void removeGroup(GroupEntity groupEntity);
180
181     /**
182      * Remove a group using the given transaction.
183      *
184      * @param tx The transaction to use.
185      * @param groupEntity The group to remove.
186      * @throws ExecutionException in case of a technical (!) error while reading
187      * @throws InterruptedException in case of a technical (!) error while reading
188      */
189     void removeGroup(TypedReadWriteTransaction<Configuration> tx, GroupEntity groupEntity)
190         throws ExecutionException, InterruptedException;
191
192     /**
193      * Remove a group using the given transaction.
194      *
195      * @param tx The transaction to use.
196      * @param dpId The DPN identifier.
197      * @param group The group to remove.
198      * @throws ExecutionException in case of a technical (!) error while reading
199      * @throws InterruptedException in case of a technical (!) error while reading
200      */
201     void removeGroup(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, Group group)
202         throws ExecutionException, InterruptedException;
203
204     /**
205      * Remove a group using the given transaction.
206      *
207      * @param tx The transaction to use.
208      * @param dpId The DPN identifier.
209      * @param groupId The group identifier of the group to remove.
210      * @throws ExecutionException in case of a technical (!) error while reading
211      * @throws InterruptedException in case of a technical (!) error while reading
212      */
213     void removeGroup(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, long groupId)
214         throws ExecutionException, InterruptedException;
215
216     /**
217      * Check if OF group exist on DPN.
218      *
219      * @param dpId
220      *            dpn id
221      * @param groupId
222      *            OF group id
223      * @return true if group exists and false otherwise
224      */
225     @Deprecated
226     boolean groupExists(Uint64 dpId, long groupId);
227
228     /**
229      * API to remove the flow on Data Plane Node synchronously. It internally waits for
230      * Flow Change Notification to confirm flow delete request is being sent with-in delayTime.
231      *
232      * @param flowEntity The flow entity.
233      * @param delayTime The delay time.
234      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, FlowEntity)}.
235      */
236     @Deprecated
237     void syncRemoveFlow(FlowEntity flowEntity, long delayTime);
238
239     /**
240      * Removes a flow.
241      *
242      * @param flowEntity The flow entity.
243      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, FlowEntity)}.
244      */
245     @Deprecated
246     void syncRemoveFlow(FlowEntity flowEntity);
247
248     /**
249      * Install a flow.
250      *
251      * @param flowEntity The flow entity.
252      * @param delayTime The delay time.
253      * @deprecated Use {@link #addFlow(TypedWriteTransaction, FlowEntity)}.
254      */
255     @Deprecated
256     void syncInstallFlow(FlowEntity flowEntity, long delayTime);
257
258     /**
259      * Installs a flow.
260      *
261      * @param flowEntity The flow entity.
262      * @deprecated Use {@link #addFlow(TypedWriteTransaction, FlowEntity)}.
263      */
264     @Deprecated
265     void syncInstallFlow(FlowEntity flowEntity);
266
267     /**
268      * Installs a group.
269      *
270      * @param groupEntity The group to add.
271      * @deprecated Use {@link #addGroup(TypedWriteTransaction, GroupEntity)}.
272      */
273     @Deprecated
274     void syncInstallGroup(GroupEntity groupEntity);
275
276     /**
277      * API to remove the Group on Data Plane Node synchronously. It internally waits for
278      * Group Change Notification to confirm group delete request is being sent.
279      * @param groupEntity The group to add.
280      * @deprecated Use {@link #removeGroup(TypedReadWriteTransaction, GroupEntity)}.
281      */
282     @Deprecated
283     void syncRemoveGroup(GroupEntity groupEntity);
284
285     void addBucket(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, long groupId, Bucket bucket)
286             throws ExecutionException, InterruptedException;
287
288     void removeBucket(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, long groupId, long bucketId)
289         throws ExecutionException, InterruptedException;
290 }