Skip to content
Snippets Groups Projects
Commit 94a6caa2 authored by Ryan Izard's avatar Ryan Izard
Browse files

Updated circuitpusher with new SFP syntax. Updated Forwarding(Base) to use a...

Updated circuitpusher with new SFP syntax. Updated Forwarding(Base) to use a default priority of 1, since in OF1.3 we have a priority=0 table-miss flow that will also match. Trying to update the Web UI to display flows correctly.
parent df825121
No related branches found
No related tags found
No related merge requests found
......@@ -143,26 +143,26 @@ if args.action=='add':
# send one flow mod per pair of APs in route
# using StaticFlowPusher rest API
# IMPORTANT NOTE: current Floodlight StaticflowEntryPusher
# IMPORTANT NOTE: current Floodlight StaticflowPusher
# assumes all flow entries to have unique name across all switches
# this will most possibly be relaxed later, but for now we
# encode each flow entry's name with both switch dpid, user
# specified name, and flow type (f: forward, r: reverse, farp/rarp: arp)
command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"nw_src\":\"%s\", \"nw_dst\":\"%s\", \"dl_type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"ingress_port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowentrypusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".f", args.srcAddress, args.dstAddress, "0x800", ap1Port['shortPortNumber'], ap2Port['shortPortNumber'], controllerRestIp)
command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"ipv4_src\":\"%s\", \"ipv4_dst\":\"%s\", \"eth_type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"in_port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowpusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".f", args.srcAddress, args.dstAddress, "0x800", ap1Port['shortPortNumber'], ap2Port['shortPortNumber'], controllerRestIp)
result = os.popen(command).read()
print command
command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"arp_spa\":\"%s\", \"arp_dpa\":\"%s\", \"dl_type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"ingress_port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowentrypusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".farp", args.srcAddress, args.dstAddress, "0x806", ap1Port['shortPortNumber'], ap2Port['shortPortNumber'], controllerRestIp)
command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"arp_spa\":\"%s\", \"arp_tpa\":\"%s\", \"eth_type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"in_port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowpusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".farp", args.srcAddress, args.dstAddress, "0x806", ap1Port['shortPortNumber'], ap2Port['shortPortNumber'], controllerRestIp)
result = os.popen(command).read()
print command
command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"nw_src\":\"%s\", \"nw_dst\":\"%s\", \"dl_type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"ingress_port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowentrypusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".r", args.dstAddress, args.srcAddress, "0x800", ap2Port['shortPortNumber'], ap1Port['shortPortNumber'], controllerRestIp)
command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"ipv4_src\":\"%s\", \"ipv4_dst\":\"%s\", \"eth_type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"in_port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowpusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".r", args.dstAddress, args.srcAddress, "0x800", ap2Port['shortPortNumber'], ap1Port['shortPortNumber'], controllerRestIp)
result = os.popen(command).read()
print command
command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"arp_spa\":\"%s\", \"arp_dpa\":\"%s\", \"dl_type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"ingress_port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowentrypusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".rarp",args.dstAddress, args.srcAddress, "0x806", ap2Port['shortPortNumber'], ap1Port['shortPortNumber'], controllerRestIp)
command = "curl -s -d '{\"switch\": \"%s\", \"name\":\"%s\", \"arp_spa\":\"%s\", \"arp_tpa\":\"%s\", \"eth_type\":\"%s\", \"cookie\":\"0\", \"priority\":\"32768\", \"in_port\":\"%s\",\"active\":\"true\", \"actions\":\"output=%s\"}' http://%s/wm/staticflowpusher/json" % (ap1Dpid, ap1Dpid+"."+args.circuitName+".rarp",args.dstAddress, args.srcAddress, "0x806", ap2Port['shortPortNumber'], ap1Port['shortPortNumber'], controllerRestIp)
result = os.popen(command).read()
print command
......@@ -198,19 +198,19 @@ elif args.action=='delete':
sw = data['Dpid']
print data, sw
command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowentrypusher/json" % (sw+"."+args.circuitName+".f", sw, controllerRestIp)
command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowpusher/json" % (sw+"."+args.circuitName+".f", sw, controllerRestIp)
result = os.popen(command).read()
print command, result
command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowentrypusher/json" % (sw+"."+args.circuitName+".farp", sw, controllerRestIp)
command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowpusher/json" % (sw+"."+args.circuitName+".farp", sw, controllerRestIp)
result = os.popen(command).read()
print command, result
command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowentrypusher/json" % (sw+"."+args.circuitName+".r", sw, controllerRestIp)
command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowpusher/json" % (sw+"."+args.circuitName+".r", sw, controllerRestIp)
result = os.popen(command).read()
print command, result
command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowentrypusher/json" % (sw+"."+args.circuitName+".rarp", sw, controllerRestIp)
command = "curl -X DELETE -d '{\"name\":\"%s\", \"switch\":\"%s\"}' http://%s/wm/staticflowpusher/json" % (sw+"."+args.circuitName+".rarp", sw, controllerRestIp)
result = os.popen(command).read()
print command, result
......
......@@ -75,9 +75,6 @@ import org.slf4j.LoggerFactory;
public class Forwarding extends ForwardingBase implements IFloodlightModule {
protected static Logger log = LoggerFactory.getLogger(Forwarding.class);
protected static int DEFAULT_HARD_TIMEOUT = 0; // not final b/c could be configured from config file
protected static int DEFAULT_IDLE_TIMEOUT = 5;
@Override
@LogMessageDoc(level="ERROR",
message="Unexpected decision made for this packet-in={}",
......@@ -155,11 +152,12 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
U64 cookie = AppCookie.makeCookie(FORWARDING_APP_ID, 0);
fmb.setCookie(cookie)
.setHardTimeout(DEFAULT_HARD_TIMEOUT)
.setIdleTimeout(DEFAULT_IDLE_TIMEOUT)
.setHardTimeout(FLOWMOD_DEFAULT_HARD_TIMEOUT)
.setIdleTimeout(FLOWMOD_DEFAULT_IDLE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setMatch(mb.build())
.setActions(actions); // empty list
.setActions(actions) // empty list
.setPriority(FLOWMOD_DEFAULT_PRIORITY);
try {
if (log.isDebugEnabled()) {
......@@ -449,21 +447,25 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule {
Map<String, String> configParameters = context.getConfigParams(this);
String tmp = configParameters.get("hard-timeout");
if (tmp != null) {
DEFAULT_HARD_TIMEOUT = Integer.parseInt(tmp);
log.info("Default hard timeout set to {}.", DEFAULT_HARD_TIMEOUT);
FLOWMOD_DEFAULT_HARD_TIMEOUT = Integer.parseInt(tmp);
log.info("Default hard timeout set to {}.", FLOWMOD_DEFAULT_HARD_TIMEOUT);
} else {
log.info("Default hard timeout not configured. Using {}.", DEFAULT_HARD_TIMEOUT);
log.info("Default hard timeout not configured. Using {}.", FLOWMOD_DEFAULT_HARD_TIMEOUT);
}
tmp = configParameters.get("idle-timeout");
if (tmp != null) {
DEFAULT_IDLE_TIMEOUT = Integer.parseInt(tmp);
log.info("Default idle timeout set to {}.", DEFAULT_IDLE_TIMEOUT);
FLOWMOD_DEFAULT_IDLE_TIMEOUT = Integer.parseInt(tmp);
log.info("Default idle timeout set to {}.", FLOWMOD_DEFAULT_IDLE_TIMEOUT);
} else {
log.info("Default idle timeout not configured. Using {}.", DEFAULT_IDLE_TIMEOUT);
log.info("Default idle timeout not configured. Using {}.", FLOWMOD_DEFAULT_IDLE_TIMEOUT);
}
tmp = configParameters.get("priority");
if (tmp != null) {
FLOWMOD_DEFAULT_PRIORITY = Integer.parseInt(tmp);
log.info("Default priority set to {}.", FLOWMOD_DEFAULT_PRIORITY);
} else {
log.info("Default priority not configured. Using {}.", FLOWMOD_DEFAULT_PRIORITY);
}
}
@Override
......
......@@ -80,8 +80,9 @@ public abstract class ForwardingBase implements IOFMessageListener {
protected static int OFMESSAGE_DAMPER_CAPACITY = 10000; // TODO: find sweet spot
protected static int OFMESSAGE_DAMPER_TIMEOUT = 250; // ms
public static short FLOWMOD_DEFAULT_IDLE_TIMEOUT = 5; // in seconds
public static short FLOWMOD_DEFAULT_HARD_TIMEOUT = 0; // infinite
public static int FLOWMOD_DEFAULT_IDLE_TIMEOUT = 5; // in seconds
public static int FLOWMOD_DEFAULT_HARD_TIMEOUT = 0; // infinite
public static int FLOWMOD_DEFAULT_PRIORITY = 1; // 0 is the default table-miss flow in OF1.3+, so we need to use 1
public static final short FLOWMOD_DEFAULT_IDLE_TIMEOUT_CONSTANT = 5;
public static final short FLOWMOD_DEFAULT_HARD_TIMEOUT_CONSTANT = 0;
......@@ -266,7 +267,8 @@ public abstract class ForwardingBase implements IOFMessageListener {
.setHardTimeout(FLOWMOD_DEFAULT_HARD_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setCookie(cookie)
.setOutPort(outPort);
.setOutPort(outPort)
.setPriority(FLOWMOD_DEFAULT_PRIORITY);
try {
if (log.isTraceEnabled()) {
......@@ -487,6 +489,7 @@ public abstract class ForwardingBase implements IOFMessageListener {
fmb.setCookie(cookie)
.setHardTimeout(hardTimeout)
.setIdleTimeout(FLOWMOD_DEFAULT_IDLE_TIMEOUT)
.setPriority(FLOWMOD_DEFAULT_PRIORITY)
.setBufferId(OFBufferId.NO_BUFFER)
.setMatch(mb.build())
.setActions(actions);
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment