Added scenario with settable auxiliaryId in featuresReply message 39/2139/1
authorMichal Polkorab <michal.polkorab@pantheon.sk>
Thu, 24 Oct 2013 13:24:27 +0000 (15:24 +0200)
committerMichal Polkorab <michal.polkorab@pantheon.sk>
Thu, 24 Oct 2013 13:24:33 +0000 (15:24 +0200)
Signed-off-by: Michal Polkorab <michal.polkorab@pantheon.sk>
simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioFactory.java

index 02ba23d90761852f41440fcae2108a1a81f746c0..2d2ddcf8f3cffa54366d9de08cdd7e7d06a9a1c0 100644 (file)
@@ -32,4 +32,25 @@ public class ScenarioFactory {
         return stack;
     }
 
+    /**
+     * Creates stack with handshake needed messages.
+     * <ol> XID of messages:
+     *   <li> hello sent - 00000001
+     *   <li> hello waiting - 00000002
+     *   <li> featuresrequest waiting - 00000003
+     *   <li> featuresreply sent - 00000003
+     * </ol>
+     * @param auxiliaryId auxiliaryId wanted in featuresReply message
+     * @return stack filled with Handshake messages (featuresReply with auxiliaryId set)
+     */
+    public static Stack<ClientEvent> createHandshakeScenarioWithAuxiliaryId(byte auxiliaryId) {
+        Stack<ClientEvent> stack = new Stack<>();
+        stack.add(0, new SendEvent(ByteBufUtils.hexStringToBytes("04 00 00 08 00 00 00 01")));
+        stack.add(0, new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 00 00 08 00 00 00 02")));
+        stack.add(0, new WaitForMessageEvent(ByteBufUtils.hexStringToBytes("04 05 00 08 00 00 00 03")));
+        stack.add(0, new SendEvent(ByteBufUtils.hexStringToBytes("04 06 00 20 00 00 00 03 "
+                + "00 01 02 03 04 05 06 07 00 01 02 03 01 " + String.format("%02x ", auxiliaryId) + " 00 00 00 01 02 03 00 01 02 03")));
+        return stack;
+    }
+
 }