Merge "Removed duplicate sal-binding-config dependency."
[openflowplugin.git] / openflowplugin-api / src / main / java / org / opendaylight / openflowplugin / api / openflow / device / DeviceManager.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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
9 package org.opendaylight.openflowplugin.api.openflow.device;
10
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;
20
21 /**
22  * This interface is responsible for instantiating DeviceContext and
23  * registering transaction chain for each DeviceContext. Each device
24  * has its own device context managed by this manager.
25  */
26 public interface DeviceManager extends DeviceConnectedHandler, DeviceDisconnectedHandler, DeviceLifecycleSupervisor,
27         DeviceInitializationPhaseHandler, DeviceTerminationPhaseHandler, TranslatorLibrarian, AutoCloseable, OFPManager {
28
29
30     /**
31      * invoked after all services injected
32      */
33     void initialize();
34
35     /**
36      * Method has to activate (MASTER) or deactivate (SLAVE) TransactionChainManager.
37      * TransactionChainManager represents possibility to write or delete Node subtree data
38      * for actual Controller Cluster Node. We are able to have an active TxManager only if
39      * newRole is {@link OfpRole#BECOMESLAVE}.
40      * Parameters are used as marker to be sure it is change to SLAVE from MASTER or from
41      * MASTER to SLAVE and the last parameter "cleanDataStore" is used for validation only.
42      *
43      * @param deviceInfo which device
44      * @param role - NewRole expect to be {@link OfpRole#BECOMESLAVE} or {@link OfpRole#BECOMEMASTER}
45      * @return RoleChangeTxChainManager future for activation/deactivation
46      */
47     ListenableFuture<Void> onClusterRoleChange(final DeviceInfo deviceInfo, final OfpRole role);
48
49     /**
50      * Register device synchronize listeners
51      * @param deviceSynchronizeListener are notified if device is synchronized or not
52      */
53     void addDeviceSynchronizeListener(final DeviceSynchronizeListener deviceSynchronizeListener);
54
55     /**
56      * Notify all registered listeners about synchronized status
57      * @param deviceInfo which device
58      * @param deviceSynchronized true if device is synchronized
59      */
60     void notifyDeviceSynchronizeListeners(final DeviceInfo deviceInfo, final boolean deviceSynchronized);
61
62     /**
63      * Register device valid listeners
64      * @param deviceValidListener are notified if device is valid or not
65      */
66     void addDeviceValidListener(final DeviceValidListener deviceValidListener);
67
68     /**
69      * Notify all registered listeners about valid status
70      * @param deviceInfo which device
71      * @param deviceValid true if device is valid
72      */
73     void notifyDeviceValidListeners(final DeviceInfo deviceInfo, final boolean deviceValid);
74
75 }
76