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
diff --git a/cli/src/main/java/org/onosproject/cli/Comparators.java b/cli/src/main/java/org/onosproject/cli/Comparators.java
index 03d25ce..50e79a1 100644
--- a/cli/src/main/java/org/onosproject/cli/Comparators.java
+++ b/cli/src/main/java/org/onosproject/cli/Comparators.java
@@ -71,10 +71,16 @@
public static final Comparator<FlowRule> FLOW_RULE_COMPARATOR = new Comparator<FlowRule>() {
@Override
public int compare(FlowRule f1, FlowRule f2) {
- int tableCompare = Integer.valueOf(f1.tableId()).compareTo(f2.tableId());
- return (tableCompare == 0)
+ // Compare table IDs in ascending order
+ int tableCompare = f1.tableId() - f2.tableId();
+ if (tableCompare != 0) {
+ return tableCompare;
+ }
+ // Compare priorities in descending order
+ int priorityCompare = f2.priority() - f1.priority();
+ return (priorityCompare == 0)
? Long.valueOf(f1.id().value()).compareTo(f2.id().value())
- : tableCompare;
+ : priorityCompare;
}
};
diff --git a/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java b/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java
index 331cca1..b6477c3 100644
--- a/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/FlowsListCommand.java
@@ -15,16 +15,13 @@
*/
package org.onosproject.cli.net;
-import static com.google.common.collect.Lists.newArrayList;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.karaf.shell.commands.Argument;
import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.commands.Option;
import org.onosproject.cli.AbstractShellCommand;
import org.onosproject.cli.Comparators;
import org.onosproject.core.ApplicationId;
@@ -35,11 +32,16 @@
import org.onosproject.net.flow.FlowEntry;
import org.onosproject.net.flow.FlowEntry.FlowEntryState;
import org.onosproject.net.flow.FlowRuleService;
+import org.onosproject.net.flow.TrafficTreatment;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+import java.util.function.Predicate;
+
+import static com.google.common.collect.Lists.newArrayList;
/**
* Lists all currently-known flows.
@@ -48,26 +50,44 @@
description = "Lists all currently-known flows.")
public class FlowsListCommand extends AbstractShellCommand {
+ private static final Predicate<FlowEntry> TRUE_PREDICATE = f -> true;
+
public static final String ANY = "any";
- private static final String FMT =
- " id=%s, state=%s, bytes=%s, packets=%s, duration=%s, priority=%s, tableId=%s appId=%s, payLoad=%s";
- private static final String TFMT = " treatment=%s";
- private static final String SFMT = " selector=%s";
+ private static final String LONG_FORMAT = " id=%s, state=%s, bytes=%s, "
+ + "packets=%s, duration=%s, priority=%s, tableId=%s, appId=%s, "
+ + "payLoad=%s, selector=%s, treatment=%s";
+
+ private static final String SHORT_FORMAT = " %s, bytes=%s, packets=%s, "
+ + "table=%s, priority=%s, selector=%s, treatment=%s";
+
+ @Argument(index = 0, name = "state", description = "Flow Rule state",
+ required = false, multiValued = false)
+ String state = null;
@Argument(index = 1, name = "uri", description = "Device ID",
required = false, multiValued = false)
String uri = null;
- @Argument(index = 0, name = "state", description = "Flow Rule state",
- required = false, multiValued = false)
- String state = null;
+ @Argument(index = 2, name = "table", description = "Table ID",
+ required = false, multiValued = false)
+ String table = null;
+
+ @Option(name = "-s", aliases = "--short",
+ description = "Print more succinct output for each flow",
+ required = false, multiValued = false)
+ private boolean shortOutput = false;
+
+ private Predicate<FlowEntry> predicate = TRUE_PREDICATE;
@Override
protected void execute() {
CoreService coreService = get(CoreService.class);
DeviceService deviceService = get(DeviceService.class);
FlowRuleService service = get(FlowRuleService.class);
+
+ compilePredicate();
+
SortedMap<Device, List<FlowEntry>> flows = getSortedFlows(deviceService, service);
if (outputJson()) {
@@ -94,6 +114,22 @@
return result;
}
+ /**
+ * Compiles a predicate to find matching flows based on the command
+ * arguments.
+ */
+ private void compilePredicate() {
+ if (state != null && !state.equals(ANY)) {
+ final FlowEntryState feState = FlowEntryState.valueOf(state.toUpperCase());
+ predicate = predicate.and(f -> f.state().equals(feState));
+ }
+
+ if (table != null) {
+ final int tableId = Integer.parseInt(table);
+ predicate = predicate.and(f -> f.tableId() == tableId);
+ }
+ }
+
// Produces JSON object with the flows of the given device.
private ObjectNode json(ObjectMapper mapper,
Device device, List<FlowEntry> flows) {
@@ -119,10 +155,7 @@
FlowRuleService service) {
SortedMap<Device, List<FlowEntry>> flows = new TreeMap<>(Comparators.ELEMENT_COMPARATOR);
List<FlowEntry> rules;
- FlowEntryState s = null;
- if (state != null && !state.equals("any")) {
- s = FlowEntryState.valueOf(state.toUpperCase());
- }
+
Iterable<Device> devices = null;
if (uri == null) {
devices = deviceService.getDevices();
@@ -131,13 +164,14 @@
devices = (dev == null) ? deviceService.getDevices()
: Collections.singletonList(dev);
}
+
for (Device d : devices) {
- if (s == null) {
+ if (predicate.equals(TRUE_PREDICATE)) {
rules = newArrayList(service.getFlowEntries(d.id()));
} else {
rules = newArrayList();
for (FlowEntry f : service.getFlowEntries(d.id())) {
- if (f.state().equals(s)) {
+ if (predicate.test(f)) {
rules.add(f);
}
}
@@ -159,17 +193,51 @@
CoreService coreService) {
boolean empty = flows == null || flows.isEmpty();
print("deviceId=%s, flowRuleCount=%d", d.id(), empty ? 0 : flows.size());
- if (!empty) {
- for (FlowEntry f : flows) {
+ if (empty) {
+ return;
+ }
+
+ for (FlowEntry f : flows) {
+ if (shortOutput) {
+ print(SHORT_FORMAT, f.state(), f.bytes(), f.packets(),
+ f.tableId(), f.priority(), f.selector().criteria(),
+ printTreatment(f.treatment()));
+ } else {
ApplicationId appId = coreService.getAppId(f.appId());
- print(FMT, Long.toHexString(f.id().value()), f.state(),
- f.bytes(), f.packets(), f.life(), f.priority(), f.tableId(),
- appId != null ? appId.name() : "<none>",
- f.payLoad() == null ? null : f.payLoad().payLoad().toString());
- print(SFMT, f.selector().criteria());
- print(TFMT, f.treatment());
+ print(LONG_FORMAT, Long.toHexString(f.id().value()), f.state(),
+ f.bytes(), f.packets(), f.life(), f.priority(), f.tableId(),
+ appId != null ? appId.name() : "<none>",
+ f.payLoad() == null ? null : f.payLoad().payLoad().toString(),
+ f.selector().criteria(), f.treatment());
}
}
}
+ private String printTreatment(TrafficTreatment treatment) {
+ final String delimiter = ", ";
+ StringBuilder builder = new StringBuilder("[");
+ if (!treatment.immediate().isEmpty()) {
+ builder.append("immediate=" + treatment.immediate() + delimiter);
+ }
+ if (!treatment.deferred().isEmpty()) {
+ builder.append("deferred=" + treatment.deferred() + delimiter);
+ }
+ if (treatment.clearedDeferred()) {
+ builder.append("clearDeferred" + delimiter);
+ }
+ if (treatment.tableTransition() != null) {
+ builder.append("transition=" + treatment.tableTransition() + delimiter);
+ }
+ if (treatment.metered() != null) {
+ builder.append("meter=" + treatment.metered() + delimiter);
+ }
+ if (treatment.writeMetadata() != null) {
+ builder.append("metadata=" + treatment.writeMetadata() + delimiter);
+ }
+ // Chop off last delimiter
+ builder.replace(builder.length() - delimiter.length(), builder.length(), "");
+ builder.append("]");
+ return builder.toString();
+ }
+
}
diff --git a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
index 59ebeb2..f9dde70 100644
--- a/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
+++ b/cli/src/main/resources/OSGI-INF/blueprint/shell-config.xml
@@ -427,6 +427,8 @@
<completers>
<ref component-id="flowRuleStatusCompleter"/>
<ref component-id="deviceIdCompleter"/>
+ <ref component-id="placeholderCompleter"/>
+ <null/>
</completers>
</command>
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpHaCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpHaCriterion.java
index 71269dd..4e1731a 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpHaCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpHaCriterion.java
@@ -15,12 +15,11 @@
*/
package org.onosproject.net.flow.criteria;
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
+import org.onlab.packet.MacAddress;
import java.util.Objects;
-import org.onlab.packet.MacAddress;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Implementation of arp_eth_src address or arp_eth_dst address criterion.
@@ -59,8 +58,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("mac", mac).toString();
+ return type().toString() + SEPARATOR + mac;
}
@Override
@@ -80,4 +78,4 @@
}
return false;
}
-}
\ No newline at end of file
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpOpCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpOpCriterion.java
index 8c5398c..c31281d 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpOpCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpOpCriterion.java
@@ -15,8 +15,6 @@
*/
package org.onosproject.net.flow.criteria;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
import java.util.Objects;
/**
@@ -54,8 +52,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("arpOp", arpOp).toString();
+ return type().toString() + SEPARATOR + arpOp;
}
@Override
@@ -75,4 +72,4 @@
}
return false;
}
-}
\ No newline at end of file
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpPaCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpPaCriterion.java
index ba5a03d..f14c7e1 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpPaCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/ArpPaCriterion.java
@@ -15,12 +15,10 @@
*/
package org.onosproject.net.flow.criteria;
-import static com.google.common.base.MoreObjects.toStringHelper;
+import org.onlab.packet.Ip4Address;
import java.util.Objects;
-import org.onlab.packet.Ip4Address;
-
/**
* Implementation of arp spa or tpa address criterion.
*/
@@ -56,8 +54,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("ip", ip).toString();
+ return type().toString() + SEPARATOR + ip;
}
@Override
@@ -77,4 +74,4 @@
}
return false;
}
-}
\ No newline at end of file
+}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
index e6b4939..80c202d 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criterion.java
@@ -21,6 +21,8 @@
*/
public interface Criterion {
+ static final String SEPARATOR = ":";
+
/**
* Types of fields to which the selection criterion may apply.
*/
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java
index 6020974..f4664c9 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/EthCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of MAC address criterion.
*/
@@ -56,8 +54,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("mac", mac).toString();
+ return type().toString() + SEPARATOR + mac;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java
index b2666d4..a0f04f0 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/EthTypeCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of Ethernet type criterion (16 bits unsigned integer).
*/
@@ -64,9 +62,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("ethType", ethType.toString())
- .toString();
+ return type().toString() + SEPARATOR + ethType;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionCriterion.java
index 0f6cd13..e07c996 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/ExtensionCriterion.java
@@ -20,8 +20,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Criterion for implementing selector extensions.
*/
@@ -66,10 +64,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("extensionSelector", extensionSelector.toString())
- .add("deviceId", deviceId)
- .toString();
+ return type().toString() + SEPARATOR + deviceId + "/" + extensionSelector;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java
index 018afe8..6e51446 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of IP address criterion.
*/
@@ -56,8 +54,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("ip", ip).toString();
+ return type().toString() + SEPARATOR + ip;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java
index 8634aa6..f2825cb 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPDscpCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of IP DSCP (Differentiated Services Code Point)
* criterion (6 bits).
@@ -52,8 +50,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("ipDscp", Long.toHexString(ipDscp)).toString();
+ return type().toString() + SEPARATOR + Long.toHexString(ipDscp);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java
index 48b3fbf..7132043 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPEcnCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of IP ECN (Explicit Congestion Notification) criterion
* (2 bits).
@@ -52,8 +50,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("ipEcn", Long.toHexString(ipEcn)).toString();
+ return type().toString() + SEPARATOR + Long.toHexString(ipEcn);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java
index 6879f80..1e71d20 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPProtocolCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of Internet Protocol Number criterion (8 bits unsigned)
* integer.
@@ -53,8 +51,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("protocol", proto).toString();
+ return type().toString() + SEPARATOR + proto;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java
index 2463bf6..ee73c52 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6ExthdrFlagsCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of IPv6 Extension Header pseudo-field criterion
* (16 bits). Those are defined in Criterion.IPv6ExthdrFlags.
@@ -54,8 +52,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("exthdrFlags", Long.toHexString(exthdrFlags)).toString();
+ return type().toString() + SEPARATOR + Long.toHexString(exthdrFlags);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java
index 6e1021d..149d675 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6FlowLabelCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of IPv6 Flow Label (RFC 6437) criterion (20 bits unsigned
* integer).
@@ -52,8 +50,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("flowLabel", Long.toHexString(flowLabel)).toString();
+ return type().toString() + SEPARATOR + Long.toHexString(flowLabel);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java
index 9f310d4..ddc0eee 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDLinkLayerAddressCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of IPv6 Neighbor Discovery link-layer address criterion.
*/
@@ -56,8 +54,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("mac", mac).toString();
+ return type().toString() + SEPARATOR + mac;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java
index ffef044..baeb7c1 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IPv6NDTargetAddressCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of IPv6 Neighbor Discovery target address criterion.
*/
@@ -52,8 +50,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("targetAddress", targetAddress).toString();
+ return type().toString() + SEPARATOR + targetAddress;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java
index 516f61b..de44211 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpCodeCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of ICMP code criterion (8 bits unsigned integer).
*/
@@ -51,8 +49,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("icmpCode", icmpCode).toString();
+ return type().toString() + SEPARATOR + icmpCode;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java
index 6325142..c173a68 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IcmpTypeCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of ICMP type criterion (8 bits unsigned integer).
*/
@@ -51,8 +49,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("icmpType", icmpType).toString();
+ return type().toString() + SEPARATOR + icmpType;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java
index a41b6fe..4eaeb6d 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6CodeCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of ICMPv6 code criterion (8 bits unsigned integer).
*/
@@ -51,8 +49,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("icmpv6Code", icmpv6Code).toString();
+ return type().toString() + SEPARATOR + icmpv6Code;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java
index 7410ba1..b4e45ba 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Icmpv6TypeCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of ICMPv6 type criterion (8 bits unsigned integer).
*/
@@ -51,8 +49,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("icmpv6Type", icmpv6Type).toString();
+ return type().toString() + SEPARATOR + icmpv6Type;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java
index 17ea2d0..3311544 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/IndexedLambdaCriterion.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.net.flow.criteria;
-import com.google.common.base.MoreObjects;
import org.onosproject.net.IndexedLambda;
import java.util.Objects;
@@ -76,8 +75,6 @@
@Override
public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("lambda", lambda)
- .toString();
+ return type().toString() + SEPARATOR + lambda;
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java
index 656800b..55af0fe 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/LambdaCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of lambda (wavelength) criterion (16 bits unsigned
* integer).
@@ -56,8 +54,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("lambda", lambda).toString();
+ return type().toString() + SEPARATOR + lambda;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java
index 8177b48..4d6c2cb 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/MetadataCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of Metadata criterion.
*/
@@ -50,9 +48,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("metadata", Long.toHexString(metadata))
- .toString();
+ return type().toString() + SEPARATOR + Long.toHexString(metadata);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsBosCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsBosCriterion.java
index c8b6690..06adbb3 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsBosCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsBosCriterion.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.net.flow.criteria;
-import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.Objects;
/**
@@ -39,8 +38,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("bos", mplsBos).toString();
+ return type().toString() + SEPARATOR + mplsBos;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java
index 34d384f..6fb7aec 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of MPLS tag criterion (20 bits).
*/
@@ -43,8 +41,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("mpls", mplsLabel).toString();
+ return type().toString() + SEPARATOR + mplsLabel;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsTcCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsTcCriterion.java
index 8ad6235..7fbb6e1 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsTcCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/MplsTcCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of MPLS TC criterion (3 bits).
*/
@@ -51,8 +49,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("tc", Long.toHexString(mplsTc)).toString();
+ return type().toString() + SEPARATOR + Long.toHexString(mplsTc);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java
index 3a51a6b..d322995 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalCriterion.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.net.flow.criteria;
-import com.google.common.base.MoreObjects;
import org.onosproject.net.OchSignal;
import java.util.Objects;
@@ -74,8 +73,6 @@
@Override
public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("lambda", lambda)
- .toString();
+ return type().toString() + SEPARATOR + lambda;
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java
index cf838bf..9e5aca0 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/OchSignalTypeCriterion.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.net.flow.criteria;
-import com.google.common.base.MoreObjects;
import org.onosproject.net.OchSignalType;
import java.util.Objects;
@@ -71,8 +70,6 @@
@Override
public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("signalType", signalType)
- .toString();
+ return type().toString() + SEPARATOR + signalType;
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java
index 2101854..b500497 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalIdCriterion.java
@@ -15,12 +15,11 @@
*/
package org.onosproject.net.flow.criteria;
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
+import org.onosproject.net.OduSignalId;
import java.util.Objects;
-import org.onosproject.net.OduSignalId;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Implementation of ODU (Optical channel Data Unit) signal ID signal criterion.
@@ -74,9 +73,7 @@
@Override
public String toString() {
- return toStringHelper(this)
- .add("oduSignalId", oduSignalId)
- .toString();
+ return type().toString() + SEPARATOR + oduSignalId;
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java
index f485433..2ab391f 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/OduSignalTypeCriterion.java
@@ -15,12 +15,11 @@
*/
package org.onosproject.net.flow.criteria;
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
+import org.onosproject.net.OduSignalType;
import java.util.Objects;
-import org.onosproject.net.OduSignalType;
+import static com.google.common.base.Preconditions.checkNotNull;
/**
* Implementation of ODU (Optical channel Data Unit) signal Type criterion.
@@ -74,8 +73,6 @@
@Override
public String toString() {
- return toStringHelper(this)
- .add("signalType", signalType)
- .toString();
+ return type().toString() + SEPARATOR + signalType;
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/PbbIsidCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/PbbIsidCriterion.java
index 979aa6b..856e192 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/PbbIsidCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/PbbIsidCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of PBB I-SID criterion (24 bits unsigned integer).
*/
@@ -51,8 +49,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("pbbIsid", Long.toHexString(pbbIsid)).toString();
+ return type().toString() + SEPARATOR + Long.toHexString(pbbIsid);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java
index f07cd50..4221451 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/PortCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of input port criterion.
*/
@@ -56,8 +54,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("port", port).toString();
+ return type().toString() + SEPARATOR + port;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java
index 2d4cf15..3062c18 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/SctpPortCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of SCTP port criterion (16 bits unsigned integer).
*/
@@ -56,8 +54,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("sctpPort", sctpPort).toString();
+ return type().toString() + SEPARATOR + sctpPort;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpFlagsCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpFlagsCriterion.java
index e0b5395..036edd0 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpFlagsCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpFlagsCriterion.java
@@ -17,8 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of TCP flags criterion (12 bits unsigned integer).
*/
@@ -51,8 +49,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("flags", Long.toHexString(flags)).toString();
+ return type().toString() + SEPARATOR + Long.toHexString(flags);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java
index e682b23..cadee2b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/TcpPortCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of TCP port criterion (16 bits unsigned integer).
*/
@@ -56,8 +54,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("tcpPort", tcpPort).toString();
+ return type().toString() + SEPARATOR + tcpPort;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/TunnelIdCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/TunnelIdCriterion.java
index 3362c73..b591ad0 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/TunnelIdCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/TunnelIdCriterion.java
@@ -16,8 +16,6 @@
package org.onosproject.net.flow.criteria;
import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
/**
* Implementation of Tunnel ID criterion.
*/
@@ -49,9 +47,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("tunnelId", Long.toHexString(tunnelId))
- .toString();
+ return type().toString() + SEPARATOR + Long.toHexString(tunnelId);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java
index 8a29f47..67c00db 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/UdpPortCriterion.java
@@ -19,8 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Implementation of UDP port criterion (16 bits unsigned integer).
*/
@@ -56,8 +54,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("udpPort", udpPort).toString();
+ return type().toString() + SEPARATOR + udpPort;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java
index 757e8ce..09516cc 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanIdCriterion.java
@@ -19,7 +19,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
/**
@@ -69,8 +68,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("vlanId", vlanId).toString();
+ return type().toString() + SEPARATOR + vlanId;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java
index 99607c8..8872527 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/VlanPcpCriterion.java
@@ -17,7 +17,6 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
/**
@@ -68,8 +67,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("priority", Long.toHexString(vlanPcp)).toString();
+ return type().toString() + SEPARATOR + Long.toHexString(vlanPcp);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
index 8ed882c8..cb6e200 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/Instructions.java
@@ -54,6 +54,8 @@
*/
public final class Instructions {
+ private static final String SEPARATOR = ":";
+
// Ban construction
private Instructions() {}
@@ -547,7 +549,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString()).toString();
+ return type().toString();
}
@Override
@@ -581,7 +583,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString()).toString();
+ return type().toString();
}
@Override
@@ -619,10 +621,10 @@
public Type type() {
return Type.OUTPUT;
}
+
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("port", port).toString();
+ return type().toString() + SEPARATOR + port.toString();
}
@Override
@@ -665,9 +667,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .addValue("group ID=0x" + Integer.toHexString(groupId.id()))
- .toString();
+ return type().toString() + SEPARATOR + Integer.toHexString(groupId.id());
}
@Override
@@ -770,8 +770,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("meter ID", meterId.id()).toString();
+ return type().toString() + SEPARATOR + meterId.id();
}
@Override
@@ -814,8 +813,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("tableId", this.tableId).toString();
+ return type().toString() + SEPARATOR + this.tableId;
}
@Override
@@ -864,10 +862,9 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("metadata", Long.toHexString(this.metadata))
- .add("metadata mask", Long.toHexString(this.metadataMask))
- .toString();
+ return type().toString() + SEPARATOR +
+ Long.toHexString(this.metadata) + "/" +
+ Long.toHexString(this.metadataMask);
}
@Override
@@ -917,10 +914,7 @@
@Override
public String toString() {
- return toStringHelper(type().toString())
- .add("extension", extensionTreatment)
- .add("deviceId", deviceId)
- .toString();
+ return type().toString() + SEPARATOR + deviceId + "/" + extensionTreatment;
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java
index 4af3d16..e0088c1 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L0ModificationInstruction.java
@@ -15,15 +15,14 @@
*/
package org.onosproject.net.flow.instructions;
-import com.google.common.base.MoreObjects;
import org.onosproject.net.OchSignal;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
import java.util.Objects;
public abstract class L0ModificationInstruction implements Instruction {
+ public static final String SEPARATOR = ":";
+
/**
* Represents the type of traffic treatment.
*/
@@ -69,8 +68,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("lambda", lambda).toString();
+ return subtype().toString() + SEPARATOR + lambda;
}
@Override
@@ -131,9 +129,7 @@
@Override
public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("lambda", lambda)
- .toString();
+ return subtype().toString() + SEPARATOR + lambda;
}
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
index b72dd7b..9a76520 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L1ModificationInstruction.java
@@ -17,12 +17,12 @@
import org.onosproject.net.OduSignalId;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
import java.util.Objects;
public abstract class L1ModificationInstruction implements Instruction {
+ public static final String SEPARATOR = ":";
+
/**
* Represents the type of traffic treatment.
*/
@@ -79,9 +79,7 @@
@Override
public String toString() {
- return toStringHelper(this)
- .add("oduSignalId", oduSignalId)
- .toString();
+ return subtype().toString() + SEPARATOR + oduSignalId;
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
index 0dbbb451..29b6f99 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L2ModificationInstruction.java
@@ -22,13 +22,13 @@
import java.util.Objects;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
/**
* Abstraction of a single traffic treatment step.
*/
public abstract class L2ModificationInstruction implements Instruction {
+ private static final String SEPARATOR = ":";
+
/**
* Represents the type of traffic treatment.
*/
@@ -94,9 +94,6 @@
MPLS_BOS
}
- // TODO: Create factory class 'Instructions' that will have various factory
- // to create specific instructions.
-
public abstract L2SubType subtype();
@Override
@@ -129,8 +126,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("mac", mac).toString();
+ return subtype().toString() + SEPARATOR + mac;
}
@Override
@@ -176,9 +172,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("ethernetType", ethernetType())
- .toString();
+ return subtype().toString() + SEPARATOR + ethernetType;
}
@Override
@@ -224,8 +218,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("id", vlanId).toString();
+ return subtype().toString() + SEPARATOR + vlanId;
}
@Override
@@ -269,8 +262,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("pcp", Long.toHexString(vlanPcp)).toString();
+ return subtype().toString() + SEPARATOR + Long.toHexString(vlanPcp);
}
@Override
@@ -308,8 +300,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .toString();
+ return subtype().toString();
}
@Override
@@ -365,8 +356,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("mpls", mplsLabel).toString();
+ return subtype().toString() + SEPARATOR + mplsLabel;
}
@Override
@@ -410,8 +400,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString()).add("bos", mplsBos)
- .toString();
+ return subtype().toString() + SEPARATOR + mplsBos;
}
@Override
@@ -448,8 +437,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .toString();
+ return subtype().toString();
}
@Override
@@ -492,9 +480,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("id", Long.toHexString(tunnelId))
- .toString();
+ return subtype().toString() + SEPARATOR + Long.toHexString(tunnelId);
}
@Override
diff --git a/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java b/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java
index 0efe9a7..fec4338 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/instructions/L3ModificationInstruction.java
@@ -15,18 +15,18 @@
*/
package org.onosproject.net.flow.instructions;
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-import java.util.Objects;
-
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
+import java.util.Objects;
+
/**
* Abstraction of a single traffic treatment step.
*/
public abstract class L3ModificationInstruction implements Instruction {
+ private static final String SEPARATOR = ":";
+
/**
* Represents the type of traffic treatment.
*/
@@ -85,8 +85,6 @@
* Arp operation modification.
*/
ARP_OP
-
- //TODO: remaining types
}
/**
@@ -125,8 +123,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("ip", ip).toString();
+ return subtype().toString() + SEPARATOR + ip;
}
@Override
@@ -173,8 +170,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("ip", ip).toString();
+ return subtype().toString() + SEPARATOR + ip;
}
@Override
@@ -221,8 +217,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("mac", mac).toString();
+ return subtype().toString() + SEPARATOR + mac;
}
@Override
@@ -269,8 +264,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("op", op).toString();
+ return subtype().toString() + SEPARATOR + op;
}
@Override
@@ -326,8 +320,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .add("flowLabel", Long.toHexString(flowLabel)).toString();
+ return subtype().toString() + SEPARATOR + Long.toHexString(flowLabel);
}
@Override
@@ -367,8 +360,7 @@
@Override
public String toString() {
- return toStringHelper(subtype().toString())
- .toString();
+ return subtype().toString();
}
@Override