Search in sources :

Example 36 with Message

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());
}
Also used : MappingAuthkey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey)

Example 37 with Message

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());
}
Also used : GetKeyOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetKeyOutputBuilder) MappingAuthkey(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey) GetKeyOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetKeyOutput)

Example 38 with Message

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());
}
Also used : MappingRecord(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord) MappingData(org.opendaylight.lispflowmapping.lisp.type.MappingData) GetMappingOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetMappingOutputBuilder) GetMappingOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.GetMappingOutput)

Example 39 with Message

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);
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) NodeConnectorRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef) TransmitPacketInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInputBuilder) TransmitPacketInput(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) NodeId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Example 40 with Message

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();
}
Also used : NotifyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.NotifyBuilder)

Aggregations

Test (org.junit.Test)192 ByteBuf (io.netty.buffer.ByteBuf)179 ArrayList (java.util.ArrayList)75 MultipartReplyMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage)53 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)45 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)44 BigInteger (java.math.BigInteger)40 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)26 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)25 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)25 MultipartReplyMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder)22 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)20 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)18 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)17 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Update)17 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message)16 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)15 List (java.util.List)13 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)13 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)12