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 SetTpDstActionSerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final PortNumber port = new PortNumber(20);
// TCP
final short protocol = 6;
final Action action = new SetTpDstActionCaseBuilder().setSetTpDstAction(new SetTpDstActionBuilder().setPort(port).setIpProtocol(protocol).build()).build();
assertAction(action, out -> assertEquals(Integer.valueOf(out.readUnsignedShort()), port.getValue()));
}
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 UdpSourcePortEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final int tcp = 10;
final Match sctpMatch = new MatchBuilder().setLayer4Match(new UdpMatchBuilder().setUdpSourcePort(new PortNumber(tcp)).build()).build();
assertMatch(sctpMatch, false, (out) -> assertEquals(out.readUnsignedShort(), tcp));
}
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 MultipartReplyMessageFactory method setGroupDesc.
private MultipartReplyGroupDescCase setGroupDesc(final ByteBuf input) {
MultipartReplyGroupDescCaseBuilder caseBuilder = new MultipartReplyGroupDescCaseBuilder();
MultipartReplyGroupDescBuilder builder = new MultipartReplyGroupDescBuilder();
List<GroupDesc> groupDescsList = new ArrayList<>();
while (input.readableBytes() > 0) {
GroupDescBuilder groupDescBuilder = new GroupDescBuilder();
final int bodyLength = input.readUnsignedShort();
groupDescBuilder.setType(GroupType.forValue(input.readUnsignedByte()));
input.skipBytes(PADDING_IN_GROUP_DESC_HEADER);
groupDescBuilder.setGroupId(new GroupId(input.readUnsignedInt()));
int actualLength = GROUP_DESC_HEADER_LENGTH;
List<BucketsList> bucketsList = new ArrayList<>();
while (actualLength < bodyLength) {
BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
final int bucketsLength = input.readUnsignedShort();
bucketsBuilder.setWeight(input.readUnsignedShort());
bucketsBuilder.setWatchPort(new PortNumber(input.readUnsignedInt()));
bucketsBuilder.setWatchGroup(input.readUnsignedInt());
input.skipBytes(PADDING_IN_BUCKETS_HEADER);
CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
List<Action> actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID, bucketsLength - BUCKETS_HEADER_LENGTH, input, keyMaker, registry);
bucketsBuilder.setAction(actions);
bucketsList.add(bucketsBuilder.build());
actualLength += bucketsLength;
}
groupDescBuilder.setBucketsList(bucketsList);
groupDescsList.add(groupDescBuilder.build());
}
builder.setGroupDesc(groupDescsList);
caseBuilder.setMultipartReplyGroupDesc(builder.build());
return caseBuilder.build();
}
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 OxmInPhyPortDeserializer method addInPhyPortValue.
private static void addInPhyPortValue(ByteBuf input, MatchEntryBuilder builder) {
InPhyPortCaseBuilder caseBuilder = new InPhyPortCaseBuilder();
InPhyPortBuilder inPhyPortBuilder = new InPhyPortBuilder();
inPhyPortBuilder.setPortNumber(new PortNumber(input.readUnsignedInt()));
caseBuilder.setInPhyPort(inPhyPortBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
}
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 OF10EnqueueActionDeserializer method deserialize.
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
final EnqueueCaseBuilder caseBuilder = new EnqueueCaseBuilder();
EnqueueActionBuilder actionBuilder = new EnqueueActionBuilder();
actionBuilder.setPort(new PortNumber((long) input.readUnsignedShort()));
input.skipBytes(ActionConstants.PADDING_IN_ENQUEUE_ACTION);
actionBuilder.setQueueId(new QueueId(input.readUnsignedInt()));
caseBuilder.setEnqueueAction(actionBuilder.build());
builder.setActionChoice(caseBuilder.build());
return builder.build();
}
Aggregations