Change return type of events
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / lifecycle / OwnershipChangeListener.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.api.openflow.lifecycle;
9
10 import javax.annotation.Nonnull;
11
12 import com.google.common.util.concurrent.ListenableFuture;
13 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.rf.state.rev170713.ResultState;
15
16 /**
17  * Internal OFP interface used by mastership service.
18  * @see ContextChainHolder
19  * @since 0.5.0 Nitrogen
20  */
21 public interface OwnershipChangeListener extends ReconciliationFrameworkRegistrar {
22
23     /**
24      * This event is called when device is fully mastered. All condition have to been done successful.
25      * <ul>
26      *     <li>Transaction chain created</li>
27      *     <li> RPC services started </li>
28      *     <li> Initial statistics gathering. </li>
29      *     <li> Initial DS submit. </li>
30      *     <li> Flow registry filled. - <b>this step is not mandatory</b></li>
31      * </ul>
32      * @param deviceInfo connected switch identification
33      */
34     void becomeMaster(@Nonnull DeviceInfo deviceInfo);
35
36     /**
37      * Should be called when device is disconnected or going to be slaved.
38      * @param deviceInfo connected switch identification
39      */
40     void becomeSlaveOrDisconnect(@Nonnull DeviceInfo deviceInfo);
41
42     /**
43      * Should be called when device is being mastered as in {@link #becomeMaster(DeviceInfo)}.
44      * <p> But before: Initial DS submit</p>
45      * <b>This is special call designed only for reconciliation framework.</b>
46      * @see #becomeMaster(DeviceInfo)
47      * @see #isReconciliationFrameworkRegistered()
48      * @param deviceInfo connected switch identification
49      * @return future to be able handle device after reconciliation
50      */
51     ListenableFuture<ResultState> becomeMasterBeforeSubmittedDS(@Nonnull DeviceInfo deviceInfo);
52
53     /**
54      * Set the device mastership checker.
55      * @param masterChecker {@link MasterChecker}
56      */
57     void setMasterChecker(@Nonnull MasterChecker masterChecker);
58
59 }