Implement toString for DefaultTrafficSelector and DefaultTrafficTreatment
Change-Id: I4e9348795855bd667e8931da161427cd4a450d44
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficSelector.java b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficSelector.java
index f51d75e..f175bd3 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficSelector.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficSelector.java
@@ -1,6 +1,10 @@
package org.onlab.onos.net.flow;
-import com.google.common.collect.ImmutableSet;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.flow.criteria.Criteria;
import org.onlab.onos.net.flow.criteria.Criterion;
@@ -8,10 +12,8 @@
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import com.google.common.base.MoreObjects;
+import com.google.common.collect.ImmutableSet;
/**
* Default traffic selector implementation.
@@ -52,6 +54,13 @@
return false;
}
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("criteria", criteria)
+ .toString();
+ }
+
/**
* Returns a new traffic selector builder.
*
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
index d202217..d3fb7d9 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultTrafficTreatment.java
@@ -1,5 +1,9 @@
package org.onlab.onos.net.flow;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+
import org.onlab.onos.net.PortNumber;
import org.onlab.onos.net.flow.instructions.Instruction;
import org.onlab.onos.net.flow.instructions.Instructions;
@@ -7,12 +11,9 @@
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
+import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-
/**
* Default traffic treatment implementation.
*/
@@ -62,6 +63,13 @@
return false;
}
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(getClass())
+ .add("instructions", instructions)
+ .toString();
+ }
+
/**
* Builds a list of treatments following the following order.
* Modifications -> Group -> Output (including drop)