Search in sources :

Example 6 with OFClient

use of org.opendaylight.openflowjava.protocol.impl.clients.OFClient in project openflowplugin by opendaylight.

the class IntegrationTest method testInitiateConnection.

@Test
public void testInitiateConnection() throws Exception {
    setUp(TransportProtocol.TCP);
    final Deque<ClientEvent> scenario = ScenarioFactory.createHandshakeScenario();
    final ScenarioHandler handler = new ScenarioHandler(scenario);
    final List<OFClient> clients = createAndStartClient(1, handler, TransportProtocol.TCP, ClientType.LISTENING);
    final OFClient ofClient = clients.get(0);
    ofClient.getIsOnlineFuture().get(CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);
    final int listeningClientPort = ((ListeningSimpleClient) ofClient).getPort();
    mockPlugin.initiateConnection(switchConnectionProvider, "localhost", listeningClientPort);
    ofClient.getScenarioDone().get();
    LOGGER.debug("testInitiateConnection() Finished");
}
Also used : ListeningSimpleClient(org.opendaylight.openflowjava.protocol.impl.clients.ListeningSimpleClient) ScenarioHandler(org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler) OFClient(org.opendaylight.openflowjava.protocol.impl.clients.OFClient) ClientEvent(org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent) Test(org.junit.Test)

Example 7 with OFClient

use of org.opendaylight.openflowjava.protocol.impl.clients.OFClient in project openflowplugin by opendaylight.

the class IntegrationTest method testHandshake.

/**
 * Library integration and communication test with handshake.
 */
@Test
public void testHandshake() throws Exception {
    setUp(TransportProtocol.TCP);
    final int amountOfCLients = 1;
    final Deque<ClientEvent> scenario = ScenarioFactory.createHandshakeScenario();
    final ScenarioHandler handler = new ScenarioHandler(scenario);
    final List<OFClient> clients = createAndStartClient(amountOfCLients, handler, TransportProtocol.TCP, ClientType.SIMPLE);
    final OFClient firstClient = clients.get(0);
    firstClient.getScenarioDone().get();
    Thread.sleep(1000);
    LOGGER.debug("testHandshake() Finished");
}
Also used : ScenarioHandler(org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler) OFClient(org.opendaylight.openflowjava.protocol.impl.clients.OFClient) ClientEvent(org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent) Test(org.junit.Test)

Aggregations

OFClient (org.opendaylight.openflowjava.protocol.impl.clients.OFClient)7 Test (org.junit.Test)6 ClientEvent (org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent)6 ScenarioHandler (org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler)6 SendEvent (org.opendaylight.openflowjava.protocol.impl.clients.SendEvent)3 SleepEvent (org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent)3 WaitForMessageEvent (org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent)3 ListeningSimpleClient (org.opendaylight.openflowjava.protocol.impl.clients.ListeningSimpleClient)2 ArrayList (java.util.ArrayList)1 SimpleClient (org.opendaylight.openflowjava.protocol.impl.clients.SimpleClient)1 UdpSimpleClient (org.opendaylight.openflowjava.protocol.impl.clients.UdpSimpleClient)1