use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class MultipartRequestInputMessageFactory method createTableFeaturesProperties.
private List<TableFeatureProperties> createTableFeaturesProperties(ByteBuf input, int length) {
List<TableFeatureProperties> properties = new ArrayList<>();
int tableFeaturesLength = length;
while (tableFeaturesLength > 0) {
int propStartIndex = input.readerIndex();
TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();
TableFeaturesPropType type = TableFeaturesPropType.forValue(input.readUnsignedShort());
builder.setType(type);
int propertyLength = input.readUnsignedShort();
int paddingRemainder = propertyLength % EncodeConstants.PADDING;
tableFeaturesLength -= propertyLength;
if (type.equals(TableFeaturesPropType.OFPTFPTINSTRUCTIONS) || type.equals(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS)) {
InstructionRelatedTableFeaturePropertyBuilder insBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
List<Instruction> instructions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID, propertyLength - COMMON_PROPERTY_LENGTH, input, keyMaker, registry);
insBuilder.setInstruction(instructions);
builder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insBuilder.build());
} else if (type.equals(TableFeaturesPropType.OFPTFPTNEXTTABLES) || type.equals(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS)) {
propertyLength -= COMMON_PROPERTY_LENGTH;
NextTableRelatedTableFeaturePropertyBuilder tableBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
List<NextTableIds> ids = new ArrayList<>();
while (propertyLength > 0) {
NextTableIdsBuilder nextTableIdsBuilder = new NextTableIdsBuilder();
nextTableIdsBuilder.setTableId(input.readUnsignedByte());
ids.add(nextTableIdsBuilder.build());
propertyLength--;
}
tableBuilder.setNextTableIds(ids);
builder.addAugmentation(NextTableRelatedTableFeatureProperty.class, tableBuilder.build());
} else if (type.equals(TableFeaturesPropType.OFPTFPTWRITEACTIONS) || type.equals(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS) || type.equals(TableFeaturesPropType.OFPTFPTAPPLYACTIONS) || type.equals(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS)) {
ActionRelatedTableFeaturePropertyBuilder actionBuilder = new ActionRelatedTableFeaturePropertyBuilder();
CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
List<Action> actions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID, propertyLength - COMMON_PROPERTY_LENGTH, input, keyMaker, registry);
actionBuilder.setAction(actions);
builder.addAugmentation(ActionRelatedTableFeatureProperty.class, actionBuilder.build());
} else if (type.equals(TableFeaturesPropType.OFPTFPTMATCH) || type.equals(TableFeaturesPropType.OFPTFPTWILDCARDS) || type.equals(TableFeaturesPropType.OFPTFPTWRITESETFIELD) || type.equals(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS) || type.equals(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD) || type.equals(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS)) {
OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
List<MatchEntry> entries = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID, propertyLength - COMMON_PROPERTY_LENGTH, input, keyMaker, registry);
oxmBuilder.setMatchEntry(entries);
builder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
} else if (type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER) || type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS)) {
long expId = input.readUnsignedInt();
input.readerIndex(propStartIndex);
OFDeserializer<TableFeatureProperties> propDeserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId));
TableFeatureProperties expProp = propDeserializer.deserialize(input);
properties.add(expProp);
continue;
}
if (paddingRemainder != 0) {
input.skipBytes(EncodeConstants.PADDING - paddingRemainder);
tableFeaturesLength -= EncodeConstants.PADDING - paddingRemainder;
}
properties.add(builder.build());
}
return properties;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class ClearActionsInstructionDeserializer method deserialize.
@Override
public Instruction deserialize(ByteBuf input) {
InstructionBuilder builder = new InstructionBuilder();
input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
builder.setInstructionChoice(new ClearActionsCaseBuilder().build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class MeterInstructionDeserializer method deserialize.
@Override
public Instruction deserialize(ByteBuf input) {
final InstructionBuilder builder = new InstructionBuilder();
input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
MeterCaseBuilder caseBuilder = new MeterCaseBuilder();
MeterBuilder instructionBuilder = new MeterBuilder();
instructionBuilder.setMeterId(input.readUnsignedInt());
caseBuilder.setMeter(instructionBuilder.build());
builder.setInstructionChoice(caseBuilder.build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class MeterInstructionDeserializer method deserializeHeader.
@Override
public Instruction deserializeHeader(ByteBuf input) {
InstructionBuilder builder = new InstructionBuilder();
input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
builder.setInstructionChoice(new MeterCaseBuilder().build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction in project openflowplugin by opendaylight.
the class WriteMetadataInstructionDeserializer method deserialize.
@Override
public Instruction deserialize(ByteBuf input) {
final InstructionBuilder builder = new InstructionBuilder();
input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
input.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);
final WriteMetadataCaseBuilder caseBuilder = new WriteMetadataCaseBuilder();
WriteMetadataBuilder metadataBuilder = new WriteMetadataBuilder();
byte[] metadata = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(metadata);
metadataBuilder.setMetadata(metadata);
byte[] metadataMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(metadataMask);
metadataBuilder.setMetadataMask(metadataMask);
caseBuilder.setWriteMetadata(metadataBuilder.build());
builder.setInstructionChoice(caseBuilder.build());
return builder.build();
}
Aggregations