use of org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInput in project openflowplugin by opendaylight.
the class NodeConfigServiceImpl method buildRequest.
@Override
protected OfHeader buildRequest(final Xid xid, final SetConfigInput input) throws ServiceException {
SetConfigInputBuilder builder = new SetConfigInputBuilder();
SwitchConfigFlag flag = SwitchConfigFlag.valueOf(input.getFlag());
builder.setXid(xid.getValue());
builder.setFlags(flag);
builder.setMissSendLen(input.getMissSearchLength());
builder.setVersion(getVersion());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInput in project openflowplugin by opendaylight.
the class SetConfigInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 02 " + "00 0a");
SetConfigInput deserializedMessage = BufferHelper.deserialize(factory, bb);
// Test Message
Assert.assertEquals("Wrong flags ", SwitchConfigFlag.forValue(2), deserializedMessage.getFlags());
Assert.assertEquals("Wrong Miss Send len ", 10, deserializedMessage.getMissSendLen().intValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInput in project openflowplugin by opendaylight.
the class SetConfigMessageFactoryTest method testSetConfigMessageV10.
/**
* Testing of {@link SetConfigMessageFactory} for correct translation from POJO.
*/
@Test
public void testSetConfigMessageV10() throws Exception {
SetConfigInputBuilder builder = new SetConfigInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
SwitchConfigFlag flag = SwitchConfigFlag.OFPCFRAGDROP;
builder.setFlags(flag);
builder.setMissSendLen(85);
SetConfigInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
setConfigFactory.serialize(message, out);
BufferHelper.checkHeaderV10(out, MESSAGE_TYPE, MESSAGE_LENGTH);
Assert.assertEquals("Wrong flags", SwitchConfigFlag.OFPCFRAGDROP.getIntValue(), out.readUnsignedShort());
Assert.assertEquals("Wrong missSendLen", 85, out.readUnsignedShort());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInput in project openflowplugin by opendaylight.
the class DefaultConfigPusherTest method testOnDataTreeChanged.
@Test
public void testOnDataTreeChanged() {
defaultConfigPusher.onDataTreeChanged(Collections.singleton(dataTreeModification));
Mockito.verify(nodeConfigService).setConfig(setConfigInputCaptor.capture());
final SetConfigInput captured = setConfigInputCaptor.getValue();
Assert.assertEquals(SwitchConfigFlag.FRAGNORMAL.toString(), captured.getFlag());
Assert.assertEquals(OFConstants.OFPCML_NO_BUFFER, captured.getMissSearchLength());
Assert.assertEquals(NODE_IID, captured.getNode().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInput in project openflowplugin by opendaylight.
the class SetConfigInputMessageFactory method deserialize.
@Override
public SetConfigInput deserialize(ByteBuf rawMessage) {
SetConfigInputBuilder builder = new SetConfigInputBuilder();
builder.setVersion(getVersion());
builder.setXid(rawMessage.readUnsignedInt());
builder.setFlags(SwitchConfigFlag.forValue(rawMessage.readUnsignedShort()));
builder.setMissSendLen(rawMessage.readUnsignedShort());
return builder.build();
}
Aggregations