use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds in project openflowplugin by opendaylight.
the class MultipartRequestTableFeaturesTest method testMultipartRequestTableFeaturesMessageFactory.
/**
* Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestTableFeaturesMessageFactory() throws Exception {
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setType(MultipartType.forValue(12));
builder.setFlags(new MultipartRequestFlags(true));
final MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
final MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();
TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
tableFeaturesBuilder.setTableId((short) 8);
tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01 }));
tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] { 0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01 }));
tableFeaturesBuilder.setConfig(new TableConfig(true));
tableFeaturesBuilder.setMaxEntries(65L);
TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLES);
NextTableRelatedTableFeaturePropertyBuilder nextPropBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
List<NextTableIds> nextIds = new ArrayList<>();
nextIds.add(new NextTableIdsBuilder().setTableId((short) 1).build());
nextIds.add(new NextTableIdsBuilder().setTableId((short) 2).build());
nextPropBuilder.setNextTableIds(nextIds);
propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());
List<TableFeatureProperties> properties = new ArrayList<>();
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS);
nextPropBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
nextIds = new ArrayList<>();
nextPropBuilder.setNextTableIds(nextIds);
propBuilder.addAugmentation(NextTableRelatedTableFeatureProperty.class, nextPropBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONS);
List<Instruction> insIds = new ArrayList<>();
InstructionBuilder insBuilder = new InstructionBuilder();
insBuilder.setInstructionChoice(new WriteActionsCaseBuilder().build());
insIds.add(insBuilder.build());
insBuilder = new InstructionBuilder();
insBuilder.setInstructionChoice(new GotoTableCaseBuilder().build());
insIds.add(insBuilder.build());
InstructionRelatedTableFeaturePropertyBuilder insPropBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
insPropBuilder.setInstruction(insIds);
propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS);
insPropBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
insIds = new ArrayList<>();
insBuilder = new InstructionBuilder();
insBuilder.setInstructionChoice(new WriteMetadataCaseBuilder().build());
insIds.add(insBuilder.build());
insBuilder = new InstructionBuilder();
insBuilder.setInstructionChoice(new ApplyActionsCaseBuilder().build());
insIds.add(insBuilder.build());
insBuilder = new InstructionBuilder();
insBuilder.setInstructionChoice(new MeterCaseBuilder().build());
insIds.add(insBuilder.build());
insBuilder = new InstructionBuilder();
insBuilder.setInstructionChoice(new ClearActionsCaseBuilder().build());
insIds.add(insBuilder.build());
insBuilder = new InstructionBuilder();
insBuilder.setInstructionChoice(new GotoTableCaseBuilder().build());
insIds.add(insBuilder.build());
insPropBuilder.setInstruction(insIds);
propBuilder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insPropBuilder.build());
properties.add(propBuilder.build());
tableFeaturesBuilder.setTableFeatureProperties(properties);
List<TableFeatures> tableFeaturesList = new ArrayList<>();
tableFeaturesList.add(tableFeaturesBuilder.build());
tableFeaturesBuilder = new TableFeaturesBuilder();
tableFeaturesBuilder.setTableId((short) 8);
tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01 }));
tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] { 0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01 }));
tableFeaturesBuilder.setConfig(new TableConfig(true));
tableFeaturesBuilder.setMaxEntries(67L);
properties = new ArrayList<>();
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONS);
ActionRelatedTableFeaturePropertyBuilder actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
List<Action> actions = new ArrayList<>();
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setActionChoice(new OutputActionCaseBuilder().build());
actions.add(actionBuilder.build());
actBuilder.setAction(actions);
propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS);
actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
actions = new ArrayList<>();
actBuilder.setAction(actions);
propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONS);
actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
actions = new ArrayList<>();
actBuilder.setAction(actions);
propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS);
actBuilder = new ActionRelatedTableFeaturePropertyBuilder();
actions = new ArrayList<>();
actBuilder.setAction(actions);
propBuilder.addAugmentation(ActionRelatedTableFeatureProperty.class, actBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTMATCH);
MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(InPhyPort.class);
entriesBuilder.setHasMask(false);
List<MatchEntry> entries = new ArrayList<>();
entries.add(entriesBuilder.build());
entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(InPort.class);
entriesBuilder.setHasMask(false);
entries.add(entriesBuilder.build());
OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
oxmBuilder.setMatchEntry(entries);
propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTWILDCARDS);
oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
entries = new ArrayList<>();
oxmBuilder.setMatchEntry(entries);
propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELD);
oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
entries = new ArrayList<>();
oxmBuilder.setMatchEntry(entries);
propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS);
oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
entries = new ArrayList<>();
oxmBuilder.setMatchEntry(entries);
propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD);
oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
entries = new ArrayList<>();
entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(IpProto.class);
entriesBuilder.setHasMask(false);
entries.add(entriesBuilder.build());
entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(IpEcn.class);
entriesBuilder.setHasMask(false);
entries.add(entriesBuilder.build());
oxmBuilder.setMatchEntry(entries);
propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
properties.add(propBuilder.build());
propBuilder = new TableFeaturePropertiesBuilder();
propBuilder.setType(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS);
oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
entries = new ArrayList<>();
oxmBuilder.setMatchEntry(entries);
propBuilder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
properties.add(propBuilder.build());
tableFeaturesBuilder.setTableFeatureProperties(properties);
tableFeaturesList.add(tableFeaturesBuilder.build());
featuresBuilder.setTableFeatures(tableFeaturesList);
caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());
builder.setMultipartRequestBody(caseBuilder.build());
MultipartRequestInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
multipartFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, (byte) 18, 296);
Assert.assertEquals("Wrong type", 12, out.readUnsignedShort());
Assert.assertEquals("Wrong flags", 1, out.readUnsignedShort());
out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
Assert.assertEquals("Wrong length", 120, out.readUnsignedShort());
Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
out.skipBytes(5);
Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG", ByteBufUtils.decodeNullTerminatedString(out, 32));
byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
out.readBytes(metadataMatch);
Assert.assertArrayEquals("Wrong metadata-match", new byte[] { 0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01 }, metadataMatch);
byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
out.readBytes(metadataWrite);
Assert.assertArrayEquals("Wrong metadata-write", new byte[] { 0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01 }, metadataWrite);
Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
Assert.assertEquals("Wrong max-entries", 65, out.readUnsignedInt());
Assert.assertEquals("Wrong property type", 2, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 6, out.readUnsignedShort());
Assert.assertEquals("Wrong next-registry-id", 1, out.readUnsignedByte());
Assert.assertEquals("Wrong next-registry-id", 2, out.readUnsignedByte());
out.skipBytes(2);
Assert.assertEquals("Wrong property type", 3, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 0, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 1, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 24, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
Assert.assertEquals("Wrong instruction length", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong length", 160, out.readUnsignedShort());
Assert.assertEquals("Wrong registry-id", 8, out.readUnsignedByte());
out.skipBytes(5);
Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG", ByteBufUtils.decodeNullTerminatedString(out, 32));
metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
out.readBytes(metadataMatch);
Assert.assertArrayEquals("Wrong metadata-match", new byte[] { 0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01 }, metadataMatch);
metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
out.readBytes(metadataWrite);
Assert.assertArrayEquals("Wrong metadata-write", new byte[] { 0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01 }, metadataWrite);
Assert.assertEquals("Wrong config", 8, out.readUnsignedInt());
Assert.assertEquals("Wrong max-entries", 67, out.readUnsignedInt());
Assert.assertEquals("Wrong property type", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 8, out.readUnsignedShort());
Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
Assert.assertEquals("Wrong property type", 5, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 6, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 7, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 8, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
Assert.assertEquals("Wrong match field&mask", 2, out.readUnsignedByte());
Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());
Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
Assert.assertEquals("Wrong match field&mask", 0, out.readUnsignedByte());
Assert.assertEquals("Wrong match length", 4, out.readUnsignedByte());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 10, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 12, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 13, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 14, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 12, out.readUnsignedShort());
Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
Assert.assertEquals("Wrong match field&mask", 20, out.readUnsignedByte());
Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());
Assert.assertEquals("Wrong match class", 0x8000, out.readUnsignedShort());
Assert.assertEquals("Wrong match field&mask", 18, out.readUnsignedByte());
Assert.assertEquals("Wrong match length", 1, out.readUnsignedByte());
out.skipBytes(4);
Assert.assertEquals("Wrong property type", 15, out.readUnsignedShort());
Assert.assertEquals("Wrong property length", 4, out.readUnsignedShort());
out.skipBytes(4);
Assert.assertTrue("Unread data", out.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method createTableFeaturesProperties.
private List<TableFeatureProperties> createTableFeaturesProperties(final ByteBuf input, final 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.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds in project openflowplugin by opendaylight.
the class MultipartRequestInputFactory method writeNextTableRelatedTableProperty.
private static void writeNextTableRelatedTableProperty(final ByteBuf output, final TableFeatureProperties property, final byte code) {
final int startIndex = output.writerIndex();
output.writeShort(code);
int lengthIndex = output.writerIndex();
output.writeShort(EncodeConstants.EMPTY_LENGTH);
List<NextTableIds> nextTableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class).getNextTableIds();
if (nextTableIds != null) {
for (NextTableIds next : nextTableIds) {
output.writeByte(next.getTableId());
}
}
int length = output.writerIndex() - startIndex;
output.setShort(lengthIndex, length);
output.writeZero(paddingNeeded(length));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds in project openflowplugin by opendaylight.
the class MultipartRequestTableFeaturesInputMessageFactoryTest method createNextTableIds.
public List<NextTableIds> createNextTableIds() {
List<NextTableIds> list = new ArrayList<>();
NextTableIdsBuilder builder = new NextTableIdsBuilder();
builder.setTableId((short) 1);
list.add(builder.build());
return list;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds in project openflowplugin by opendaylight.
the class MultipartReplyTableFeaturesTest method testMultipartReplyTableFeatures2.
/**
* Testing {@link MultipartReplyMessageFactory} for correct translation into POJO.
*/
@Test
public void testMultipartReplyTableFeatures2() {
ByteBuf bb = BufferHelper.buildBuffer(//
"00 0C 00 00 00 00 00 00 " + // length, tableId, padding
"00 B0 01 00 00 00 00 00 " + //
"4F 70 65 6E 64 61 79 6C 69 67 68 74 00 00 00 00 00 00 00 " + // name
"00 00 00 00 00 00 00 00 00 00 00 00 00 " + // metadata match
"00 00 00 00 00 00 00 01 " + // metadata write
"00 00 00 00 00 00 00 02 " + // config
"00 00 00 00 " + // max entries
"00 00 00 2A " + //
"00 00 00 04 00 00 00 00 " + //
"00 01 00 04 00 00 00 00 " + //
"00 02 00 08 01 02 03 04 " + //
"00 03 00 07 05 06 07 00 " + //
"00 04 00 04 00 00 00 00 " + //
"00 05 00 04 00 00 00 00 " + //
"00 06 00 04 00 00 00 00 " + //
"00 07 00 04 00 00 00 00 " + //
"00 08 00 04 00 00 00 00 " + //
"00 0A 00 04 00 00 00 00 " + //
"00 0C 00 04 00 00 00 00 " + //
"00 0D 00 04 00 00 00 00 " + //
"00 0E 00 04 00 00 00 00 " + "00 0F 00 04 00 00 00 00");
MultipartReplyMessage builtByFactory = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
Assert.assertEquals("Wrong type", 12, builtByFactory.getType().getIntValue());
Assert.assertEquals("Wrong flag", false, builtByFactory.getFlags().isOFPMPFREQMORE());
MultipartReplyTableFeaturesCase messageCase = (MultipartReplyTableFeaturesCase) builtByFactory.getMultipartReplyBody();
MultipartReplyTableFeatures message = messageCase.getMultipartReplyTableFeatures();
Assert.assertEquals("Wrong table features size", 1, message.getTableFeatures().size());
TableFeatures feature = message.getTableFeatures().get(0);
Assert.assertEquals("Wrong table id", 1, feature.getTableId().intValue());
Assert.assertEquals("Wrong name", "Opendaylight", feature.getName());
Assert.assertArrayEquals("Wrong metadata match", new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }, feature.getMetadataMatch());
Assert.assertArrayEquals("Wrong metadata write", new byte[] { 0, 0, 0, 0, 0, 0, 0, 2 }, feature.getMetadataWrite());
Assert.assertEquals("Wrong config", false, feature.getConfig().isOFPTCDEPRECATEDMASK());
Assert.assertEquals("Wrong max entries", 42, feature.getMaxEntries().intValue());
Assert.assertEquals("Wrong properties size", 14, feature.getTableFeatureProperties().size());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONS, feature.getTableFeatureProperties().get(0).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS, feature.getTableFeatureProperties().get(1).getType());
TableFeatureProperties property = feature.getTableFeatureProperties().get(2);
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLES, property.getType());
List<NextTableIds> tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class).getNextTableIds();
Assert.assertEquals("Wrong next table id size", 4, tableIds.size());
Assert.assertEquals("Wrong next table id", 1, tableIds.get(0).getTableId().intValue());
Assert.assertEquals("Wrong next table id", 2, tableIds.get(1).getTableId().intValue());
Assert.assertEquals("Wrong next table id", 3, tableIds.get(2).getTableId().intValue());
Assert.assertEquals("Wrong next table id", 4, tableIds.get(3).getTableId().intValue());
property = feature.getTableFeatureProperties().get(3);
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTNEXTTABLESMISS, property.getType());
tableIds = property.getAugmentation(NextTableRelatedTableFeatureProperty.class).getNextTableIds();
Assert.assertEquals("Wrong next table id size", 3, tableIds.size());
Assert.assertEquals("Wrong next table id", 5, tableIds.get(0).getTableId().intValue());
Assert.assertEquals("Wrong next table id", 6, tableIds.get(1).getTableId().intValue());
Assert.assertEquals("Wrong next table id", 7, tableIds.get(2).getTableId().intValue());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONS, feature.getTableFeatureProperties().get(4).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS, feature.getTableFeatureProperties().get(5).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONS, feature.getTableFeatureProperties().get(6).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS, feature.getTableFeatureProperties().get(7).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTMATCH, feature.getTableFeatureProperties().get(8).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWILDCARDS, feature.getTableFeatureProperties().get(9).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELD, feature.getTableFeatureProperties().get(10).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS, feature.getTableFeatureProperties().get(11).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELD, feature.getTableFeatureProperties().get(12).getType());
Assert.assertEquals("Wrong property type", TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS, feature.getTableFeatureProperties().get(13).getType());
}
Aggregations