Search in sources :

Example 6 with BarrierInput

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);
}
Also used : BarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput) BarrierInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 7 with BarrierInput

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());
}
Also used : SendBarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput) Test(org.junit.Test)

Example 8 with BarrierInput

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();
}
Also used : BarrierInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder)

Example 9 with BarrierInput

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);
}
Also used : BarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput) SendBarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput) SendBarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput) Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) Test(org.junit.Test)

Example 10 with 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");
    }
}
Also used : BarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) BarrierInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ExecutionException(java.util.concurrent.ExecutionException) BarrierOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 BarrierInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput)6 BarrierInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder)6 SendBarrierInput (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput)3 OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)3 ByteBuf (io.netty.buffer.ByteBuf)2 BarrierOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput)2 BarrierOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder)2 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)2 InetSocketAddress (java.net.InetSocketAddress)1 ExecutionException (java.util.concurrent.ExecutionException)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1 MutablePair (org.apache.commons.lang3.tuple.MutablePair)1 Pair (org.apache.commons.lang3.tuple.Pair)1 Before (org.junit.Before)1 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)1 ThreadPoolLoggingExecutor (org.opendaylight.openflowplugin.impl.util.ThreadPoolLoggingExecutor)1 NonZeroUint32Type (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type)1 OpenflowProviderConfigBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder)1