From a7ccbc1bf237b74836200d275f5b1fb8c1300fe5 Mon Sep 17 00:00:00 2001 From: Ryan Izard <rizard@g.clemson.edu> Date: Fri, 13 Nov 2015 15:41:20 -0500 Subject: [PATCH] Fixed SFP issue where the flow checker would allow a flow w/o a switch specified. --- .../web/StaticFlowEntryPusherResource.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/web/StaticFlowEntryPusherResource.java b/src/main/java/net/floodlightcontroller/staticflowentry/web/StaticFlowEntryPusherResource.java index 6c0897ba2..f46c3f94b 100644 --- a/src/main/java/net/floodlightcontroller/staticflowentry/web/StaticFlowEntryPusherResource.java +++ b/src/main/java/net/floodlightcontroller/staticflowentry/web/StaticFlowEntryPusherResource.java @@ -20,7 +20,7 @@ package net.floodlightcontroller.staticflowentry.web; import java.io.IOException; import java.util.Map; - +import org.projectfloodlight.openflow.types.DatapathId; import org.restlet.resource.Delete; import org.restlet.resource.Post; import org.restlet.resource.ServerResource; @@ -211,9 +211,17 @@ public class StaticFlowEntryPusherResource extends ServerResource { state = 7; return state; } - + + if (rows.containsKey(StaticFlowEntryPusher.COLUMN_SWITCH)) { + try { + DatapathId.of((String) rows.get(StaticFlowEntryPusher.COLUMN_SWITCH)); + } catch (Exception e) { + state = 9; + } + } else { + state = 8; + } return state; - } /** @@ -312,6 +320,12 @@ public class StaticFlowEntryPusherResource extends ServerResource { } else if (state == 7) { status = "Warning! IPv4 & IPv6 fields cannot be specified in the same flow! The flow has been discarded."; log.error(status); + } else if (state == 8) { + status = "Warning! Must specify switch DPID in flow. The flow has been discarded."; + log.error(status); + } else if (state == 9) { + status = "Warning! Switch DPID invalid! The flow has been discarded."; + log.error(status); } else if (state == 0) { status = "Entry pushed"; storageSource.insertRowAsync(StaticFlowEntryPusher.TABLE_NAME, rowValues); -- GitLab