use of org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler 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");
}
use of org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler in project openflowplugin by opendaylight.
the class SalIntegrationTest method handshakeAndNodeUpdate.
/**
* test basic integration with OFLib running the handshake
*
* @throws Exception
*/
@Test
public void handshakeAndNodeUpdate() throws Exception {
final TestInventoryListener listener = new TestInventoryListener();
BindingAwareConsumer openflowConsumer = new BindingAwareConsumer() {
@Override
public void onSessionInitialized(ConsumerContext session) {
session.getSALService(NotificationService.class).registerNotificationListener(listener);
}
};
ConsumerContext consumerReg = broker.registerConsumer(openflowConsumer, ctx);
assertNotNull(consumerReg);
LOG.debug("handshake integration test");
LOG.debug("openflowPluginProvider: " + openflowPluginProvider);
switchSim.setSecuredClient(false);
ScenarioHandler scenario = new ScenarioHandler(ScenarioFactory.createHandshakeScenarioVBM(ScenarioFactory.VERSION_BITMAP_13, (short) 0, ScenarioFactory.VERSION_BITMAP_10_13, true));
switchSim.setScenarioHandler(scenario);
scenarioPool.execute(switchSim);
finalCheck = new Runnable() {
@Override
public void run() {
// FIXME: Enable the test -- It's requires EntityOnwershipService hook to the test
// assertEquals(1, listener.nodeUpdated.size());
assertEquals(0, listener.nodeUpdated.size());
// assertNotNull(listener.nodeUpdated.get(0));
}
};
}
use of org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler 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");
}
use of org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler 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");
}
use of org.opendaylight.openflowjava.protocol.impl.clients.ScenarioHandler 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");
}
Aggregations