From 180da75d20d68de0f3659f286ad9543785ef64fe Mon Sep 17 00:00:00 2001
From: Ryan Izard <ryan.izard@bigswitch.com>
Date: Thu, 14 Jul 2016 14:45:02 -0400
Subject: [PATCH] Remove old shortest path computations

---
 .../topology/TopologyInstance.java            | 46 -------------------
 .../topology/TopologyInstanceTest.java        |  1 -
 2 files changed, 47 deletions(-)

diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
index ad88dd685..d72e16259 100644
--- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
+++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
@@ -30,7 +30,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.*;
-import java.util.Map.Entry;
 
 /**
  * A representation of a network topology. Used internally by
@@ -179,11 +178,6 @@ public class TopologyInstance {
         // clusters as possible.
         calculateBroadcastNodePortsInClusters();
 
-        // Step 4. Compute e2e shortest path trees on entire topology for unicast routing.
-        // The trees are rooted at the destination.
-        // Cost for tunnel links and direct links are the same.
-        calculateAllShortestPaths();
-
         // Step 4.1 Use Yens algorithm to compute multiple paths 
         computeOrderedPaths();
 
@@ -830,46 +824,6 @@ public class TopologyInstance {
         }
     }
 
-    /*
-     * Modification of the calculateShortestPathTreeInClusters (dealing with whole topology, not individual clusters)
-     */
-    private void calculateAllShortestPaths() {
-        this.broadcastNodePorts.clear();
-        this.destinationRootedFullTrees.clear();
-        Map<Link, Integer> linkCost = new HashMap<Link, Integer>();
-        int tunnel_weight = switchPorts.size() + 1;
-
-        for (NodePortTuple npt : tunnelPorts) {
-            if (allLinks.get(npt) == null) continue;
-            for (Link link : allLinks.get(npt)) {
-                if (link == null) continue;
-                linkCost.put(link, tunnel_weight);
-            }
-        }
-
-        Map<DatapathId, Set<Link>> linkDpidMap = new HashMap<DatapathId, Set<Link>>();
-        for (DatapathId s : switches) {
-            if (switchPorts.get(s) == null) continue;
-            for (OFPort p : switchPorts.get(s)) {
-                NodePortTuple np = new NodePortTuple(s, p);
-                if (allLinks.get(np) == null) continue;
-                for (Link l : allLinks.get(np)) {
-                    if (linkDpidMap.containsKey(s)) {
-                        linkDpidMap.get(s).add(l);
-                    }
-                    else {
-                        linkDpidMap.put(s, new HashSet<Link>(Arrays.asList(l)));
-                    }
-                }
-            }
-        }   
-
-        for (DatapathId node : linkDpidMap.keySet()) {
-            BroadcastTree tree = dijkstra(linkDpidMap, node, linkCost, true);
-            destinationRootedFullTrees.put(node, tree);
-        }
-    }
-
     /*
      * Calculates and stores n possible paths  using Yen's algorithm,
      * looping through every switch.
diff --git a/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java b/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java
index ebc82290a..ce97e92d6 100644
--- a/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java
+++ b/src/test/java/net/floodlightcontroller/topology/TopologyInstanceTest.java
@@ -655,7 +655,6 @@ public class TopologyInstanceTest {
         DatapathId three = DatapathId.of(3);
         DatapathId six = DatapathId.of(6);
 
-
         /*
          * FIRST TOPOLOGY
          * Both link arrays and corresponding latency
-- 
GitLab