Switch to MD-SAL APIs
[openflowplugin.git] / applications / forwardingrules-manager / src / main / java / org / opendaylight / openflowplugin / applications / frm / ForwardingRulesManager.java
1 /*
2  * Copyright (c) 2014, 2017 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 package org.opendaylight.openflowplugin.applications.frm;
9
10 import org.opendaylight.mdsal.binding.api.ReadTransaction;
11 import org.opendaylight.openflowplugin.api.openflow.configuration.ConfigurationListener;
12 import org.opendaylight.openflowplugin.applications.frm.impl.DevicesGroupRegistry;
13 import org.opendaylight.openflowplugin.applications.frm.impl.FlowNodeConnectorInventoryTranslatorImpl;
14 import org.opendaylight.serviceutils.srm.RecoverableListener;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.SalBundleService;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.arbitrator.reconcile.service.rev180227.ArbitratorReconcileService;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
26 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
27
28 /**
29  * It represent a central point for whole module. Implementation Flow Provider
30  * registers the link FlowChangeListener} and it holds all needed services for
31  * link FlowChangeListener}.
32  *
33  * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
34  */
35 public interface ForwardingRulesManager extends ConfigurationListener, AutoCloseable {
36
37     void start();
38
39     /**
40      * Method returns information : "is Node with send InstanceIdentifier
41      * connected"?.
42      *
43      * @param ident
44      *            - the key of the node
45      * @return boolean - true if device is connected
46      */
47     boolean isNodeActive(InstanceIdentifier<FlowCapableNode> ident);
48
49     /**
50      * Method returns information : "is Node with send InstanceIdentifier present in
51      * operational data store"?.
52      *
53      * @param ident
54      *            - the key of the node
55      * @return boolean - true if device is present in operational data store
56      */
57     boolean checkNodeInOperationalDataStore(InstanceIdentifier<FlowCapableNode> ident);
58
59     /**
60      * Method returns generated transaction ID, which is unique for every
61      * transaction. ID is composite from prefix ("DOM") and unique number.
62      *
63      * @return String transactionID for RPC transaction identification
64      */
65     String getNewTransactionId();
66
67     /**
68      * Method returns Read Transaction. It is need for Node reconciliation only.
69      *
70      * @return ReadOnlyTransaction
71      */
72     ReadTransaction getReadTransaction();
73
74     /**
75      * Flow RPC service.
76      *
77      */
78     SalFlowService getSalFlowService();
79
80     /**
81      * Group RPC service.
82      *
83      */
84     SalGroupService getSalGroupService();
85
86     /**
87      * Meter RPC service.
88      *
89      */
90     SalMeterService getSalMeterService();
91
92     /**
93      * Table RPC service.
94      *
95      */
96     SalTableService getSalTableService();
97
98     /**
99      * Return Devices Group Registry which can be used to track the groups present in a device.
100      *
101      * @return devicesGroupRegistry
102      */
103     DevicesGroupRegistry getDevicesGroupRegistry();
104
105     /**
106      * Bundle RPC service.
107      *
108      * @return salBundleService
109      */
110     SalBundleService getSalBundleService();
111
112     /**
113      * Content definition method and prevent code duplicity in Reconcil.
114      *
115      * @return ForwardingRulesCommiter&lt;Flow&gt;.
116      */
117     ForwardingRulesCommiter<Flow> getFlowCommiter();
118
119     /**
120      * Content definition method and prevent code duplicity in Reconcil.
121      *
122      * @return ForwardingRulesCommiter&lt;Group&gt;
123      */
124     ForwardingRulesCommiter<Group> getGroupCommiter();
125
126     /**
127      * Content definition method and prevent code duplicity.
128      *
129      * @return ForwardingRulesCommiter&lt;Meter&gt;
130      */
131     ForwardingRulesCommiter<Meter> getMeterCommiter();
132
133     /**
134      * Content definition method and prevent code duplicity.
135      *
136      * @return ForwardingRulesCommiter&lt;Table&gt;
137      */
138     ForwardingRulesCommiter<TableFeatures> getTableFeaturesCommiter();
139
140     /**
141      * Check if reconciliation is disabled by user.
142      *
143      * @return true if reconciliation is disabled, else false
144      */
145     boolean isReconciliationDisabled();
146
147     /**
148      * Check if stale marking is enabled for switch reconciliation.
149      *
150      * @return true if stale marking is enabled, else false
151      */
152     boolean isStaleMarkingEnabled();
153
154     /**
155      * Return number of reconciliation retry are allowed.
156      *
157      * @return number of retries.
158      */
159     int getReconciliationRetryCount();
160
161     /**
162      * Method checks if *this* instance of openflowplugin is owner of the given
163      * openflow node.
164      *
165      * @return True if owner, else false
166      */
167     boolean isNodeOwner(InstanceIdentifier<FlowCapableNode> ident);
168
169     /**
170      * Content definition method and prevent code duplicity.
171      *
172      * @return FlowNodeConnectorInventoryTranslatorImpl
173      */
174     FlowNodeConnectorInventoryTranslatorImpl getFlowNodeConnectorInventoryTranslatorImpl();
175
176     /**
177      * holds the value read from the configuration file openflowplugin.cfg file.
178      *
179      * @return True if user enables bundle-based-reconciliation-enabled field in
180      *         config file or False
181      */
182     boolean isBundleBasedReconciliationEnabled();
183
184     /**
185      * Return the NodeConfigurator which could be used to serialize jobs.
186      *
187      * @return modeConfigurator.
188      */
189     NodeConfigurator getNodeConfigurator();
190
191     /**
192      * Method for register RecoverableListener.
193      *
194      */
195     void addRecoverableListener(RecoverableListener recoverableListener);
196
197     /**
198      * Method exposes the ArbitratorReconciliationManager service used for performing Arbitrator Based Reconciliation.
199      * @return ArbitratorReconciliationManager
200      */
201     ArbitratorReconcileService getArbitratorReconciliationManager();
202 }