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

Update Forwarding and LoadBalancer to perform empty path checks instead of null checks

parent c7c40a88
No related branches found
No related tags found
No related merge requests found
...@@ -487,7 +487,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF ...@@ -487,7 +487,7 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF
Match m = createMatchFromPacket(sw, srcPort, pi, cntx); Match m = createMatchFromPacket(sw, srcPort, pi, cntx);
if (path != null) { if (! path.getPath().isEmpty()) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("pushRoute inPort={} route={} " + log.debug("pushRoute inPort={} route={} " +
"destination={}:{}", "destination={}:{}",
...@@ -500,29 +500,15 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF ...@@ -500,29 +500,15 @@ public class Forwarding extends ForwardingBase implements IFloodlightModule, IOF
pushRoute(path, m, pi, sw.getId(), cookie, pushRoute(path, m, pi, sw.getId(), cookie,
cntx, requestFlowRemovedNotifn, cntx, requestFlowRemovedNotifn,
OFFlowModCommand.ADD); OFFlowModCommand.ADD);
} else {
/* Route traverses no links --> src/dst devices on same switch */ /*
log.debug("Could not compute route. Devices should be on same switch src={} and dst={}", srcDevice, dstDevice); * Register this flowset with ingress and egress ports for link down
path = new Path(srcDevice.getAttachmentPoints()[0].getNodeId(), dstDevice.getAttachmentPoints()[0].getNodeId()); * flow removal. This is done after we push the path as it is blocking.
List<NodePortTuple> npts = new ArrayList<NodePortTuple>(2); */
npts.add(new NodePortTuple(srcDevice.getAttachmentPoints()[0].getNodeId(), for (NodePortTuple npt : path.getPath()) {
srcDevice.getAttachmentPoints()[0].getPortId())); flowSetIdRegistry.registerFlowSetId(npt, flowSetId);
npts.add(new NodePortTuple(dstDevice.getAttachmentPoints()[0].getNodeId(), }
dstDevice.getAttachmentPoints()[0].getPortId())); } /* else no path was found */
path.setPath(npts);
pushRoute(path, m, pi, sw.getId(), cookie,
cntx, requestFlowRemovedNotifn,
OFFlowModCommand.ADD);
}
/*
* Register this flowset with ingress and egress ports for link down
* flow removal. This is done after we push the path as it is blocking.
*/
for (NodePortTuple npt : path.getPath()) {
flowSetIdRegistry.registerFlowSetId(npt, flowSetId);
}
} }
/** /**
......
...@@ -466,11 +466,11 @@ public class LoadBalancer implements IFloodlightModule, ...@@ -466,11 +466,11 @@ public class LoadBalancer implements IFloodlightModule,
// in: match src client (ip, port), rewrite dest from vip ip/port to member ip/port, forward // in: match src client (ip, port), rewrite dest from vip ip/port to member ip/port, forward
// out: match dest client (ip, port), rewrite src from member ip/port to vip ip/port, forward // out: match dest client (ip, port), rewrite src from member ip/port to vip ip/port, forward
if (routeIn != null) { if (! routeIn.getPath().isEmpty()) {
pushStaticVipRoute(true, routeIn, client, member, sw); pushStaticVipRoute(true, routeIn, client, member, sw);
} }
if (routeOut != null) { if (! routeOut.getPath().isEmpty()) {
pushStaticVipRoute(false, routeOut, client, member, sw); pushStaticVipRoute(false, routeOut, client, member, sw);
} }
......
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