use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project lispflowmapping by opendaylight.
the class MappingServiceIntegrationTestUtil method getDefaultLocatorBuilder.
/**
* Create a default LocatorRecordBuilder object.
*
* @param rloc RLOC for the mapping record, if null, a default will be added
* @return the LocatorRecordBuilder object
*/
static LocatorRecordBuilder getDefaultLocatorBuilder(Rloc rloc) {
if (rloc == null) {
rloc = DEFAULT_IPV4_RLOC;
LOG.warn("getDefaultLocatorBuilder(): null RLOC received, using the default {}", DEFAULT_IPV4_RLOC_STRING);
}
return new LocatorRecordBuilder().setLocalLocator(true).setMulticastPriority((short) 255).setMulticastWeight((short) 0).setPriority((short) 1).setRlocProbed(false).setRouted(true).setWeight((short) 1).setKey(new LocatorRecordKey(LispAddressStringifier.getString(rloc))).setRloc(rloc);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project lispflowmapping by opendaylight.
the class MappingService method addKey.
@Override
public Future<RpcResult<Void>> addKey(AddKeyInput input) {
Preconditions.checkNotNull(input, "add-key RPC input must be not null!");
LOG.trace("RPC received to add the following key: " + input.toString());
RpcResultBuilder<Void> rpcResultBuilder;
MappingAuthkey key = mappingSystem.getAuthenticationKey(convertToBinaryIfNecessary(input.getEid()));
if (key != null) {
String message = "Key already exists! Please use update-key if you want to change it.";
rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.PROTOCOL, DATA_EXISTS_TAG, message);
return Futures.immediateFuture(rpcResultBuilder.build());
}
dsbe.addAuthenticationKey(RPCInputConvertorUtil.toAuthenticationKey(input));
rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project lispflowmapping by opendaylight.
the class MappingService method updateKey.
@Override
public Future<RpcResult<Void>> updateKey(UpdateKeyInput input) {
Preconditions.checkNotNull(input, "update-key RPC input must be not null!");
LOG.trace("RPC received to update the following key: " + input.toString());
RpcResultBuilder<Void> rpcResultBuilder;
MappingAuthkey key = mappingSystem.getAuthenticationKey(convertToBinaryIfNecessary(input.getEid()));
if (key == null) {
String message = "Key doesn't exist! Please use add-key if you want to create a new authentication key.";
rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.PROTOCOL, NOT_FOUND_TAG, message);
return Futures.immediateFuture(rpcResultBuilder.build());
}
dsbe.updateAuthenticationKey(RPCInputConvertorUtil.toAuthenticationKey(input));
rpcResultBuilder = RpcResultBuilder.success();
return Futures.immediateFuture(rpcResultBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project lispflowmapping by opendaylight.
the class MappingService method getKey.
@Override
public Future<RpcResult<GetKeyOutput>> getKey(GetKeyInput input) {
Preconditions.checkNotNull(input, "get-key RPC input must be not null!");
LOG.trace("RPC received to get the following key: " + input.toString());
RpcResultBuilder<GetKeyOutput> rpcResultBuilder;
MappingAuthkey key = mappingSystem.getAuthenticationKey(convertToBinaryIfNecessary(input.getEid()));
if (key == null) {
String message = "Key was not found in the mapping database";
rpcResultBuilder = RpcResultBuilder.<GetKeyOutput>failed().withError(RpcError.ErrorType.APPLICATION, NOT_FOUND_TAG, message);
} else {
rpcResultBuilder = RpcResultBuilder.success(new GetKeyOutputBuilder().setMappingAuthkey(key));
}
return Futures.immediateFuture(rpcResultBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.messages.Received in project lispflowmapping by opendaylight.
the class MappingService method getMapping.
@Override
public Future<RpcResult<GetMappingOutput>> getMapping(GetMappingInput input) {
Preconditions.checkNotNull(input, "get-mapping RPC input must be not null!");
LOG.trace("RPC received to get the following mapping: " + input.toString());
RpcResultBuilder<GetMappingOutput> rpcResultBuilder;
MappingData reply = mappingSystem.getMapping(convertToBinaryIfNecessary(input.getEid()));
if (reply == null) {
String message = "No mapping was found in the mapping database";
rpcResultBuilder = RpcResultBuilder.<GetMappingOutput>failed().withError(RpcError.ErrorType.APPLICATION, NOT_FOUND_TAG, message);
} else {
final MappingRecord convertedReply = convertFromBinaryIfNecessary(reply.getRecord());
rpcResultBuilder = RpcResultBuilder.success(new GetMappingOutputBuilder().setMappingRecord(convertedReply));
}
return Futures.immediateFuture(rpcResultBuilder.build());
}
Aggregations