use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class OF10StatsRequestInputTableFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 03 00 00");
MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV10(deserializedMessage);
Assert.assertEquals("Wrong type", 3, 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.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class MultipartRequestGroupDescTest method test.
/**
* Tests {@link MultipartRequestInputFactory} - GroupDesc case.
*/
@Test
public void test() throws Exception {
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setType(MultipartType.OFPMPGROUPDESC);
builder.setFlags(new MultipartRequestFlags(false));
MultipartRequestGroupDescCaseBuilder caseBuilder = new MultipartRequestGroupDescCaseBuilder();
MultipartRequestGroupDescBuilder descBuilder = new MultipartRequestGroupDescBuilder();
descBuilder.setEmpty(true);
caseBuilder.setMultipartRequestGroupDesc(descBuilder.build());
builder.setMultipartRequestBody(caseBuilder.build());
MultipartRequestInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
multipartFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, (byte) 18, 16);
Assert.assertEquals("Wrong type", 7, out.readUnsignedShort());
Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
// skip padding
out.skipBytes(4);
Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class MultipartRequestAggregateInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 08 00 " + "00 00 00 00 00 55 00 00 00 5f 00 00 00 00 00 01 01 01 01 01 " + "01 01 00 01 01 01 01 01 01 01");
MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong type", MultipartType.forValue(2), deserializedMessage.getType());
Assert.assertEquals("Wrong flags", new MultipartRequestFlags(true), deserializedMessage.getFlags());
Assert.assertEquals("Wrong aggregate", createRequestAggregate(), deserializedMessage.getMultipartRequestBody());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class MultipartRequestFlowInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 01 00 01 00 00 00 00 " + "08 00 00 00 00 00 00 55 00 00 00 5f 00 " + "00 00 00 00 01 01 01 01 01 01 01 00 01 01 01 01 01 01 01");
MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong type", MultipartType.forValue(1), deserializedMessage.getType());
Assert.assertEquals("Wrong flags", new MultipartRequestFlags(true), deserializedMessage.getFlags());
Assert.assertEquals("Wrong flow", createRequestFlow(), deserializedMessage.getMultipartRequestBody());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class MultipartRequestInputFactory method serializeExperimenterBody.
private void serializeExperimenterBody(final MultipartRequestInput message, final ByteBuf outBuffer) {
MultipartRequestExperimenterCase expCase = (MultipartRequestExperimenterCase) message.getMultipartRequestBody();
MultipartRequestExperimenter experimenter = expCase.getMultipartRequestExperimenter();
final long expId = experimenter.getExperimenter().getValue().longValue();
final long expType = experimenter.getExpType().longValue();
// write experimenterId and type
outBuffer.writeInt((int) expId);
outBuffer.writeInt((int) expType);
// serialize experimenter data
OFSerializer<ExperimenterDataOfChoice> serializer = registry.getSerializer(ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey(EncodeConstants.OF13_VERSION_ID, expId, expType));
serializer.serialize(experimenter.getExperimenterDataOfChoice(), outBuffer);
}
Aggregations