Search in sources :

Example 41 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.

the class OF10FlowModInputMessageFactory method deserialize.

@Override
// FB doesn't recognize Objects.requireNonNull
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
public FlowModInput deserialize(ByteBuf rawMessage) {
    Objects.requireNonNull(registry);
    FlowModInputBuilder builder = new FlowModInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    OFDeserializer<MatchV10> matchDeserializer = registry.getDeserializer(new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EMPTY_VALUE, MatchV10.class));
    builder.setMatchV10(matchDeserializer.deserialize(rawMessage));
    byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
    rawMessage.readBytes(cookie);
    builder.setCookie(new BigInteger(1, cookie));
    builder.setCommand(FlowModCommand.forValue(rawMessage.readUnsignedShort()));
    builder.setIdleTimeout(rawMessage.readUnsignedShort());
    builder.setHardTimeout(rawMessage.readUnsignedShort());
    builder.setPriority(rawMessage.readUnsignedShort());
    builder.setBufferId(rawMessage.readUnsignedInt());
    builder.setOutPort(new PortNumber((long) rawMessage.readUnsignedShort()));
    builder.setFlagsV10(createFlowModFlagsFromBitmap(rawMessage.readUnsignedShort()));
    CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF10_VERSION_ID);
    List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF10_VERSION_ID, rawMessage.readableBytes(), rawMessage, keyMaker, registry);
    builder.setAction(actions);
    return builder.build();
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) MessageCodeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey) CodeKeyMaker(org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker) BigInteger(java.math.BigInteger) FlowModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder) MatchV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Example 42 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.

the class OF10GetQueueConfigInputMessageFactory method deserialize.

@Override
public GetQueueConfigInput deserialize(ByteBuf rawMessage) {
    GetQueueConfigInputBuilder builder = new GetQueueConfigInputBuilder();
    builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setPort(new PortNumber((long) rawMessage.readUnsignedShort()));
    return builder.build();
}
Also used : GetQueueConfigInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetQueueConfigInputBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)

Example 43 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.

the class PacketOutInputMessageFactory method deserialize.

@Override
public PacketOutInput deserialize(ByteBuf rawMessage) {
    PacketOutInputBuilder builder = new PacketOutInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setBufferId(rawMessage.readUnsignedInt());
    builder.setInPort(new PortNumber(rawMessage.readUnsignedInt()));
    int actionsLen = rawMessage.readShort();
    rawMessage.skipBytes(PADDING);
    CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
    List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID, actionsLen, rawMessage, keyMaker, registry);
    builder.setAction(actions);
    byte[] data = new byte[rawMessage.readableBytes()];
    rawMessage.readBytes(data);
    builder.setData(data);
    return builder.build();
}
Also used : PacketOutInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInputBuilder) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) CodeKeyMaker(org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)

Example 44 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.

the class OxmUdpDstDeserializer method addUdpDstValue.

private static void addUdpDstValue(ByteBuf input, MatchEntryBuilder builder) {
    UdpDstCaseBuilder caseBuilder = new UdpDstCaseBuilder();
    UdpDstBuilder udpBuilder = new UdpDstBuilder();
    udpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setUdpDst(udpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}
Also used : UdpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpDstCaseBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) UdpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.dst._case.UdpDstBuilder)

Example 45 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber in project openflowplugin by opendaylight.

the class TcpDestinationPortEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final int port = message.readUnsignedShort();
    if (Objects.isNull(builder.getLayer4Match())) {
        builder.setLayer4Match(new TcpMatchBuilder().setTcpDestinationPort(new PortNumber(port)).build());
    } else if (TcpMatch.class.isInstance(builder.getLayer4Match()) && Objects.isNull(TcpMatch.class.cast(builder.getLayer4Match()).getTcpDestinationPort())) {
        builder.setLayer4Match(new TcpMatchBuilder(TcpMatch.class.cast(builder.getLayer4Match())).setTcpDestinationPort(new PortNumber(port)).build());
    } else {
        throwErrorOnMalformed(builder, "layer4Match", "tcpDestinationPort");
    }
}
Also used : TcpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)

Aggregations

PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)98 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)81 Test (org.junit.Test)72 ArrayList (java.util.ArrayList)50 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)33 ByteBuf (io.netty.buffer.ByteBuf)29 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)29 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)26 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)23 BigInteger (java.math.BigInteger)21 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder)19 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)18 TransportAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)17 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)17 OutputActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder)17 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)16 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)16 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)14 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)13 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)12