Arrays.sort(dstDaps, clusterIdComparator);
int iSrcDaps = 0, iDstDaps = 0;
while ((iSrcDaps < srcDaps.length) && (iDstDaps < dstDaps.length)) {
SwitchPort srcDap = srcDaps[iSrcDaps];
SwitchPort dstDap = dstDaps[iDstDaps];
// srcCluster and dstCluster here cannot be null as
// every switch will be at least in its own L2 domain.
Long srcCluster =
topology.getL2DomainId(srcDap.getSwitchDPID());
Long dstCluster =
topology.getL2DomainId(dstDap.getSwitchDPID());
int srcVsDest = srcCluster.compareTo(dstCluster);
if (srcVsDest == 0) {
if (!srcDap.equals(dstDap)) {
Route route =
routingEngine.getRoute(srcDap.getSwitchDPID(),
(short)srcDap.getPort(),
dstDap.getSwitchDPID(),
(short)dstDap.getPort(), 0); //cookie = 0, i.e., default route
if (route != null) {
if (log.isTraceEnabled()) {
log.trace("pushRoute match={} route={} " +
"destination={}:{}",
new Object[] {match, route,
dstDap.getSwitchDPID(),
dstDap.getPort()});
}
long cookie =
AppCookie.makeCookie(FORWARDING_APP_ID, 0);
// if there is prior routing decision use wildcard