use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message 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.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message 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.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message in project genius by opendaylight.
the class ArpUtilImpl method sendPacketOutWithActions.
private Future<RpcResult<Void>> sendPacketOutWithActions(BigInteger dpnId, byte[] payload, NodeConnectorRef ref, List<Action> actions) {
NodeConnectorRef nodeConnectorRef = MDSALUtil.getNodeConnRef(dpnId, "0xfffffffd");
TransmitPacketInput transmitPacketInput = new TransmitPacketInputBuilder().setPayload(payload).setNode(new NodeRef(InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId("openflow:" + dpnId))).toInstance())).setIngress(nodeConnectorRef).setEgress(ref).setAction(actions).build();
LOG.trace("PacketOut message framed for transmitting {}", transmitPacketInput);
return packetProcessingService.transmitPacket(transmitPacketInput);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message in project bgpcep by opendaylight.
the class BGPNotificationMessageParser method parseMessageBody.
/**
* Parses BGP Notification message to bytes.
*
* @param body ByteBuf to be parsed
* @param messageLength the length of the message
* @return {@link Notify} which represents BGP notification message
* @throws BGPDocumentedException if parsing goes wrong
*/
@Override
public Notify parseMessageBody(final ByteBuf body, final int messageLength) throws BGPDocumentedException {
Preconditions.checkArgument(body != null, "Buffer cannot be null.");
if (body.readableBytes() < ERROR_SIZE) {
throw BGPDocumentedException.badMessageLength("Notification message too small.", messageLength);
}
final int errorCode = body.readUnsignedByte();
final int errorSubcode = body.readUnsignedByte();
final NotifyBuilder builder = new NotifyBuilder().setErrorCode((short) errorCode).setErrorSubcode((short) errorSubcode);
if (body.isReadable()) {
builder.setData(ByteArray.readAllBytes(body));
}
LOG.debug("BGP Notification message was parsed: err = {}, data = {}.", BGPError.forValue(errorCode, errorSubcode), Arrays.toString(builder.getData()));
return builder.build();
}
Aggregations