X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fapi%2Fopenflow%2Fdevice%2FDeviceManager.java;h=55f68da8b7efe3689563127cd383cae4a10ff3a8;hb=71580413cf6f1f2b4a8b65c3101743743f98bd82;hp=3af5e496428bf83d98bb3f948ae68d1eb52dad49;hpb=d30249f84eaf9878cf68fb76c46f7e99587f4e57;p=openflowplugin.git diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceManager.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceManager.java index 3af5e49642..55f68da8b7 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceManager.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceManager.java @@ -8,46 +8,69 @@ package org.opendaylight.openflowplugin.api.openflow.device; -import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; -import org.opendaylight.controller.md.sal.binding.api.NotificationService; +import com.google.common.util.concurrent.ListenableFuture; +import org.opendaylight.openflowplugin.api.openflow.OFPManager; import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler; import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler; import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitializationPhaseHandler; import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceLifecycleSupervisor; import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceTerminationPhaseHandler; import org.opendaylight.openflowplugin.api.openflow.translator.TranslatorLibrarian; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole; /** * This interface is responsible for instantiating DeviceContext and * registering transaction chain for each DeviceContext. Each device * has its own device context managed by this manager. - * Created by Martin Bobak <mbobak@cisco.com> on 25.2.2015. */ public interface DeviceManager extends DeviceConnectedHandler, DeviceDisconnectedHandler, DeviceLifecycleSupervisor, - DeviceInitializationPhaseHandler, DeviceTerminationPhaseHandler, TranslatorLibrarian, AutoCloseable { + DeviceInitializationPhaseHandler, DeviceTerminationPhaseHandler, TranslatorLibrarian, AutoCloseable, OFPManager { + /** - * Sets notification publish service + * invoked after all services injected + */ + void initialize(); + + /** + * Method has to activate (MASTER) or deactivate (SLAVE) TransactionChainManager. + * TransactionChainManager represents possibility to write or delete Node subtree data + * for actual Controller Cluster Node. We are able to have an active TxManager only if + * newRole is {@link OfpRole#BECOMESLAVE}. + * Parameters are used as marker to be sure it is change to SLAVE from MASTER or from + * MASTER to SLAVE and the last parameter "cleanDataStore" is used for validation only. * - * @param notificationPublishService + * @param deviceInfo which device + * @param role - NewRole expect to be {@link OfpRole#BECOMESLAVE} or {@link OfpRole#BECOMEMASTER} + * @return RoleChangeTxChainManager future for activation/deactivation */ - void setNotificationPublishService(NotificationPublishService notificationPublishService); + ListenableFuture onClusterRoleChange(final DeviceInfo deviceInfo, final OfpRole role); /** - * invoked after all services injected + * Register device synchronize listeners + * @param deviceSynchronizeListener are notified if device is synchronized or not */ - void initialize(); + void addDeviceSynchronizeListener(final DeviceSynchronizeListener deviceSynchronizeListener); + + /** + * Notify all registered listeners about synchronized status + * @param deviceInfo which device + * @param deviceSynchronized true if device is synchronized + */ + void notifyDeviceSynchronizeListeners(final DeviceInfo deviceInfo, final boolean deviceSynchronized); + + /** + * Register device valid listeners + * @param deviceValidListener are notified if device is valid or not + */ + void addDeviceValidListener(final DeviceValidListener deviceValidListener); /** - * Returning device context from map maintained in device manager - * This prevent to send whole device context to another context - * If device context not exists for nodeId it will return null - * @param nodeId - * @return device context or null + * Notify all registered listeners about valid status + * @param deviceInfo which device + * @param deviceValid true if device is valid */ - DeviceContext getDeviceContextFromNodeId(NodeId nodeId); + void notifyDeviceValidListeners(final DeviceInfo deviceInfo, final boolean deviceValid); - void setStatisticsRpcEnabled(boolean isStatisticsRpcEnabled); }