use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class OfToSalInPortCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull InPortCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final OpenflowVersion ofVersion = OpenflowVersion.get(data.getVersion());
final BigInteger datapathId = data.getDatapathId();
final PortNumber portNumber = source.getInPort().getPortNumber();
if (portNumber != null) {
matchBuilder.setInPort(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathId, portNumber.getValue(), ofVersion));
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.
the class SalToOfSetTpDstActionV10Case method process.
@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
SetTpDstAction settpdstaction = source.getSetTpDstAction();
SetTpDstCaseBuilder setTpDstCaseBuilder = new SetTpDstCaseBuilder();
SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
setTpDstActionBuilder.setPort(new PortNumber(settpdstaction.getPort().getValue().longValue()));
setTpDstCaseBuilder.setSetTpDstAction(setTpDstActionBuilder.build());
return Optional.of(new ActionBuilder().setActionChoice(setTpDstCaseBuilder.build()).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.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.opendaylight.openflow.common.types.rev130731.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.opendaylight.openflow.common.types.rev130731.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();
}
Aggregations