Search in sources :

Example 11 with CodeKeyMaker

use of org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker in project openflowplugin by opendaylight.

the class GroupModInputMessageFactory method deserialize.

@Override
public GroupModInput deserialize(ByteBuf rawMessage) {
    GroupModInputBuilder builder = new GroupModInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setCommand(GroupModCommand.forValue(rawMessage.readUnsignedShort()));
    builder.setType(GroupType.forValue(rawMessage.readUnsignedByte()));
    rawMessage.skipBytes(PADDING);
    builder.setGroupId(new GroupId(rawMessage.readUnsignedInt()));
    List<BucketsList> bucketsList = new ArrayList<>();
    while (rawMessage.readableBytes() > 0) {
        BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
        final int bucketsLength = rawMessage.readUnsignedShort();
        bucketsBuilder.setWeight(rawMessage.readUnsignedShort());
        bucketsBuilder.setWatchPort(new PortNumber(rawMessage.readUnsignedInt()));
        bucketsBuilder.setWatchGroup(rawMessage.readUnsignedInt());
        rawMessage.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, rawMessage, keyMaker, registry);
        bucketsBuilder.setAction(actions);
        bucketsList.add(bucketsBuilder.build());
    }
    builder.setBucketsList(bucketsList);
    return builder.build();
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) BucketsListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsListBuilder) ArrayList(java.util.ArrayList) CodeKeyMaker(org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker) GroupModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInputBuilder) BucketsList(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId)

Aggregations

CodeKeyMaker (org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker)11 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)9 ArrayList (java.util.ArrayList)6 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)6 BigInteger (java.math.BigInteger)4 MessageCodeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey)4 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction)4 BucketsList (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList)3 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 List (java.util.List)2 ActionRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder)2 InstructionRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeaturePropertyBuilder)2 NextTableRelatedTableFeatureProperty (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty)2 NextTableRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder)2 OxmRelatedTableFeatureProperty (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeatureProperty)2 OxmRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeaturePropertyBuilder)2 NextTableIdsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIdsBuilder)2 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId)2 TableFeaturesPropType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType)2 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.Match)2