use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class OF10StatsRequestInputAggregateFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 02 00 00 00 00 00 00 00 33 00 01 02 " + "03 04 05 05 04 03 02 01 00 00 34 35 00 00 36 37 38 00 00 0a 00 00 01 " + "0a 00 00 02 00 39 00 3a 2a 00 19 fd");
MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV10(deserializedMessage);
Assert.assertEquals("Wrong type", 2, deserializedMessage.getType().getIntValue());
Assert.assertEquals("Wrong flags", new MultipartRequestFlags(false), deserializedMessage.getFlags());
Assert.assertEquals("Wrong body", createMultipartRequestBody(), deserializedMessage.getMultipartRequestBody());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method testMultipartRequestPortStatsMessageFactory.
/**
* Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestPortStatsMessageFactory() throws Exception {
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setType(MultipartType.forValue(4));
builder.setFlags(new MultipartRequestFlags(true));
builder.setMultipartRequestBody(createRequestPortStats());
MultipartRequestInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
multipartFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, (byte) 18, 24);
Assert.assertEquals("Wrong type", message.getType().getIntValue(), out.readShort());
Assert.assertEquals("Wrong flags", message.getFlags(), decodeMultipartRequestFlags(out.readShort()));
out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
Assert.assertEquals("Wrong portStatsBody", message.getMultipartRequestBody(), decodeRequestPortStats(out));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method testMultipartRequestGroupMessageFactory.
/**
* Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestGroupMessageFactory() throws Exception {
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setType(MultipartType.forValue(6));
builder.setFlags(new MultipartRequestFlags(true));
builder.setMultipartRequestBody(createRequestGroup());
MultipartRequestInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
multipartFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, (byte) 18, 24);
Assert.assertEquals("Wrong type", message.getType().getIntValue(), out.readShort());
Assert.assertEquals("Wrong flags", message.getFlags(), decodeMultipartRequestFlags(out.readShort()));
out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
Assert.assertEquals("Wrong groupBody", message.getMultipartRequestBody(), decodeRequestGroup(out));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method testMultipartRequestInputTableFactory.
/**
* Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestInputTableFactory() throws Exception {
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setType(MultipartType.forValue(3));
builder.setFlags(new MultipartRequestFlags(true));
// multipart request for registry does not have body
MultipartRequestInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
multipartFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, (byte) 18, 16);
Assert.assertEquals("Wrong type", message.getType().getIntValue(), out.readShort());
Assert.assertEquals("Wrong flags", message.getFlags(), decodeMultipartRequestFlags(out.readShort()));
out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method testMultipartRequestQueueMessageFactory.
/**
* Testing of {@link MultipartRequestInputFactory} for correct translation from POJO.
*/
@Test
public void testMultipartRequestQueueMessageFactory() throws Exception {
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setType(MultipartType.forValue(5));
builder.setFlags(new MultipartRequestFlags(true));
builder.setMultipartRequestBody(createRequestQueue());
MultipartRequestInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
multipartFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, (byte) 18, 24);
Assert.assertEquals("Wrong type", message.getType().getIntValue(), out.readShort());
Assert.assertEquals("Wrong flags", message.getFlags(), decodeMultipartRequestFlags(out.readShort()));
out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
Assert.assertEquals("Wrong queueBody", message.getMultipartRequestBody(), decodeRequestQueue(out));
}
Aggregations