Search in sources :

Example 1 with ClientEvent

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

the class OFPluginToLibraryTest method handshakeOk2.

/**
 * test basic integration with OFLib running the handshake (with version bitmap)
 * @throws Exception
 */
@Test
public void handshakeOk2() throws Exception {
    LOG.debug("handshakeOk2 integration test");
    switchSim = createSimpleClient();
    switchSim.setSecuredClient(false);
    Deque<ClientEvent> handshakeScenario = ScenarioFactory.createHandshakeScenario((short) 0, ScenarioFactory.VERSION_BITMAP_10_13);
    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) Test(org.junit.Test)

Example 2 with ClientEvent

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

the class OFPluginToLibraryTest method handshakeFail1.

/**
 * test basic integration with OFLib running the handshake:
 * creating auxiliary connection without primary connection -- FAIL
 * @throws Exception
 */
@Test
public void handshakeFail1() throws Exception {
    LOG.debug("handshakeFail1 integration test");
    switchSim = createSimpleClient();
    switchSim.setSecuredClient(false);
    Deque<ClientEvent> handshakeScenario = ScenarioFactory.createHandshakeScenario((short) 1, ScenarioFactory.VERSION_BITMAP_10_13);
    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) Test(org.junit.Test)

Example 3 with ClientEvent

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

the class OFPluginToLibraryTest method handshakeOkNoVBM_OF10_SingleHello.

/**
 * test with Mininet running OF10 and OFP running OF13/OF10
 *
 * Mininet issues an OFPT_ERROR on the version compatability Mininet doesn't
 * issue a second HELLO
 *
 * @throws Exception
 */
@Test
public void handshakeOkNoVBM_OF10_SingleHello() throws Exception {
    LOG.debug("handshakeOkMLX10 integration test");
    LOG.debug("openflowPluginProvider: " + openflowPluginProvider);
    switchSim = createSimpleClient();
    switchSim.setSecuredClient(false);
    Deque<ClientEvent> handshakeScenario = ScenarioFactory.createHandshakeScenarioNOVBM_OF10_OneHello();
    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) Test(org.junit.Test)

Example 4 with ClientEvent

use of org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent 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 5 with ClientEvent

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

the class ScenarioFactory method createHandshakeScenarioVBM.

/**
 * Creates stack with handshake needed messages.
 * <ol> XID of messages:
 *   <li> hello sent - 00000001
 *   <li> hello waiting - 00000015
 *   <li> featuresrequest waiting - 00000002
 *   <li> featuresreply sent - 00000002
 * </ol>
 * @param switchVersionBitmap
 * @param auxId
 * @param pluginVersionBitmap
 * @param addSleep if true - then add final sleep {@link #DEFAULT_SCENARIO_SLEEP}
 * @return stack filled with Handshake messages
 */
public static Deque<ClientEvent> createHandshakeScenarioVBM(String switchVersionBitmap, short auxId, String pluginVersionBitmap, boolean addSleep) {
    Deque<ClientEvent> stack = new ArrayDeque<>();
    stack.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("04 00 00 10 00 00 00 01 " + switchVersionBitmap)));
    stack.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 00 00 10 00 00 00 15 " + pluginVersionBitmap)));
    stack.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 05 00 08 00 00 00 02")));
    stack.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("04 06 00 20 00 00 00 02 " + "00 01 02 03 04 05 06 07 " + "00 01 02 03 01 " + Integer.toHexString(auxId) + " 00 00 00 01 02 03 00 01 02 03")));
    if (addSleep) {
        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)

Aggregations

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