use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput in project openflowplugin by opendaylight.
the class ConnectionAdapterImplTest method testConsume3.
/**
* Tests {@link ConnectionAdapterImpl#consume(DataObject)} with expected rpc.
*/
@Test
public void testConsume3() {
final BarrierInputBuilder inputBuilder = new BarrierInputBuilder();
inputBuilder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
inputBuilder.setXid(42L);
final BarrierInput barrierInput = inputBuilder.build();
final RpcResponseKey key = new RpcResponseKey(42L, "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput");
final ResponseExpectedRpcListener<OfHeader> listener = new ResponseExpectedRpcListener<>(barrierInput, "failure", mockCache, key);
cache.put(key, listener);
final BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();
barrierBuilder.setXid(42L);
final BarrierOutput barrierOutput = barrierBuilder.build();
adapter.consume(barrierOutput);
final ResponseExpectedRpcListener<?> ifPresent = cache.getIfPresent(key);
Assert.assertNull("Listener was not discarded", ifPresent);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput in project openflowplugin by opendaylight.
the class ConnectionAdapterImplTest method testConsume2.
/**
* Tests {@link ConnectionAdapterImpl#consume(DataObject)} with unexpected rpc.
*/
@Test
public void testConsume2() {
adapter.setResponseCache(mockCache);
final BarrierOutputBuilder barrierBuilder = new BarrierOutputBuilder();
barrierBuilder.setXid(42L);
final BarrierOutput barrier = barrierBuilder.build();
adapter.consume(barrier);
verify(mockCache, times(1)).getIfPresent(any(RpcResponseKey.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput in project openflowplugin by opendaylight.
the class BarrierReplyMessageFactory method deserialize.
@Override
public BarrierOutput deserialize(ByteBuf rawMessage) {
BarrierOutputBuilder builder = new BarrierOutputBuilder();
builder.setVersion(getVersion());
builder.setXid(rawMessage.readUnsignedInt());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput in project openflowplugin by opendaylight.
the class OF10BarrierReplyMessageFactoryTest method testSerialize.
@Test
public void testSerialize() throws Exception {
BarrierOutputBuilder builder = new BarrierOutputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
BarrierOutput message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
factory.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV10(serializedBuffer, MESSAGE_TYPE, 8);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput in project openflowplugin by opendaylight.
the class BarrierReplyMessageFactoryTest method testSerialize.
@Test
public void testSerialize() throws Exception {
BarrierOutputBuilder builder = new BarrierOutputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
BarrierOutput message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
factory.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 8);
}
Aggregations