Skip to content
Snippets Groups Projects
Commit 164ce03e authored by abat's avatar abat
Browse files

Merge into master from pull request #188:

Update to getRoute() method to provide complete path even when only one switch is involved. (https://github.com/floodlight/floodlight/pull/188)
parents 6f08fdc2 8047029b
No related branches found
No related tags found
No related merge requests found
package net.floodlightcontroller.topology; package net.floodlightcontroller.topology;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
...@@ -602,19 +603,31 @@ public class TopologyInstance { ...@@ -602,19 +603,31 @@ public class TopologyInstance {
protected Route getRoute(long srcId, short srcPort, protected Route getRoute(long srcId, short srcPort,
long dstId, short dstPort) { long dstId, short dstPort) {
// Return null the route source and desitnation are the
// same switchports.
if (srcId == dstId && srcPort == dstPort)
return null;
List<NodePortTuple> nptList;
NodePortTuple npt; NodePortTuple npt;
Route r = getRoute(srcId, dstId); Route r = getRoute(srcId, dstId);
if (r == null && srcId != dstId) return null; if (r == null && srcId != dstId) return null;
RouteId id = new RouteId(srcId, dstId); if (r != null) {
nptList= r.getPath();
List<NodePortTuple> nptList= r.getPath(); } else {
nptList = new ArrayList<NodePortTuple>();
}
npt = new NodePortTuple(srcId, srcPort); npt = new NodePortTuple(srcId, srcPort);
nptList.add(0, npt); // add src port to the front nptList.add(0, npt); // add src port to the front
npt = new NodePortTuple(dstId, dstPort); npt = new NodePortTuple(dstId, dstPort);
nptList.add(npt); // add dst port to the end nptList.add(npt); // add dst port to the end
return new Route(id, nptList); RouteId id = new RouteId(srcId, dstId);
r = new Route(id, nptList);
return r;
} }
protected Route getRoute(long srcId, long dstId) { protected Route getRoute(long srcId, long dstId) {
......
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