Search in sources :

Example 1 with GetMappingWithXtrIdOutputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetMappingWithXtrIdOutputBuilder in project lispflowmapping by opendaylight.

the class MappingService method getMappingWithXtrId.

@Override
public Future<RpcResult<GetMappingWithXtrIdOutput>> getMappingWithXtrId(GetMappingWithXtrIdInput input) {
    Preconditions.checkNotNull(input, "get-mapping RPC input must be not null!");
    LOG.trace("RPC received to get the following mapping: " + input.toString());
    RpcResultBuilder<GetMappingWithXtrIdOutput> rpcResultBuilder;
    MappingData reply = mappingSystem.getMapping(null, convertToBinaryIfNecessary(input.getEid()), input.getXtrId());
    if (reply == null) {
        String message = "No mapping was found in the mapping database";
        rpcResultBuilder = RpcResultBuilder.<GetMappingWithXtrIdOutput>failed().withError(RpcError.ErrorType.APPLICATION, NOT_FOUND_TAG, message);
    } else {
        final MappingRecord convertedReply = convertFromBinaryIfNecessary(reply.getRecord());
        rpcResultBuilder = RpcResultBuilder.success(new GetMappingWithXtrIdOutputBuilder().setMappingRecord(convertedReply));
    }
    return Futures.immediateFuture(rpcResultBuilder.build());
}
Also used : GetMappingWithXtrIdOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetMappingWithXtrIdOutput) MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) GetMappingWithXtrIdOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetMappingWithXtrIdOutputBuilder)

Aggregations

MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)1 MappingRecord (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord)1 GetMappingWithXtrIdOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetMappingWithXtrIdOutput)1 GetMappingWithXtrIdOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetMappingWithXtrIdOutputBuilder)1