Use DPID format like "00:00:00:00:00:00:00:00" to set the switch DPID
instead of an integer when pusing an intent via the REST api.
Change-Id: Ie58a774762f201e64f85ec811ca0aa0b2c51d6b1
diff --git a/src/main/java/net/onrc/onos/core/datagrid/web/IntentResource.java b/src/main/java/net/onrc/onos/core/datagrid/web/IntentResource.java
index 909ec82..1445e4b 100755
--- a/src/main/java/net/onrc/onos/core/datagrid/web/IntentResource.java
+++ b/src/main/java/net/onrc/onos/core/datagrid/web/IntentResource.java
@@ -19,6 +19,7 @@
import net.onrc.onos.core.intent.IntentOperationList;
import net.onrc.onos.core.intent.ShortestPathIntent;
import net.onrc.onos.core.intent.runtime.IPathCalcRuntimeService;
+import net.onrc.onos.core.util.Dpid;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonNode;
@@ -188,12 +189,15 @@
if ((intentOp.equals("remove"))) {
operation = IntentOperation.Operator.REMOVE;
}
+ Dpid srcSwitchDpid = new Dpid((String) fields.get("srcSwitch"));
+ Dpid dstSwitchDpid = new Dpid((String) fields.get("dstSwitch"));
+
if (intentType.equals("shortest_intent_type")) {
ShortestPathIntent spi = new ShortestPathIntent(applnIntentId,
- Long.decode((String) fields.get("srcSwitch")),
+ srcSwitchDpid.value(),
(long) fields.get("srcPort"),
MACAddress.valueOf((String) fields.get("srcMac")).toLong(),
- Long.decode((String) fields.get("dstSwitch")),
+ dstSwitchDpid.value(),
(long) fields.get("dstPort"),
MACAddress.valueOf((String) fields.get("dstMac")).toLong());
spi.setPathFrozen(pathFrozen);