2 * Copyright (c) 2015 Cisco Systems, Inc. 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
9 package org.opendaylight.openflowplugin.api.openflow.device;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.openflowplugin.api.openflow.OFPManager;
13 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
14 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
15 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitializationPhaseHandler;
16 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceLifecycleSupervisor;
17 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceTerminationPhaseHandler;
18 import org.opendaylight.openflowplugin.api.openflow.translator.TranslatorLibrarian;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
21 import javax.annotation.CheckForNull;
24 * This interface is responsible for instantiating DeviceContext and
25 * registering transaction chain for each DeviceContext. Each device
26 * has its own device context managed by this manager.
28 public interface DeviceManager extends DeviceConnectedHandler, DeviceDisconnectedHandler, DeviceLifecycleSupervisor,
29 DeviceInitializationPhaseHandler, DeviceTerminationPhaseHandler, TranslatorLibrarian, AutoCloseable, OFPManager {
33 * invoked after all services injected
38 * Method has to activate (MASTER) or deactivate (SLAVE) TransactionChainManager.
39 * TransactionChainManager represents possibility to write or delete Node subtree data
40 * for actual Controller Cluster Node. We are able to have an active TxManager only if
41 * newRole is {@link OfpRole#BECOMESLAVE}.
42 * Parameters are used as marker to be sure it is change to SLAVE from MASTER or from
43 * MASTER to SLAVE and the last parameter "cleanDataStore" is used for validation only.
45 * @param deviceInfo which device
46 * @param role - NewRole expect to be {@link OfpRole#BECOMESLAVE} or {@link OfpRole#BECOMEMASTER}
47 * @return RoleChangeTxChainManager future for activation/deactivation
49 ListenableFuture<Void> onClusterRoleChange(final DeviceInfo deviceInfo, final OfpRole role);
52 * Register device synchronize listeners
53 * @param deviceSynchronizeListener are notified if device is synchronized or not
55 void registerDeviceSynchronizeListeners(final DeviceSynchronizeListener deviceSynchronizeListener);
58 * Notify all registered listeners about synchronized status
59 * @param deviceInfo which device
60 * @param deviceSynchronized true if device is synchronized
62 void notifyDeviceSynchronizeListeners(final DeviceInfo deviceInfo, final boolean deviceSynchronized);
65 * Register device valid listeners
66 * @param deviceValidListener are notified if device is valid or not
68 void registerDeviceValidListeners(final DeviceValidListener deviceValidListener);
71 * Notify all registered listeners about valid status
72 * @param deviceInfo which device
73 * @param deviceValid true if device is valid
75 void notifyDeviceValidListeners(final DeviceInfo deviceInfo, final boolean deviceValid);