use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput in project openflowplugin by opendaylight.
the class TableModInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("09 00 00 00 00 00 00 01");
TableModInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
// Test Message
Assert.assertEquals("Wrong table id ", new TableId(9L), deserializedMessage.getTableId());
Assert.assertEquals("Wrong config ", new TableConfig(true), deserializedMessage.getConfig());
}
Aggregations