Search in sources :

Example 1 with SleepEvent

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

the class OFPluginToLibraryTest method handshakeFail2.

/**
 * test basic integration with OFLib running the handshake
 * adding 5s wait as first event of switch -- FAIL
 * @throws Exception
 */
@Test
public void handshakeFail2() throws Exception {
    LOG.debug("handshakeFail2 integration test");
    LOG.debug("openflowPluginProvider: " + openflowPluginProvider);
    switchSim = createSimpleClient();
    switchSim.setSecuredClient(false);
    Deque<ClientEvent> handshakeScenario = ScenarioFactory.createHandshakeScenario((short) 0, ScenarioFactory.VERSION_BITMAP_10_13);
    handshakeScenario.addFirst(new SleepEvent(5000));
    ScenarioHandler scenario = new ScenarioHandler(handshakeScenario);
    switchSim.setScenarioHandler(scenario);
    scenarioPool.execute(switchSim);
}
Also used : ScenarioHandler(org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler) ClientEvent(org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent) SleepEvent(org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent) Test(org.junit.Test)

Example 2 with SleepEvent

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

the class IntegrationTest method testTlsHandshakeAndEcho.

/**
 * Library integration and secured communication test with handshake + echo exchange.
 */
@Test
public void testTlsHandshakeAndEcho() throws Exception {
    setUp(TransportProtocol.TLS);
    final int amountOfCLients = 1;
    final Deque<ClientEvent> scenario = ScenarioFactory.createHandshakeScenario();
    scenario.addFirst(new SleepEvent(1000));
    scenario.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("04 02 00 08 00 00 00 04")));
    scenario.addFirst(new SleepEvent(1000));
    scenario.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 03 00 08 00 00 00 04")));
    final ScenarioHandler handler = new ScenarioHandler(scenario);
    final List<OFClient> clients = createAndStartClient(amountOfCLients, handler, TransportProtocol.TLS, ClientType.SIMPLE);
    final OFClient firstClient = clients.get(0);
    firstClient.getScenarioDone().get();
    LOGGER.debug("testTlsHandshakeAndEcho() Finished");
}
Also used : ScenarioHandler(org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler) OFClient(org.opendaylight.openflowjava.protocol.impl.clients.OFClient) WaitForMessageEvent(org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent) ClientEvent(org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent) SendEvent(org.opendaylight.openflowjava.protocol.impl.clients.SendEvent) SleepEvent(org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent) Test(org.junit.Test)

Example 3 with SleepEvent

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

the class IntegrationTest method testUdpHandshakeAndEcho.

/**
 * Library udp integration and communication test with handshake + echo exchange.
 */
@Test
public void testUdpHandshakeAndEcho() throws Exception {
    setUp(TransportProtocol.UDP);
    final int amountOfCLients = 1;
    final Deque<ClientEvent> scenario = ScenarioFactory.createHandshakeScenario();
    scenario.addFirst(new SleepEvent(1000));
    scenario.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("04 02 00 08 00 00 00 04")));
    scenario.addFirst(new SleepEvent(1000));
    scenario.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 03 00 08 00 00 00 04")));
    final ScenarioHandler handler = new ScenarioHandler(scenario);
    final List<OFClient> clients = createAndStartClient(amountOfCLients, handler, TransportProtocol.UDP, ClientType.SIMPLE);
    final OFClient firstClient = clients.get(0);
    firstClient.getScenarioDone().get();
    LOGGER.debug("testUdpHandshakeAndEcho() Finished");
}
Also used : ScenarioHandler(org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler) OFClient(org.opendaylight.openflowjava.protocol.impl.clients.OFClient) WaitForMessageEvent(org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent) ClientEvent(org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent) SendEvent(org.opendaylight.openflowjava.protocol.impl.clients.SendEvent) SleepEvent(org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent) Test(org.junit.Test)

Example 4 with SleepEvent

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

