MDSAL-API Migration
[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      * @deprecated Use {@link #addFlow(TypedWriteTransaction, FlowEntity)}.
31      */
32     @Deprecated
33     FluentFuture<Void> installFlow(FlowEntity flowEntity);
34
35     /**
36      * Adds a flow.
37      *
38      * @deprecated Use {@link #addFlow(TypedWriteTransaction, Uint64, Flow)}.
39      */
40     @Deprecated
41     FluentFuture<Void> installFlow(Uint64 dpId, Flow flowEntity);
42
43     /**
44      * Adds a flow.
45      *
46      * @deprecated Use {@link #addFlow(TypedWriteTransaction, FlowEntity)}.
47      */
48     @Deprecated
49     FluentFuture<Void> installFlow(Uint64 dpId, FlowEntity flowEntity);
50
51     /**
52      * Adds the given flow.
53      *
54      * @param tx The transaction to use.
55      * @param flowEntity The flow entity.
56      */
57     void addFlow(TypedWriteTransaction<Configuration> tx, FlowEntity flowEntity);
58
59     /**
60      * Adds the given flow.
61      *
62      * @param tx The transaction to use.
63      * @param dpId The DPN identifier.
64      * @param flow The flow.
65      */
66     void addFlow(TypedWriteTransaction<Configuration> tx, Uint64 dpId, Flow flow);
67
68     /**
69      * Removes a flow.
70      *
71      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, Uint64, String, short)}.
72      */
73     @Deprecated
74     ListenableFuture<Void> removeFlow(Uint64 dpId, short tableId, FlowId flowId);
75
76     /**
77      * Removes a flow.
78      *
79      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, FlowEntity)}.
80      */
81     @Deprecated
82     FluentFuture<Void> removeFlow(FlowEntity flowEntity);
83
84     /**
85      * Removes a flow.
86      *
87      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, Uint64, Flow)}.
88      */
89     @Deprecated
90     FluentFuture<Void> removeFlow(Uint64 dpId, Flow flowEntity);
91
92     /**
93      * Removes the given flow.
94      *
95      * @param tx The transaction to use.
96      * @param dpId The DPN identifier.
97      * @param flow The flow.
98      */
99     void removeFlow(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, Flow flow)
100         throws ExecutionException, InterruptedException;
101
102     /**
103      * Removes the given flow.
104      *
105      * @param tx The transaction to use.
106      * @param flowEntity The flow entity.
107      */
108     void removeFlow(TypedReadWriteTransaction<Configuration> tx, FlowEntity flowEntity)
109         throws ExecutionException, InterruptedException;
110
111     /**
112      * Removes the given flow.
113      *
114      * @param tx The transaction to use.
115      * @param dpId The DPN identifier.
116      * @param flowKey The flow key.
117      * @param tableId The table identifier.
118      */
119     void removeFlow(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, FlowKey flowKey, short tableId)
120         throws ExecutionException, InterruptedException;
121
122     /**
123      * Removes the given flow.
124      *
125      * @param tx The transaction to use.
126      * @param dpId The DPN identifier.
127      * @param flowId The flow identifier.
128      * @param tableId The table identifier.
129      */
130     void removeFlow(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, String flowId, short tableId)
131         throws ExecutionException, InterruptedException;
132
133     /**
134      * Adds the given group using the given transaction.
135      *
136      * @param tx The transaction to use.
137      * @param groupEntity The group to add.
138      */
139     void addGroup(TypedWriteTransaction<Configuration> tx, GroupEntity groupEntity);
140
141     /**
142      * Adds the given group using the given transaction.
143      *
144      * @param tx The transaction to use.
145      * @param dpId The DPN identifier.
146      * @param group The group to add.
147      */
148     void addGroup(TypedWriteTransaction<Configuration> tx, Uint64 dpId, Group group);
149
150     /**
151      * Remove a group.
152      *
153      * @deprecated Use {@link #removeGroup(TypedReadWriteTransaction, GroupEntity)}
154      */
155     @Deprecated
156     void removeGroup(GroupEntity groupEntity);
157
158     /**
159      * Remove a group using the given transaction.
160      *
161      * @param tx The transaction to use.
162      * @param groupEntity The group to remove.
163      */
164     void removeGroup(TypedReadWriteTransaction<Configuration> tx, GroupEntity groupEntity)
165         throws ExecutionException, InterruptedException;
166
167     /**
168      * Remove a group using the given transaction.
169      *
170      * @param tx The transaction to use.
171      * @param dpId The DPN identifier.
172      * @param group The group to remove.
173      */
174     void removeGroup(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, Group group)
175         throws ExecutionException, InterruptedException;
176
177     /**
178      * Remove a group using the given transaction.
179      *
180      * @param tx The transaction to use.
181      * @param dpId The DPN identifier.
182      * @param groupId The group identifier of the group to remove.
183      */
184     void removeGroup(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, long groupId)
185         throws ExecutionException, InterruptedException;
186
187     /**
188      * Check if OF group exist on DPN.
189      *
190      * @param dpId
191      *            dpn id
192      * @param groupId
193      *            OF group id
194      * @return true if group exists and false otherwise
195      */
196     @Deprecated
197     boolean groupExists(Uint64 dpId, long groupId);
198
199     /**
200      * API to remove the flow on Data Plane Node synchronously. It internally waits for
201      * Flow Change Notification to confirm flow delete request is being sent with-in delayTime.
202      *
203      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, FlowEntity)}.
204      */
205     @Deprecated
206     void syncRemoveFlow(FlowEntity flowEntity, long delayTime);
207
208     /**
209      * Removes a flow.
210      *
211      * @deprecated Use {@link #removeFlow(TypedReadWriteTransaction, FlowEntity)}.
212      */
213     @Deprecated
214     void syncRemoveFlow(FlowEntity flowEntity);
215
216     /**
217      * Install a flow.
218      *
219      * @deprecated Use {@link #addFlow(TypedWriteTransaction, FlowEntity)}.
220      */
221     @Deprecated
222     void syncInstallFlow(FlowEntity flowEntity, long delayTime);
223
224     /**
225      * Installs a flow.
226      *
227      * @deprecated Use {@link #addFlow(TypedWriteTransaction, FlowEntity)}.
228      */
229     @Deprecated
230     void syncInstallFlow(FlowEntity flowEntity);
231
232     /**
233      * Installs a group.
234      *
235      * @deprecated Use {@link #addGroup(TypedWriteTransaction, GroupEntity)}.
236      */
237     @Deprecated
238     void syncInstallGroup(GroupEntity groupEntity);
239
240     /**
241      * API to remove the Group on Data Plane Node synchronously. It internally waits for
242      * Group Change Notification to confirm group delete request is being sent.
243      * @deprecated Use {@link #removeGroup(TypedReadWriteTransaction, GroupEntity)}.
244      */
245     @Deprecated
246     void syncRemoveGroup(GroupEntity groupEntity);
247
248     void addBucket(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, long groupId, Bucket bucket)
249             throws ExecutionException, InterruptedException;
250
251     void removeBucket(TypedReadWriteTransaction<Configuration> tx, Uint64 dpId, long groupId, long bucketId)
252         throws ExecutionException, InterruptedException;
253 }