From ffa7810ae2a8c2255f23c782b20845fdb07c352e Mon Sep 17 00:00:00 2001
From: Michele Iessi <iessimichele@gmail.com>
Date: Tue, 20 Sep 2016 21:33:05 +0200
Subject: [PATCH] Fixed link cost calculation

Fix for link cost calculation into TopologyInstance for the metric "utilization". It was an erroneous copy-paste from the link-speed case.
---
 .../net/floodlightcontroller/topology/TopologyInstance.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
index 5ce0a4967..734443b57 100644
--- a/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
+++ b/src/main/java/net/floodlightcontroller/topology/TopologyInstance.java
@@ -748,7 +748,7 @@ public class TopologyInstance {
 
                     if ((bpsTx / 10^6) / 8 > 1) {
                         int cost = (int) (bpsTx / 10^6) / 8;
-                        linkCost.put(link, ((1/cost)*1000));
+                        linkCost.put(link, cost);
                     } else {
                         linkCost.put(link, MAX_LINK_WEIGHT);
                     }
@@ -1430,4 +1430,4 @@ public class TopologyInstance {
     public Set<DatapathId> getArchipelagoIds() {
         return archipelagos.stream().map(a -> a.getId()).collect(Collectors.toSet());
     }
-} 
\ No newline at end of file
+} 
-- 
GitLab