use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput in project openflowplugin by opendaylight.
the class BarrierInputMessageFactoryTest method test.
/**
* Testing of {@link BarrierInputMessageFactory} for correct translation from POJO.
*/
@Test
public void test() throws Exception {
BarrierInputBuilder bib = new BarrierInputBuilder();
BufferHelper.setupHeader(bib, EncodeConstants.OF13_VERSION_ID);
BarrierInput bi = bib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
barrierFactory.serialize(bi, out);
BufferHelper.checkHeaderV13(out, BARRIER_REQUEST_MESSAGE_CODE_TYPE, 8);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput in project openflowplugin by opendaylight.
the class BarrierUtilTest method testCreateSendBarrierInput.
@Test
public void testCreateSendBarrierInput() throws Exception {
final SendBarrierInput barrierInput = BarrierUtil.createSendBarrierInput(NODE_REF);
Assert.assertEquals(NODE_REF, barrierInput.getNode());
Assert.assertEquals(SendBarrierInput.class, barrierInput.getImplementedInterface());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput in project openflowplugin by opendaylight.
the class BarrierInputMessageFactory method deserialize.
@Override
public BarrierInput deserialize(ByteBuf rawMessage) {
BarrierInputBuilder builder = new BarrierInputBuilder();
builder.setVersion(getVersion());
builder.setXid(rawMessage.readUnsignedInt());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput in project openflowplugin by opendaylight.
the class FlowCapableTransactionServiceImplTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
SendBarrierInput sendBarrierInput = buildSendBarrierInput();
final OfHeader request = flowCapableTransactionService.buildRequest(new Xid(DUMMY_XID_VALUE), sendBarrierInput);
assertEquals(DUMMY_XID_VALUE, request.getXid());
assertTrue(request instanceof BarrierInput);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput in project openflowplugin by opendaylight.
the class ResponseExpectedRpcListenerTest method testCompleted.
/**
* Test object creation.
*/
@Test
public void testCompleted() {
RpcResponseKey key = new RpcResponseKey(12345L, BarrierOutput.class.getName());
ResponseExpectedRpcListener<OfHeader> listener = new ResponseExpectedRpcListener<>("MESSAGE", "Failed to send message", responseCache, key);
BarrierInputBuilder barrierBuilder = new BarrierInputBuilder();
BarrierInput barrierInput = barrierBuilder.build();
listener.completed(barrierInput);
SettableFuture<RpcResult<?>> result = SettableFuture.create();
result.set(RpcResultBuilder.success(barrierInput).build());
try {
Assert.assertEquals("Wrong result", result.get().getErrors(), listener.getResult().get().getErrors());
Assert.assertEquals("Wrong result", result.get().getResult(), listener.getResult().get().getResult());
Assert.assertEquals("Wrong result", result.get().isSuccessful(), listener.getResult().get().isSuccessful());
} catch (InterruptedException | ExecutionException e) {
fail("Problem accessing result");
}
}
Aggregations