2 * Copyright (c) 2016 Pantheon Technologies s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.openflowplugin.api.openflow.lifecycle;
10 import javax.annotation.Nonnull;
11 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
12 import org.opendaylight.openflowplugin.api.openflow.mastership.MastershipChangeException;
15 * Watcher if able to start mastership for device.
18 public interface ContextChainMastershipWatcher {
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
27 void onNotAbleToStartMastership(DeviceInfo deviceInfo, String reason, boolean mandatory);
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
35 default void onNotAbleToStartMastershipMandatory(DeviceInfo deviceInfo, String reason) {
36 onNotAbleToStartMastership(deviceInfo, reason, true);
40 * Changed to MASTER role on device.
41 * @param deviceInfo connected switch identification
42 * @param mastershipState state
44 void onMasterRoleAcquired(DeviceInfo deviceInfo, @Nonnull ContextChainMastershipState mastershipState);
47 * Change to SLAVE role on device was successful.
48 * @param deviceInfo connected switch identification
50 void onSlaveRoleAcquired(DeviceInfo deviceInfo);
53 * Change to SLAVE role on device was not able.
54 * @param deviceInfo connected switch identification
56 void onSlaveRoleNotAcquired(DeviceInfo deviceInfo);