the class IntegrationTest method testHandshakeAndEcho.

/**
 * Library integration and communication test with handshake + echo exchange.
 */
@Test
public void testHandshakeAndEcho() throws Exception {
    setUp(TransportProtocol.TCP);
    final int amountOfCLients = 1;
    final Deque<ClientEvent> scenario = ScenarioFactory.createHandshakeScenario();
    scenario.addFirst(new SleepEvent(1000));
    scenario.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("04 02 00 08 00 00 00 04")));
    scenario.addFirst(new SleepEvent(1000));
    scenario.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 03 00 08 00 00 00 04")));
    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();
    LOGGER.debug("testHandshakeAndEcho() Finished");
}
Also used : ScenarioHandler(org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler) OFClient(org.opendaylight.openflowjava.protocol.impl.clients.OFClient) WaitForMessageEvent(org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent) ClientEvent(org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent) SendEvent(org.opendaylight.openflowjava.protocol.impl.clients.SendEvent) SleepEvent(org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent) Test(org.junit.Test)

Example 5 with SleepEvent

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

the class ScenarioFactory method createHandshakeScenarioNoVBM_OF10_TwoHello.

/**
 * Attempt to simulate the MLX running 1.0 talking to ODL
 *
 * @return handshake scenario without switch version bitmap
 */
public static Deque<ClientEvent> createHandshakeScenarioNoVBM_OF10_TwoHello() {
    Deque<ClientEvent> stack = new ArrayDeque<>();
    stack.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("01 00 00 08 00 00 01 67")));
    stack.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 00 00 10 00 00 00 15 00 01 00 08 00 00 00 12")));
    stack.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("01 01 00 0c 00 00 00 15 00 00 00 00")));
    stack.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("01 00 00 08 00 00 01 68")));
    stack.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("01 00 00 08 00 00 01 68")));
    stack.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("01 05 00 08 00 00 01 69")));
    stack.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("01 06 00 80 00 00 01 69 cc 4e 24 1c 4a 00 00 00" + " 00 00 01 00 01 00 00 00 00 00 00 07 00 00 01 0f" + " 00 61 cc 4e 24 1c 4a 60 65 74 68 33 2f 31 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 01" + " 00 00 01 40 00 00 01 40 00 00 01 40 00 00 01 40" + " 00 62 cc 4e 24 1c 4a 61 65 74 68 33 2f 32 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 11 00 00 00 01" + " 00 00 01 40 00 00 01 40 00 00 01 40 00 00 01 40")));
    stack.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("01 10 00 0c 00 00 00 01 00 00 00 00")));
    stack.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("01 11 04 2c 00 00 00 01 00 00 00 00 42 72 6f 63" + " 61 64 65 20 43 6f 6d 6d 75 6e 69 63 61 74 69" + " 6f 6e 73 2c 20 49 6e 63 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 4d 75 6c" + " 74 69 2d 53 65 72 76 69 63 65 20 49 72 6f 6e" + " 77 61 72 65 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 4e 49" + " 20 35 2e 37 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4e" + " 6f 6e 65 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 4e 6f 6e 65 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + " 00 00")));
    stack.addFirst(new SleepEvent(5000));
    addSleep(stack);
    return stack;
}
Also used : WaitForMessageEvent(org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent) ClientEvent(org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent) ArrayDeque(java.util.ArrayDeque) SendEvent(org.opendaylight.openflowjava.protocol.impl.clients.SendEvent) SleepEvent(org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent)

Aggregations

ClientEvent (org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent)6 SleepEvent (org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent)6 Test (org.junit.Test)5 ScenarioHandler (org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler)5 WaitForMessageEvent (org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent)5 SendEvent (org.opendaylight.openflowjava.protocol.impl.clients.SendEvent)4 OFClient (org.opendaylight.openflowjava.protocol.impl.clients.OFClient)3 ArrayDeque (java.util.ArrayDeque)1 DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)1 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)1