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());
}
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);
}
}
}
}
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);
}
Aggregations