Search in sources :

Example 1 with GetNatTranslationsOnRouterOutput

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());
}
Also used : GetNatTranslationsOnRouterOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.GetNatTranslationsOnRouterOutput) RouterNat(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.nat.output.RouterNat) GetNatTranslationsOnRouterOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.GetNatTranslationsOnRouterOutputBuilder)

Aggregations

GetNatTranslationsOnRouterOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.GetNatTranslationsOnRouterOutput)1 GetNatTranslationsOnRouterOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.GetNatTranslationsOnRouterOutputBuilder)1 RouterNat (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rpc.rev170209.nat.output.RouterNat)1