* Added initial support for add/get/delete Flow state to the Network MAP via the REST API
NOTE: The "add" REST API can't be used as-is.
* Added initial support for reading the Flow state from the Network MAP by the Controller
and sending it to the switches.
Currently, the Controller reads periodically the Flow entries (every 3 seconds)
NOTE: The writing of the OpenFlow state to the switches is not tested.
The Python scripts for to add/delete/get flows are intentionally omitted until
the "add" REST API issue is resolved.
NOTE: Two new keys have been added to the database: "flow_id" and "flow_entry_id".
This requires that the older database should be deleted, because Cassandra
doesn't allow adding new keys to an existing database.
diff --git a/src/main/java/net/floodlightcontroller/util/DataPath.java b/src/main/java/net/floodlightcontroller/util/DataPath.java
index 71e0a2f..b2dded6 100644
--- a/src/main/java/net/floodlightcontroller/util/DataPath.java
+++ b/src/main/java/net/floodlightcontroller/util/DataPath.java
@@ -19,6 +19,8 @@
* Default constructor.
*/
public DataPath() {
+ srcPort = new SwitchPort();
+ dstPort = new SwitchPort();
flowEntries = new ArrayList<FlowEntry>();
}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntry.java b/src/main/java/net/floodlightcontroller/util/FlowEntry.java
index dfb8f82..efab0cf 100644
--- a/src/main/java/net/floodlightcontroller/util/FlowEntry.java
+++ b/src/main/java/net/floodlightcontroller/util/FlowEntry.java
@@ -4,33 +4,13 @@
import net.floodlightcontroller.util.FlowEntryActions;
import net.floodlightcontroller.util.FlowEntryId;
import net.floodlightcontroller.util.FlowEntryMatch;
+import net.floodlightcontroller.util.FlowEntrySwitchState;
+import net.floodlightcontroller.util.FlowEntryUserState;
import net.floodlightcontroller.util.Port;
import org.codehaus.jackson.annotate.JsonProperty;
/**
- * The Flow Entry state as set by the user (via the ONOS API).
- */
-enum FlowEntryUserState {
- FE_USER_UNKNOWN, // Initialization value: state unknown
- FE_USER_ADD, // Flow entry that is added
- FE_USER_MODIFY, // Flow entry that is modified
- FE_USER_DELETE // Flow entry that is deleted
-}
-
-/**
- * The Flow Entry state as set by the controller.
- */
-enum FlowEntrySwitchState {
- FE_SWITCH_UNKNOWN, // Initialization value: state unknown
- FE_SWITCH_NOT_UPDATED, // Switch not updated with this entry
- FE_SWITCH_UPDATE_IN_PROGRESS, // Switch update in progress
- FE_SWITCH_UPDATED, // Switch updated with this entry
- FE_SWITCH_UPDATE_FAILED // Error updating the switch with this entry
-}
-
-
-/**
* The class representing the Flow Entry.
*
* NOTE: The specification is incomplete. E.g., the entry needs to
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryId.java b/src/main/java/net/floodlightcontroller/util/FlowEntryId.java
index 0874bdb..d322f5e 100644
--- a/src/main/java/net/floodlightcontroller/util/FlowEntryId.java
+++ b/src/main/java/net/floodlightcontroller/util/FlowEntryId.java
@@ -63,6 +63,6 @@
*/
@Override
public String toString() {
- return Long.toHexString(this.value);
+ return "0x" + Long.toHexString(this.value);
}
}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntrySwitchState.java b/src/main/java/net/floodlightcontroller/util/FlowEntrySwitchState.java
new file mode 100644
index 0000000..4f9882a
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/FlowEntrySwitchState.java
@@ -0,0 +1,12 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The Flow Entry state as set by the controller.
+ */
+public enum FlowEntrySwitchState {
+ FE_SWITCH_UNKNOWN, // Initialization value: state unknown
+ FE_SWITCH_NOT_UPDATED, // Switch not updated with this entry
+ FE_SWITCH_UPDATE_IN_PROGRESS, // Switch update in progress
+ FE_SWITCH_UPDATED, // Switch updated with this entry
+ FE_SWITCH_UPDATE_FAILED // Error updating the switch with this entry
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowEntryUserState.java b/src/main/java/net/floodlightcontroller/util/FlowEntryUserState.java
new file mode 100644
index 0000000..8637b4f
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/util/FlowEntryUserState.java
@@ -0,0 +1,11 @@
+package net.floodlightcontroller.util;
+
+/**
+ * The Flow Entry state as set by the user (via the ONOS API).
+ */
+public enum FlowEntryUserState {
+ FE_USER_UNKNOWN, // Initialization value: state unknown
+ FE_USER_ADD, // Flow entry that is added
+ FE_USER_MODIFY, // Flow entry that is modified
+ FE_USER_DELETE // Flow entry that is deleted
+}
diff --git a/src/main/java/net/floodlightcontroller/util/FlowPath.java b/src/main/java/net/floodlightcontroller/util/FlowPath.java
index 5b3bbd1..11f23fe 100644
--- a/src/main/java/net/floodlightcontroller/util/FlowPath.java
+++ b/src/main/java/net/floodlightcontroller/util/FlowPath.java
@@ -18,6 +18,7 @@
* Default constructor.
*/
public FlowPath() {
+ dataPath = new DataPath();
}
/**