Added a method to return a list of augmented Nicira Instructions 91/10291/1
authorBrent Salisbury <brent.salisbury@gmail.com>
Tue, 26 Aug 2014 09:42:45 +0000 (05:42 -0400)
committerBrent Salisbury <brent.salisbury@gmail.com>
Tue, 26 Aug 2014 09:42:45 +0000 (05:42 -0400)
-Example output of a needed flow using an NX action
and an OXM set_field metadata:
actions=resubmit(10,0),write_metadata:0xc/0xc

-This is indeed odd. Returned List<Instruction>
rather then InstructionBuilder since the first
param was variable etc. Made a new method to
avoid breaking SFC or anyone using the current
NX augmentation. Will knock out match next.

This is indeed odd :s
rev131026.instruction.list.Instruction
rev131026.instruction.Instruction

Signed-off-by: Brent Salisbury <brent.salisbury@gmail.com>
utils/mdsal-openflow/src/main/java/org/opendaylight/ovsdb/utils/mdsal/openflow/InstructionUtils.java

index f656b62d75f0e486100f71b1b6708fbe8249448b..f846ee0ac182eceb55a1b037116735f8112565db 100644 (file)
@@ -945,4 +945,24 @@ public class InstructionUtils {
         return getInstructions(applyActionIns(dropAction()));
     }
 
+    /**
+     * Get a list of Instructions containing Nicira extensions that can have
+     * additional OF/OXM instructions added to the returned Instruction list
+     *
+     * @param instructions org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instructions
+     * @return instruction list that additional
+     */
+    public static List<Instruction> getInstructionList(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction... instructions) {
+        ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction> ins
+                = new ArrayList<>();
+        int order = 0;
+        for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction i : instructions) {
+            ins.add(new InstructionBuilder()
+                    .setOrder(order++)
+                    .setInstruction(i)
+                    .build());
+        }
+        return ins;
+    }
 }
\ No newline at end of file