* Added JsonSerialize to the Flow-related containers.
* Implement the remaining toString() methods that were
returning empty strings.
diff --git a/src/main/java/net/floodlightcontroller/util/DataPath.java b/src/main/java/net/floodlightcontroller/util/DataPath.java
index 2374fbe..34fc1f2 100644
--- a/src/main/java/net/floodlightcontroller/util/DataPath.java
+++ b/src/main/java/net/floodlightcontroller/util/DataPath.java
@@ -4,10 +4,15 @@
import net.floodlightcontroller.util.SwitchPort;
import net.floodlightcontroller.util.FlowEntry;
+import net.floodlightcontroller.util.serializers.DataPathSerializer;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
/**
* The class representing the Data Path.
*/
+@JsonSerialize(using=DataPathSerializer.class)
public class DataPath {
private SwitchPort srcPort; // The source port
private SwitchPort dstPort; // The destination port
@@ -70,12 +75,20 @@
/**
* Convert the data path to a string.
*
+ * The string has the following form:
+ * [src:01:01:01:01:01:01:01:01/1111 flowEntry:<entry1> flowEntry:<entry2> flowEntry:<entry3> dst:02:02:02:02:02:02:02:02/2222]
+ *
* @return the data path as a string.
*/
@Override
public String toString() {
- String ret = "";
- // TODO: Implement it!
+ String ret = "[src:" + this.srcPort.toString();
+
+ for (FlowEntry fe : flowEntries) {
+ ret += " flowEntry:" + fe.toString();
+ }
+ ret += " dst:" + this.dstPort.toString() + "]";
+
return ret;
}
}