Change return type of events
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / mastership / ReconciliationFrameworkEvent.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.mastership;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
13 import org.opendaylight.openflowplugin.api.openflow.lifecycle.OwnershipChangeListener;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.rf.state.rev170713.ResultState;
15
16 /**
17  * Service provide one event designed for reconciliation framework.
18  * <ul>
19  *     <li><i>{@link #onDeviceDisconnected(DeviceInfo)}</i>
20  *     is called when device is being mastered by controller but not yet submitted into data store.
21  *     This method is being called only if the {@link OwnershipChangeListener#isReconciliationFrameworkRegistered()}
22  *     is set to {@link Boolean#TRUE}</li>
23  *     <li><i>{@link #onDevicePrepared(DeviceInfo)}</i>
24  *     is called when device is disconnected or controller loses control of the switch</li>
25  * </ul>
26  * <p>
27  * <b>This event <i>onDevicePrepared</i> should be used only for reconciliation framework and application can't do anything with
28  * node before the device is not stored in to data store.</b>
29  * @since 0.5.0 Nitrogen
30  */
31
32 public interface ReconciliationFrameworkEvent extends AutoCloseable {
33
34     /**
35      * Event when device is ready as a master but not yet submitted in data store. This event is evoked by
36      * {@link OwnershipChangeListener#becomeMasterBeforeSubmittedDS(DeviceInfo)}
37      * @param deviceInfo connected switch identification
38      * @return result state if the device can continue with connecting or should be disconnected
39      */
40     ListenableFuture<ResultState> onDevicePrepared(@Nonnull DeviceInfo deviceInfo);
41
42     /**
43      * This event occurs after device is disconnected or being slaved.
44      * Event is similar to the {@link MastershipChangeService#onLoseOwnership(DeviceInfo)}. This event is used by
45      * reconciliation framework that the framework don't need to register {@link MastershipChangeService}
46      * @param deviceInfo connected switch identification
47      * @return future
48      * @see MastershipChangeService
49      */
50     ListenableFuture<Void> onDeviceDisconnected(@Nonnull DeviceInfo deviceInfo);
51
52
53 }