performance improvements

Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5a
diff --git a/minindn/helpers/ndn_routing_helper.py b/minindn/helpers/ndn_routing_helper.py
index c2d1013..93b196f 100644
--- a/minindn/helpers/ndn_routing_helper.py
+++ b/minindn/helpers/ndn_routing_helper.py
@@ -33,7 +33,6 @@
 import json
 import operator
 from collections import defaultdict
-from tqdm import tqdm
 from joblib import Parallel, delayed
 
 from mininet.log import info, debug, error, warn
@@ -298,7 +297,7 @@
         info('Creating faces and adding routes to FIB\n')
 
         res = Parallel(n_jobs=-1, require='sharedmem',
-                       prefer="threads")(delayed(self.addNodeRoutes)(host) for host in tqdm(self.net.hosts))
+                       prefer="threads", verbose=1)(delayed(self.addNodeRoutes)(host) for host in self.net.hosts)
 
         info('Processed all the routes to NFD\n')
 
@@ -309,8 +308,8 @@
         :param Node node: Node from net object
         """
         neighborIPs = self.getNeighbor(node)
-        self.createFaces(node, neighborIPs)
-        self.routeAdd(node, neighborIPs)
+        neighborFaces = self.createFaces(node, neighborIPs)
+        self.routeAdd(node, neighborFaces)
 
     def addOrigin(self, nodes, prefix):
         """
@@ -348,10 +347,15 @@
         self.calculateNPossibleRoutes(nFaces=1)
 
     def createFaces(self, node, neighborIPs):
-        for ip in neighborIPs.values():
-            nfdc.createFace(node, ip, self.faceType)
+        neighborFaces = {}
+        for k, ip in neighborIPs.items():
+            faceID = nfdc.createFace(node, ip, self.faceType)
+            if not isinstance(faceID, str): raise ValueError(faceID)
+            neighborFaces[k] = faceID
+        return neighborFaces
 
-    def routeAdd(self, node, neighborIPs):
+
+    def routeAdd(self, node, neighborFaces):
         """
         Add route from a node to its neighbors for each prefix/s  advertised by destination node
 
@@ -367,8 +371,7 @@
             prefixes = [defaultPrefix] + self.namePrefixes[destination]
             for prefix in prefixes:
                 # Register routes to all the available destination name prefix/s
-                faceID = nfdc.createFace(node, neighborIPs[nextHop])
-                nfdc.registerRoute(node, prefix, faceID, cost=cost)
+                nfdc.registerRoute(node, prefix, neighborFaces[nextHop], cost=cost)
     @staticmethod
     def getNeighbor(node):
         # Nodes to IP mapping