Supports capability of T3 to trace multiple actions with priority in a group

T3 sets an egress packet of a device in the trace after handling
OUTPUT action of a group, so actions placed after OUTPUT were ignored.
This was fixed by sorting the list of instructions with priority.

Change-Id: I071f9356e53924f90a06eb9f184e0c762b3975d4
(cherry picked from commit 80a6276388034a79c54e403c93f02094485a45d5)
diff --git a/app/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java b/app/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java
index df73a61..51332da 100644
--- a/app/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java
+++ b/app/src/main/java/org/onosproject/t3/impl/TroubleshootManager.java
@@ -1117,7 +1117,16 @@
                                            Builder builder, List<PortNumber> outputPorts,
                                            ConnectPoint in, List<ConnectPoint> completePath) {
         List<Instruction> groupInstructionlist = new ArrayList<>();
-        for (Instruction instruction : instructions) {
+        // sort instructions according to priority (larger Instruction.Type ENUM constant first)
+        // which enables to treat other actions before the OUTPUT action
+        //TODO improve the priority scheme according to the OpenFlow ActionSet spec
+        List<Instruction> instructionsSorted = new ArrayList<>();
+        instructionsSorted.addAll(instructions);
+        instructionsSorted.sort((instr1, instr2) -> {
+            return Integer.compare(instr2.type().ordinal(), instr1.type().ordinal());
+        });
+
+        for (Instruction instruction : instructionsSorted) {
             log.debug("Considering Instruction {}", instruction);
             //if the instruction is not group we need to update the packet or add the output
             //to the possible outputs for this packet