<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>ietf-yang-types-20130715</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal.model</groupId>
- <artifactId>ietf-yang-types-20130715</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>yang-ext</artifactId>
import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleService;
-import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry;
import org.opendaylight.openflowplugin.api.openflow.role.RoleContext;
import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
@Override
public ListenableFuture<Void> stopClusterServices() {
+ ListenableFuture<Void> future;
try {
//TODO: Add callback
sendRoleChangeToDevice(OfpRole.BECOMESLAVE).get();
LOG.warn("Send role to device failed ", e);
} finally {
myManager.removeDeviceFromOperationalDS(deviceInfo, MAX_CLEAN_DS_RETRIES);
- return Futures.immediateFuture(null);
+ future = Futures.immediateFuture(null);
}
+ return future;
}
private ListenableFuture<RpcResult<SetRoleOutput>> sendRoleChangeToDevice(final OfpRole newRole) {
return contexts.get(deviceInfo);
}
- /**
- * This method is only for testing
- */
- @VisibleForTesting
- void setRoleContext(DeviceInfo deviceInfo, RoleContext roleContext){
- if(!contexts.containsKey(deviceInfo)) {
- contexts.put(deviceInfo, roleContext);
- }
- }
-
- /**
- * Invoked when initialization phase is done
- * @param deviceInfo node identification
- * @param success true if initialization done ok, false otherwise
- */
- @VisibleForTesting
- void notifyListenersRoleInitializationDone(final DeviceInfo deviceInfo, final boolean success){
- LOG.debug("Notifying registered listeners for role initialization done, no. of listeners {}", listeners.size());
- for (final RoleChangeListener listener : listeners) {
- listener.roleInitializationDone(deviceInfo, success);
- }
- }
-
- /**
- * Notifies registered listener on role change. Role is the new role on device
- * If initialization phase is true, we may skip service starting
- * @param deviceInfo
- * @param role new role meant to be set on device
- */
- @VisibleForTesting
- void notifyListenersRoleChangeOnDevice(final DeviceInfo deviceInfo, final OfpRole role){
- LOG.debug("Notifying registered listeners for role change, no. of listeners {}", listeners.size());
- for (final RoleChangeListener listener : listeners) {
- listener.roleChangeOnDevice(deviceInfo, role);
- }
- }
-
@Override
public <T extends OFPContext> T gainContext(final DeviceInfo deviceInfo) {
return (T) contexts.get(deviceInfo);