Use "POST" instead of "GET" to install a flow via the REST API.
diff --git a/src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java b/src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java
index 1646012..769970a 100644
--- a/src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java
+++ b/src/main/java/net/floodlightcontroller/flowcache/web/AddFlowResource.java
@@ -1,4 +1,4 @@
-package net.floodlightcontroller.flowcache.web;
+flowIdpackage net.floodlightcontroller.flowcache.web;
import java.io.IOException;
@@ -10,7 +10,7 @@
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
-import org.restlet.resource.Get;
+import org.restlet.resource.Post;
import org.restlet.resource.ServerResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -19,8 +19,8 @@
protected static Logger log = LoggerFactory.getLogger(AddFlowResource.class);
- @Get("json")
- public FlowId retrieve() {
+ @Post("json")
+ public FlowId store(String flowJson) {
FlowId result = new FlowId();
IFlowService flowService =
@@ -37,10 +37,7 @@
// NOTE: The "flow" is specified in JSON format.
//
ObjectMapper mapper = new ObjectMapper();
- String flowPathStr = (String) getRequestAttributes().get("flow");
- // TODO: Remove it later
- // String flowPathStr = "{\"flowId\":{\"value\":\"5\"},\"installerId\":{\"value\":\"FOOBAR\"},\"dataPath\":{\"srcPort\":{\"dpid\":{\"value\":\"00:00:00:00:00:00:00:01\"},\"port\":{\"value\":0}},\"dstPort\":{\"dpid\":{\"value\":\"00:00:00:00:00:00:00:02\"},\"port\":{\"value\":0}},\"flowEntries\":[{\"flowEntryId\":null,\"flowEntryMatch\":null,\"flowEntryActions\":null,\"dpid\":{\"value\":\"00:00:00:00:00:00:00:01\"},\"inPort\":{\"value\":0},\"outPort\":{\"value\":1},\"flowEntryUserState\":\"FE_USER_UNKNOWN\",\"flowEntrySwitchState\":\"FE_SWITCH_UNKNOWN\",\"flowEntryErrorState\":null},{\"flowEntryId\":null,\"flowEntryMatch\":null,\"flowEntryActions\":null,\"dpid\":{\"value\":\"00:00:00:00:00:00:00:02\"},\"inPort\":{\"value\":9},\"outPort\":{\"value\":0},\"flowEntryUserState\":\"FE_USER_UNKNOWN\",\"flowEntrySwitchState\":\"FE_SWITCH_UNKNOWN\",\"flowEntryErrorState\":null}]}}";
-
+ String flowPathStr = flowJson;
FlowPath flowPath = null;
log.debug("Add Flow Path: " + flowPathStr);
try {