Change return type of events
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / lifecycle / ContextChainMastershipWatcher.java
1 /*
2  * Copyright (c) 2016 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 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
12 import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeException;
13
14 /**
15  * Watcher if able to start mastership for device.
16  * @since 0.4.0 Carbon
17  */
18 public interface ContextChainMastershipWatcher {
19
20     /**
21      * Event occurs if there was a try to acquire MASTER role.
22      * But it was not possible to start this MASTER role on device.
23      * @param deviceInfo connected switch identification
24      * @param reason reason
25      * @param mandatory if it is mandatory connection will be dropped
26      */
27     void onNotAbleToStartMastership(DeviceInfo deviceInfo, String reason, boolean mandatory);
28
29     /**
30      * Event occurs if there was a try to acquire MASTER role.
31      * But it was not possible to start this MASTER role on device.
32      * @param deviceInfo connected switch identification
33      * @param reason reason
34      */
35     default void onNotAbleToStartMastershipMandatory(DeviceInfo deviceInfo, String reason) {
36         onNotAbleToStartMastership(deviceInfo, reason, true);
37     }
38
39     /**
40      * Changed to MASTER role on device.
41      * @param deviceInfo connected switch identification
42      * @param mastershipState state
43      */
44     void onMasterRoleAcquired(DeviceInfo deviceInfo, @Nonnull ContextChainMastershipState mastershipState);
45
46     /**
47      * Change to SLAVE role on device was successful.
48      * @param deviceInfo connected switch identification
49      */
50     void onSlaveRoleAcquired(DeviceInfo deviceInfo);
51
52     /**
53      * Change to SLAVE role on device was not able.
54      * @param deviceInfo connected switch identification
55      */
56     void onSlaveRoleNotAcquired(DeviceInfo deviceInfo);
57 }