Search in sources :

Example 1 with MultipartRequestTableFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeatures in project openflowplugin by opendaylight.

the class SingleLayerTableMultipartServiceTest method buildRequest.

@Test
public void buildRequest() throws Exception {
    final UpdateTableInput input = new UpdateTableInputBuilder().setUpdatedTable(new UpdatedTableBuilder().setTableFeatures(Collections.singletonList(new TableFeaturesBuilder().setMaxEntries(MAX_ENTRIES).build())).build()).build();
    final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
    assertEquals(MultipartRequest.class, ofHeader.getImplementedInterface());
    final MultipartRequestTableFeatures result = MultipartRequestTableFeatures.class.cast(MultipartRequest.class.cast(ofHeader).getMultipartRequestBody());
    assertEquals(MAX_ENTRIES, result.getTableFeatures().get(0).getMaxEntries().longValue());
}
Also used : OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) UpdateTableInput(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput) UpdatedTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder) MultipartReplyTableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesBuilder) MultipartRequestTableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeatures) UpdateTableInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder) Test(org.junit.Test)

Example 2 with MultipartRequestTableFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeatures in project openflowplugin by opendaylight.

the class MultipartRequestInputFactory method serializeTableFeaturesBody.

private void serializeTableFeaturesBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
    if (multipartRequestBody != null) {
        MultipartRequestTableFeaturesCase tableFeaturesCase = (MultipartRequestTableFeaturesCase) multipartRequestBody;
        MultipartRequestTableFeatures tableFeatures = tableFeaturesCase.getMultipartRequestTableFeatures();
        if (tableFeatures.getTableFeatures() != null) {
            for (TableFeatures currTableFeature : tableFeatures.getTableFeatures()) {
                final int tableFeatureLengthIndex = output.writerIndex();
                output.writeShort(EncodeConstants.EMPTY_LENGTH);
                output.writeByte(currTableFeature.getTableId());
                output.writeZero(PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY);
                final byte[] nameBytes = currTableFeature.getName().getBytes(StandardCharsets.UTF_8);
                output.writeBytes(nameBytes);
                output.writeZero(32 - nameBytes.length);
                output.writeLong(currTableFeature.getMetadataMatch().longValue());
                output.writeLong(currTableFeature.getMetadataWrite().longValue());
                output.writeInt(createTableConfigBitmask(currTableFeature.getConfig()));
                output.writeInt(currTableFeature.getMaxEntries().intValue());
                writeTableFeatureProperties(output, currTableFeature.getTableFeatureProperties());
                output.setShort(tableFeatureLengthIndex, output.writerIndex() - tableFeatureLengthIndex);
            }
        }
    }
}
Also used : MultipartRequestTableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeatures) 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) MultipartRequestTableFeaturesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCase) MultipartRequestTableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeatures)

Example 3 with MultipartRequestTableFeatures

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeatures in project openflowplugin by opendaylight.

the class MultipartRequestInputFactoryTest method testMakeMultipartRequestInputTableFeatures.

@Test
public void testMakeMultipartRequestInputTableFeatures() throws Exception {
    final MultipartType mpType = MultipartType.OFPMPTABLEFEATURES;
    final MultipartRequestInput mpRqInput = (MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
    checkHeader(mpRqInput, mpType);
    final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
    Assert.assertTrue(mpRqBody instanceof MultipartRequestTableFeaturesCase);
    MultipartRequestTableFeatures mpRq = ((MultipartRequestTableFeaturesCase) mpRqBody).getMultipartRequestTableFeatures();
    Assert.assertNotNull(mpRq);
}
Also used : MultipartType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType) MultipartRequestBody(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.MultipartRequestBody) MultipartRequestTableFeaturesCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCase) MultipartRequestTableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeatures) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 MultipartRequestTableFeaturesCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableFeaturesCase)2 MultipartRequestTableFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeatures)2 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)1 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)1 OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)1 MultipartRequestBody (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.MultipartRequestBody)1 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)1 UpdateTableInput (org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput)1 UpdateTableInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder)1 UpdatedTableBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder)1 MultipartReplyTableFeaturesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesBuilder)1 MultipartRequestTableFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeatures)1 TableFeaturesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder)1