967d3e48d83a553d0c9b60fe3cdf1d2a4c7b572d
[openflowplugin.git] / applications / forwardingrules-manager / src / main / java / org / opendaylight / openflowplugin / applications / frm / ForwardingRulesCommiter.java
1 /**
2  * Copyright (c) 2014 Cisco Systems, Inc. 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
9 package org.opendaylight.openflowplugin.applications.frm;
10
11 import java.util.concurrent.Future;
12 import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 import org.opendaylight.yangtools.yang.common.RpcResult;
17
18 /**
19  * forwardingrules-manager org.opendaylight.openflowplugin.applications.frm
20  *
21  * <p>
22  * ForwardingRulesCommiter It represent a contract between DataStore
23  * DataTreeModification and relevant SalRpcService for device. Every
24  * implementation has to be registered for Configurational/DS tree path.
25  */
26 public interface ForwardingRulesCommiter<D extends DataObject>
27         extends AutoCloseable, ClusteredDataTreeChangeListener<D> {
28
29     /**
30      * Method removes DataObject which is identified by InstanceIdentifier from
31      * device.
32      *
33      * @param identifier
34      *            - the whole path to DataObject
35      * @param del
36      *            - DataObject for removing
37      * @param nodeIdent
38      *            Node InstanceIdentifier
39      */
40     void remove(InstanceIdentifier<D> identifier, D del, InstanceIdentifier<FlowCapableNode> nodeIdent);
41
42     /**
43      * Method updates the original DataObject to the update DataObject in device.
44      * Both are identified by same InstanceIdentifier
45      *
46      * @param identifier
47      *            - the whole path to DataObject
48      * @param original
49      *            - original DataObject (for update)
50      * @param update
51      *            - changed DataObject (contain updates)
52      * @param nodeIdent
53      *            Node InstanceIdentifier
54      */
55     void update(InstanceIdentifier<D> identifier, D original, D update, InstanceIdentifier<FlowCapableNode> nodeIdent);
56
57     /**
58      * Method adds the DataObject which is identified by InstanceIdentifier to
59      * device.
60      *
61      * @param identifier
62      *            - the whole path to new DataObject
63      * @param add
64      *            - new DataObject
65      * @param nodeIdent
66      *            Node InstanceIdentifier
67      * @return A future associated with RPC task. {@code null} is set to the future
68      *         if this method does not invoke RPC.
69      */
70     Future<? extends RpcResult<?>> add(InstanceIdentifier<D> identifier, D add,
71             InstanceIdentifier<FlowCapableNode> nodeIdent);
72
73     /**
74      * Method creates stale-marked DataObject which is identified by
75      * InstanceIdentifier from device.
76      *
77      * @param identifier
78      *            - the whole path to DataObject
79      * @param del
80      *            - DataObject removed. Stale-Mark object to be created from this
81      *            object
82      * @param nodeIdent
83      *            Node InstanceIdentifier
84      */
85     void createStaleMarkEntity(InstanceIdentifier<D> identifier, D del, InstanceIdentifier<FlowCapableNode> nodeIdent);
86
87     Future<? extends RpcResult<?>> removeWithResult(InstanceIdentifier<D> identifier, D del,
88             InstanceIdentifier<FlowCapableNode> nodeIdent);
89
90 }