use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OxmUdpSrcDeserializer method addUdpSrcValue.
private static void addUdpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
UdpSrcCaseBuilder caseBuilder = new UdpSrcCaseBuilder();
UdpSrcBuilder udpBuilder = new UdpSrcBuilder();
udpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
caseBuilder.setUdpSrc(udpBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OxmInPortDeserializer method addInPortValue.
private static void addInPortValue(ByteBuf input, MatchEntryBuilder builder) {
InPortCaseBuilder caseBuilder = new InPortCaseBuilder();
InPortBuilder inPortBuilder = new InPortBuilder();
inPortBuilder.setPortNumber(new PortNumber(input.readUnsignedInt()));
caseBuilder.setInPort(inPortBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class SctpDestinationPortEntryDeserializer 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 SctpMatchBuilder().setSctpDestinationPort(new PortNumber(port)).build());
} else if (SctpMatch.class.isInstance(builder.getLayer4Match()) && Objects.isNull(SctpMatch.class.cast(builder.getLayer4Match()).getSctpDestinationPort())) {
builder.setLayer4Match(new SctpMatchBuilder(SctpMatch.class.cast(builder.getLayer4Match())).setSctpDestinationPort(new PortNumber(port)).build());
} else {
throwErrorOnMalformed(builder, "layer4Match", "sctpDestinationPort");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class UdpDestinationPortEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int tcp = 10;
final Match sctpMatch = new MatchBuilder().setLayer4Match(new UdpMatchBuilder().setUdpDestinationPort(new PortNumber(tcp)).build()).build();
assertMatch(sctpMatch, false, (out) -> assertEquals(out.readUnsignedShort(), tcp));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class SetTpSrcActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final PortNumber port = new PortNumber(20);
// TCP
final short protocol = 6;
final Action action = new SetTpSrcActionCaseBuilder().setSetTpSrcAction(new SetTpSrcActionBuilder().setPort(port).setIpProtocol(protocol).build()).build();
assertAction(action, out -> assertEquals(Integer.valueOf(out.readUnsignedShort()), port.getValue()));
}
Aggregations