Search in sources :

Example 56 with MultipartRequestInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput 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());
}
Also used : MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) ByteBuf(io.netty.buffer.ByteBuf) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Example 57 with MultipartRequestInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput 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));
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) ByteBuf(io.netty.buffer.ByteBuf) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Example 58 with MultipartRequestInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput 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));
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) ByteBuf(io.netty.buffer.ByteBuf) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Example 59 with MultipartRequestInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput 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);
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) ByteBuf(io.netty.buffer.ByteBuf) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Example 60 with MultipartRequestInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput 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));
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) ByteBuf(io.netty.buffer.ByteBuf) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)59 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)59 ByteBuf (io.netty.buffer.ByteBuf)40 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)40 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)27 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)17 MultipartRequestBody (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.MultipartRequestBody)8 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)7 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)3 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)3 ExperimenterId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId)3 MultipartRequestFlowCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase)3 MultipartRequestPortStatsCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCase)3 BigInteger (java.math.BigInteger)2 ArrayList (java.util.ArrayList)2 MultipartRequestInputFactory (org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactory)2 MultipartRequestInputFactoryTest (org.opendaylight.openflowjava.protocol.impl.serialization.factories.MultipartRequestInputFactoryTest)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 FlowWildcardsV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10)2 TableConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig)2