use of org.opendaylight.yangtools.yang.common.RpcError in project controller by opendaylight.
the class MdsalLowLevelTestProvider method shutdownPrefixShardReplica.
@Override
public Future<RpcResult<Void>> shutdownPrefixShardReplica(final ShutdownPrefixShardReplicaInput input) {
LOG.debug("Received shutdown-prefix-shard-replica rpc, input: {}", input);
final InstanceIdentifier<?> shardPrefix = input.getPrefix();
if (shardPrefix == null) {
final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "bad-element", "A valid shard prefix must be specified");
return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(rpcError).build());
}
final YangInstanceIdentifier shardPath = bindingNormalizedNodeSerializer.toYangInstanceIdentifier(shardPrefix);
final String cleanPrefixShardName = ClusterUtils.getCleanShardName(shardPath);
return shutdownShardGracefully(cleanPrefixShardName);
}
use of org.opendaylight.yangtools.yang.common.RpcError in project controller by opendaylight.
the class MdsalLowLevelTestProvider method unregisterFlappingSingleton.
@Override
public Future<RpcResult<UnregisterFlappingSingletonOutput>> unregisterFlappingSingleton() {
LOG.debug("unregister-flapping-singleton received.");
if (flappingSingletonService == null) {
final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "missing-registration", "No flapping-singleton registration present.");
final RpcResult<UnregisterFlappingSingletonOutput> result = RpcResultBuilder.<UnregisterFlappingSingletonOutput>failed().withRpcError(rpcError).build();
return Futures.immediateFuture(result);
}
final long flapCount = flappingSingletonService.setInactive();
flappingSingletonService = null;
final UnregisterFlappingSingletonOutput output = new UnregisterFlappingSingletonOutputBuilder().setFlapCount(flapCount).build();
return Futures.immediateFuture(RpcResultBuilder.success(output).build());
}
use of org.opendaylight.yangtools.yang.common.RpcError in project controller by opendaylight.
the class MdsalLowLevelTestProvider method shutdownShardReplica.
@Override
public Future<RpcResult<Void>> shutdownShardReplica(final ShutdownShardReplicaInput input) {
LOG.debug("Received shutdown-shard-replica rpc, input: {}", input);
final String shardName = input.getShardName();
if (Strings.isNullOrEmpty(shardName)) {
final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "bad-element", "A valid shard name must be specified");
return Futures.immediateFuture(RpcResultBuilder.<Void>failed().withRpcError(rpcError).build());
}
return shutdownShardGracefully(shardName);
}
use of org.opendaylight.yangtools.yang.common.RpcError in project controller by opendaylight.
the class MdsalLowLevelTestProvider method unregisterBoundConstant.
@Override
public Future<RpcResult<Void>> unregisterBoundConstant(final UnregisterBoundConstantInput input) {
LOG.debug("unregister-bound-constant, {}", input);
final DOMRpcImplementationRegistration<RoutedGetConstantService> rpcRegistration = routedRegistrations.remove(input.getContext());
if (rpcRegistration == null) {
LOG.debug("No get-contexted-constant registration for context: {}", input.getContext());
final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "missing-registration", "No get-constant rpc registration present.");
final RpcResult<Void> result = RpcResultBuilder.<Void>failed().withRpcError(rpcError).build();
return Futures.immediateFuture(result);
}
rpcRegistration.close();
return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
}
use of org.opendaylight.yangtools.yang.common.RpcError in project controller by opendaylight.
the class MdsalLowLevelTestProvider method unregisterConstant.
@Override
public Future<RpcResult<Void>> unregisterConstant() {
if (globalGetConstantRegistration == null) {
final RpcError rpcError = RpcResultBuilder.newError(ErrorType.APPLICATION, "missing-registration", "No get-constant rpc registration present.");
final RpcResult<Void> result = RpcResultBuilder.<Void>failed().withRpcError(rpcError).build();
return Futures.immediateFuture(result);
}
globalGetConstantRegistration.close();
globalGetConstantRegistration = null;
return Futures.immediateFuture(RpcResultBuilder.<Void>success().build());
}
Aggregations