1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.clients;
4 import java.util.Stack;
6 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
9 * @author michal.polkorab
12 public class ScenarioFactory {
15 * Creates stack with handshake needed messages.
16 * <ol> XID of messages:
17 * <li> hello sent - 00000001
18 * <li> hello waiting - 00000002
19 * <li> featuresrequest waiting - 00000003
20 * <li> featuresreply sent - 00000003
22 * @return stack filled with Handshake messages
24 public static Stack<ClientEvent> createHandshakeScenario() {
25 Stack<ClientEvent> stack = new Stack<>();
26 stack.add(0, new SendEvent(ByteBufUtils.hexStringToBytes("04 00 00 08 00 00 00 01")));
27 stack.add(0, new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 00 00 08 00 00 00 02")));
28 stack.add(0, new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 05 00 08 00 00 00 03")));
29 stack.add(0, new SendEvent(ByteBufUtils.hexStringToBytes("04 06 00 20 00 00 00 03 "
30 + "00 01 02 03 04 05 06 07 00 01 02 03 01 01 00 00 00 01 02 03 00 01 02 03")));