Synchronize Flow and Group Remove 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  * <b>This event <i>onDevicePrepared</i> should be used only for reconciliation framework
27  * and application can't do anything with node before the device is not stored in to data store.</b>
28  * @since 0.5.0 Nitrogen
29  */
30
31 public interface ReconciliationFrameworkEvent extends AutoCloseable {
32
33     /**
34      * Event when device is ready as a master but not yet submitted in data store. This event is evoked by
35      * {@link OwnershipChangeListener#becomeMasterBeforeSubmittedDS(DeviceInfo)}
36      * @param deviceInfo connected switch identification
37      * @return result state if the device can continue with connecting or should be disconnected
38      */
39     ListenableFuture<ResultState> onDevicePrepared(@Nonnull DeviceInfo deviceInfo);
40
41     /**
42      * This event occurs after device is disconnected or being slaved.
43      * Event is similar to the {@link MastershipChangeService#onLoseOwnership(DeviceInfo)}. This event is used by
44      * reconciliation framework that the framework don't need to register {@link MastershipChangeService}
45      * @param deviceInfo connected switch identification
46      * @return future
47      * @see MastershipChangeService
48      */
49     ListenableFuture<Void> onDeviceDisconnected(@Nonnull DeviceInfo deviceInfo);
50
51
52 }