Search in sources :

Example 11 with ScenarioHandler

use of org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler 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)

Example 12 with ScenarioHandler

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

the class OFPluginToLibraryTest method handshakeOk1.

/**
 * test basic integration with OFLib running the handshake
 * @throws Exception
 */
@Test
public void handshakeOk1() throws Exception {
    LOG.debug("handshakeOk1 integration test");
    switchSim.setSecuredClient(false);
    Deque<ClientEvent> handshakeScenario = ScenarioFactory.createHandshakeScenarioVBM(ScenarioFactory.VERSION_BITMAP_13, (short) 0, ScenarioFactory.VERSION_BITMAP_10_13, true);
    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 13 with ScenarioHandler

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

the class OFPluginToLibraryTest method handshakeOkNoVBM_OF10_TwoHello.

/**
 * test with MLX running OF10 and OFP running OF13/OF10
 *
 * MLX issues an OFPT_ERROR on the version compatability MLX issues a second
 * HELLO after the second OFP HELLO
 *
 * @throws Exception
 */
@Test
public void handshakeOkNoVBM_OF10_TwoHello() throws Exception {
    LOG.debug("handshakeOkMLX10 integration test");
    LOG.debug("openflowPluginProvider: " + openflowPluginProvider);
    switchSim = createSimpleClient();
    switchSim.setSecuredClient(false);
    Deque<ClientEvent> handshakeScenario = ScenarioFactory.createHandshakeScenarioNoVBM_OF10_TwoHello();
    // handshakeScenario.setElementAt(new SleepEvent(5000),
    // handshakeScenario
    // .size());
    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 14 with ScenarioHandler

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

the class OFPluginFlowTest method testFlowMod.

/**
 * test basic integration with OFLib running the handshake
 * @throws Exception
 */
@Test
public void testFlowMod() throws Exception {
    LOG.debug("testFlowMod integration test");
    TriggerTestListener brmListener = new TriggerTestListener();
    final DataTreeIdentifier<FlowCapableNode> dataTreeIdentifier = new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, getWildcardPath());
    dataBroker.registerDataTreeChangeListener(dataTreeIdentifier, brmListener);
    switchSim = createSimpleClient();
    switchSim.setSecuredClient(false);
    Deque<ClientEvent> handshakeScenario = ScenarioFactory.createHandshakeScenarioVBM(ScenarioFactory.VERSION_BITMAP_13, (short) 0, ScenarioFactory.VERSION_BITMAP_10_13, false);
    handshakeScenario.addFirst(new SleepEvent(6000L));
    ScenarioFactory.appendPostHandshakeScenario(handshakeScenario, true);
    WaitForMessageEvent flowModEvent = new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 0e 00 58 00 00 00 03 00 00 00 00 00 00 00 0a " + "00 00 00 00 00 00 00 0a 00 00 00 00 00 00 80 00 " + "ff ff ff ff ff ff ff ff ff ff ff ff 00 01 00 00 " + "00 01 00 16 80 00 0a 02 08 00 80 00 19 08 0a 00 " + "00 01 ff ff ff 00 00 00 00 04 00 10 00 00 00 00 " + "00 18 00 08 00 00 00 00"));
    handshakeScenario.addFirst(flowModEvent);
    ScenarioHandler scenario = new ScenarioHandler(handshakeScenario);
    switchSim.setScenarioHandler(scenario);
    scenarioPool.execute(switchSim);
    LOG.info("finishing testFlowMod");
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) ScenarioHandler(org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler) WaitForMessageEvent(org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent) ClientEvent(org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent) SleepEvent(org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)14 ScenarioHandler (org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler)14 ClientEvent (org.opendaylight.openflowjava.protocol.impl.clients.ClientEvent)13 OFClient (org.opendaylight.openflowjava.protocol.impl.clients.OFClient)6 SleepEvent (org.opendaylight.openflowjava.protocol.impl.clients.SleepEvent)5 WaitForMessageEvent (org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent)4 SendEvent (org.opendaylight.openflowjava.protocol.impl.clients.SendEvent)3 DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)1 ConsumerContext (org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext)1 BindingAwareConsumer (org.opendaylight.controller.sal.binding.api.BindingAwareConsumer)1 NotificationService (org.opendaylight.controller.sal.binding.api.NotificationService)1 ListeningSimpleClient (org.opendaylight.openflowjava.protocol.impl.clients.ListeningSimpleClient)1 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)1