use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder in project openflowplugin by opendaylight.
the class MultipartReplyTableFeaturesDeserializer method readTableProperties.
private TableProperties readTableProperties(ByteBuf message, int length) {
final List<TableFeatureProperties> items = new ArrayList<>();
int tableFeaturesLength = length;
int order = 0;
while (tableFeaturesLength > 0) {
final int propStartIndex = message.readerIndex();
final TableFeaturesPropType propType = TableFeaturesPropType.forValue(message.readUnsignedShort());
int propertyLength = message.readUnsignedShort();
final int paddingRemainder = propertyLength % EncodeConstants.PADDING;
tableFeaturesLength -= propertyLength;
final int commonPropertyLength = propertyLength - COMMON_PROPERTY_LENGTH;
final TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder().setOrder(order).setKey(new TableFeaturePropertiesKey(order));
switch(propType) {
case OFPTFPTINSTRUCTIONS:
propBuilder.setTableFeaturePropType(new InstructionsBuilder().setInstructions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder().setInstruction(readInstructions(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTINSTRUCTIONSMISS:
propBuilder.setTableFeaturePropType(new InstructionsMissBuilder().setInstructionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder().setInstruction(readInstructions(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTNEXTTABLES:
propBuilder.setTableFeaturePropType(new NextTableBuilder().setTables(new TablesBuilder().setTableIds(readNextTableIds(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTNEXTTABLESMISS:
propBuilder.setTableFeaturePropType(new NextTableMissBuilder().setTablesMiss(new TablesMissBuilder().setTableIds(readNextTableIds(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTWRITEACTIONS:
propBuilder.setTableFeaturePropType(new WriteActionsBuilder().setWriteActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActionsBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTWRITEACTIONSMISS:
propBuilder.setTableFeaturePropType(new WriteActionsMissBuilder().setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMissBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTAPPLYACTIONS:
propBuilder.setTableFeaturePropType(new ApplyActionsBuilder().setApplyActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTAPPLYACTIONSMISS:
propBuilder.setTableFeaturePropType(new ApplyActionsMissBuilder().setApplyActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTMATCH:
propBuilder.setTableFeaturePropType(new MatchBuilder().setMatchSetfield(new MatchSetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTWILDCARDS:
propBuilder.setTableFeaturePropType(new WildcardsBuilder().setWildcardSetfield(new WildcardSetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTWRITESETFIELD:
propBuilder.setTableFeaturePropType(new WriteSetfieldBuilder().setWriteSetfield(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTWRITESETFIELDMISS:
propBuilder.setTableFeaturePropType(new WriteSetfieldMissBuilder().setWriteSetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTAPPLYSETFIELD:
propBuilder.setTableFeaturePropType(new ApplySetfieldBuilder().setApplySetfield(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTAPPLYSETFIELDMISS:
propBuilder.setTableFeaturePropType(new ApplySetfieldMissBuilder().setApplySetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
break;
case OFPTFPTEXPERIMENTER:
case OFPTFPTEXPERIMENTERMISS:
final long expId = message.readUnsignedInt();
message.readerIndex(propStartIndex);
final OFDeserializer<TableFeatureProperties> propDeserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId));
// TODO: Finish experimenter table features (currently using OFJava deserialization only to skip
// bytes)
propDeserializer.deserialize(message);
LOG.debug("Table feature property type {} is not handled yet.", propType);
break;
default:
}
if (paddingRemainder != 0) {
message.skipBytes(EncodeConstants.PADDING - paddingRemainder);
tableFeaturesLength -= EncodeConstants.PADDING - paddingRemainder;
}
items.add(propBuilder.build());
order++;
}
return new TablePropertiesBuilder().setTableFeatureProperties(items).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder in project openflowplugin by opendaylight.
the class TableFeaturesConvertorTest method setupTest.
@Before
public void setupTest() {
setupInstructionsList();
setupActions();
setupFieldTableFeatures();
InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
List<Instruction> instructions = new ArrayList<>();
for (int i = 0; i < INSTRUCTIONS_LIST.size(); i++) {
InstructionBuilder instructionBuilder = new InstructionBuilder();
instructionBuilder.setInstruction(INSTRUCTIONS_LIST.get(i));
instructions.add(instructionBuilder.build());
}
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder instructionsBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder();
instructionsBuilder1.setInstruction(instructions);
instructionsBuilder.setInstructions(instructionsBuilder1.build());
AUGMENTATIONS_MAP.put(Instructions.class, instructionsBuilder.build());
InstructionsMissBuilder instructionsMissBuilder = new InstructionsMissBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder instructionsMissBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder();
instructionsMissBuilder1.setInstruction(instructions);
instructionsMissBuilder.setInstructionsMiss(instructionsMissBuilder1.build());
AUGMENTATIONS_MAP.put(InstructionsMiss.class, instructionsMissBuilder.build());
NextTableBuilder nextTableBuilder = new NextTableBuilder();
AUGMENTATIONS_MAP.put(NextTable.class, nextTableBuilder.build());
NextTableMissBuilder nextTableMissBuilder = new NextTableMissBuilder();
AUGMENTATIONS_MAP.put(NextTableMiss.class, nextTableMissBuilder.build());
WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
AUGMENTATIONS_MAP.put(WriteActions.class, writeActionsBuilder.build());
WriteActionsMissBuilder writeActionsMissBuilder = new WriteActionsMissBuilder();
AUGMENTATIONS_MAP.put(WriteActionsMiss.class, writeActionsMissBuilder.build());
ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
AUGMENTATIONS_MAP.put(ApplyActions.class, applyActionsBuilder.build());
ApplyActionsMissBuilder applyActionsMissBuilder = new ApplyActionsMissBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder applyActionsMissBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder();
applyActionsMissBuilder1.setAction(ACTIONS);
applyActionsMissBuilder.setApplyActionsMiss(applyActionsMissBuilder1.build());
AUGMENTATIONS_MAP.put(ApplyActionsMiss.class, applyActionsMissBuilder.build());
MatchBuilder matchBuilder = new MatchBuilder();
AUGMENTATIONS_MAP.put(Match.class, matchBuilder.build());
WildcardsBuilder wildcardsBuilder = new WildcardsBuilder();
AUGMENTATIONS_MAP.put(Wildcards.class, wildcardsBuilder.build());
WriteSetfieldBuilder writeSetfieldBuilder = new WriteSetfieldBuilder();
AUGMENTATIONS_MAP.put(WriteSetfield.class, writeSetfieldBuilder.build());
WriteSetfieldMissBuilder writeSetfieldMissBuilder = new WriteSetfieldMissBuilder();
AUGMENTATIONS_MAP.put(WriteSetfieldMiss.class, writeSetfieldMissBuilder.build());
ApplySetfieldBuilder applySetfieldBuilder = new ApplySetfieldBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder applySetfieldBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder();
applySetfieldBuilder1.setSetFieldMatch(FIELD_TABLE_FEATURES);
applySetfieldBuilder.setApplySetfield(applySetfieldBuilder1.build());
AUGMENTATIONS_MAP.put(ApplySetfield.class, applySetfieldBuilder.build());
ApplySetfieldMissBuilder applySetfieldMissBuilder = new ApplySetfieldMissBuilder();
AUGMENTATIONS_MAP.put(ApplySetfieldMiss.class, applySetfieldMissBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder in project openflowplugin by opendaylight.
the class ApplySetfieldMissTablePropertySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final ApplySetfieldMiss property = new ApplySetfieldMissBuilder().setApplySetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder().setSetFieldMatch(ImmutableList.<SetFieldMatch>builder().add(new SetFieldMatchBuilder().setMatchType(ArpOp.class).setHasMask(false).build()).build()).build()).build();
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
// Skip match entry length
out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTableFeaturesTestCommandProvider method createApplySetFieldMissTblFeatureProp.
private TableFeaturePropertiesBuilder createApplySetFieldMissTblFeatureProp() {
// t14
SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
setFieldMatchBld1.setHasMask(false);
setFieldMatchBld1.setMatchType(ArpOp.class);
SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder();
setFieldMatchBld2.setHasMask(true);
setFieldMatchBld2.setMatchType(InPort.class);
SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder();
setFieldMatchBld3.setHasMask(true);
setFieldMatchBld3.setMatchType(Ipv4Dst.class);
List<SetFieldMatch> setFieldMatch = new ArrayList<>();
setFieldMatch.add(setFieldMatchBld1.build());
setFieldMatch.add(setFieldMatchBld2.build());
setFieldMatch.add(setFieldMatchBld3.build());
ApplySetfieldMissBuilder applySetfieldMissBld = new ApplySetfieldMissBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder applySetfieldMissBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder();
applySetfieldMissBuilder.setSetFieldMatch(setFieldMatch);
applySetfieldMissBld.setApplySetfieldMiss(applySetfieldMissBuilder.build());
TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
tableFeatureProperty.setTableFeaturePropType(applySetfieldMissBld.build());
TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
tableFeatureProperty.setKey(keyValue);
tableFeatureProperty.setOrder(1);
return tableFeatureProperty;
}
Aggregations