Integration test, SimpleClient bundle
[openflowjava.git] / simple-client / src / main / java / org / opendaylight / openflowjava / protocol / impl / clients / ScenarioFactory.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.clients;
3
4 import java.util.Stack;
5
6 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
7
8 /**
9  * @author michal.polkorab
10  *
11  */
12 public class ScenarioFactory {
13
14     /**
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
21      * </ol>
22      * @return stack filled with Handshake messages
23      */
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")));
31         return stack;
32     }
33
34 }