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());
}
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();
}
Aggregations