Committed by
Gerrit Code Review
Improvements to flows list command.
* Added -s option which gives more succinct output. * Display each flow on one line for easy grepping. * Added ability to filter output by table ID. * Flows are now sorted by descending priority within a table. * Removed the use of toStringHelper in instructions and criterion to produce less verbose output. Change-Id: I1c874c776491386488ea5a4d23627b20f1e5728b
Showing
46 changed files
with
202 additions
and
270 deletions
... | @@ -71,10 +71,16 @@ public final class Comparators { | ... | @@ -71,10 +71,16 @@ public final class Comparators { |
71 | public static final Comparator<FlowRule> FLOW_RULE_COMPARATOR = new Comparator<FlowRule>() { | 71 | public static final Comparator<FlowRule> FLOW_RULE_COMPARATOR = new Comparator<FlowRule>() { |
72 | @Override | 72 | @Override |
73 | public int compare(FlowRule f1, FlowRule f2) { | 73 | public int compare(FlowRule f1, FlowRule f2) { |
74 | - int tableCompare = Integer.valueOf(f1.tableId()).compareTo(f2.tableId()); | 74 | + // Compare table IDs in ascending order |
75 | - return (tableCompare == 0) | 75 | + int tableCompare = f1.tableId() - f2.tableId(); |
76 | + if (tableCompare != 0) { | ||
77 | + return tableCompare; | ||
78 | + } | ||
79 | + // Compare priorities in descending order | ||
80 | + int priorityCompare = f2.priority() - f1.priority(); | ||
81 | + return (priorityCompare == 0) | ||
76 | ? Long.valueOf(f1.id().value()).compareTo(f2.id().value()) | 82 | ? Long.valueOf(f1.id().value()).compareTo(f2.id().value()) |
77 | - : tableCompare; | 83 | + : priorityCompare; |
78 | } | 84 | } |
79 | }; | 85 | }; |
80 | 86 | ... | ... |
... | @@ -15,16 +15,13 @@ | ... | @@ -15,16 +15,13 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.cli.net; | 16 | package org.onosproject.cli.net; |
17 | 17 | ||
18 | -import static com.google.common.collect.Lists.newArrayList; | 18 | +import com.fasterxml.jackson.databind.JsonNode; |
19 | - | 19 | +import com.fasterxml.jackson.databind.ObjectMapper; |
20 | -import java.util.Collections; | 20 | +import com.fasterxml.jackson.databind.node.ArrayNode; |
21 | -import java.util.List; | 21 | +import com.fasterxml.jackson.databind.node.ObjectNode; |
22 | -import java.util.Map; | ||
23 | -import java.util.SortedMap; | ||
24 | -import java.util.TreeMap; | ||
25 | - | ||
26 | import org.apache.karaf.shell.commands.Argument; | 22 | import org.apache.karaf.shell.commands.Argument; |
27 | import org.apache.karaf.shell.commands.Command; | 23 | import org.apache.karaf.shell.commands.Command; |
24 | +import org.apache.karaf.shell.commands.Option; | ||
28 | import org.onosproject.cli.AbstractShellCommand; | 25 | import org.onosproject.cli.AbstractShellCommand; |
29 | import org.onosproject.cli.Comparators; | 26 | import org.onosproject.cli.Comparators; |
30 | import org.onosproject.core.ApplicationId; | 27 | import org.onosproject.core.ApplicationId; |
... | @@ -35,11 +32,16 @@ import org.onosproject.net.device.DeviceService; | ... | @@ -35,11 +32,16 @@ import org.onosproject.net.device.DeviceService; |
35 | import org.onosproject.net.flow.FlowEntry; | 32 | import org.onosproject.net.flow.FlowEntry; |
36 | import org.onosproject.net.flow.FlowEntry.FlowEntryState; | 33 | import org.onosproject.net.flow.FlowEntry.FlowEntryState; |
37 | import org.onosproject.net.flow.FlowRuleService; | 34 | import org.onosproject.net.flow.FlowRuleService; |
35 | +import org.onosproject.net.flow.TrafficTreatment; | ||
38 | 36 | ||
39 | -import com.fasterxml.jackson.databind.JsonNode; | 37 | +import java.util.Collections; |
40 | -import com.fasterxml.jackson.databind.ObjectMapper; | 38 | +import java.util.List; |
41 | -import com.fasterxml.jackson.databind.node.ArrayNode; | 39 | +import java.util.Map; |
42 | -import com.fasterxml.jackson.databind.node.ObjectNode; | 40 | +import java.util.SortedMap; |
41 | +import java.util.TreeMap; | ||
42 | +import java.util.function.Predicate; | ||
43 | + | ||
44 | +import static com.google.common.collect.Lists.newArrayList; | ||
43 | 45 | ||
44 | /** | 46 | /** |
45 | * Lists all currently-known flows. | 47 | * Lists all currently-known flows. |
... | @@ -48,26 +50,44 @@ import com.fasterxml.jackson.databind.node.ObjectNode; | ... | @@ -48,26 +50,44 @@ import com.fasterxml.jackson.databind.node.ObjectNode; |
48 | description = "Lists all currently-known flows.") | 50 | description = "Lists all currently-known flows.") |
49 | public class FlowsListCommand extends AbstractShellCommand { | 51 | public class FlowsListCommand extends AbstractShellCommand { |
50 | 52 | ||
53 | + private static final Predicate<FlowEntry> TRUE_PREDICATE = f -> true; | ||
54 | + | ||
51 | public static final String ANY = "any"; | 55 | public static final String ANY = "any"; |
52 | 56 | ||
53 | - private static final String FMT = | 57 | + private static final String LONG_FORMAT = " id=%s, state=%s, bytes=%s, " |
54 | - " id=%s, state=%s, bytes=%s, packets=%s, duration=%s, priority=%s, tableId=%s appId=%s, payLoad=%s"; | 58 | + + "packets=%s, duration=%s, priority=%s, tableId=%s, appId=%s, " |
55 | - private static final String TFMT = " treatment=%s"; | 59 | + + "payLoad=%s, selector=%s, treatment=%s"; |
56 | - private static final String SFMT = " selector=%s"; | 60 | + |
61 | + private static final String SHORT_FORMAT = " %s, bytes=%s, packets=%s, " | ||
62 | + + "table=%s, priority=%s, selector=%s, treatment=%s"; | ||
63 | + | ||
64 | + @Argument(index = 0, name = "state", description = "Flow Rule state", | ||
65 | + required = false, multiValued = false) | ||
66 | + String state = null; | ||
57 | 67 | ||
58 | @Argument(index = 1, name = "uri", description = "Device ID", | 68 | @Argument(index = 1, name = "uri", description = "Device ID", |
59 | required = false, multiValued = false) | 69 | required = false, multiValued = false) |
60 | String uri = null; | 70 | String uri = null; |
61 | 71 | ||
62 | - @Argument(index = 0, name = "state", description = "Flow Rule state", | 72 | + @Argument(index = 2, name = "table", description = "Table ID", |
63 | - required = false, multiValued = false) | 73 | + required = false, multiValued = false) |
64 | - String state = null; | 74 | + String table = null; |
75 | + | ||
76 | + @Option(name = "-s", aliases = "--short", | ||
77 | + description = "Print more succinct output for each flow", | ||
78 | + required = false, multiValued = false) | ||
79 | + private boolean shortOutput = false; | ||
80 | + | ||
81 | + private Predicate<FlowEntry> predicate = TRUE_PREDICATE; | ||
65 | 82 | ||
66 | @Override | 83 | @Override |
67 | protected void execute() { | 84 | protected void execute() { |
68 | CoreService coreService = get(CoreService.class); | 85 | CoreService coreService = get(CoreService.class); |
69 | DeviceService deviceService = get(DeviceService.class); | 86 | DeviceService deviceService = get(DeviceService.class); |
70 | FlowRuleService service = get(FlowRuleService.class); | 87 | FlowRuleService service = get(FlowRuleService.class); |
88 | + | ||
89 | + compilePredicate(); | ||
90 | + | ||
71 | SortedMap<Device, List<FlowEntry>> flows = getSortedFlows(deviceService, service); | 91 | SortedMap<Device, List<FlowEntry>> flows = getSortedFlows(deviceService, service); |
72 | 92 | ||
73 | if (outputJson()) { | 93 | if (outputJson()) { |
... | @@ -94,6 +114,22 @@ public class FlowsListCommand extends AbstractShellCommand { | ... | @@ -94,6 +114,22 @@ public class FlowsListCommand extends AbstractShellCommand { |
94 | return result; | 114 | return result; |
95 | } | 115 | } |
96 | 116 | ||
117 | + /** | ||
118 | + * Compiles a predicate to find matching flows based on the command | ||
119 | + * arguments. | ||
120 | + */ | ||
121 | + private void compilePredicate() { | ||
122 | + if (state != null && !state.equals(ANY)) { | ||
123 | + final FlowEntryState feState = FlowEntryState.valueOf(state.toUpperCase()); | ||
124 | + predicate = predicate.and(f -> f.state().equals(feState)); | ||
125 | + } | ||
126 | + | ||
127 | + if (table != null) { | ||
128 | + final int tableId = Integer.parseInt(table); | ||
129 | + predicate = predicate.and(f -> f.tableId() == tableId); | ||
130 | + } | ||
131 | + } | ||
132 | + | ||
97 | // Produces JSON object with the flows of the given device. | 133 | // Produces JSON object with the flows of the given device. |
98 | private ObjectNode json(ObjectMapper mapper, | 134 | private ObjectNode json(ObjectMapper mapper, |
99 | Device device, List<FlowEntry> flows) { | 135 | Device device, List<FlowEntry> flows) { |
... | @@ -119,10 +155,7 @@ public class FlowsListCommand extends AbstractShellCommand { | ... | @@ -119,10 +155,7 @@ public class FlowsListCommand extends AbstractShellCommand { |
119 | FlowRuleService service) { | 155 | FlowRuleService service) { |
120 | SortedMap<Device, List<FlowEntry>> flows = new TreeMap<>(Comparators.ELEMENT_COMPARATOR); | 156 | SortedMap<Device, List<FlowEntry>> flows = new TreeMap<>(Comparators.ELEMENT_COMPARATOR); |
121 | List<FlowEntry> rules; | 157 | List<FlowEntry> rules; |
122 | - FlowEntryState s = null; | 158 | + |
123 | - if (state != null && !state.equals("any")) { | ||
124 | - s = FlowEntryState.valueOf(state.toUpperCase()); | ||
125 | - } | ||
126 | Iterable<Device> devices = null; | 159 | Iterable<Device> devices = null; |
127 | if (uri == null) { | 160 | if (uri == null) { |
128 | devices = deviceService.getDevices(); | 161 | devices = deviceService.getDevices(); |
... | @@ -131,13 +164,14 @@ public class FlowsListCommand extends AbstractShellCommand { | ... | @@ -131,13 +164,14 @@ public class FlowsListCommand extends AbstractShellCommand { |
131 | devices = (dev == null) ? deviceService.getDevices() | 164 | devices = (dev == null) ? deviceService.getDevices() |
132 | : Collections.singletonList(dev); | 165 | : Collections.singletonList(dev); |
133 | } | 166 | } |
167 | + | ||
134 | for (Device d : devices) { | 168 | for (Device d : devices) { |
135 | - if (s == null) { | 169 | + if (predicate.equals(TRUE_PREDICATE)) { |
136 | rules = newArrayList(service.getFlowEntries(d.id())); | 170 | rules = newArrayList(service.getFlowEntries(d.id())); |
137 | } else { | 171 | } else { |
138 | rules = newArrayList(); | 172 | rules = newArrayList(); |
139 | for (FlowEntry f : service.getFlowEntries(d.id())) { | 173 | for (FlowEntry f : service.getFlowEntries(d.id())) { |
140 | - if (f.state().equals(s)) { | 174 | + if (predicate.test(f)) { |
141 | rules.add(f); | 175 | rules.add(f); |
142 | } | 176 | } |
143 | } | 177 | } |
... | @@ -159,17 +193,51 @@ public class FlowsListCommand extends AbstractShellCommand { | ... | @@ -159,17 +193,51 @@ public class FlowsListCommand extends AbstractShellCommand { |
159 | CoreService coreService) { | 193 | CoreService coreService) { |
160 | boolean empty = flows == null || flows.isEmpty(); | 194 | boolean empty = flows == null || flows.isEmpty(); |
161 | print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : flows.size()); | 195 | print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : flows.size()); |
162 | - if (!empty) { | 196 | + if (empty) { |
163 | - for (FlowEntry f : flows) { | 197 | + return; |
198 | + } | ||
199 | + | ||
200 | + for (FlowEntry f : flows) { | ||
201 | + if (shortOutput) { | ||
202 | + print(SHORT_FORMAT, f.state(), f.bytes(), f.packets(), | ||
203 | + f.tableId(), f.priority(), f.selector().criteria(), | ||
204 | + printTreatment(f.treatment())); | ||
205 | + } else { | ||
164 | ApplicationId appId = coreService.getAppId(f.appId()); | 206 | ApplicationId appId = coreService.getAppId(f.appId()); |
165 | - print(FMT, Long.toHexString(f.id().value()), f.state(), | 207 | + print(LONG_FORMAT, Long.toHexString(f.id().value()), f.state(), |
166 | - f.bytes(), f.packets(), f.life(), f.priority(), f.tableId(), | 208 | + f.bytes(), f.packets(), f.life(), f.priority(), f.tableId(), |
167 | - appId != null ? appId.name() : "<none>", | 209 | + appId != null ? appId.name() : "<none>", |
168 | - f.payLoad() == null ? null : f.payLoad().payLoad().toString()); | 210 | + f.payLoad() == null ? null : f.payLoad().payLoad().toString(), |
169 | - print(SFMT, f.selector().criteria()); | 211 | + f.selector().criteria(), f.treatment()); |
170 | - print(TFMT, f.treatment()); | ||
171 | } | 212 | } |
172 | } | 213 | } |
173 | } | 214 | } |
174 | 215 | ||
216 | + private String printTreatment(TrafficTreatment treatment) { | ||
217 | + final String delimiter = ", "; | ||
218 | + StringBuilder builder = new StringBuilder("["); | ||
219 | + if (!treatment.immediate().isEmpty()) { | ||
220 | + builder.append("immediate=" + treatment.immediate() + delimiter); | ||
221 | + } | ||
222 | + if (!treatment.deferred().isEmpty()) { | ||
223 | + builder.append("deferred=" + treatment.deferred() + delimiter); | ||
224 | + } | ||
225 | + if (treatment.clearedDeferred()) { | ||
226 | + builder.append("clearDeferred" + delimiter); | ||
227 | + } | ||
228 | + if (treatment.tableTransition() != null) { | ||
229 | + builder.append("transition=" + treatment.tableTransition() + delimiter); | ||
230 | + } | ||
231 | + if (treatment.metered() != null) { | ||
232 | + builder.append("meter=" + treatment.metered() + delimiter); | ||
233 | + } | ||
234 | + if (treatment.writeMetadata() != null) { | ||
235 | + builder.append("metadata=" + treatment.writeMetadata() + delimiter); | ||
236 | + } | ||
237 | + // Chop off last delimiter | ||
238 | + builder.replace(builder.length() - delimiter.length(), builder.length(), ""); | ||
239 | + builder.append("]"); | ||
240 | + return builder.toString(); | ||
241 | + } | ||
242 | + | ||
175 | } | 243 | } | ... | ... |
... | @@ -427,6 +427,8 @@ | ... | @@ -427,6 +427,8 @@ |
427 | <completers> | 427 | <completers> |
428 | <ref component-id="flowRuleStatusCompleter"/> | 428 | <ref component-id="flowRuleStatusCompleter"/> |
429 | <ref component-id="deviceIdCompleter"/> | 429 | <ref component-id="deviceIdCompleter"/> |
430 | + <ref component-id="placeholderCompleter"/> | ||
431 | + <null/> | ||
430 | </completers> | 432 | </completers> |
431 | </command> | 433 | </command> |
432 | 434 | ... | ... |
... | @@ -15,12 +15,11 @@ | ... | @@ -15,12 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | -import static com.google.common.base.MoreObjects.toStringHelper; | 18 | +import org.onlab.packet.MacAddress; |
19 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | 19 | ||
21 | import java.util.Objects; | 20 | import java.util.Objects; |
22 | 21 | ||
23 | -import org.onlab.packet.MacAddress; | 22 | +import static com.google.common.base.Preconditions.checkNotNull; |
24 | 23 | ||
25 | /** | 24 | /** |
26 | * Implementation of arp_eth_src address or arp_eth_dst address criterion. | 25 | * Implementation of arp_eth_src address or arp_eth_dst address criterion. |
... | @@ -59,8 +58,7 @@ public final class ArpHaCriterion implements Criterion { | ... | @@ -59,8 +58,7 @@ public final class ArpHaCriterion implements Criterion { |
59 | 58 | ||
60 | @Override | 59 | @Override |
61 | public String toString() { | 60 | public String toString() { |
62 | - return toStringHelper(type().toString()) | 61 | + return type().toString() + SEPARATOR + mac; |
63 | - .add("mac", mac).toString(); | ||
64 | } | 62 | } |
65 | 63 | ||
66 | @Override | 64 | @Override |
... | @@ -80,4 +78,4 @@ public final class ArpHaCriterion implements Criterion { | ... | @@ -80,4 +78,4 @@ public final class ArpHaCriterion implements Criterion { |
80 | } | 78 | } |
81 | return false; | 79 | return false; |
82 | } | 80 | } |
83 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
81 | +} | ... | ... |
... | @@ -15,8 +15,6 @@ | ... | @@ -15,8 +15,6 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | - | ||
20 | import java.util.Objects; | 18 | import java.util.Objects; |
21 | 19 | ||
22 | /** | 20 | /** |
... | @@ -54,8 +52,7 @@ public final class ArpOpCriterion implements Criterion { | ... | @@ -54,8 +52,7 @@ public final class ArpOpCriterion implements Criterion { |
54 | 52 | ||
55 | @Override | 53 | @Override |
56 | public String toString() { | 54 | public String toString() { |
57 | - return toStringHelper(type().toString()) | 55 | + return type().toString() + SEPARATOR + arpOp; |
58 | - .add("arpOp", arpOp).toString(); | ||
59 | } | 56 | } |
60 | 57 | ||
61 | @Override | 58 | @Override |
... | @@ -75,4 +72,4 @@ public final class ArpOpCriterion implements Criterion { | ... | @@ -75,4 +72,4 @@ public final class ArpOpCriterion implements Criterion { |
75 | } | 72 | } |
76 | return false; | 73 | return false; |
77 | } | 74 | } |
78 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
75 | +} | ... | ... |
... | @@ -15,12 +15,10 @@ | ... | @@ -15,12 +15,10 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | -import static com.google.common.base.MoreObjects.toStringHelper; | 18 | +import org.onlab.packet.Ip4Address; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import org.onlab.packet.Ip4Address; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of arp spa or tpa address criterion. | 23 | * Implementation of arp spa or tpa address criterion. |
26 | */ | 24 | */ |
... | @@ -56,8 +54,7 @@ public final class ArpPaCriterion implements Criterion { | ... | @@ -56,8 +54,7 @@ public final class ArpPaCriterion implements Criterion { |
56 | 54 | ||
57 | @Override | 55 | @Override |
58 | public String toString() { | 56 | public String toString() { |
59 | - return toStringHelper(type().toString()) | 57 | + return type().toString() + SEPARATOR + ip; |
60 | - .add("ip", ip).toString(); | ||
61 | } | 58 | } |
62 | 59 | ||
63 | @Override | 60 | @Override |
... | @@ -77,4 +74,4 @@ public final class ArpPaCriterion implements Criterion { | ... | @@ -77,4 +74,4 @@ public final class ArpPaCriterion implements Criterion { |
77 | } | 74 | } |
78 | return false; | 75 | return false; |
79 | } | 76 | } |
80 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
77 | +} | ... | ... |
... | @@ -21,6 +21,8 @@ package org.onosproject.net.flow.criteria; | ... | @@ -21,6 +21,8 @@ package org.onosproject.net.flow.criteria; |
21 | */ | 21 | */ |
22 | public interface Criterion { | 22 | public interface Criterion { |
23 | 23 | ||
24 | + static final String SEPARATOR = ":"; | ||
25 | + | ||
24 | /** | 26 | /** |
25 | * Types of fields to which the selection criterion may apply. | 27 | * Types of fields to which the selection criterion may apply. |
26 | */ | 28 | */ | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onlab.packet.MacAddress; | ... | @@ -19,8 +19,6 @@ import org.onlab.packet.MacAddress; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of MAC address criterion. | 23 | * Implementation of MAC address criterion. |
26 | */ | 24 | */ |
... | @@ -56,8 +54,7 @@ public final class EthCriterion implements Criterion { | ... | @@ -56,8 +54,7 @@ public final class EthCriterion implements Criterion { |
56 | 54 | ||
57 | @Override | 55 | @Override |
58 | public String toString() { | 56 | public String toString() { |
59 | - return toStringHelper(type().toString()) | 57 | + return type().toString() + SEPARATOR + mac; |
60 | - .add("mac", mac).toString(); | ||
61 | } | 58 | } |
62 | 59 | ||
63 | @Override | 60 | @Override | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onlab.packet.EthType; | ... | @@ -19,8 +19,6 @@ import org.onlab.packet.EthType; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of Ethernet type criterion (16 bits unsigned integer). | 23 | * Implementation of Ethernet type criterion (16 bits unsigned integer). |
26 | */ | 24 | */ |
... | @@ -64,9 +62,7 @@ public final class EthTypeCriterion implements Criterion { | ... | @@ -64,9 +62,7 @@ public final class EthTypeCriterion implements Criterion { |
64 | 62 | ||
65 | @Override | 63 | @Override |
66 | public String toString() { | 64 | public String toString() { |
67 | - return toStringHelper(type().toString()) | 65 | + return type().toString() + SEPARATOR + ethType; |
68 | - .add("ethType", ethType.toString()) | ||
69 | - .toString(); | ||
70 | } | 66 | } |
71 | 67 | ||
72 | @Override | 68 | @Override | ... | ... |
... | @@ -20,8 +20,6 @@ import org.onosproject.net.DeviceId; | ... | @@ -20,8 +20,6 @@ import org.onosproject.net.DeviceId; |
20 | 20 | ||
21 | import java.util.Objects; | 21 | import java.util.Objects; |
22 | 22 | ||
23 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
24 | - | ||
25 | /** | 23 | /** |
26 | * Criterion for implementing selector extensions. | 24 | * Criterion for implementing selector extensions. |
27 | */ | 25 | */ |
... | @@ -66,10 +64,7 @@ public class ExtensionCriterion implements Criterion { | ... | @@ -66,10 +64,7 @@ public class ExtensionCriterion implements Criterion { |
66 | 64 | ||
67 | @Override | 65 | @Override |
68 | public String toString() { | 66 | public String toString() { |
69 | - return toStringHelper(type().toString()) | 67 | + return type().toString() + SEPARATOR + deviceId + "/" + extensionSelector; |
70 | - .add("extensionSelector", extensionSelector.toString()) | ||
71 | - .add("deviceId", deviceId) | ||
72 | - .toString(); | ||
73 | } | 68 | } |
74 | 69 | ||
75 | @Override | 70 | @Override | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onlab.packet.IpPrefix; | ... | @@ -19,8 +19,6 @@ import org.onlab.packet.IpPrefix; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of IP address criterion. | 23 | * Implementation of IP address criterion. |
26 | */ | 24 | */ |
... | @@ -56,8 +54,7 @@ public final class IPCriterion implements Criterion { | ... | @@ -56,8 +54,7 @@ public final class IPCriterion implements Criterion { |
56 | 54 | ||
57 | @Override | 55 | @Override |
58 | public String toString() { | 56 | public String toString() { |
59 | - return toStringHelper(type().toString()) | 57 | + return type().toString() + SEPARATOR + ip; |
60 | - .add("ip", ip).toString(); | ||
61 | } | 58 | } |
62 | 59 | ||
63 | @Override | 60 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of IP DSCP (Differentiated Services Code Point) | 21 | * Implementation of IP DSCP (Differentiated Services Code Point) |
24 | * criterion (6 bits). | 22 | * criterion (6 bits). |
... | @@ -52,8 +50,7 @@ public final class IPDscpCriterion implements Criterion { | ... | @@ -52,8 +50,7 @@ public final class IPDscpCriterion implements Criterion { |
52 | 50 | ||
53 | @Override | 51 | @Override |
54 | public String toString() { | 52 | public String toString() { |
55 | - return toStringHelper(type().toString()) | 53 | + return type().toString() + SEPARATOR + Long.toHexString(ipDscp); |
56 | - .add("ipDscp", Long.toHexString(ipDscp)).toString(); | ||
57 | } | 54 | } |
58 | 55 | ||
59 | @Override | 56 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of IP ECN (Explicit Congestion Notification) criterion | 21 | * Implementation of IP ECN (Explicit Congestion Notification) criterion |
24 | * (2 bits). | 22 | * (2 bits). |
... | @@ -52,8 +50,7 @@ public final class IPEcnCriterion implements Criterion { | ... | @@ -52,8 +50,7 @@ public final class IPEcnCriterion implements Criterion { |
52 | 50 | ||
53 | @Override | 51 | @Override |
54 | public String toString() { | 52 | public String toString() { |
55 | - return toStringHelper(type().toString()) | 53 | + return type().toString() + SEPARATOR + Long.toHexString(ipEcn); |
56 | - .add("ipEcn", Long.toHexString(ipEcn)).toString(); | ||
57 | } | 54 | } |
58 | 55 | ||
59 | @Override | 56 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of Internet Protocol Number criterion (8 bits unsigned) | 21 | * Implementation of Internet Protocol Number criterion (8 bits unsigned) |
24 | * integer. | 22 | * integer. |
... | @@ -53,8 +51,7 @@ public final class IPProtocolCriterion implements Criterion { | ... | @@ -53,8 +51,7 @@ public final class IPProtocolCriterion implements Criterion { |
53 | 51 | ||
54 | @Override | 52 | @Override |
55 | public String toString() { | 53 | public String toString() { |
56 | - return toStringHelper(type().toString()) | 54 | + return type().toString() + SEPARATOR + proto; |
57 | - .add("protocol", proto).toString(); | ||
58 | } | 55 | } |
59 | 56 | ||
60 | @Override | 57 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of IPv6 Extension Header pseudo-field criterion | 21 | * Implementation of IPv6 Extension Header pseudo-field criterion |
24 | * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags. | 22 | * (16 bits). Those are defined in Criterion.IPv6ExthdrFlags. |
... | @@ -54,8 +52,7 @@ public final class IPv6ExthdrFlagsCriterion implements Criterion { | ... | @@ -54,8 +52,7 @@ public final class IPv6ExthdrFlagsCriterion implements Criterion { |
54 | 52 | ||
55 | @Override | 53 | @Override |
56 | public String toString() { | 54 | public String toString() { |
57 | - return toStringHelper(type().toString()) | 55 | + return type().toString() + SEPARATOR + Long.toHexString(exthdrFlags); |
58 | - .add("exthdrFlags", Long.toHexString(exthdrFlags)).toString(); | ||
59 | } | 56 | } |
60 | 57 | ||
61 | @Override | 58 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of IPv6 Flow Label (RFC 6437) criterion (20 bits unsigned | 21 | * Implementation of IPv6 Flow Label (RFC 6437) criterion (20 bits unsigned |
24 | * integer). | 22 | * integer). |
... | @@ -52,8 +50,7 @@ public final class IPv6FlowLabelCriterion implements Criterion { | ... | @@ -52,8 +50,7 @@ public final class IPv6FlowLabelCriterion implements Criterion { |
52 | 50 | ||
53 | @Override | 51 | @Override |
54 | public String toString() { | 52 | public String toString() { |
55 | - return toStringHelper(type().toString()) | 53 | + return type().toString() + SEPARATOR + Long.toHexString(flowLabel); |
56 | - .add("flowLabel", Long.toHexString(flowLabel)).toString(); | ||
57 | } | 54 | } |
58 | 55 | ||
59 | @Override | 56 | @Override | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onlab.packet.MacAddress; | ... | @@ -19,8 +19,6 @@ import org.onlab.packet.MacAddress; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of IPv6 Neighbor Discovery link-layer address criterion. | 23 | * Implementation of IPv6 Neighbor Discovery link-layer address criterion. |
26 | */ | 24 | */ |
... | @@ -56,8 +54,7 @@ public final class IPv6NDLinkLayerAddressCriterion implements Criterion { | ... | @@ -56,8 +54,7 @@ public final class IPv6NDLinkLayerAddressCriterion implements Criterion { |
56 | 54 | ||
57 | @Override | 55 | @Override |
58 | public String toString() { | 56 | public String toString() { |
59 | - return toStringHelper(type().toString()) | 57 | + return type().toString() + SEPARATOR + mac; |
60 | - .add("mac", mac).toString(); | ||
61 | } | 58 | } |
62 | 59 | ||
63 | @Override | 60 | @Override | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onlab.packet.Ip6Address; | ... | @@ -19,8 +19,6 @@ import org.onlab.packet.Ip6Address; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of IPv6 Neighbor Discovery target address criterion. | 23 | * Implementation of IPv6 Neighbor Discovery target address criterion. |
26 | */ | 24 | */ |
... | @@ -52,8 +50,7 @@ public final class IPv6NDTargetAddressCriterion implements Criterion { | ... | @@ -52,8 +50,7 @@ public final class IPv6NDTargetAddressCriterion implements Criterion { |
52 | 50 | ||
53 | @Override | 51 | @Override |
54 | public String toString() { | 52 | public String toString() { |
55 | - return toStringHelper(type().toString()) | 53 | + return type().toString() + SEPARATOR + targetAddress; |
56 | - .add("targetAddress", targetAddress).toString(); | ||
57 | } | 54 | } |
58 | 55 | ||
59 | @Override | 56 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of ICMP code criterion (8 bits unsigned integer). | 21 | * Implementation of ICMP code criterion (8 bits unsigned integer). |
24 | */ | 22 | */ |
... | @@ -51,8 +49,7 @@ public final class IcmpCodeCriterion implements Criterion { | ... | @@ -51,8 +49,7 @@ public final class IcmpCodeCriterion implements Criterion { |
51 | 49 | ||
52 | @Override | 50 | @Override |
53 | public String toString() { | 51 | public String toString() { |
54 | - return toStringHelper(type().toString()) | 52 | + return type().toString() + SEPARATOR + icmpCode; |
55 | - .add("icmpCode", icmpCode).toString(); | ||
56 | } | 53 | } |
57 | 54 | ||
58 | @Override | 55 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of ICMP type criterion (8 bits unsigned integer). | 21 | * Implementation of ICMP type criterion (8 bits unsigned integer). |
24 | */ | 22 | */ |
... | @@ -51,8 +49,7 @@ public final class IcmpTypeCriterion implements Criterion { | ... | @@ -51,8 +49,7 @@ public final class IcmpTypeCriterion implements Criterion { |
51 | 49 | ||
52 | @Override | 50 | @Override |
53 | public String toString() { | 51 | public String toString() { |
54 | - return toStringHelper(type().toString()) | 52 | + return type().toString() + SEPARATOR + icmpType; |
55 | - .add("icmpType", icmpType).toString(); | ||
56 | } | 53 | } |
57 | 54 | ||
58 | @Override | 55 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of ICMPv6 code criterion (8 bits unsigned integer). | 21 | * Implementation of ICMPv6 code criterion (8 bits unsigned integer). |
24 | */ | 22 | */ |
... | @@ -51,8 +49,7 @@ public final class Icmpv6CodeCriterion implements Criterion { | ... | @@ -51,8 +49,7 @@ public final class Icmpv6CodeCriterion implements Criterion { |
51 | 49 | ||
52 | @Override | 50 | @Override |
53 | public String toString() { | 51 | public String toString() { |
54 | - return toStringHelper(type().toString()) | 52 | + return type().toString() + SEPARATOR + icmpv6Code; |
55 | - .add("icmpv6Code", icmpv6Code).toString(); | ||
56 | } | 53 | } |
57 | 54 | ||
58 | @Override | 55 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of ICMPv6 type criterion (8 bits unsigned integer). | 21 | * Implementation of ICMPv6 type criterion (8 bits unsigned integer). |
24 | */ | 22 | */ |
... | @@ -51,8 +49,7 @@ public final class Icmpv6TypeCriterion implements Criterion { | ... | @@ -51,8 +49,7 @@ public final class Icmpv6TypeCriterion implements Criterion { |
51 | 49 | ||
52 | @Override | 50 | @Override |
53 | public String toString() { | 51 | public String toString() { |
54 | - return toStringHelper(type().toString()) | 52 | + return type().toString() + SEPARATOR + icmpv6Type; |
55 | - .add("icmpv6Type", icmpv6Type).toString(); | ||
56 | } | 53 | } |
57 | 54 | ||
58 | @Override | 55 | @Override | ... | ... |
... | @@ -15,7 +15,6 @@ | ... | @@ -15,7 +15,6 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | -import com.google.common.base.MoreObjects; | ||
19 | import org.onosproject.net.IndexedLambda; | 18 | import org.onosproject.net.IndexedLambda; |
20 | 19 | ||
21 | import java.util.Objects; | 20 | import java.util.Objects; |
... | @@ -76,8 +75,6 @@ public class IndexedLambdaCriterion implements Criterion { | ... | @@ -76,8 +75,6 @@ public class IndexedLambdaCriterion implements Criterion { |
76 | 75 | ||
77 | @Override | 76 | @Override |
78 | public String toString() { | 77 | public String toString() { |
79 | - return MoreObjects.toStringHelper(this) | 78 | + return type().toString() + SEPARATOR + lambda; |
80 | - .add("lambda", lambda) | ||
81 | - .toString(); | ||
82 | } | 79 | } |
83 | } | 80 | } | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of lambda (wavelength) criterion (16 bits unsigned | 21 | * Implementation of lambda (wavelength) criterion (16 bits unsigned |
24 | * integer). | 22 | * integer). |
... | @@ -56,8 +54,7 @@ public final class LambdaCriterion implements Criterion { | ... | @@ -56,8 +54,7 @@ public final class LambdaCriterion implements Criterion { |
56 | 54 | ||
57 | @Override | 55 | @Override |
58 | public String toString() { | 56 | public String toString() { |
59 | - return toStringHelper(type().toString()) | 57 | + return type().toString() + SEPARATOR + lambda; |
60 | - .add("lambda", lambda).toString(); | ||
61 | } | 58 | } |
62 | 59 | ||
63 | @Override | 60 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of Metadata criterion. | 21 | * Implementation of Metadata criterion. |
24 | */ | 22 | */ |
... | @@ -50,9 +48,7 @@ public final class MetadataCriterion implements Criterion { | ... | @@ -50,9 +48,7 @@ public final class MetadataCriterion implements Criterion { |
50 | 48 | ||
51 | @Override | 49 | @Override |
52 | public String toString() { | 50 | public String toString() { |
53 | - return toStringHelper(type().toString()) | 51 | + return type().toString() + SEPARATOR + Long.toHexString(metadata); |
54 | - .add("metadata", Long.toHexString(metadata)) | ||
55 | - .toString(); | ||
56 | } | 52 | } |
57 | 53 | ||
58 | @Override | 54 | @Override | ... | ... |
... | @@ -15,7 +15,6 @@ | ... | @@ -15,7 +15,6 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | import java.util.Objects; | 18 | import java.util.Objects; |
20 | 19 | ||
21 | /** | 20 | /** |
... | @@ -39,8 +38,7 @@ public class MplsBosCriterion implements Criterion { | ... | @@ -39,8 +38,7 @@ public class MplsBosCriterion implements Criterion { |
39 | 38 | ||
40 | @Override | 39 | @Override |
41 | public String toString() { | 40 | public String toString() { |
42 | - return toStringHelper(type().toString()) | 41 | + return type().toString() + SEPARATOR + mplsBos; |
43 | - .add("bos", mplsBos).toString(); | ||
44 | } | 42 | } |
45 | 43 | ||
46 | @Override | 44 | @Override | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onlab.packet.MplsLabel; | ... | @@ -19,8 +19,6 @@ import org.onlab.packet.MplsLabel; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of MPLS tag criterion (20 bits). | 23 | * Implementation of MPLS tag criterion (20 bits). |
26 | */ | 24 | */ |
... | @@ -43,8 +41,7 @@ public final class MplsCriterion implements Criterion { | ... | @@ -43,8 +41,7 @@ public final class MplsCriterion implements Criterion { |
43 | 41 | ||
44 | @Override | 42 | @Override |
45 | public String toString() { | 43 | public String toString() { |
46 | - return toStringHelper(type().toString()) | 44 | + return type().toString() + SEPARATOR + mplsLabel; |
47 | - .add("mpls", mplsLabel).toString(); | ||
48 | } | 45 | } |
49 | 46 | ||
50 | @Override | 47 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of MPLS TC criterion (3 bits). | 21 | * Implementation of MPLS TC criterion (3 bits). |
24 | */ | 22 | */ |
... | @@ -51,8 +49,7 @@ public final class MplsTcCriterion implements Criterion { | ... | @@ -51,8 +49,7 @@ public final class MplsTcCriterion implements Criterion { |
51 | 49 | ||
52 | @Override | 50 | @Override |
53 | public String toString() { | 51 | public String toString() { |
54 | - return toStringHelper(type().toString()) | 52 | + return type().toString() + SEPARATOR + Long.toHexString(mplsTc); |
55 | - .add("tc", Long.toHexString(mplsTc)).toString(); | ||
56 | } | 53 | } |
57 | 54 | ||
58 | @Override | 55 | @Override | ... | ... |
... | @@ -15,7 +15,6 @@ | ... | @@ -15,7 +15,6 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | -import com.google.common.base.MoreObjects; | ||
19 | import org.onosproject.net.OchSignal; | 18 | import org.onosproject.net.OchSignal; |
20 | 19 | ||
21 | import java.util.Objects; | 20 | import java.util.Objects; |
... | @@ -74,8 +73,6 @@ public final class OchSignalCriterion implements Criterion { | ... | @@ -74,8 +73,6 @@ public final class OchSignalCriterion implements Criterion { |
74 | 73 | ||
75 | @Override | 74 | @Override |
76 | public String toString() { | 75 | public String toString() { |
77 | - return MoreObjects.toStringHelper(this) | 76 | + return type().toString() + SEPARATOR + lambda; |
78 | - .add("lambda", lambda) | ||
79 | - .toString(); | ||
80 | } | 77 | } |
81 | } | 78 | } | ... | ... |
... | @@ -15,7 +15,6 @@ | ... | @@ -15,7 +15,6 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | -import com.google.common.base.MoreObjects; | ||
19 | import org.onosproject.net.OchSignalType; | 18 | import org.onosproject.net.OchSignalType; |
20 | 19 | ||
21 | import java.util.Objects; | 20 | import java.util.Objects; |
... | @@ -71,8 +70,6 @@ public class OchSignalTypeCriterion implements Criterion { | ... | @@ -71,8 +70,6 @@ public class OchSignalTypeCriterion implements Criterion { |
71 | 70 | ||
72 | @Override | 71 | @Override |
73 | public String toString() { | 72 | public String toString() { |
74 | - return MoreObjects.toStringHelper(this) | 73 | + return type().toString() + SEPARATOR + signalType; |
75 | - .add("signalType", signalType) | ||
76 | - .toString(); | ||
77 | } | 74 | } |
78 | } | 75 | } | ... | ... |
... | @@ -15,12 +15,11 @@ | ... | @@ -15,12 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | -import static com.google.common.base.MoreObjects.toStringHelper; | 18 | +import org.onosproject.net.OduSignalId; |
19 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | 19 | ||
21 | import java.util.Objects; | 20 | import java.util.Objects; |
22 | 21 | ||
23 | -import org.onosproject.net.OduSignalId; | 22 | +import static com.google.common.base.Preconditions.checkNotNull; |
24 | 23 | ||
25 | /** | 24 | /** |
26 | * Implementation of ODU (Optical channel Data Unit) signal ID signal criterion. | 25 | * Implementation of ODU (Optical channel Data Unit) signal ID signal criterion. |
... | @@ -74,9 +73,7 @@ public final class OduSignalIdCriterion implements Criterion { | ... | @@ -74,9 +73,7 @@ public final class OduSignalIdCriterion implements Criterion { |
74 | 73 | ||
75 | @Override | 74 | @Override |
76 | public String toString() { | 75 | public String toString() { |
77 | - return toStringHelper(this) | 76 | + return type().toString() + SEPARATOR + oduSignalId; |
78 | - .add("oduSignalId", oduSignalId) | ||
79 | - .toString(); | ||
80 | } | 77 | } |
81 | 78 | ||
82 | } | 79 | } | ... | ... |
... | @@ -15,12 +15,11 @@ | ... | @@ -15,12 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | -import static com.google.common.base.MoreObjects.toStringHelper; | 18 | +import org.onosproject.net.OduSignalType; |
19 | -import static com.google.common.base.Preconditions.checkNotNull; | ||
20 | 19 | ||
21 | import java.util.Objects; | 20 | import java.util.Objects; |
22 | 21 | ||
23 | -import org.onosproject.net.OduSignalType; | 22 | +import static com.google.common.base.Preconditions.checkNotNull; |
24 | 23 | ||
25 | /** | 24 | /** |
26 | * Implementation of ODU (Optical channel Data Unit) signal Type criterion. | 25 | * Implementation of ODU (Optical channel Data Unit) signal Type criterion. |
... | @@ -74,8 +73,6 @@ public final class OduSignalTypeCriterion implements Criterion { | ... | @@ -74,8 +73,6 @@ public final class OduSignalTypeCriterion implements Criterion { |
74 | 73 | ||
75 | @Override | 74 | @Override |
76 | public String toString() { | 75 | public String toString() { |
77 | - return toStringHelper(this) | 76 | + return type().toString() + SEPARATOR + signalType; |
78 | - .add("signalType", signalType) | ||
79 | - .toString(); | ||
80 | } | 77 | } |
81 | } | 78 | } | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of PBB I-SID criterion (24 bits unsigned integer). | 21 | * Implementation of PBB I-SID criterion (24 bits unsigned integer). |
24 | */ | 22 | */ |
... | @@ -51,8 +49,7 @@ public final class PbbIsidCriterion implements Criterion { | ... | @@ -51,8 +49,7 @@ public final class PbbIsidCriterion implements Criterion { |
51 | 49 | ||
52 | @Override | 50 | @Override |
53 | public String toString() { | 51 | public String toString() { |
54 | - return toStringHelper(type().toString()) | 52 | + return type().toString() + SEPARATOR + Long.toHexString(pbbIsid); |
55 | - .add("pbbIsid", Long.toHexString(pbbIsid)).toString(); | ||
56 | } | 53 | } |
57 | 54 | ||
58 | @Override | 55 | @Override | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onosproject.net.PortNumber; | ... | @@ -19,8 +19,6 @@ import org.onosproject.net.PortNumber; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of input port criterion. | 23 | * Implementation of input port criterion. |
26 | */ | 24 | */ |
... | @@ -56,8 +54,7 @@ public final class PortCriterion implements Criterion { | ... | @@ -56,8 +54,7 @@ public final class PortCriterion implements Criterion { |
56 | 54 | ||
57 | @Override | 55 | @Override |
58 | public String toString() { | 56 | public String toString() { |
59 | - return toStringHelper(type().toString()) | 57 | + return type().toString() + SEPARATOR + port; |
60 | - .add("port", port).toString(); | ||
61 | } | 58 | } |
62 | 59 | ||
63 | @Override | 60 | @Override | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onlab.packet.TpPort; | ... | @@ -19,8 +19,6 @@ import org.onlab.packet.TpPort; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of SCTP port criterion (16 bits unsigned integer). | 23 | * Implementation of SCTP port criterion (16 bits unsigned integer). |
26 | */ | 24 | */ |
... | @@ -56,8 +54,7 @@ public final class SctpPortCriterion implements Criterion { | ... | @@ -56,8 +54,7 @@ public final class SctpPortCriterion implements Criterion { |
56 | 54 | ||
57 | @Override | 55 | @Override |
58 | public String toString() { | 56 | public String toString() { |
59 | - return toStringHelper(type().toString()) | 57 | + return type().toString() + SEPARATOR + sctpPort; |
60 | - .add("sctpPort", sctpPort).toString(); | ||
61 | } | 58 | } |
62 | 59 | ||
63 | @Override | 60 | @Override | ... | ... |
... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,8 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | /** | 20 | /** |
23 | * Implementation of TCP flags criterion (12 bits unsigned integer). | 21 | * Implementation of TCP flags criterion (12 bits unsigned integer). |
24 | */ | 22 | */ |
... | @@ -51,8 +49,7 @@ public final class TcpFlagsCriterion implements Criterion { | ... | @@ -51,8 +49,7 @@ public final class TcpFlagsCriterion implements Criterion { |
51 | 49 | ||
52 | @Override | 50 | @Override |
53 | public String toString() { | 51 | public String toString() { |
54 | - return toStringHelper(type().toString()) | 52 | + return type().toString() + SEPARATOR + Long.toHexString(flags); |
55 | - .add("flags", Long.toHexString(flags)).toString(); | ||
56 | } | 53 | } |
57 | 54 | ||
58 | @Override | 55 | @Override | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onlab.packet.TpPort; | ... | @@ -19,8 +19,6 @@ import org.onlab.packet.TpPort; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of TCP port criterion (16 bits unsigned integer). | 23 | * Implementation of TCP port criterion (16 bits unsigned integer). |
26 | */ | 24 | */ |
... | @@ -56,8 +54,7 @@ public final class TcpPortCriterion implements Criterion { | ... | @@ -56,8 +54,7 @@ public final class TcpPortCriterion implements Criterion { |
56 | 54 | ||
57 | @Override | 55 | @Override |
58 | public String toString() { | 56 | public String toString() { |
59 | - return toStringHelper(type().toString()) | 57 | + return type().toString() + SEPARATOR + tcpPort; |
60 | - .add("tcpPort", tcpPort).toString(); | ||
61 | } | 58 | } |
62 | 59 | ||
63 | @Override | 60 | @Override | ... | ... |
... | @@ -16,8 +16,6 @@ | ... | @@ -16,8 +16,6 @@ |
16 | package org.onosproject.net.flow.criteria; | 16 | package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | - | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | /** | 19 | /** |
22 | * Implementation of Tunnel ID criterion. | 20 | * Implementation of Tunnel ID criterion. |
23 | */ | 21 | */ |
... | @@ -49,9 +47,7 @@ public class TunnelIdCriterion implements Criterion { | ... | @@ -49,9 +47,7 @@ public class TunnelIdCriterion implements Criterion { |
49 | 47 | ||
50 | @Override | 48 | @Override |
51 | public String toString() { | 49 | public String toString() { |
52 | - return toStringHelper(type().toString()) | 50 | + return type().toString() + SEPARATOR + Long.toHexString(tunnelId); |
53 | - .add("tunnelId", Long.toHexString(tunnelId)) | ||
54 | - .toString(); | ||
55 | } | 51 | } |
56 | 52 | ||
57 | @Override | 53 | @Override | ... | ... |
... | @@ -19,8 +19,6 @@ import org.onlab.packet.TpPort; | ... | @@ -19,8 +19,6 @@ import org.onlab.packet.TpPort; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | - | ||
24 | /** | 22 | /** |
25 | * Implementation of UDP port criterion (16 bits unsigned integer). | 23 | * Implementation of UDP port criterion (16 bits unsigned integer). |
26 | */ | 24 | */ |
... | @@ -56,8 +54,7 @@ public final class UdpPortCriterion implements Criterion { | ... | @@ -56,8 +54,7 @@ public final class UdpPortCriterion implements Criterion { |
56 | 54 | ||
57 | @Override | 55 | @Override |
58 | public String toString() { | 56 | public String toString() { |
59 | - return toStringHelper(type().toString()) | 57 | + return type().toString() + SEPARATOR + udpPort; |
60 | - .add("udpPort", udpPort).toString(); | ||
61 | } | 58 | } |
62 | 59 | ||
63 | @Override | 60 | @Override | ... | ... |
... | @@ -19,7 +19,6 @@ import org.onlab.packet.VlanId; | ... | @@ -19,7 +19,6 @@ import org.onlab.packet.VlanId; |
19 | 19 | ||
20 | import java.util.Objects; | 20 | import java.util.Objects; |
21 | 21 | ||
22 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
23 | import static com.google.common.base.Preconditions.checkArgument; | 22 | import static com.google.common.base.Preconditions.checkArgument; |
24 | 23 | ||
25 | /** | 24 | /** |
... | @@ -69,8 +68,7 @@ public final class VlanIdCriterion implements Criterion { | ... | @@ -69,8 +68,7 @@ public final class VlanIdCriterion implements Criterion { |
69 | 68 | ||
70 | @Override | 69 | @Override |
71 | public String toString() { | 70 | public String toString() { |
72 | - return toStringHelper(type().toString()) | 71 | + return type().toString() + SEPARATOR + vlanId; |
73 | - .add("vlanId", vlanId).toString(); | ||
74 | } | 72 | } |
75 | 73 | ||
76 | @Override | 74 | @Override | ... | ... |
... | @@ -17,7 +17,6 @@ package org.onosproject.net.flow.criteria; | ... | @@ -17,7 +17,6 @@ package org.onosproject.net.flow.criteria; |
17 | 17 | ||
18 | import java.util.Objects; | 18 | import java.util.Objects; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | import static com.google.common.base.Preconditions.checkArgument; | 20 | import static com.google.common.base.Preconditions.checkArgument; |
22 | 21 | ||
23 | /** | 22 | /** |
... | @@ -68,8 +67,7 @@ public final class VlanPcpCriterion implements Criterion { | ... | @@ -68,8 +67,7 @@ public final class VlanPcpCriterion implements Criterion { |
68 | 67 | ||
69 | @Override | 68 | @Override |
70 | public String toString() { | 69 | public String toString() { |
71 | - return toStringHelper(type().toString()) | 70 | + return type().toString() + SEPARATOR + Long.toHexString(vlanPcp); |
72 | - .add("priority", Long.toHexString(vlanPcp)).toString(); | ||
73 | } | 71 | } |
74 | 72 | ||
75 | @Override | 73 | @Override | ... | ... |
... | @@ -54,6 +54,8 @@ import static com.google.common.base.Preconditions.checkNotNull; | ... | @@ -54,6 +54,8 @@ import static com.google.common.base.Preconditions.checkNotNull; |
54 | */ | 54 | */ |
55 | public final class Instructions { | 55 | public final class Instructions { |
56 | 56 | ||
57 | + private static final String SEPARATOR = ":"; | ||
58 | + | ||
57 | // Ban construction | 59 | // Ban construction |
58 | private Instructions() {} | 60 | private Instructions() {} |
59 | 61 | ||
... | @@ -547,7 +549,7 @@ public final class Instructions { | ... | @@ -547,7 +549,7 @@ public final class Instructions { |
547 | 549 | ||
548 | @Override | 550 | @Override |
549 | public String toString() { | 551 | public String toString() { |
550 | - return toStringHelper(type().toString()).toString(); | 552 | + return type().toString(); |
551 | } | 553 | } |
552 | 554 | ||
553 | @Override | 555 | @Override |
... | @@ -581,7 +583,7 @@ public final class Instructions { | ... | @@ -581,7 +583,7 @@ public final class Instructions { |
581 | 583 | ||
582 | @Override | 584 | @Override |
583 | public String toString() { | 585 | public String toString() { |
584 | - return toStringHelper(type().toString()).toString(); | 586 | + return type().toString(); |
585 | } | 587 | } |
586 | 588 | ||
587 | @Override | 589 | @Override |
... | @@ -619,10 +621,10 @@ public final class Instructions { | ... | @@ -619,10 +621,10 @@ public final class Instructions { |
619 | public Type type() { | 621 | public Type type() { |
620 | return Type.OUTPUT; | 622 | return Type.OUTPUT; |
621 | } | 623 | } |
624 | + | ||
622 | @Override | 625 | @Override |
623 | public String toString() { | 626 | public String toString() { |
624 | - return toStringHelper(type().toString()) | 627 | + return type().toString() + SEPARATOR + port.toString(); |
625 | - .add("port", port).toString(); | ||
626 | } | 628 | } |
627 | 629 | ||
628 | @Override | 630 | @Override |
... | @@ -665,9 +667,7 @@ public final class Instructions { | ... | @@ -665,9 +667,7 @@ public final class Instructions { |
665 | 667 | ||
666 | @Override | 668 | @Override |
667 | public String toString() { | 669 | public String toString() { |
668 | - return toStringHelper(type().toString()) | 670 | + return type().toString() + SEPARATOR + Integer.toHexString(groupId.id()); |
669 | - .addValue("group ID=0x" + Integer.toHexString(groupId.id())) | ||
670 | - .toString(); | ||
671 | } | 671 | } |
672 | 672 | ||
673 | @Override | 673 | @Override |
... | @@ -770,8 +770,7 @@ public final class Instructions { | ... | @@ -770,8 +770,7 @@ public final class Instructions { |
770 | 770 | ||
771 | @Override | 771 | @Override |
772 | public String toString() { | 772 | public String toString() { |
773 | - return toStringHelper(type().toString()) | 773 | + return type().toString() + SEPARATOR + meterId.id(); |
774 | - .add("meter ID", meterId.id()).toString(); | ||
775 | } | 774 | } |
776 | 775 | ||
777 | @Override | 776 | @Override |
... | @@ -814,8 +813,7 @@ public final class Instructions { | ... | @@ -814,8 +813,7 @@ public final class Instructions { |
814 | 813 | ||
815 | @Override | 814 | @Override |
816 | public String toString() { | 815 | public String toString() { |
817 | - return toStringHelper(type().toString()) | 816 | + return type().toString() + SEPARATOR + this.tableId; |
818 | - .add("tableId", this.tableId).toString(); | ||
819 | } | 817 | } |
820 | 818 | ||
821 | @Override | 819 | @Override |
... | @@ -864,10 +862,9 @@ public final class Instructions { | ... | @@ -864,10 +862,9 @@ public final class Instructions { |
864 | 862 | ||
865 | @Override | 863 | @Override |
866 | public String toString() { | 864 | public String toString() { |
867 | - return toStringHelper(type().toString()) | 865 | + return type().toString() + SEPARATOR + |
868 | - .add("metadata", Long.toHexString(this.metadata)) | 866 | + Long.toHexString(this.metadata) + "/" + |
869 | - .add("metadata mask", Long.toHexString(this.metadataMask)) | 867 | + Long.toHexString(this.metadataMask); |
870 | - .toString(); | ||
871 | } | 868 | } |
872 | 869 | ||
873 | @Override | 870 | @Override |
... | @@ -917,10 +914,7 @@ public final class Instructions { | ... | @@ -917,10 +914,7 @@ public final class Instructions { |
917 | 914 | ||
918 | @Override | 915 | @Override |
919 | public String toString() { | 916 | public String toString() { |
920 | - return toStringHelper(type().toString()) | 917 | + return type().toString() + SEPARATOR + deviceId + "/" + extensionTreatment; |
921 | - .add("extension", extensionTreatment) | ||
922 | - .add("deviceId", deviceId) | ||
923 | - .toString(); | ||
924 | } | 918 | } |
925 | 919 | ||
926 | @Override | 920 | @Override | ... | ... |
... | @@ -15,15 +15,14 @@ | ... | @@ -15,15 +15,14 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.instructions; | 16 | package org.onosproject.net.flow.instructions; |
17 | 17 | ||
18 | -import com.google.common.base.MoreObjects; | ||
19 | import org.onosproject.net.OchSignal; | 18 | import org.onosproject.net.OchSignal; |
20 | 19 | ||
21 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
22 | - | ||
23 | import java.util.Objects; | 20 | import java.util.Objects; |
24 | 21 | ||
25 | public abstract class L0ModificationInstruction implements Instruction { | 22 | public abstract class L0ModificationInstruction implements Instruction { |
26 | 23 | ||
24 | + public static final String SEPARATOR = ":"; | ||
25 | + | ||
27 | /** | 26 | /** |
28 | * Represents the type of traffic treatment. | 27 | * Represents the type of traffic treatment. |
29 | */ | 28 | */ |
... | @@ -69,8 +68,7 @@ public abstract class L0ModificationInstruction implements Instruction { | ... | @@ -69,8 +68,7 @@ public abstract class L0ModificationInstruction implements Instruction { |
69 | 68 | ||
70 | @Override | 69 | @Override |
71 | public String toString() { | 70 | public String toString() { |
72 | - return toStringHelper(subtype().toString()) | 71 | + return subtype().toString() + SEPARATOR + lambda; |
73 | - .add("lambda", lambda).toString(); | ||
74 | } | 72 | } |
75 | 73 | ||
76 | @Override | 74 | @Override |
... | @@ -131,9 +129,7 @@ public abstract class L0ModificationInstruction implements Instruction { | ... | @@ -131,9 +129,7 @@ public abstract class L0ModificationInstruction implements Instruction { |
131 | 129 | ||
132 | @Override | 130 | @Override |
133 | public String toString() { | 131 | public String toString() { |
134 | - return MoreObjects.toStringHelper(this) | 132 | + return subtype().toString() + SEPARATOR + lambda; |
135 | - .add("lambda", lambda) | ||
136 | - .toString(); | ||
137 | } | 133 | } |
138 | } | 134 | } |
139 | } | 135 | } | ... | ... |
... | @@ -17,12 +17,12 @@ package org.onosproject.net.flow.instructions; | ... | @@ -17,12 +17,12 @@ package org.onosproject.net.flow.instructions; |
17 | 17 | ||
18 | import org.onosproject.net.OduSignalId; | 18 | import org.onosproject.net.OduSignalId; |
19 | 19 | ||
20 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
21 | - | ||
22 | import java.util.Objects; | 20 | import java.util.Objects; |
23 | 21 | ||
24 | public abstract class L1ModificationInstruction implements Instruction { | 22 | public abstract class L1ModificationInstruction implements Instruction { |
25 | 23 | ||
24 | + public static final String SEPARATOR = ":"; | ||
25 | + | ||
26 | /** | 26 | /** |
27 | * Represents the type of traffic treatment. | 27 | * Represents the type of traffic treatment. |
28 | */ | 28 | */ |
... | @@ -79,9 +79,7 @@ public abstract class L1ModificationInstruction implements Instruction { | ... | @@ -79,9 +79,7 @@ public abstract class L1ModificationInstruction implements Instruction { |
79 | 79 | ||
80 | @Override | 80 | @Override |
81 | public String toString() { | 81 | public String toString() { |
82 | - return toStringHelper(this) | 82 | + return subtype().toString() + SEPARATOR + oduSignalId; |
83 | - .add("oduSignalId", oduSignalId) | ||
84 | - .toString(); | ||
85 | } | 83 | } |
86 | } | 84 | } |
87 | 85 | ... | ... |
... | @@ -22,13 +22,13 @@ import org.onlab.packet.VlanId; | ... | @@ -22,13 +22,13 @@ import org.onlab.packet.VlanId; |
22 | 22 | ||
23 | import java.util.Objects; | 23 | import java.util.Objects; |
24 | 24 | ||
25 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
26 | - | ||
27 | /** | 25 | /** |
28 | * Abstraction of a single traffic treatment step. | 26 | * Abstraction of a single traffic treatment step. |
29 | */ | 27 | */ |
30 | public abstract class L2ModificationInstruction implements Instruction { | 28 | public abstract class L2ModificationInstruction implements Instruction { |
31 | 29 | ||
30 | + private static final String SEPARATOR = ":"; | ||
31 | + | ||
32 | /** | 32 | /** |
33 | * Represents the type of traffic treatment. | 33 | * Represents the type of traffic treatment. |
34 | */ | 34 | */ |
... | @@ -94,9 +94,6 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -94,9 +94,6 @@ public abstract class L2ModificationInstruction implements Instruction { |
94 | MPLS_BOS | 94 | MPLS_BOS |
95 | } | 95 | } |
96 | 96 | ||
97 | - // TODO: Create factory class 'Instructions' that will have various factory | ||
98 | - // to create specific instructions. | ||
99 | - | ||
100 | public abstract L2SubType subtype(); | 97 | public abstract L2SubType subtype(); |
101 | 98 | ||
102 | @Override | 99 | @Override |
... | @@ -129,8 +126,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -129,8 +126,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
129 | 126 | ||
130 | @Override | 127 | @Override |
131 | public String toString() { | 128 | public String toString() { |
132 | - return toStringHelper(subtype().toString()) | 129 | + return subtype().toString() + SEPARATOR + mac; |
133 | - .add("mac", mac).toString(); | ||
134 | } | 130 | } |
135 | 131 | ||
136 | @Override | 132 | @Override |
... | @@ -176,9 +172,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -176,9 +172,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
176 | 172 | ||
177 | @Override | 173 | @Override |
178 | public String toString() { | 174 | public String toString() { |
179 | - return toStringHelper(subtype().toString()) | 175 | + return subtype().toString() + SEPARATOR + ethernetType; |
180 | - .add("ethernetType", ethernetType()) | ||
181 | - .toString(); | ||
182 | } | 176 | } |
183 | 177 | ||
184 | @Override | 178 | @Override |
... | @@ -224,8 +218,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -224,8 +218,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
224 | 218 | ||
225 | @Override | 219 | @Override |
226 | public String toString() { | 220 | public String toString() { |
227 | - return toStringHelper(subtype().toString()) | 221 | + return subtype().toString() + SEPARATOR + vlanId; |
228 | - .add("id", vlanId).toString(); | ||
229 | } | 222 | } |
230 | 223 | ||
231 | @Override | 224 | @Override |
... | @@ -269,8 +262,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -269,8 +262,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
269 | 262 | ||
270 | @Override | 263 | @Override |
271 | public String toString() { | 264 | public String toString() { |
272 | - return toStringHelper(subtype().toString()) | 265 | + return subtype().toString() + SEPARATOR + Long.toHexString(vlanPcp); |
273 | - .add("pcp", Long.toHexString(vlanPcp)).toString(); | ||
274 | } | 266 | } |
275 | 267 | ||
276 | @Override | 268 | @Override |
... | @@ -308,8 +300,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -308,8 +300,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
308 | 300 | ||
309 | @Override | 301 | @Override |
310 | public String toString() { | 302 | public String toString() { |
311 | - return toStringHelper(subtype().toString()) | 303 | + return subtype().toString(); |
312 | - .toString(); | ||
313 | } | 304 | } |
314 | 305 | ||
315 | @Override | 306 | @Override |
... | @@ -365,8 +356,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -365,8 +356,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
365 | 356 | ||
366 | @Override | 357 | @Override |
367 | public String toString() { | 358 | public String toString() { |
368 | - return toStringHelper(subtype().toString()) | 359 | + return subtype().toString() + SEPARATOR + mplsLabel; |
369 | - .add("mpls", mplsLabel).toString(); | ||
370 | } | 360 | } |
371 | 361 | ||
372 | @Override | 362 | @Override |
... | @@ -410,8 +400,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -410,8 +400,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
410 | 400 | ||
411 | @Override | 401 | @Override |
412 | public String toString() { | 402 | public String toString() { |
413 | - return toStringHelper(subtype().toString()).add("bos", mplsBos) | 403 | + return subtype().toString() + SEPARATOR + mplsBos; |
414 | - .toString(); | ||
415 | } | 404 | } |
416 | 405 | ||
417 | @Override | 406 | @Override |
... | @@ -448,8 +437,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -448,8 +437,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
448 | 437 | ||
449 | @Override | 438 | @Override |
450 | public String toString() { | 439 | public String toString() { |
451 | - return toStringHelper(subtype().toString()) | 440 | + return subtype().toString(); |
452 | - .toString(); | ||
453 | } | 441 | } |
454 | 442 | ||
455 | @Override | 443 | @Override |
... | @@ -492,9 +480,7 @@ public abstract class L2ModificationInstruction implements Instruction { | ... | @@ -492,9 +480,7 @@ public abstract class L2ModificationInstruction implements Instruction { |
492 | 480 | ||
493 | @Override | 481 | @Override |
494 | public String toString() { | 482 | public String toString() { |
495 | - return toStringHelper(subtype().toString()) | 483 | + return subtype().toString() + SEPARATOR + Long.toHexString(tunnelId); |
496 | - .add("id", Long.toHexString(tunnelId)) | ||
497 | - .toString(); | ||
498 | } | 484 | } |
499 | 485 | ||
500 | @Override | 486 | @Override | ... | ... |
... | @@ -15,18 +15,18 @@ | ... | @@ -15,18 +15,18 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.flow.instructions; | 16 | package org.onosproject.net.flow.instructions; |
17 | 17 | ||
18 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
19 | - | ||
20 | -import java.util.Objects; | ||
21 | - | ||
22 | import org.onlab.packet.IpAddress; | 18 | import org.onlab.packet.IpAddress; |
23 | import org.onlab.packet.MacAddress; | 19 | import org.onlab.packet.MacAddress; |
24 | 20 | ||
21 | +import java.util.Objects; | ||
22 | + | ||
25 | /** | 23 | /** |
26 | * Abstraction of a single traffic treatment step. | 24 | * Abstraction of a single traffic treatment step. |
27 | */ | 25 | */ |
28 | public abstract class L3ModificationInstruction implements Instruction { | 26 | public abstract class L3ModificationInstruction implements Instruction { |
29 | 27 | ||
28 | + private static final String SEPARATOR = ":"; | ||
29 | + | ||
30 | /** | 30 | /** |
31 | * Represents the type of traffic treatment. | 31 | * Represents the type of traffic treatment. |
32 | */ | 32 | */ |
... | @@ -85,8 +85,6 @@ public abstract class L3ModificationInstruction implements Instruction { | ... | @@ -85,8 +85,6 @@ public abstract class L3ModificationInstruction implements Instruction { |
85 | * Arp operation modification. | 85 | * Arp operation modification. |
86 | */ | 86 | */ |
87 | ARP_OP | 87 | ARP_OP |
88 | - | ||
89 | - //TODO: remaining types | ||
90 | } | 88 | } |
91 | 89 | ||
92 | /** | 90 | /** |
... | @@ -125,8 +123,7 @@ public abstract class L3ModificationInstruction implements Instruction { | ... | @@ -125,8 +123,7 @@ public abstract class L3ModificationInstruction implements Instruction { |
125 | 123 | ||
126 | @Override | 124 | @Override |
127 | public String toString() { | 125 | public String toString() { |
128 | - return toStringHelper(subtype().toString()) | 126 | + return subtype().toString() + SEPARATOR + ip; |
129 | - .add("ip", ip).toString(); | ||
130 | } | 127 | } |
131 | 128 | ||
132 | @Override | 129 | @Override |
... | @@ -173,8 +170,7 @@ public abstract class L3ModificationInstruction implements Instruction { | ... | @@ -173,8 +170,7 @@ public abstract class L3ModificationInstruction implements Instruction { |
173 | 170 | ||
174 | @Override | 171 | @Override |
175 | public String toString() { | 172 | public String toString() { |
176 | - return toStringHelper(subtype().toString()) | 173 | + return subtype().toString() + SEPARATOR + ip; |
177 | - .add("ip", ip).toString(); | ||
178 | } | 174 | } |
179 | 175 | ||
180 | @Override | 176 | @Override |
... | @@ -221,8 +217,7 @@ public abstract class L3ModificationInstruction implements Instruction { | ... | @@ -221,8 +217,7 @@ public abstract class L3ModificationInstruction implements Instruction { |
221 | 217 | ||
222 | @Override | 218 | @Override |
223 | public String toString() { | 219 | public String toString() { |
224 | - return toStringHelper(subtype().toString()) | 220 | + return subtype().toString() + SEPARATOR + mac; |
225 | - .add("mac", mac).toString(); | ||
226 | } | 221 | } |
227 | 222 | ||
228 | @Override | 223 | @Override |
... | @@ -269,8 +264,7 @@ public abstract class L3ModificationInstruction implements Instruction { | ... | @@ -269,8 +264,7 @@ public abstract class L3ModificationInstruction implements Instruction { |
269 | 264 | ||
270 | @Override | 265 | @Override |
271 | public String toString() { | 266 | public String toString() { |
272 | - return toStringHelper(subtype().toString()) | 267 | + return subtype().toString() + SEPARATOR + op; |
273 | - .add("op", op).toString(); | ||
274 | } | 268 | } |
275 | 269 | ||
276 | @Override | 270 | @Override |
... | @@ -326,8 +320,7 @@ public abstract class L3ModificationInstruction implements Instruction { | ... | @@ -326,8 +320,7 @@ public abstract class L3ModificationInstruction implements Instruction { |
326 | 320 | ||
327 | @Override | 321 | @Override |
328 | public String toString() { | 322 | public String toString() { |
329 | - return toStringHelper(subtype().toString()) | 323 | + return subtype().toString() + SEPARATOR + Long.toHexString(flowLabel); |
330 | - .add("flowLabel", Long.toHexString(flowLabel)).toString(); | ||
331 | } | 324 | } |
332 | 325 | ||
333 | @Override | 326 | @Override |
... | @@ -367,8 +360,7 @@ public abstract class L3ModificationInstruction implements Instruction { | ... | @@ -367,8 +360,7 @@ public abstract class L3ModificationInstruction implements Instruction { |
367 | 360 | ||
368 | @Override | 361 | @Override |
369 | public String toString() { | 362 | public String toString() { |
370 | - return toStringHelper(subtype().toString()) | 363 | + return subtype().toString(); |
371 | - .toString(); | ||
372 | } | 364 | } |
373 | 365 | ||
374 | @Override | 366 | @Override | ... | ... |
-
Please register or login to post a comment