Fixed toString of PiInstruction when using groups
Change-Id: I3817914b3a204bf3e9a1ac885cc5505600c1972a
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/PiInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/PiInstruction.java
index 5109a92..5db8a84 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/PiInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/PiInstruction.java
@@ -21,6 +21,8 @@
import com.google.common.base.Objects;
import org.onosproject.net.pi.runtime.PiTableAction;
+import static java.lang.String.format;
+
/**
* Representation of a protocol-independent instruction.
*/
@@ -71,6 +73,13 @@
@Override
public String toString() {
- return tableAction.toString();
+ switch (tableAction.type()) {
+ case ACTION_GROUP_ID:
+ case GROUP_MEMBER_ID:
+ // e.g. PiActionGroupId(1)
+ return format("%s{%s}", tableAction.getClass().getSimpleName(), tableAction.toString());
+ default:
+ return tableAction.toString();
+ }
}
}