Jonathan Hart

Implement toString for DefaultTrafficSelector and DefaultTrafficTreatment

Change-Id: I4e9348795855bd667e8931da161427cd4a450d44
1 package org.onlab.onos.net.flow; 1 package org.onlab.onos.net.flow;
2 2
3 -import com.google.common.collect.ImmutableSet; 3 +import java.util.HashMap;
4 +import java.util.Map;
5 +import java.util.Objects;
6 +import java.util.Set;
7 +
4 import org.onlab.onos.net.PortNumber; 8 import org.onlab.onos.net.PortNumber;
5 import org.onlab.onos.net.flow.criteria.Criteria; 9 import org.onlab.onos.net.flow.criteria.Criteria;
6 import org.onlab.onos.net.flow.criteria.Criterion; 10 import org.onlab.onos.net.flow.criteria.Criterion;
...@@ -8,10 +12,8 @@ import org.onlab.packet.IpPrefix; ...@@ -8,10 +12,8 @@ import org.onlab.packet.IpPrefix;
8 import org.onlab.packet.MacAddress; 12 import org.onlab.packet.MacAddress;
9 import org.onlab.packet.VlanId; 13 import org.onlab.packet.VlanId;
10 14
11 -import java.util.HashMap; 15 +import com.google.common.base.MoreObjects;
12 -import java.util.Map; 16 +import com.google.common.collect.ImmutableSet;
13 -import java.util.Objects;
14 -import java.util.Set;
15 17
16 /** 18 /**
17 * Default traffic selector implementation. 19 * Default traffic selector implementation.
...@@ -52,6 +54,13 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -52,6 +54,13 @@ public final class DefaultTrafficSelector implements TrafficSelector {
52 return false; 54 return false;
53 } 55 }
54 56
57 + @Override
58 + public String toString() {
59 + return MoreObjects.toStringHelper(getClass())
60 + .add("criteria", criteria)
61 + .toString();
62 + }
63 +
55 /** 64 /**
56 * Returns a new traffic selector builder. 65 * Returns a new traffic selector builder.
57 * 66 *
......
1 package org.onlab.onos.net.flow; 1 package org.onlab.onos.net.flow;
2 2
3 +import java.util.LinkedList;
4 +import java.util.List;
5 +import java.util.Objects;
6 +
3 import org.onlab.onos.net.PortNumber; 7 import org.onlab.onos.net.PortNumber;
4 import org.onlab.onos.net.flow.instructions.Instruction; 8 import org.onlab.onos.net.flow.instructions.Instruction;
5 import org.onlab.onos.net.flow.instructions.Instructions; 9 import org.onlab.onos.net.flow.instructions.Instructions;
...@@ -7,12 +11,9 @@ import org.onlab.packet.IpPrefix; ...@@ -7,12 +11,9 @@ import org.onlab.packet.IpPrefix;
7 import org.onlab.packet.MacAddress; 11 import org.onlab.packet.MacAddress;
8 import org.onlab.packet.VlanId; 12 import org.onlab.packet.VlanId;
9 13
14 +import com.google.common.base.MoreObjects;
10 import com.google.common.collect.ImmutableList; 15 import com.google.common.collect.ImmutableList;
11 16
12 -import java.util.LinkedList;
13 -import java.util.List;
14 -import java.util.Objects;
15 -
16 /** 17 /**
17 * Default traffic treatment implementation. 18 * Default traffic treatment implementation.
18 */ 19 */
...@@ -62,6 +63,13 @@ public final class DefaultTrafficTreatment implements TrafficTreatment { ...@@ -62,6 +63,13 @@ public final class DefaultTrafficTreatment implements TrafficTreatment {
62 return false; 63 return false;
63 } 64 }
64 65
66 + @Override
67 + public String toString() {
68 + return MoreObjects.toStringHelper(getClass())
69 + .add("instructions", instructions)
70 + .toString();
71 + }
72 +
65 /** 73 /**
66 * Builds a list of treatments following the following order. 74 * Builds a list of treatments following the following order.
67 * Modifications -> Group -> Output (including drop) 75 * Modifications -> Group -> Output (including drop)
......