use of org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent 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;
}
use of org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent in project openflowplugin by opendaylight.
the class ScenarioFactory method createHandshakeScenario.
/**
* @param auxId
* @param pluginVersionBitmap
* @return handshake scenario without switch version bitmap
*/
public static Deque<ClientEvent> createHandshakeScenario(short auxId, String pluginVersionBitmap) {
Deque<ClientEvent> stack = new ArrayDeque<>();
stack.addFirst(new SendEvent(ByteBufUtils.hexStringToBytes("04 00 00 08 00 00 00 01")));
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")));
addSleep(stack);
return stack;
}
use of org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent in project openflowplugin by opendaylight.
the class ScenarioFactory method appendPostHandshakeScenario.
/**
* @param stack
* @param addSleep if true - then add final sleep {@link #DEFAULT_SCENARIO_SLEEP}
* @return
*/
public static Deque<ClientEvent> appendPostHandshakeScenario(Deque<ClientEvent> stack, boolean addSleep) {
stack.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 12 00 10 00 00 00 01 " + "00 0d 00 00 00 00 00 00")));
stack.addFirst(new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 12 00 10 00 00 00 02 " + "00 00 00 00 00 00 00 00")));
if (addSleep) {
addSleep(stack);
}
return stack;
}
use of org.opendaylight.openflowjava.protocol.impl.clients.WaitForMessageEvent 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.WaitForMessageEvent 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");
}
Aggregations