Search in sources :

Example 1 with MultipartRequestTableFeaturesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder in project openflowplugin by opendaylight.

the class MultipartRequestInputFactory method makeDefaultMultiLayerBody.

private static MultipartRequestBody makeDefaultMultiLayerBody(@Nonnull final MultipartType type, final short version) {
    switch(type) {
        case OFPMPDESC:
            return new MultipartRequestDescCaseBuilder().build();
        case OFPMPFLOW:
            final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
            MultipartRequestFlowBuilder multipartRequestFlowBuilder = new MultipartRequestFlowBuilder();
            multipartRequestFlowBuilder.setTableId(OFConstants.OFPTT_ALL);
            multipartRequestFlowBuilder.setOutPort(OFConstants.OFPP_ANY);
            multipartRequestFlowBuilder.setOutGroup(OFConstants.OFPG_ANY);
            multipartRequestFlowBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
            multipartRequestFlowBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
            switch(version) {
                case OFConstants.OFP_VERSION_1_0:
                    MatchV10Builder matchV10Builder = MatchUtil.createEmptyV10Match();
                    multipartRequestFlowBuilder.setMatchV10(matchV10Builder.build());
                    break;
                case OFConstants.OFP_VERSION_1_3:
                    multipartRequestFlowBuilder.setMatch(new MatchBuilder().setType(OxmMatchType.class).build());
                    break;
                default:
                    throw new IllegalArgumentException("Unknown version " + version);
            }
            multipartRequestFlowCaseBuilder.setMultipartRequestFlow(multipartRequestFlowBuilder.build());
            return multipartRequestFlowCaseBuilder.build();
        case OFPMPAGGREGATE:
            return new MultipartRequestAggregateCaseBuilder().build();
        case OFPMPTABLE:
            return new MultipartRequestTableCaseBuilder().build();
        case OFPMPPORTSTATS:
            MultipartRequestPortStatsCaseBuilder multipartRequestPortStatsCaseBuilder = new MultipartRequestPortStatsCaseBuilder();
            MultipartRequestPortStatsBuilder multipartRequestPortStatsBuilder = new MultipartRequestPortStatsBuilder();
            multipartRequestPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
            multipartRequestPortStatsCaseBuilder.setMultipartRequestPortStats(multipartRequestPortStatsBuilder.build());
            return multipartRequestPortStatsCaseBuilder.build();
        case OFPMPQUEUE:
            MultipartRequestQueueCaseBuilder multipartRequestQueueCaseBuilder = new MultipartRequestQueueCaseBuilder();
            MultipartRequestQueueBuilder multipartRequestQueueBuilder = new MultipartRequestQueueBuilder();
            multipartRequestQueueBuilder.setPortNo(OFConstants.OFPP_ANY);
            multipartRequestQueueBuilder.setQueueId(OFConstants.OFPQ_ALL);
            multipartRequestQueueCaseBuilder.setMultipartRequestQueue(multipartRequestQueueBuilder.build());
            return multipartRequestQueueCaseBuilder.build();
        case OFPMPGROUP:
            MultipartRequestGroupCaseBuilder multipartRequestGroupCaseBuilder = new MultipartRequestGroupCaseBuilder();
            MultipartRequestGroupBuilder multipartRequestGroupBuilder = new MultipartRequestGroupBuilder();
            GroupId groupId = new GroupId(OFConstants.OFPG_ALL);
            multipartRequestGroupBuilder.setGroupId(groupId);
            multipartRequestGroupCaseBuilder.setMultipartRequestGroup(multipartRequestGroupBuilder.build());
            return multipartRequestGroupCaseBuilder.build();
        case OFPMPGROUPDESC:
            return new MultipartRequestGroupDescCaseBuilder().build();
        case OFPMPGROUPFEATURES:
            return new MultipartRequestGroupFeaturesCaseBuilder().build();
        case OFPMPMETER:
            MultipartRequestMeterCaseBuilder multipartRequestMeterCaseBuilder = new MultipartRequestMeterCaseBuilder();
            MultipartRequestMeterBuilder multipartRequestMeterBuilder = new MultipartRequestMeterBuilder();
            MeterId meterId = new MeterId(OFConstants.OFPM_ALL);
            multipartRequestMeterBuilder.setMeterId(meterId);
            multipartRequestMeterCaseBuilder.setMultipartRequestMeter(multipartRequestMeterBuilder.build());
            return multipartRequestMeterCaseBuilder.build();
        case OFPMPMETERCONFIG:
            MultipartRequestMeterConfigCaseBuilder multipartRequestMeterConfigCaseBuilder = new MultipartRequestMeterConfigCaseBuilder();
            MultipartRequestMeterConfigBuilder multipartRequestMeterConfigBuilder = new MultipartRequestMeterConfigBuilder();
            MeterId configMeterId = new MeterId(OFConstants.OFPM_ALL);
            multipartRequestMeterConfigBuilder.setMeterId(configMeterId);
            multipartRequestMeterConfigCaseBuilder.setMultipartRequestMeterConfig(multipartRequestMeterConfigBuilder.build());
            return multipartRequestMeterConfigCaseBuilder.build();
        case OFPMPMETERFEATURES:
            return new MultipartRequestMeterFeaturesCaseBuilder().build();
        case OFPMPTABLEFEATURES:
            MultipartRequestTableFeaturesCaseBuilder tableFeaturesCaseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
            tableFeaturesCaseBuilder.setMultipartRequestTableFeatures(new MultipartRequestTableFeaturesBuilder().build());
            return tableFeaturesCaseBuilder.build();
        case OFPMPPORTDESC:
            return new MultipartRequestPortDescCaseBuilder().build();
        case OFPMPEXPERIMENTER:
            return new MultipartRequestExperimenterCaseBuilder().build();
        default:
            throw new IllegalArgumentException("Unknown MultipartType " + type);
    }
}
Also used : MultipartRequestPortStatsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder) MultipartRequestMeterConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.config._case.MultipartRequestMeterConfigBuilder) MultipartRequestMeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder) MultipartRequestQueueCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder) MultipartRequestPortDescCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortDescCaseBuilder) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId) MultipartRequestQueueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder) MultipartRequestFlowCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder) MultipartRequestFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder) MultipartRequestExperimenterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder) MultipartRequestGroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder) MultipartRequestDescCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestDescCaseBuilder) MultipartRequestMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder) MultipartRequestGroupDescCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId) MultipartRequestGroupCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCaseBuilder) MultipartRequestTableFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder) MultipartRequestTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder) MultipartRequestTableCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder) MatchV10Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder) MultipartRequestMeterConfigCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterConfigCaseBuilder) MultipartRequestMeterFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder) MultipartRequestGroupFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesCaseBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder) MultipartRequestPortStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder)

Example 2 with MultipartRequestTableFeaturesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder 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);
}
Also used : InstructionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder) OutputActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action) NextTableIdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIdsBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) WriteMetadataCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCaseBuilder) ArrayList(java.util.ArrayList) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties) GotoTableCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCaseBuilder) NextTableRelatedTableFeaturePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction) ByteBuf(io.netty.buffer.ByteBuf) MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) InstructionRelatedTableFeaturePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeaturePropertyBuilder) ActionRelatedTableFeaturePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder) ApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCaseBuilder) TableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures) TableConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig) ClearActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder) MeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCaseBuilder) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) WriteActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCaseBuilder) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder) MultipartRequestTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder) MultipartRequestTableFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder) MultipartRequestTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder) NextTableIds(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds) BigInteger(java.math.BigInteger) OxmRelatedTableFeaturePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeaturePropertyBuilder) MultipartRequestInputFactoryTest(org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactoryTest) Test(org.junit.Test)

Example 3 with MultipartRequestTableFeaturesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder in project openflowplugin by opendaylight.

the class MultipartRequestTableFeaturesTest method testMultipartRequestTableFeaturesExperimenter.

/**
 * Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
 */
@Test
public void testMultipartRequestTableFeaturesExperimenter() throws Exception {
    MultipartRequestInputFactory factory = new MultipartRequestInputFactory();
    factory.injectSerializerRegistry(mockRegistry);
    MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setType(MultipartType.forValue(12));
    builder.setFlags(new MultipartRequestFlags(true));
    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.OFPTFPTEXPERIMENTER);
    ExperimenterIdTableFeaturePropertyBuilder expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();
    expBuilder.setExperimenter(new ExperimenterId(42L));
    propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());
    List<TableFeatureProperties> properties = new ArrayList<>();
    properties.add(propBuilder.build());
    propBuilder = new TableFeaturePropertiesBuilder();
    propBuilder.setType(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS);
    expBuilder = new ExperimenterIdTableFeaturePropertyBuilder();
    expBuilder.setExperimenter(new ExperimenterId(43L));
    propBuilder.addAugmentation(ExperimenterIdTableFeatureProperty.class, expBuilder.build());
    properties.add(propBuilder.build());
    tableFeaturesBuilder.setTableFeatureProperties(properties);
    List<TableFeatures> tableFeaturesList = new ArrayList<>();
    tableFeaturesList.add(tableFeaturesBuilder.build());
    MultipartRequestTableFeaturesBuilder featuresBuilder = new MultipartRequestTableFeaturesBuilder();
    featuresBuilder.setTableFeatures(tableFeaturesList);
    MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
    caseBuilder.setMultipartRequestTableFeatures(featuresBuilder.build());
    builder.setMultipartRequestBody(caseBuilder.build());
    MultipartRequestInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    factory.serialize(message, out);
    BufferHelper.checkHeaderV13(out, (byte) 18, 80);
    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", 64, 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());
    Mockito.verify(serializer, Mockito.times(2)).serialize(Matchers.any(TableFeatureProperties.class), Matchers.any(ByteBuf.class));
}
Also used : ExperimenterIdTableFeaturePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdTableFeaturePropertyBuilder) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties) ArrayList(java.util.ArrayList) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder) MultipartRequestTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder) ByteBuf(io.netty.buffer.ByteBuf) ExperimenterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId) MultipartRequestInputFactory(org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory) MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestTableFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder) MultipartRequestTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder) TableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures) BigInteger(java.math.BigInteger) TableConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) MultipartRequestInputFactoryTest(org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactoryTest) Test(org.junit.Test)

Example 4 with MultipartRequestTableFeaturesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder in project openflowplugin by opendaylight.

the class MultipartRequestTableFeaturesInputMessageFactoryTest method createTableFeatures.

public MultipartRequestTableFeaturesCase createTableFeatures() {
    MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
    MultipartRequestTableFeaturesBuilder builder = new MultipartRequestTableFeaturesBuilder();
    builder.setTableFeatures(createTableFeaturesList());
    caseBuilder.setMultipartRequestTableFeatures(builder.build());
    return caseBuilder.build();
}
Also used : MultipartRequestTableFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder) MultipartRequestTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder)

Example 5 with MultipartRequestTableFeaturesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder in project openflowplugin by opendaylight.

the class MultipartRequestInputMessageFactory method setTableFeatures.

private MultipartRequestTableFeaturesCase setTableFeatures(ByteBuf input) {
    MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
    MultipartRequestTableFeaturesBuilder tableFeaturesBuilder = new MultipartRequestTableFeaturesBuilder();
    List<TableFeatures> features = new ArrayList<>();
    while (input.readableBytes() > 0) {
        TableFeaturesBuilder featuresBuilder = new TableFeaturesBuilder();
        final int length = input.readUnsignedShort();
        featuresBuilder.setTableId(input.readUnsignedByte());
        input.skipBytes(PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES);
        featuresBuilder.setName(ByteBufUtils.decodeNullTerminatedString(input, MAX_TABLE_NAME_LENGTH));
        byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        input.readBytes(metadataMatch);
        featuresBuilder.setMetadataMatch(new BigInteger(1, metadataMatch));
        byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        input.readBytes(metadataWrite);
        featuresBuilder.setMetadataWrite(new BigInteger(1, metadataWrite));
        featuresBuilder.setConfig(createTableConfig(input.readUnsignedInt()));
        featuresBuilder.setMaxEntries(input.readUnsignedInt());
        featuresBuilder.setTableFeatureProperties(createTableFeaturesProperties(input, length - MULTIPART_REQUEST_TABLE_FEATURES_STRUCTURE_LENGTH));
        features.add(featuresBuilder.build());
    }
    tableFeaturesBuilder.setTableFeatures(features);
    caseBuilder.setMultipartRequestTableFeatures(tableFeaturesBuilder.build());
    return caseBuilder.build();
}
Also used : MultipartRequestTableFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder) MultipartRequestTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder) TableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures) ArrayList(java.util.ArrayList) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder) MultipartRequestTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder) BigInteger(java.math.BigInteger)

Aggregations

MultipartRequestTableFeaturesCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCaseBuilder)5 MultipartRequestTableFeaturesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder)5 BigInteger (java.math.BigInteger)3 ArrayList (java.util.ArrayList)3 TableFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures)3 TableFeaturesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeaturesBuilder)3 ByteBuf (io.netty.buffer.ByteBuf)2 Test (org.junit.Test)2 MultipartRequestInputFactoryTest (org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactoryTest)2 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)2 TableConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig)2 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)2 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)2 TableFeatureProperties (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties)2 TableFeaturePropertiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder)2 MultipartRequestInputFactory (org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory)1 ActionRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder)1 ExperimenterIdTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdTableFeaturePropertyBuilder)1 InstructionRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeaturePropertyBuilder)1 NextTableRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder)1