Search in sources :

Example 1 with BarrierInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput in project openflowplugin by opendaylight.

the class OutboundQueueProviderImpl method createBarrierRequest.

@Nonnull
@Override
public BarrierInput createBarrierRequest(@Nonnull final Long xid) {
    final BarrierInputBuilder biBuilder = new BarrierInputBuilder();
    biBuilder.setVersion(ofVersion);
    biBuilder.setXid(xid);
    return biBuilder.build();
}
Also used : BarrierInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder) Nonnull(javax.annotation.Nonnull)

Example 2 with BarrierInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput in project openflowplugin by opendaylight.

the class ConnectionManagerImplTest method setUp.

@Before
public void setUp() {
    final ThreadPoolLoggingExecutor threadPool = new ThreadPoolLoggingExecutor(0, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(), "ofppool");
    connectionManagerImpl = new ConnectionManagerImpl(new OpenflowProviderConfigBuilder().setEchoReplyTimeout(new NonZeroUint32Type(ECHO_REPLY_TIMEOUT)).build(), threadPool);
    connectionManagerImpl.setDeviceConnectedHandler(deviceConnectedHandler);
    final InetSocketAddress deviceAddress = InetSocketAddress.createUnresolved("yahoo", 42);
    Mockito.when(connection.getRemoteAddress()).thenReturn(deviceAddress);
    Mockito.when(connection.isAlive()).thenReturn(true);
    Mockito.when(connection.barrier(Matchers.<BarrierInput>any())).thenReturn(RpcResultBuilder.success(new BarrierOutputBuilder().build()).buildFuture());
}
Also used : OpenflowProviderConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfigBuilder) InetSocketAddress(java.net.InetSocketAddress) NonZeroUint32Type(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type) ThreadPoolLoggingExecutor(org.opendaylight.openflowplugin.impl.util.ThreadPoolLoggingExecutor) BarrierOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder) Before(org.junit.Before)

Example 3 with BarrierInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput 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);
}
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) BarrierOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutputBuilder) BarrierOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput) Test(org.junit.Test)

Example 4 with BarrierInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput in project openflowplugin by opendaylight.

the class OutboundQueueProviderImplTest method testCreateBarrierRequest.

@Test
public void testCreateBarrierRequest() {
    final BarrierInput barrierRequest = outboundQueueProvider.createBarrierRequest(DUMMY_XID);
    assertNotNull(barrierRequest);
    assertEquals((short) OFConstants.OFP_VERSION_1_3, (short) barrierRequest.getVersion());
    assertEquals(DUMMY_XID, barrierRequest.getXid());
}
Also used : BarrierInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput) Test(org.junit.Test)

Example 5 with BarrierInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput in project openflowplugin by opendaylight.

the class OF10BarrierInputMessageFactoryTest method test.

/**
 * Testing of {@link OF10BarrierInputMessageFactory} for correct translation from POJO.
 */
@Test
public void test() throws Exception {
    BarrierInputBuilder bib = new BarrierInputBuilder();
    BufferHelper.setupHeader(bib, EncodeConstants.OF10_VERSION_ID);
    BarrierInput bi = bib.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    barrierFactory.serialize(bi, out);
    BufferHelper.checkHeaderV10(out, (byte) 18, 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)

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