import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext.CONNECTION_STATE;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext.CONNECTION_STATE;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.SetRoleInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.SetRoleOutput;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.SetRoleInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.SetRoleOutput;
import org.opendaylight.yangtools.yang.common.RpcResult;
implements SalRoleService {
private static final Logger LOG = LoggerFactory.getLogger(SalRoleServiceImpl.class);
implements SalRoleService {
private static final Logger LOG = LoggerFactory.getLogger(SalRoleServiceImpl.class);
return Futures.transformAsync(roleService.getGenerationIdFromDevice(getVersion()), generationId -> {
LOG.debug("RoleChangeTask, GenerationIdFromDevice from device {} is {}",
getDeviceInfo().getNodeId().getValue(), generationId);
return Futures.transformAsync(roleService.getGenerationIdFromDevice(getVersion()), generationId -> {
LOG.debug("RoleChangeTask, GenerationIdFromDevice from device {} is {}",
getDeviceInfo().getNodeId().getValue(), generationId);
LOG.debug("nextGenerationId received from device:{} is {}",
getDeviceInfo().getNodeId().getValue(), nextGenerationId);
return roleService.submitRoleChange(role, getVersion(), nextGenerationId);
}, MoreExecutors.directExecutor());
}
LOG.debug("nextGenerationId received from device:{} is {}",
getDeviceInfo().getNodeId().getValue(), nextGenerationId);
return roleService.submitRoleChange(role, getVersion(), nextGenerationId);
}, MoreExecutors.directExecutor());
}