use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.GetNatTranslationsOnRouterOutput in project netvirt by opendaylight.
the class NatRpcServiceImpl method getNatTranslationsOnRouter.
@Override
public Future<RpcResult<GetNatTranslationsOnRouterOutput>> getNatTranslationsOnRouter(GetNatTranslationsOnRouterInput input) {
RpcResultBuilder<GetNatTranslationsOnRouterOutput> rpcResultBuilder = null;
long routerId = NatUtil.getVpnId(dataBroker, input.getRouterUuid().getValue());
if (routerId == NatConstants.INVALID_ID) {
String errMsg = String.format("404 Not Found - No Router found with UUID {%s}", input.getRouterUuid().getValue());
rpcResultBuilder = RpcResultBuilder.<GetNatTranslationsOnRouterOutput>failed().withError(RpcError.ErrorType.APPLICATION, errMsg);
return Futures.immediateFuture(rpcResultBuilder.build());
}
List<RouterNat> routerNatList = constructNatInformation(input.getRouterUuid(), routerId);
GetNatTranslationsOnRouterOutputBuilder output = new GetNatTranslationsOnRouterOutputBuilder().setRouterNat(routerNatList);
rpcResultBuilder = RpcResultBuilder.success();
rpcResultBuilder.withResult(output.build());
return Futures.immediateFuture(rpcResultBuilder.build());
}
Aggregations