Search in sources :

Example 1 with TableModInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInputBuilder in project openflowplugin by opendaylight.

the class TableModInputMessageFactoryTest method testTableModInput.

/**
 * Testing of {@link TableModInputMessageFactory} for correct translation from POJO.
 */
@Test
public void testTableModInput() throws Exception {
    TableModInputBuilder builder = new TableModInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setTableId(new TableId(9L));
    builder.setConfig(new TableConfig(true));
    TableModInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    tableModFactory.serialize(message, out);
    BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, 16);
    Assert.assertEquals("Wrong TableID", message.getTableId().getValue().intValue(), out.readUnsignedByte());
    out.skipBytes(PADDING_IN_TABLE_MOD_MESSAGE);
    Assert.assertEquals("Wrong TableConfig", 8, out.readUnsignedInt());
}
Also used : TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId) TableModInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput) TableConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig) ByteBuf(io.netty.buffer.ByteBuf) TableModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInputBuilder) Test(org.junit.Test)

Example 2 with TableModInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInputBuilder in project openflowplugin by opendaylight.

the class TableModInputMessageFactory method deserialize.

@Override
public TableModInput deserialize(ByteBuf rawMessage) {
    TableModInputBuilder builder = new TableModInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setTableId(new TableId((long) rawMessage.readUnsignedByte()));
    rawMessage.skipBytes(PADDING_IN_TABLE_MOD_MESSAGE);
    builder.setConfig(createTableConfig(rawMessage.readUnsignedInt()));
    return builder.build();
}
Also used : TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId) TableModInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInputBuilder)

Aggregations

TableId (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId)2 TableModInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInputBuilder)2 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 TableConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig)1 TableModInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput)1