Merge pull request #102 from opennetworkinglab/devl/IntentRerouteChanges

Devl/intent reroute changes
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 83a6471..d94c0e4 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1779,7 +1779,7 @@
         configFile.close()        
         os.system( "scp " + tempFile + " admin@" + benchIp + ":" + nullDevicePath)
 
-    def createNullLinkProviderFile( self, benchIp, neighborIpList=0, eventRate=0, onNode=False): 
+    def createNullLinkProviderFile( self, benchIp, neighborIpList=0,fileName="", eventRate=0, onNode=False): 
         '''
                 neighbor list is an optional list of neighbors to be written directly to the file
                 onNode - bool, if true, alternate file path will be used to scp, inteneded
@@ -1799,9 +1799,12 @@
             configFile.write("#eventRate = \n")
         else: 
             configFile.write("eventRate = " + str(eventRate) + "\n") 
-
-        configFile.write("#cfgFile = /tmp/foo.cfg        #If enabled, points to the full path to the topology file.\n") 
         
+        if fileName == "":
+            configFile.write("#cfgFile = /tmp/foo.cfg        #If enabled, points to the full path to the topology file.\n") 
+        else: 
+            configFile.write("cfgFile =" + str(fileName) + "\n")
+
         if neighborIpList != 0:
             configFile.write("neighbors = ")
             for n in range (0, len(neighborIpList)):
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.params b/TestON/tests/IntentEventTP/IntentEventTP.params
index d5dd65c..7f355dc 100644
--- a/TestON/tests/IntentEventTP/IntentEventTP.params
+++ b/TestON/tests/IntentEventTP/IntentEventTP.params
@@ -20,41 +20,41 @@
     <CTRL> 
         <USER>admin</USER>
 
-        <ip1>10.128.5.51</ip1>
+        <ip1>10.254.1.201</ip1>
         <port1>6633</port1>
 
-        <ip2>10.128.5.52</ip2>
+        <ip2>10.254.1.202</ip2>
         <port2>6633</port2>
 
-        <ip3>10.128.5.53</ip3>
+        <ip3>10.254.1.203</ip3>
         <port3>6633</port3>
 
-        <ip4>10.128.5.54</ip4>
+        <ip4>10.254.1.204</ip4>
         <port4>6633</port4>
 
-        <ip5>10.128.5.65</ip5>
+        <ip5>10.254.1.205</ip5>
         <port5>6633</port5>
 
-        <ip6>10.128.5.66</ip6>
+        <ip6>10.254.1.206</ip6>
         <port6>6633</port6>
 
-         <ip7>10.128.5.67</ip7>
+         <ip7>10.254.1.207</ip7>
         <port7>6633</port7> 
     </CTRL>
 
-    <MN><ip1>10.128.5.55</ip1></MN>
+    <MN><ip1>10.254.1.200</ip1></MN>
 
     <BENCH>
         <user>admin</user>
-        <ip1>10.128.5.55</ip1>
+        <ip1>10.254.1.200</ip1>
     </BENCH>
 
     <TEST> 
-        <loadFrom>1,0,0,0,0,0,0</loadFrom>                                     #generate load on server, 1 = generator on 
-        <numSwitches>35</numSwitches>
+        <loadFrom>1,1,1,1,1,1,1</loadFrom>                                     #generate load on server, 1 = generator on 
+        <numSwitches>10,10,10,10,10,10,10</numSwitches>
         <skipCleanInstall>yes</skipCleanInstall>
-        <duration>60</duration>
-        <log_interval>5</log_interval>                            
+        <duration>600</duration>
+        <log_interval>20</log_interval>                            
     </TEST>
 
     <METRICS>
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.py b/TestON/tests/IntentEventTP/IntentEventTP.py
index b1f0e91..863599c 100644
--- a/TestON/tests/IntentEventTP/IntentEventTP.py
+++ b/TestON/tests/IntentEventTP/IntentEventTP.py
@@ -33,7 +33,7 @@
         maxNodes = int(main.params[ 'availableNodes' ])
         MNip = main.params[ 'MN' ][ 'ip1' ]
         skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
-        numSwitches = main.params[ 'TEST' ][ 'numSwitches' ]
+        numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",")
 
         homeDir = os.path.expanduser('~')
         
@@ -83,68 +83,26 @@
         if skipMvn != "yes":
             mvnResult = main.ONOSbench.cleanInstall()
  
-        #configure null device provider         
-        switchList = [0,int(numSwitches),0,0,0,0,0,0]
-        devicesString  = ""
-        for node in range(1, maxNodes + 1):
-            devicesString += (ONOSIp[node] + ":" + str(switchList[node] ))
-            if node < maxNodes:
-                devicesString += (",")
+        #null link
+        #null provider 
+        #linkgraph 
+        #intentPerf
 
-        main.log.info("Configuring device provider: ONOS 1 with " + (numSwitches) + " switches")
-        localPath = "/onos/tools/package/etc/org.onosproject.provider.nil.device.impl.NullDeviceProvider.cfg"
-        filePath = homeDir + localPath
-        main.log.info(filePath)
+        myDistribution = []
+        for node in range (1, clusterCount + 1):
+            myDistribution.append(numSwitches[node-1])
 
-        configFile = open(filePath, 'w+')
-        configFile.write("devConfigs = " + devicesString + "\n")
-        configFile.write("#numPorts = 8") 
-        configFile.close()
-        main.log.info("DevConfig = " + devicesString) 
-        main.log.info("Device provider file written and closed")
+        main.ONOSbench.createLinkGraphFile( BENCHIp,cellIp,myDistribution)
+        main.ONOSbench.createNullDevProviderFile( BENCHIp, cellIp, myDistribution)
+        main.ONOSbench.createNullLinkProviderFile(BENCHIp)
 
-        ## configuring null link provider
-        main.log.info(" Configuring null provider to disable flicker" )
-        homeDir = os.path.expanduser('~')
-        main.log.info(homeDir)
-        localPath = "/onos/tools/package/etc/org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg"
-        filePath = homeDir + localPath
-        main.log.info(filePath)
-
-        neighborsString = ""
-        for node in range(1, maxNodes + 1):
-            neighborsString += ONOSIp[node]
-            if node < maxNodes:
-                neighborsString += ","
-
-        configFile = open(filePath, 'w+')
-        configFile.write("#eventRate =\n")
-        configFile.write("#cfgFile = /tmp/foo.cfg        #If enabled, points to the full path to the topology file.\n")
-        configFile.write("#neighbors = ")
-        configFile.close()
-        main.log.info("Configuration completed")
+        main.log.step("Writing IntentPerf config file") 
+        intentPerfConfig = open( homeDir + "/onos/tools/package/etc/org.onosproject.intentperf.IntentPerfInstaller.cfg", "w+")
+        intentPerfConfig.write("numKeys = 40000\n")        
+        intentPerfConfig.write("cyclePeriod = 1000\n")
+        intentPerfConfig.write("numNeighors = 0\n")
+        intentPerfConfig.close()
         
-        main.log.info("Writing link graph configuration file..." )
-        homeDir = os.path.expanduser('~')
-        localPath = "/onos/tools/package/etc/linkGraph.cfg"
-        filePath = homeDir + localPath
-        linkGraph = open(filePath, 'w+')
-        linkGraph.write("# NullLinkProvider topology description (config file).\n")
-        linkGraph.write("# The NodeId is only added if the destination is another node's device.\n")
-        linkGraph.write("# Bugs: Comments cannot be appended to a line to be read.\n")
-
-        myPort = 6
-        for node in range(1, clusterCount+1):
-            linkGraph.write("graph " + ONOSIp[node] + " {\n")
-            for switch in range (0, switchList[node]-1):
-                line = ""
-                line = ("\t" + str(switch) + ":" + str(myPort))
-                line += " -- "
-                line += (str(switch+1) + ":" + str(myPort-1) + "\n")
-                linkGraph.write(line) 
-            linkGraph.write("}")
-        linkGraph.close()        
-
         main.step( "Creating ONOS package" )
         packageResult = main.ONOSbench.onosPackage()  
 
@@ -170,7 +128,7 @@
             main.ONOSbench.handle.expect(":~")
             clusterCheck = ((main.ONOSbench.handle.before).splitlines())[3]
             print("\nBefore: " + str(clusterCheck))
-            if "SCC(s)=1," in clusterCheck and ("devices=" + str(numSwitches)) in clusterCheck:                  #check for links and devices too 
+            if "SCC(s)=1," in clusterCheck:     
                 break 
             if clusterCheck != lastOutput:
                 sameOutput = False 
@@ -205,7 +163,7 @@
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         MNip = main.params[ 'MN' ][ 'ip1' ]
         BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
-        numSwitches = int(main.params[ 'TEST' ][ 'numSwitches' ])
+        numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",")
         scale = int( main.params[ 'SCALE' ] )
         maxNodes = int(main.params[ 'availableNodes' ])
         clusterCount += scale
@@ -234,53 +192,23 @@
         main.step( "Set Cell" )
         main.ONOSbench.setCell(cellName)
 
-        baselineSwitchCount = numSwitches/clusterCount
-        switchList = [0,0,0,0,0,0,0,0]
-        
-        for node in range(1, clusterCount + 1):
-            switchList[node] = baselineSwitchCount  
-            
-        for node in range(1, (numSwitches%clusterCount)+1):
-            switchList[node] += 1
-                      
-        devicesString  = ""
-        for node in range(1, maxNodes + 1):
-            devicesString += (ONOSIp[node] + ":" + str(switchList[node] ))
-            if node < maxNodes:
-                devicesString += (",")
+        myDistribution = []
+        for node in range (1, clusterCount + 1):
+            myDistribution.append(numSwitches[node-1])
 
-        main.log.info("Configuring device provider")
-        localPath = "/onos/tools/package/etc/org.onosproject.provider.nil.device.impl.NullDeviceProvider.cfg"
-        filePath = homeDir + localPath
-        main.log.info(filePath)
+        main.ONOSbench.createLinkGraphFile( BENCHIp, cellIp, myDistribution)
+        main.ONOSbench.createNullDevProviderFile( BENCHIp, cellIp, myDistribution)
+        main.ONOSbench.createNullLinkProviderFile( BENCHIp )
 
-        configFile = open(filePath, 'w+')
-        configFile.write("devConfigs = " + devicesString +"\n")
-        configFile.write("# numPorts = 8")
-        configFile.close()
-        main.log.info("DevConfig = " + devicesString)
-        main.log.info("Device provider file written and closed")
+        #neighbors = max(1, clusterCount-1) 
+        neighbors = 0
 
-        main.log.info("Writing link graph configuration file..." )
-        homeDir = os.path.expanduser('~')
-        localPath = "/onos/tools/package/etc/linkGraph.cfg"
-        filePath = homeDir + localPath
-        linkGraph = open(filePath, 'w+')
-        linkGraph.write("# NullLinkProvider topology description (config file).\n")
-        linkGraph.write("# The NodeId is only added if the destination is another node's device.\n")
-        linkGraph.write("# Bugs: Comments cannot be appended to a line to be read.\n")
-
-        myPort = 6
-        for node in range(1, clusterCount+1):
-            linkGraph.write("graph " + ONOSIp[node] + " {\n")
-            for switch in range (0, switchList[node]-1):
-                line = ""
-                line = ("\t" + str(switch) + ":" + str(myPort))
-                line += " -- "
-                line += (str(switch+1) + ":" + str(myPort-1) + "\n")
-                linkGraph.write(line)
-            linkGraph.write("}\n")
-        linkGraph.close()
+        main.log.step("Writing IntentPerf config file")
+        intentPerfConfig = open( homeDir + "/onos/tools/package/etc/org.onosproject.intentperf.IntentPerfInstaller.cfg", "w+")
+        intentPerfConfig.write("numKeys = 40000\n")
+        intentPerfConfig.write("cyclePeriod = 1000\n")
+        intentPerfConfig.write("numNeighors = " + str(neighbors) + "\n")
+        intentPerfConfig.close()
 
         main.step( "Creating ONOS package, preparing to reinstall" )
         packageResult = main.ONOSbench.onosPackage()   
@@ -306,7 +234,7 @@
             main.ONOSbench.handle.expect(":~")
             clusterCheck = ((main.ONOSbench.handle.before).splitlines())[3]
             print("\nBefore: " + str(clusterCheck))
-            if "SCC(s)=1," in clusterCheck and ("nodes=" + str(clusterCount)) in clusterCheck and ("devices=" + str(numSwitches)) in clusterCheck:  
+            if ("SCC(s)=1,") in clusterCheck:   
                 break
             if clusterCheck != lastOutput:
                 sameOutput = False
@@ -326,6 +254,7 @@
         import json
         import string 
         import csv
+        import numpy
 
         main.log.info("Cluster Count = " + str(clusterCount))
 
@@ -338,7 +267,7 @@
 
         metricList = [intentsRate, intentsWithdrawn, intentsFailed]
         
-        tempsleep =40
+        tempsleep =20
         main.log.info("sleeping " + str(tempsleep)) 
         time.sleep(tempsleep)
         
@@ -351,47 +280,59 @@
                 main.ONOSbench.handle.sendline(cmd)
                 main.ONOSbench.handle.expect(":~")
                 main.log.info("Load initiated on node " + str(node))
-       
+        
+            time.sleep(5)
+            actcmd = "onos $OC" + str(node) + " intent-perf-start"
+            main.ONOSbench.handle.sendline(actcmd)
+            main.ONOSbench.handle.expect(":~")
+            main.log.info("Starting ONOS " + str(node) + "  intent-perf...")
+
         main.log.info( "Starting test loop for " + str(testDuration) + " seconds...\n" )
         stop = time.time() + float( testDuration )
         
         while time.time() < stop:
             time.sleep( float( logInterval ) )
+            groupResult = []
             for node in range (1, clusterCount + 1):
-                myResults = ['0','0','0']
-                for metric in metricList: 
-
-                    onosEnv = "onos $OC" + str(node)  
-                    cmd = onosEnv + " " + metric
-                    main.log.info("COMMAND: " + cmd)
-                    main.ONOSbench.handle.sendline( cmd )
-                    time.sleep(10)
-                    main.ONOSbench.handle.expect(":~")                   
-                    rawResult = main.ONOSbench.handle.before
-                    rawResult = (rawResult.splitlines())
-
-                    tempResult = "--"
-                    for word in rawResult:
-                        if debug: print("word: " + word)
-                        if "m1" in str(word): 
-                            tempResult = word
-                            break
-
-                    if tempResult == "--": 
-                        main.log.error("WRONG pexepct.before data\n" + str(rawResult))
-                        main.log.info("retrying command... ")
-                        main.ONOSbench.handle.sendline(cmd)
-                        main.ONOSbench.handle.expect(":~")
-                        test = main.ONOSbench.handle.before
-                        print ("\n\n" + str(test))
-
-                    tempResult = round(float(tempResult.replace("m1=","")),1)
-                    tempResult = str(tempResult)                        # easy way to clean up number/prep to log
-                    resultIndex = metricList.index(metric)
-                    myResults[resultIndex] = tempResult
+                if loadFrom[node] == "0": continue
+                groupResult.append(0)               
                 
-                main.log.info("\tNode " + str(node))
-                main.log.info("Installed\tWithdrawn\tFailed")
-                main.log.info(myResults[0] + "\t\t " + myResults[1] + "\t\t" + myResults[2] + "\n")
-                
+                cmd = " onos-ssh $OC" + str(node) +  """ cat /opt/onos/log/karaf.log | grep "SNAPSHOT | Throughput" | tail -1  """ 
+                main.log.info("COMMAND: " + str(cmd))
+  
+                x = 0 
+                while True: 
+                    main.ONOSbench.handle.sendline(cmd)                   
+                    main.ONOSbench.handle.expect(":~")
+                    raw = main.ONOSbench.handle.before 
+                    if "OVERALL=" in raw: 
+                        break 
+                    x += 1
+                    if x > 10: 
+                        main.log.error("Expected output not being recieved... continuing")
+                        break
+                    time.sleep(2)
 
+                raw = raw.splitlines()
+                splitResults = []
+                for line in raw: 
+                    splitResults.extend(line.split(" "))
+
+                myResult = "--" 
+                for field in splitResults: 
+                    if "OVERALL" in field: 
+                        myResult = field 
+                
+                if myResult == "--": 
+                    main.log.error("Parsing/Pexpect error\n" + str(splitResults)) 
+
+                myResult = myResult.replace(";", "") 
+                myResult = myResult.replace("OVERALL=","")
+                myResult = float(myResult)  
+                groupResult[len(groupResult) -1] = myResult 
+
+                main.log.info("Node " + str(node) + " overall rate: " + str(myResult))
+
+            main.log.report("Results from this round of polling: " + str(groupResult)) 
+            main.log.report("Cluster Total: " + str(numpy.sum(groupResult)) + "\n")
+                
diff --git a/TestON/tests/IntentEventTP/IntentEventTP.topo b/TestON/tests/IntentEventTP/IntentEventTP.topo
index 30a1467..0e45e0f 100644
--- a/TestON/tests/IntentEventTP/IntentEventTP.topo
+++ b/TestON/tests/IntentEventTP/IntentEventTP.topo
@@ -3,7 +3,7 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosDriver</type>
@@ -12,7 +12,7 @@
         </ONOSbench>
 
         <ONOS1cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -21,7 +21,7 @@
         </ONOS1cli>
 
         <ONOS2cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -30,7 +30,7 @@
         </ONOS2cli>
 
         <ONOS3cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -39,7 +39,7 @@
         </ONOS3cli>
 
         <ONOS4cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -48,7 +48,7 @@
         </ONOS4cli>
 
         <ONOS5cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -57,7 +57,7 @@
         </ONOS5cli>
 
         <ONOS6cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -66,7 +66,7 @@
         </ONOS6cli>
 
         <ONOS7cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -75,7 +75,7 @@
         </ONOS7cli>
 
         <ONOS1>
-            <host>10.128.5.51</host>
+            <host>10.254.1.201</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -84,7 +84,7 @@
         </ONOS1>
 
         <ONOS2>
-            <host>10.128.5.52</host>
+            <host>10.254.1.202</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -93,7 +93,7 @@
         </ONOS2>
 
         <ONOS3>
-            <host>10.128.5.53</host>
+            <host>10.254.1.203</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -102,7 +102,7 @@
         </ONOS3>
 
         <ONOS4>
-            <host>10.128.5.54</host>
+            <host>10.254.1.204</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -112,7 +112,7 @@
 
     
         <ONOS5>
-            <host>10.128.5.65</host>
+            <host>10.254.1.205</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -121,7 +121,7 @@
         </ONOS5>
 
         <ONOS6>
-            <host>10.128.5.66</host>
+            <host>10.254.1.206</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -130,7 +130,7 @@
         </ONOS6>
 
         <ONOS7>
-            <host>10.128.5.67</host>
+            <host>10.254.1.207</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
diff --git a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.params b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.params
index 194a783..f01f017 100644
--- a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.params
+++ b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.params
@@ -1,5 +1,5 @@
 <PARAMS>
-    <testcases>1,2,3,4,2,3,4,2,3,4,2,3</testcases>
+    <testcases>1,2,4,2,4,2,4,2</testcases>
 
     <ENV>
         <cellName>intent_perf_test</cellName>
@@ -49,6 +49,7 @@
         <numMult>1</numMult>
         #Interface to bring down for intent reroute case
         <intfs>s3-eth2</intfs>
+        <cellStr>webconsole,onos-core,onos-api,onos-app-metrics,onos-app-gui,onos-cli,onos-openflow</cellStr>
     </TEST>
 
     <DB>
diff --git a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
index 8f23b29..32477a6 100644
--- a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
+++ b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
@@ -23,6 +23,7 @@
         gitPull = main.params['GIT']['autoPull']
         checkoutBranch = main.params['GIT']['checkout']
         intentFilePath = main.params['DB']['intentFilePath']
+        cellStr = main.params[ 'TEST' ][ 'cellStr' ]
         ONOSIp = []
         
         for i in range(1, 8):
@@ -39,7 +40,8 @@
         main.step('Starting mininet topology')
         main.Mininet1.startNet()
         main.step('Creating cell file')
-        cellFileResult = main.TRUE
+        cellFileResult = main.ONOSbench.createCellFile(
+                BENCHIp, cellName, MN1Ip, cellStr, ONOSIp[0])
         main.step('Applying cell file to environment')
         cellApplyResult = main.ONOSbench.setCell(cellName)
         verifyCellResult = main.ONOSbench.verifyCell()
@@ -151,7 +153,6 @@
 
         time.sleep(20)
         
-        batchResultList = []
         deviceIdList = []
         batchInstallLat = []
         batchWithdrawLat = []
@@ -165,6 +166,9 @@
         for device in jsonObj:
             deviceIdList.append(device['id'])
 
+        if not jsonObj:
+            main.log.warn( "Devices not found, check topology" )
+            
         sleepTime = 10
         baseDir = '/tmp/'
         for batch in range(0, 5):
@@ -283,6 +287,7 @@
                 stdWithdrawLat = 'NA'
                 main.log.report('Batch withdraw failed')
                 assertion = main.FALSE
+            
             main.log.report('Avg of batch installation latency ' +
                     'of size ' + str(batchIntentSize) + ': ' +
                     str(avgInstallLat) + ' ms')
@@ -293,6 +298,7 @@
                     str(avgWithdrawLat) + ' ms')
             main.log.report('Std Deviation of batch withdraw latency ' +
                     ': ' + str(round(numpy.std(maxWithdrawLat), 2)) + ' ms')
+            
             main.log.report('Avg of batch withdraw latency ' + 'of size ' +
                     str(batchIntentSize) + ': ' + str(avgWithdrawLat) + ' ms')
             main.log.report('Std Deviation of batch withdraw latency ' +
@@ -302,6 +308,7 @@
                     str(avgSingleWithdrawLat) + ' ms')
             main.log.report('Std Deviation of single withdraw latency ' +
                     ': ' + str(stdSingleWithdrawLat) + ' ms')
+            
             dbCmd = "INSERT INTO intents_latency_tests VALUES('" +\
                     timeToPost + "','intents_latency_results'," +\
                     runNum + ',' + str(clusterCount) + ',' +\
@@ -680,27 +687,28 @@
         import time
         import json
         
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        features = main.params[ 'ENV' ][ 'cellFeatures' ]
-        benchIp = main.params[ 'BENCH' ][ 'ip' ]
-        mininetIp = main.params[ 'TEST' ][ 'MN' ]
-        
         clusterCount += 2
+        
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        features = main.params[ 'TEST' ][ 'cellStr' ]
+        benchIp = main.params[ 'BENCH' ][ 'ip' ]
+        mininetIp = main.params[ 'MN' ][ 'ip1' ]
+        
         main.log.report('Increasing cluster size to ' + str(clusterCount))
         
         ONOSIp = []
         for i in range( 1, 8 ):
-            ONOSIp.append( main.params[ 'CTRL' ][ 'ip'+str(i) ]
+            ONOSIp.append( main.params[ 'CTRL' ][ 'ip'+str(i) ] )
 
         main.step( "Cleaning environment" )
-        for i in range( 1, 8 ):
+        for i in range( 0, 7 ):
             main.ONOSbench.onosDie( ONOSIp[i] )
-            main.log.info( "Uninstalling ONOS "+str(i) )
+            main.log.info( "Uninstalling ONOS "+str(i+1) )
             main.ONOSbench.onosUninstall( ONOSIp[i] )
 
         main.step( "Creating new cell file" )
         cellIp = []
-        for node in range( 1, clusterCount + 1 )
+        for node in range( 1, clusterCount + 1 ):
             cellIp.append( ONOSIp[node] )
         main.ONOSbench.createCellFile( benchIp, cellName,
                                        mininetIp, str(features), *cellIp )
@@ -712,12 +720,9 @@
         main.ONOSbench.onosPackage()
 
         for node in range( 1, clusterCount + 1 ):
-            time.sleep(10)
-            main.log.info( "Starting ONOS "+str(node) +
-                            " at IP: "+ONOSIp[node] )
-            main.ONOSbench.onosInstall( ONOSIp[node] )
-            exec "a = main.ONOS%scli.startOnosCli" %str(node)
-            a( ONOSIp[node] )
+            main.ONOSbench.onosInstall( node = ONOSIp[node] )
+            
+        time.sleep( 20 )
 
         for node in range( 1, clusterCount + 1 ):
             for i in range( 2 ):
@@ -729,6 +734,12 @@
                 if not isup:
                     main.log.info( "ONOS" + str(node) + " did not start")
         
+        for node in range( 1, clusterCount + 1 ):
+            exec "a = main.ONOS%scli.startOnosCli" %str(node)
+            a( ONOSIp[node] )
+
+        time.sleep(30)
+
         utilities.assert_equals(expect=main.TRUE, actual=assertion,
             onpass='Scale out to ' + str(clusterCount) + ' nodes successful',
             onfail='Scale out to ' + str(clusterCount) + ' nodes failed')
diff --git a/TestON/tests/IntentReroute/IntentReroute.params b/TestON/tests/IntentReroute/IntentReroute.params
new file mode 100644
index 0000000..4139613
--- /dev/null
+++ b/TestON/tests/IntentReroute/IntentReroute.params
@@ -0,0 +1,78 @@
+<PARAMS>
+
+    <testcases>1,3,2,3,2,3,2,3</testcases>
+
+    <SCALE>2</SCALE>
+    <availableNodes>7</availableNodes>
+ 
+    <ENV>
+        <cellName>intentRerouteCell</cellName>
+        <cellFeatures>webconsole,onos-core,onos-api,onos-cli,onos-null,onos-gui,onos-rest,onos-app-metrics,onos-app-metrics-intent,onos-app-metrics-topology </cellFeatures>
+        <scale1switches>8,</scale1switches>
+        <scale3switches>2,3,3</scale3switches>
+        <scale5switches>2,3,1,1,1</scale5switches>
+        <scale7switches>1,1,2,1,1,1,1</scale7switches>
+    
+    </ENV>
+
+    <TEST>
+        <skipCleanInstall>yes</skipCleanInstall>
+        <warmUp>4</warmUp>
+        <sampleSize>20</sampleSize>                     
+        <wait></wait>
+        <intents>1,100,1000,5000</intents>                       #list format, will be split on ','
+        <debug>True</debug>                          
+    </TEST>
+
+    <METRICS>
+        <Submitted>0</Submitted>
+        <Installed>1</Installed>
+        <Failed>0</Failed>
+        <Withdraw>0</Withdraw>
+        <Withdrawn>0</Withdrawn>
+    </METRICS>
+
+    <GIT>
+        <autopull>on</autopull>
+        <checkout>master</checkout>
+    </GIT>
+
+    <CTRL>
+        <USER>admin</USER>
+        
+        <ip1>10.254.1.201</ip1>
+        <port1>6633</port1>
+        
+        <ip2>10.254.1.202</ip2>
+        <port2>6633</port2>
+        
+        <ip3>10.254.1.203</ip3>
+        <port3>6633</port3>
+        
+        <ip4>10.254.1.204</ip4>
+        <port4>6633</port4>
+        
+        <ip5>10.254.1.205</ip5>
+        <port5>6633</port5>
+        
+        <ip6>10.254.1.206</ip6>
+        <port6>6633</port6> 
+       
+        <ip7>10.254.1.207</ip7>
+        <port7>6633</port7>
+
+    </CTRL>
+
+    <MN>
+        <ip1>10.254.1.200</ip1>
+    </MN>
+
+    <BENCH>
+        <user>admin</user>
+        <ip1>10.254.1.200</ip1>
+    </BENCH>
+
+    <JSON>
+    </JSON>
+
+</PARAMS>
diff --git a/TestON/tests/IntentReroute/IntentReroute.py b/TestON/tests/IntentReroute/IntentReroute.py
new file mode 100644
index 0000000..4a778f8
--- /dev/null
+++ b/TestON/tests/IntentReroute/IntentReroute.py
@@ -0,0 +1,468 @@
+# ScaleOutTemplate - IntentReroute 
+#
+# CASE1 starts number of nodes specified in param file
+#
+# cameron@onlab.us
+
+import sys
+import os.path
+
+
+class IntentReroute:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):            #This is the initialization case
+                                        #this case will clean up all nodes 
+        import time                     #but only node 1 is started in this case
+        import os.path
+
+        global clusterCount             #number of nodes running
+        global ONOSIp                   #list of ONOS IP addresses 
+        clusterCount = 1
+        ONOSIp = [ 0 ]
+
+
+        #Load values from params file
+        checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
+        gitPull = main.params[ 'GIT' ][ 'autopull' ]
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        Features= main.params[ 'ENV' ][ 'cellFeatures' ]
+        BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+        BENCHUser = main.params[ 'BENCH' ][ 'user' ]
+        MN1Ip = main.params[ 'MN' ][ 'ip1' ]
+        maxNodes = int(main.params[ 'availableNodes' ])
+        Features = main.params[ 'ENV' ][ 'cellFeatures' ]
+        skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
+        switchCount = (main.params[ 'ENV' ][ 'scale1switches' ]).split(",")
+        homeDir = os.path.expanduser('~')
+
+        #Populate ONOSIp with ips from params 
+        for i in range(1, maxNodes + 1): 
+            ipString = 'ip' + str(i) 
+            ONOSIp.append(main.params[ 'CTRL' ][ ipString ])   
+    
+        tempIp = []
+        for node in range( 1, clusterCount + 1):
+            tempIp.append(ONOSIp[node])
+
+        #kill off all onos processes 
+        main.log.step("Safety check, killing all ONOS processes")
+        main.log.step("before initiating enviornment setup")
+        for node in range(1, maxNodes + 1):
+            main.ONOSbench.onosDie(ONOSIp[node])
+
+        #construct the cell file
+        main.log.info("Creating cell file")
+        exec "a = main.ONOSbench.createCellFile"
+        cellIp = []
+        for node in range (1, clusterCount + 1):
+            cellIp.append(ONOSIp[node])
+        a(BENCHIp,cellName,MN1Ip,str(Features), *cellIp)
+
+        main.step( "Applying cell file to environment" )
+        cellApplyResult = main.ONOSbench.setCell( cellName )
+
+        #Uninstall everywhere
+        main.log.step( "Cleaning Enviornment..." )
+        for i in range(1, maxNodes + 1):
+            main.log.info(" Uninstalling ONOS " + str(i) )
+            main.ONOSbench.onosUninstall( ONOSIp[i] )
+        
+        #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
+        if skipMvn != "yes":
+            mvnResult = main.ONOSbench.cleanInstall()
+                        
+            #git
+            main.step( "Git checkout and pull " + checkoutBranch )
+            if gitPull == 'on':
+                checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
+                pullResult = main.ONOSbench.gitPull()
+
+            else:
+                checkoutResult = main.TRUE
+                pullResult = main.TRUE
+                main.log.info( "Skipped git checkout and pull" )
+        
+        main.ONOSbench.handle.sendline("cp ~/ONLabTest/TestON/dependencies/IntentRerouteTest/oneNode7linear.cfg ~/onos/tools/package/etc/")
+        main.ONOSbench.handle.expect(":~")
+        main.ONOSbench.handle.sendline("cp ~/ONLabTest/TestON/dependencies/IntentRerouteTest/oneNode7linearCut.cfg ~/onos/tools/package/etc/")
+        main.ONOSbench.handle.expect(":~")
+
+        main.ONOSbench.createNullDevProviderFile(BENCHIp, tempIp, switchCount)
+        main.ONOSbench.createNullLinkProviderFile(BENCHIp, fileName=("/opt/onos/apache-karaf-3.0.2/etc/oneNode7linear.cfg"))
+ 
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()  
+
+        main.step( "Installing ONOS package" )
+        install1Result = main.ONOSbench.onosInstall( node=ONOSIp[1] )
+
+        main.step( "verify cells" )
+        verifyCellResult = main.ONOSbench.verifyCell()
+
+        main.step( "Set cell for ONOS cli env" )
+        cli1 = main.ONOS1cli.startOnosCli( ONOSIp[1] )
+
+        
+    def CASE2( self, main ):
+        # This case increases the cluster size by whatever scale is
+        # Note: 'scale' is the size of the step
+        # if scaling is not a part of your test, simply run this case
+        # once after CASE1 to set up your enviornment for your desired 
+        # cluster size. If scaling is a part of you test call this case each time 
+        # you want to increase cluster size
+
+        ''                                                         
+        'Increase number of nodes and initiate CLI'
+        ''
+        import time
+        global clusterCount
+        
+        BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+        scale = int( main.params[ 'SCALE' ] )
+        clusterCount += scale
+        homeDir = os.path.expanduser('~')
+        switchParams = ("scale" + str(clusterCount) + "switches")
+        switchCount = (main.params[ 'ENV' ][ switchParams ]).split(",") 
+
+        if clusterCount == 1: 
+            temp = "one"
+        if clusterCount == 3: 
+            temp = "three"
+        if clusterCount == 5: 
+            temp = "five"
+        if clusterCount == 7: 
+            temp = "seven"
+
+        lgfile = temp + "Node7linear.cfg"
+        main.ONOSbench.handle.sendline("cp ~/ONLabTest/TestON/dependencies/IntentRerouteTest/" + lgfile + " ~/onos/tools/package/etc/")
+        main.ONOSbench.handle.expect(":~")
+        main.ONOSbench.handle.sendline("cp ~/ONLabTest/TestON/dependencies/IntentRerouteTest/" + temp + "Node7linearCut.cfg" + " ~/onos/tools/package/etc/")
+        main.ONOSbench.handle.expect(":~")
+        
+        main.log.info("Creating cell file")
+        exec "a = main.ONOSbench.createCellFile"
+        cellIp = []
+        for node in range (1, clusterCount + 1):
+            cellIp.append(ONOSIp[node])
+        a(BENCHIp,cellName,MN1Ip,str(Features), *cellIp) 
+    
+        main.step( "Applying cell file to environment" )
+        cellApplyResult = main.ONOSbench.setCell( cellName )
+
+        #Uninstall everywhere
+        main.log.step( "Cleaning Enviornment..." )
+        for node in range(1, maxNodes + 1):
+            main.ONOSbench.onosDie(ONOSIp[node])
+            main.log.info(" Uninstalling ONOS " + str(node) )
+            main.ONOSbench.onosUninstall( ONOSIp[node] )
+
+        tempIp = []
+        for node in range( 1, clusterCount + 1): 
+            tempIp.append(ONOSIp[node]) 
+
+        main.ONOSbench.createNullDevProviderFile(BENCHIp, tempIp, switchCount)
+        main.ONOSbench.createNullLinkProviderFile(BENCHIp, fileName=("/opt/onos/apache-karaf-3.0.2/etc/" + lgfile))
+
+        main.ONOSbench.onosPackage()
+        
+        
+        main.log.report( "Increasing cluster size to " + str( clusterCount ) )
+        for node in range(1, clusterCount + 1):
+            main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])    
+            main.ONOSbench.onosInstall( node=ONOSIp[node])
+            if node == 1: 
+                main.ONOS1cli.startOnosCli( ONOSIp[1] )
+        
+        for node in range(1, clusterCount + 1): 
+            for i in range( 2 ):
+                isup = main.ONOSbench.isup( ONOSIp[node] )
+                if isup:
+                    main.log.info("ONOS " + str(node) + " is up\n")
+                    break
+            if not isup:
+                main.log.report( "ONOS " + str(node) + " didn't start!" ) 
+    
+    def CASE3( self, main ): 
+
+        import time 
+        import numpy 
+        import datetime
+        #from scipy import stats
+
+        ts = time.time()
+        date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d')
+
+        sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ]) 
+        warmUp = int(main.params[ 'TEST' ][ 'warmUp' ])
+        intentsList = (main.params[ 'TEST' ][ 'intents' ]).split(",")
+        debug = main.params[ 'TEST' ][ 'debug' ]
+        for i in range(0,len(intentsList)):
+            intentsList[i] = int(intentsList[i]) 
+        
+        timestampMetrics = []
+        if main.params['METRICS']['Submitted'] == "1":
+            timestampMetrics.append("Submitted")
+        if main.params['METRICS']['Installed'] == "1": 
+            timestampMetrics.append("Installed")
+        if main.params['METRICS']['Failed'] == "1":
+            timestampMetrics.append("Failed")    
+        if main.params['METRICS']['Withdraw'] == "1":
+            timestampMetrics.append("Withdraw")
+        if main.params['METRICS']['Withdrawn'] == "1":
+            timestampMetrics.append("Withdrawn")
+        if debug: main.log.info(timestampMetrics) 
+    
+        if debug == "True": 
+            debug = True
+        else: 
+            debug = False
+
+        if clusterCount == 1:
+            temp = "one"
+        if clusterCount == 3:
+            temp = "three"
+        if clusterCount == 5:
+            temp = "five"
+        if clusterCount == 7:
+            temp = "seven"
+
+        lgfile = temp + "Node7linear.cfg"
+        lgfileCut = temp + "Node7linearCut.cfg"
+        linkCount = 0
+
+        for i in range(0,15):
+            main.ONOSbench.handle.sendline("onos $OC1 links|wc -l")
+            main.ONOSbench.handle.expect(":~")
+            linkCount = main.ONOSbench.handle.before
+            if debug: main.log.info("Link Count check: " + linkCount)
+            if str(16) in linkCount:
+                break
+            time.sleep(3)
+            main.log.info("waiting for links")
+
+        links = "--"
+        while "=null:" not in links:
+            if debug: main.log.info("top of loop")
+            main.ONOSbench.handle.sendline("onos $OC1 links")
+            main.ONOSbench.handle.expect(":~")
+            links = main.ONOSbench.handle.before
+            if debug: main.log.info(str(links))
+            time.sleep(1)
+        links = links.splitlines()
+        templinks = links
+
+        tempDevices = []
+        for line in links:
+            temp = line.split(" ")
+            temp[0].replace("src=","")
+            temp[0] = (temp[0].split("/"))[0]
+            tempDevices.append(temp[0])
+
+        tempDevices.sort()
+        devices = []
+        for i in tempDevices:
+            if "src=null" in i:
+                devices.append(i.replace("src=", ""))
+        if debug: main.log.info(str(devices))
+
+        ingress = devices[0]
+        egress = devices.pop()
+        if debug: main.log.info("ingress: " + ingress)
+        if debug: main.log.info("egress: " + egress)
+
+
+        for intents in intentsList:
+            main.log.report("Intent Batch size: " + str(intents) + "\n      ") 
+            myResult = [["latency", "lastNode"] for x in range(sampleSize)]
+            
+            for run in range(0, (warmUp + sampleSize)):
+                if run > warmUp: 
+                    main.log.info("Starting test iteration " + str(run-warmUp)) 
+
+                cmd = """onos $OC1 "push-test-intents -i """
+                cmd += ingress + "/0 "
+                cmd += egress + "/0 "
+                cmd += str(intents) +""" 1" """
+                if debug: main.log.info(cmd)
+
+                withdrawCmd = cmd.replace("intents -i", "intents -w ")
+                 
+                #push-test-intents 
+                main.ONOSbench.handle.sendline(cmd)
+                main.ONOSbench.handle.expect(":~")
+                myRawResult = main.ONOSbench.handle.before
+              
+                for i in range(0, 40):
+                    main.ONOSbench.handle.sendline("onos $OC1 summary")
+                    main.ONOSbench.handle.expect(":~")
+                    linkCheck = main.ONOSbench.handle.before
+                    if ("flows=" + str(8*intents) + ",") in linkCheck:
+                        break
+                    if i == 39:
+                        main.log.error("Flow count incorrect, data invalid.")
+
+                #cut link
+                nodesLinksCut = []
+                if clusterCount == 1: 
+                    nodesLinksCut.append(1)
+                if clusterCount == 3 or clusterCount == 5:
+                    nodesLinksCut.append(2)
+                if clusterCount == 7:
+                    nodesLinksCut.append(3)
+                    nodesLinksCut.append(4)
+
+                for node in nodesLinksCut:
+                    exec "a = main.ONOS%s.createNullLinkProviderFile" %str(node)
+                    a(ONOSIp[node], fileName=("/opt/onos/apache-karaf-3.0.2/etc/" + lgfileCut), onNode=True)
+
+                #collect timestamp from link cut 
+                cmd = "onos-ssh $OC" + str(nodesLinksCut[len(nodesLinksCut)-1]) + " cat /opt/onos/log/karaf.log | grep " + lgfileCut + "| tail -1" 
+                if debug: main.log.info("COMMAND: " + str(cmd))
+                
+                for i in range(0,10):
+                    main.ONOSbench.handle.sendline(cmd)
+                    main.ONOSbench.handle.expect(":~")
+                    raw = main.ONOSbench.handle.before
+                    if "NullLinkProvider" in raw:
+                        break
+                    if i >= 9:
+                        main.log.error("Expected output not being recieved... continuing")
+                        main.log.info(raw)
+                        break
+                    time.sleep(2) 
+
+                temp = raw.splitlines()
+                for line in temp: 
+                    if str(date) in line: 
+                        temp = line 
+                        break
+
+                cutTimestamp = (temp.split(" "))[0] + " " + (temp.split(" "))[1]
+
+                #validate link count and flow count
+                for i in range(0, 40):
+                    main.ONOSbench.handle.sendline("onos $OC1 summary")
+                    main.ONOSbench.handle.expect(":~")
+                    linkCheck = main.ONOSbench.handle.before
+                    if "links=14," in linkCheck and ("flows=" + str(7*intents) + ",") in linkCheck:
+                        break
+                    if i == 39:
+                        main.log.error("Link or flow count incorrect, data invalid.")
+
+                #intents events metrics installed timestamp 
+                IEMtimestamps = [0]*(clusterCount + 1)
+                installedTemp = [0]*(clusterCount + 1)
+                for node in range(1, clusterCount +1):      
+                    cmd = "onos $OC" + str(node) + " intents-events-metrics|grep Timestamp"
+                    raw = ""
+                    while "Timestamp" not in raw:
+                        main.ONOSbench.handle.sendline(cmd)
+                        main.ONOSbench.handle.expect(":~")
+                        raw = main.ONOSbench.handle.before 
+
+                    intentsTimestamps = {}
+                    rawTimestamps = raw.splitlines()
+                    for line in rawTimestamps: 
+                        if "Timestamp" in line and "grep" not in line: 
+                            metricKey = (line.split(" "))[1]
+                            metricTimestamp = (line.split(" ")[len(line.split(" ")) -1]).replace("epoch)=","")
+                            metricTimestamp = float(metricTimestamp)
+                            metricTimestamp = numpy.divide(metricTimestamp, 1000)
+                            if debug: main.log.info(repr(metricTimestamp))
+                            intentsTimestamps[metricKey] = metricTimestamp
+                            if metricKey == "Installed":
+                                installedTemp[node] = metricTimestamp 
+
+                    main.log.info("Node: " + str(node) + " Timestamps: " + str(intentsTimestamps))
+                    IEMtimestamps[node] = intentsTimestamps
+              
+                myMax = max(installedTemp)
+                indexOfMax = installedTemp.index(myMax)
+
+                #number crunch
+                for metric in timestampMetrics:     #this is where we sould add support for computing other timestamp metrics
+                    if metric == "Installed":
+                        if run >= warmUp: 
+                            main.log.report("link cut timestamp: " + cutTimestamp)
+                            #readableInstalledTimestamp = str(intentsTimestamps["Installed"])
+                            readableInstalledTimestamp = str(myMax)
+
+                            #main.log.report("Intent Installed timestamp: " + str(intentsTimestamps["Installed"]))          
+                            main.log.report("Intent Installed timestamp: " + str(myMax))
+
+                            cutEpoch = time.mktime(time.strptime(cutTimestamp, "%Y-%m-%d %H:%M:%S,%f"))
+                            if debug: main.log.info("cutEpoch=" + str(cutEpoch))
+                            #rerouteLatency = float(intentsTimestamps["Installed"] - cutEpoch)
+                            rerouteLatency = float(myMax - cutEpoch)
+
+                            rerouteLatency = numpy.divide(rerouteLatency, 1000)
+                            main.log.report("Reroute latency:" + str(rerouteLatency) + " (seconds)\n    ") 
+                            myResult[run-warmUp][0] = rerouteLatency
+                            myResult[run-warmUp][1] = indexOfMax
+                            if debug: main.log.info("Latency: " + str(myResult[run-warmUp][0])) 
+                            if debug: main.log.info("last node: " + str(myResult[run-warmUp][1]))  
+
+                #time.sleep(12)
+
+                #reset
+                for node in nodesLinksCut:
+                    exec "a = main.ONOS%s.createNullLinkProviderFile" %str(node)
+                    a(ONOSIp[node], fileName=("/opt/onos/apache-karaf-3.0.2/etc/" + lgfile), onNode=True)
+
+                #wait for intent withdraw
+                if debug: main.log.info(withdrawCmd)
+                main.ONOSbench.handle.sendline(withdrawCmd)
+                main.ONOSbench.handle.expect(":~")
+                main.ONOSbench.handle.sendline("onos $OC1 intents|grep WITHDRAWN|wc -l")
+                main.ONOSbench.handle.expect(":~")
+                intentWithdrawCheck = main.ONOSbench.handle.before
+                if (str(intents)) in intentWithdrawCheck: 
+                    main.log.info("intents withdrawn")
+                if debug: main.log.info(intentWithdrawCheck)
+                
+                # wait for links to be reestablished  
+                for i in range(0, 10): 
+                    main.ONOSbench.handle.sendline("onos $OC1 summary")
+                    main.ONOSbench.handle.expect(":~") 
+                    linkCheck = main.ONOSbench.handle.before
+                    if "links=16," in linkCheck:
+                        break
+                    time.sleep(1)
+                    if i == 9: 
+                        main.log.info("Links Failed to reconnect, next iteration of data invalid.") 
+
+                if run < warmUp: 
+                    main.log.info("Warm up run " + str(run+1) + " completed") 
+            
+            if debug: main.log.info(myResult)
+            latTemp = []
+            nodeTemp = []
+            for i in myResult: 
+                latTemp.append(i[0])
+                nodeTemp.append(i[1])
+
+            mode = {}
+            for i in nodeTemp: 
+                if i in mode: 
+                    mode[i] += 1
+                else: 
+                    mode[i] = 1
+
+            for i in mode.keys():
+                if mode[i] == max(mode.values()):
+                    nodeMode = i 
+            
+            average = numpy.average(latTemp)
+            stdDev = numpy.std(latTemp) 
+
+            main.log.report("Scale: " + str(clusterCount) + "  \tIntent batch: " + str(intents))
+            main.log.report("Latency average:................" + str(average)) 
+            main.log.report("Latency standard deviation:....." + str(stdDev))
+            main.log.report("Mode of last node to respond:..." + str(nodeMode))
+            main.log.report("________________________________________________________")
+
+
+             
diff --git a/TestON/tests/IntentReroute/IntentReroute.topo b/TestON/tests/IntentReroute/IntentReroute.topo
new file mode 100644
index 0000000..0e45e0f
--- /dev/null
+++ b/TestON/tests/IntentReroute/IntentReroute.topo
@@ -0,0 +1,146 @@
+<TOPOLOGY>
+
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.254.1.200</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS><home>~/onos</home></COMPONENTS>
+        </ONOSbench>
+
+        <ONOS1cli>
+            <host>10.254.1.200</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1cli>
+
+        <ONOS2cli>
+            <host>10.254.1.200</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2cli>
+
+        <ONOS3cli>
+            <host>10.254.1.200</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3cli>
+
+        <ONOS4cli>
+            <host>10.254.1.200</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4cli>
+
+        <ONOS5cli>
+            <host>10.254.1.200</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5cli>
+
+        <ONOS6cli>
+            <host>10.254.1.200</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6cli>
+
+        <ONOS7cli>
+            <host>10.254.1.200</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7cli>
+
+        <ONOS1>
+            <host>10.254.1.201</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.254.1.202</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <ONOS3>
+            <host>10.254.1.203</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+        <ONOS4>
+            <host>10.254.1.204</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>12</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4>
+
+    
+        <ONOS5>
+            <host>10.254.1.205</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5>
+
+        <ONOS6>
+            <host>10.254.1.206</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6>
+
+        <ONOS7>
+            <host>10.254.1.207</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>15</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7>
+
+    </COMPONENT>
+
+</TOPOLOGY>
+
+
+    
diff --git a/TestON/tests/IntentReroute/__init__.py b/TestON/tests/IntentReroute/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/IntentReroute/__init__.py
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.params b/TestON/tests/LinkEventTP/LinkEventTP.params
index b4d50e5..7a47a51 100644
--- a/TestON/tests/LinkEventTP/LinkEventTP.params
+++ b/TestON/tests/LinkEventTP/LinkEventTP.params
@@ -1,10 +1,14 @@
 <PARAMS>
-    <testcases>1,3,2,3,2,3,2,3</testcases>
+    <testcases>1,2,3</testcases>
+    
     <ENV>
-    <cellName>network_tp_test</cellName>
-    <cellFeatures>"webconsole,onos-core,onos-api,onos-cli,onos-null,onos-rest,onos-app-metrics,onos-app-metrics-intent,onos-app-metrics-topology"</cellFeatures>
+        <cellName>network_tp_test</cellName>
+        <cellFeatures>"webconsole,onos-core,onos-api,onos-cli,onos-null,onos-rest,onos-app-metrics,onos-app-metrics-intent,onos-app-metrics-topology"</cellFeatures>
+        <onBaremetal>true</onBaremetal>   "true"
     </ENV>
-    <SCALE>2</SCALE>
+        
+    <SCALE>6</SCALE>
+    
     <availableNodes>7</availableNodes>
 
     <GIT>
@@ -26,7 +30,7 @@
         <port5>6633</port5>
 	<ip6>10.254.1.206</ip6>
         <port6>6633</port6>
-	<ip7>10.254.1.207</ip7>
+        <ip7>10.254.1.207</ip7>
         <port7>6633</port7>
     </CTRL>
 
@@ -38,21 +42,21 @@
     <TEST>          #   duration =      time the test loop runs
                     #   log_interval =  how often the data is reported 
                     #   wait =          time between tests, used to let the averages run down 
-               
-        <flickerRates>1000,0,0,0,0,0,0</flickerRates>
-        <devicesPerNode>20,0,0,0,0,0,0</devicesPerNode>
+        <configFile>/onos/tools/package/etc/org.onosproject.net.topology.impl.DefaultTopologyProvider.cfg</configFile>       
+        <flickerRates>20000,20000,20000,20000,20000,20000,20000</flickerRates>
+        <devicesPerNode>40,40,40,40,40,40,40</devicesPerNode>
         <flickerRate>1000</flickerRate>
         <linkgraphdif>.03</linkgraphdif>          # 0-1 indicated link/graph rate dif tolerance
-        <duration>120</duration>
+        <duration>1800</duration>
         <log_interval>15</log_interval>
         <wait>60</wait>
         <skipCleanInstall>yes</skipCleanInstall>
         <MN>localhost</MN>
-	    <logFile>link_event_tp_results_LOG</logFile>
+        <logFile>link_event_tp_results_LOG</logFile>
     </TEST>
 
     <JSON>
         <intents_rate>intentInstalledRate</intents_rate>
-    </JSON>
+    </JSON> 
 
 </PARAMS>
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.py b/TestON/tests/LinkEventTP/LinkEventTP.py
index e7d2133..a4bc0aa 100644
--- a/TestON/tests/LinkEventTP/LinkEventTP.py
+++ b/TestON/tests/LinkEventTP/LinkEventTP.py
@@ -36,9 +36,12 @@
         flickerRate = main.params[ 'TEST' ][ 'flickerRate']
         deviceDistribution = (main.params[ 'TEST' ][ 'devicesPerNode']).split(",")    
         MNip = main.params[ 'TEST' ][ 'MN' ]
-      
+        logFileName = main.params[ 'TEST' ][ 'logFile' ]
+        onBaremetal = main.params[ 'ENV' ][ 'onBaremetal' ]
+
         main.ONOSbench.handle.sendline("export TERM=vt100")
         main.ONOSbench.handle.expect(":~") 	    
+        homeDir = os.path.expanduser('~')
 
         #Populate ONOSIp with ips from params 
         for i in range(1, maxNodes + 1): 
@@ -90,34 +93,6 @@
         if skipMvn != "yes":
             mvnResult = main.ONOSbench.cleanInstall()
 
-        #configuring file to enable flicker
-        main.log.step(" Configuring null provider to enable flicker. Flicker Rate = " + flickerRate )
-        homeDir = os.path.expanduser('~')
-        main.log.info(homeDir)
-        localPath = "/onos/tools/package/etc/org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg"
-        filePath = homeDir + localPath
-        main.log.info(filePath)
-
-        neighborsString = ""
-        for node in range(1, maxNodes + 1):
-            neighborsString += ONOSIp[node]
-            if node < maxNodes:
-                neighborsString += ","
-
-        configFile = open(filePath, 'w+')
-        main.log.info("File opened")
-        configFile.write("# Sample configurations for the NullLinkProvider.\n")
-        configFile.write("# \n")
-        configFile.write("# If enabled, sets time between linkEvent generation\n")
-        configFile.write("# in milliseconds.\n")
-        configFile.write("#\n") 
-        configFile.write("eventRate = " + flickerRate)
-        configFile.write("\n")
-        configFile.write("#Set order of islands to chain together, in a line.\n")
-        configFile.write("neighbors = " + neighborsString)
-        configFile.close()
-        main.log.info("Configuration completed")
-
         ### configure event rate file ###
         main.log.step("Writing Default Topology Provider config file")
         localPath = main.params[ 'TEST' ][ 'configFile' ]
@@ -129,29 +104,28 @@
         configFile.write("maxIdleMs = 0\n")
         configFile.write("maxBatchMs = 0\n")
         main.log.info("File written and closed")
-       
- 
-        devices_by_ip = ""
-        for node in range(1, maxNodes + 1):
-            devices_by_ip += (ONOSIp[node] + ":" + str(5))
-            if node < maxNodes:
-                devices_by_ip +=(",")
-        
-        main.log.step("Configuring device provider")
-        localPath = "/onos/tools/package/etc/org.onosproject.provider.nil.device.impl.NullDeviceProvider.cfg"
-        filePath = homeDir + localPath
-        main.log.info(filePath)
-        configFile = open(filePath, 'w+')
-        main.log.info("Device config file opened")
-        configFile.write("devConfigs = " + devices_by_ip)
         configFile.close()
-        main.log.info("File closed")
 
-        logFileName = main.params[ 'TEST' ][ 'logFile' ]
         logFile = open(logFileName, 'w+')
         main.log.info("Created log File")
         logFile.close()
 
+        if onBaremetal == "true":
+            filename = "/onos/tools/package/bin/onos-service"
+            serviceConfig = open(homeDir + filename, 'w+')
+            serviceConfig.write("#!/bin/bash\n ")
+            serviceConfig.write("#------------------------------------- \n ")
+            serviceConfig.write("# Starts ONOS Apache Karaf container\n ")
+            serviceConfig.write("#------------------------------------- \n ")
+            serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ")
+            serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms256m -Xmx8G}" \n """)
+            serviceConfig.write("")
+            serviceConfig.write("ONOS_HOME=/opt/onos \n ")
+            serviceConfig.write("")
+            serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n")
+            serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """)
+            serviceConfig.close() 
+
         main.step( "Creating ONOS package" )
         packageResult = main.ONOSbench.onosPackage()  
 
@@ -212,11 +186,14 @@
         main.step( "Set Cell" )
         main.ONOSbench.setCell(cellName)
 
+        main.step( "Packaging" ) 
+        main.ONOSbench.onosPackage()
+
         main.log.report( "Increasing cluster size to " + str( clusterCount ) )
         for node in range(1, clusterCount + 1):
             time.sleep(10)
             main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
-            main.ONOSbench.onosInstall( ONOSIp[node] )
+            main.ONOSbench.onosInstall( node=ONOSIp[node] )
             exec "a = main.ONOS%scli.startOnosCli" %str(node)
             a(ONOSIp[node])
         
@@ -245,8 +222,7 @@
         linkResult = main.FALSE
         scale = int( main.params[ 'SCALE' ] )
 
-        testDelay = main.params[ 'TEST' ][ 'wait']
-        time.sleep( float( testDelay ) )
+        testDelay = main.params[ 'TEST' ][ 'wait' ]
                 
         for node in range(1, clusterCount + 1): 
             main.log.info("Writing flicker file to node " + str(node))
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.pyc b/TestON/tests/LinkEventTP/LinkEventTP.pyc
index 08393ed..644df6d 100644
--- a/TestON/tests/LinkEventTP/LinkEventTP.pyc
+++ b/TestON/tests/LinkEventTP/LinkEventTP.pyc
Binary files differ
diff --git a/TestON/tests/LinkEventTP/LinkEventTP.topo b/TestON/tests/LinkEventTP/LinkEventTP.topo
index cf5fc94..3c24161 100644
--- a/TestON/tests/LinkEventTP/LinkEventTP.topo
+++ b/TestON/tests/LinkEventTP/LinkEventTP.topo
@@ -3,7 +3,7 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosDriver</type>
@@ -15,7 +15,7 @@
         </ONOSbench>
 
         <ONOS1cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -24,7 +24,7 @@
         </ONOS1cli>
 
         <ONOS2cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -33,7 +33,7 @@
         </ONOS2cli>
 
         <ONOS3cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -42,7 +42,7 @@
         </ONOS3cli>
 
         <ONOS4cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -51,7 +51,7 @@
         </ONOS4cli>
 
         <ONOS5cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -60,7 +60,7 @@
         </ONOS5cli>
 
 	<ONOS6cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -69,7 +69,7 @@
         </ONOS6cli>
 
         <ONOS7cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -78,7 +78,7 @@
         </ONOS7cli>
 
         <ONOS1>
-            <host>10.128.5.51</host>
+            <host>10.254.1.201</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -87,7 +87,7 @@
         </ONOS1>
 
         <ONOS2>
-            <host>10.128.5.52</host>
+            <host>10.254.1.202</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -96,7 +96,7 @@
         </ONOS2>
 
         <ONOS3>
-            <host>10.128.5.53</host>
+            <host>10.254.1.203</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -105,7 +105,7 @@
         </ONOS3>
 
         <ONOS4>
-            <host>10.128.5.54</host>
+            <host>10.254.1.204</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -115,7 +115,7 @@
 
 	
         <ONOS5>
-            <host>10.128.5.65</host>
+            <host>10.254.1.205</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -124,7 +124,7 @@
         </ONOS5>
 
         <ONOS6>
-            <host>10.128.5.66</host>
+            <host>10.254.1.206</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -133,7 +133,7 @@
         </ONOS6>
 
         <ONOS7>
-            <host>10.128.5.67</host>
+            <host>10.254.1.207</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
diff --git a/TestON/tests/LinkEventTP/__init__.pyc b/TestON/tests/LinkEventTP/__init__.pyc
index 5415a7b..62abfab 100644
--- a/TestON/tests/LinkEventTP/__init__.pyc
+++ b/TestON/tests/LinkEventTP/__init__.pyc
Binary files differ
diff --git a/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.params b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.params
index 09c741c..24588e0 100644
--- a/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.params
+++ b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.params
@@ -39,6 +39,8 @@
     <TSHARK>
         <ofpPortStatus>OF 1.3 146</ofpPortStatus>
         <ofpRoleReply>OF 1.3 90 of_role_reply</ofpRoleReply>
+        <featureReply>OF 1.3 98 of_features_reply</featureReply>
+        <roleRequest>OF 1.3 90 of_role_request</roleRequest>
         <tcpSynAck>TCP 74 6633</tcpSynAck>
     </TSHARK>
 
@@ -59,7 +61,7 @@
         </topoConfigName>
 
         #Number of times to iterate each case
-        <numIter>10</numIter>
+        <numIter>35</numIter>
         <numSwitch>2</numSwitch>
         #Number of iterations to ignore initially
         <iterIgnore>2</iterIgnore>
diff --git a/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py
index 872238e..8a9591d 100644
--- a/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py
+++ b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py
@@ -156,8 +156,10 @@
         defaultSwPort = main.params['CTRL']['port1']
         numIter = main.params['TEST']['numIter']
         iterIgnore = int(main.params['TEST']['iterIgnore'])
+        
         deviceTimestamp = main.params['JSON']['deviceTimestamp']
         graphTimestamp = main.params['JSON']['graphTimestamp']
+
         debugMode = main.params['TEST']['debugMode']
         onosLog = main.params['TEST']['onosLogFile']
         resultPath = main.params['DB']['switchEventResultPath']
@@ -166,25 +168,26 @@
         thresholdMin = int(thresholdObj[0])
         thresholdMax = int(thresholdObj[1])
        
-        #TODO: Look for 'role-request' messages,
-        #      which replaces the 'vendor' messages previously seen
-        #      on OVS 2.0.1
-        tsharkOfString = main.params[ 'TSHARK' ][ 'ofpRoleReply' ]
+        # Look for 'role-request' messages,
+        # which replaces the 'vendor' messages previously seen
+        # on OVS 2.0.1
         tsharkTcpString = main.params[ 'TSHARK' ][ 'tcpSynAck' ]
+        tsharkFeatureReply = main.params[ 'TSHARK' ][ 'featureReply' ]
+        tsharkRoleRequest = main.params[ 'TSHARK' ][ 'roleRequest' ]
+        tsharkOfString = main.params[ 'TSHARK' ][ 'ofpRoleReply' ]
+
         tsharkOfOutput = '/tmp/tshark_of_topo.txt'
         tsharkTcpOutput = '/tmp/tshark_tcp_topo.txt'
+        tsharkRoleOutput = '/tmp/tshark_role_request.txt'
+        tsharkFeatureOutput = '/tmp/tshark_feature_reply.txt'
 
-        latencyEndToEndList = []
-        latencyOfpToGraphList = []
-        latencyOfpToDeviceList = []
-        latencyT0ToDeviceList = []
-        latencyTcpToOfpList = []
-        
         endToEndLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
         ofpToGraphLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
         ofpToDeviceLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
         
         tcpToOfpLatIter = []
+        tcpToFeatureLatIter = []
+        tcpToRoleLatIter = []
         assertion = main.TRUE
         localTime = time.strftime('%x %X')
         localTime = localTime.replace('/', '')
@@ -204,7 +207,9 @@
             main.log.info('Starting tshark capture')
             main.ONOS1.tsharkGrep(tsharkTcpString, tsharkTcpOutput)
             main.ONOS1.tsharkGrep(tsharkOfString, tsharkOfOutput)
-            
+            main.ONOS1.tsharkGrep(tsharkRoleRequest, tsharkRoleOutput)
+            main.ONOS1.tsharkGrep(tsharkFeatureReply, tsharkFeatureOutput)
+
             time.sleep(10)
            
             main.log.info('Assigning s3 to controller')
@@ -219,6 +224,14 @@
             main.log.info('Copying over tshark files')
             os.system('scp ' + ONOSUser + '@' + ONOS1Ip +
                     ':' + tsharkTcpOutput + ' /tmp/')
+            os.system('scp ' + ONOSUser + '@' + ONOS1Ip +
+                    ':' + tsharkRoleOutput + ' /tmp/')
+            os.system('scp ' + ONOSUser + '@' + ONOS1Ip +
+                    ':' + tsharkFeatureOutput + ' /tmp/')
+            os.system('scp ' + ONOSUser + '@' +
+                      ONOS1Ip + ':' + tsharkOfOutput + ' /tmp/')
+           
+            # Get tcp syn / ack output
             time.sleep(5)
             tcpFile = open(tsharkTcpOutput, 'r')
             tempText = tcpFile.readline()
@@ -234,10 +247,8 @@
                 t0Tcp = 0
                 assertion = main.FALSE
             tcpFile.close()
-            
-            os.system('scp ' + ONOSUser + '@' +
-                      ONOS1Ip + ':' + tsharkOfOutput + ' /tmp/')
-            
+           
+            # Get Role reply output
             time.sleep(5)
             ofFile = open(tsharkOfOutput, 'r')
             lineOfp = ''
@@ -247,7 +258,6 @@
                     lineOfp = tempText
                 else:
                     break
-
             obj = lineOfp.split(' ')
             main.log.info('Object read in from OFP capture: ' +
                     str(lineOfp))
@@ -259,7 +269,92 @@
                 t0Ofp = 0
                 assertion = main.FALSE
             ofFile.close()
-            
+           
+            # Get role request output
+            roleFile = open(tsharkRoleOutput, 'r')
+            tempText = roleFile.readline()
+            tempText = tempText.split(' ')
+            if len(tempText) > 1:
+                main.log.info('Object read in from role request capture:' +
+                        str(tempText))
+                roleTimestamp = float(tempText[1]) * 1000.0
+            else:
+                main.log.error('Tshark output file for role request' +
+                        ' returned unexpected results')
+                timeRoleRequest = 0
+                assertion = main.FALSE
+            roleFile.close()
+
+            # Get feature reply output
+            featureFile = open(tsharkFeatureOutput, 'r')
+            tempText = featureFile.readline()
+            tempText = tempText.split(' ')
+            if len(tempText) > 1:
+                main.log.info('Object read in from feature reply capture: '+
+                        str(tempText))
+                featureTimestamp = float(tempText[1]) * 1000.0
+            else:
+                main.log.error('Tshark output file for feature reply' +
+                        ' returned unexpected results')
+                timeFeatureReply = 0
+                assertion = main.FALSE
+            featureFile.close()
+
+            # TODO: calculate feature reply, role request times
+            # stack measurements correctly and report
+
+            """
+            #TODO: Refactor in progress
+
+            for node in range(0, clusterCount):
+                nodeNum = node+1
+                exec "metricsSwUp = main.ONOS%scli.topologyEventsMetrics"%str(nodeNum) 
+                jsonStr = metricsSwUp()
+                jsonObj = json.loads(jsonStr)
+                graphTimestamp = jsonObj[graphTimestamp]['value']
+                deviceTimestamp = jsonObj[deviceTimestamp]['value']
+               
+                deltaGraphTcp = int(graphTimestamp) - int(t0Tcp)
+                deltaDeviceTcp = int(deviceTimestamp) - int(t0Tcp)
+                deltaGraphOfp = int(graphTimestamp) - int(t0Ofp)
+                deltaDeviceOfp = int(deviceTimestamp) - int(t0Ofp)
+                deltaRoleTcp = int(roleTimestamp) - int(t0Tcp) 
+                deltaFeatureTcp = int(featureTimestamp) - int(t0Tcp)
+                deltaOfpTcp = int(t0Ofp) - int(t0Tcp)
+
+                if deltaGraphTcp > thresholdMin and\
+                   deltaGraphTcp < thresholdMax and i >= iterIgnore:
+                    endToEndLatNodeIter[node][i] = deltaGraphTcp
+                    main.log.info("ONOS "+str(nodeNum)+ " tcp-to-graph: "+
+                            str(deltaGraphTcp) + " ms")
+                else:
+                    main.log.info("ONOS "+str(nodeNum)+ " tcp-to-graph "+
+                            "measurement ignored due to excess in "+
+                            "threshold or premature iteration")
+
+                if deltaGraphOfp > thresholdMin and\
+                   deltaGraphOfp < thresholdMax and i >= iterIgnore:
+                    ofpToGraphLatNodeIter[node][i] = deltaGraphOfp
+                    main.log.info("ONOS "+str(nodeNum)+ " ofp-to-graph: "+
+                            str(deltaGraphOfp) + " ms")
+                else:
+                    main.log.info("ONOS "+str(nodeNum)+ " ofp-to-graph: "+
+                            "measurement ignored due to excess in "+
+                            "threshold or premature iteration")
+
+                if deltaDeviceOfp > thresholdMin and\
+                   deltaDeviceOfp < thresholdMax and i >= iterIgnore:
+                    ofpToDeviceLatNodeIter[node][i] = deltaDeviceOfp
+                    main.log.info("ONOS "+str(nodeNum)+ " ofp-to-device: "+
+                            str(deltaDeviceOfp) + " ms")
+                else:
+                    main.log.info("ONOS "+str(nodeNum)+ " ofp-to-device: "+
+                            "measurement ignored due to excess in "+
+                            "threshold or premature iteration")
+
+
+            # ********************
+            """
             jsonStr1 = main.ONOS1cli.topologyEventsMetrics()
             jsonStr2 = ''
             jsonStr3 = ''
@@ -275,7 +370,8 @@
             jsonObj5 = ''
             jsonObj6 = ''
             jsonObj7 = ''
-            
+
+
             graphTimestamp1 = jsonObj1[graphTimestamp]['value']
             deviceTimestamp1 = jsonObj1[deviceTimestamp]['value']
             
@@ -286,39 +382,46 @@
             deltaGraph1 = int(graphTimestamp1) - int(t0Tcp)
             deltaOfpGraph1 = int(graphTimestamp1) - int(t0Ofp)
             deltaOfpDevice1 = int(deviceTimestamp1) - int(t0Ofp)
+            # Tshark timestamps 
             deltaTcpOfp1 = int(t0Ofp) - int(t0Tcp)
+            deltaRoleTcp1 = int(roleTimestamp) - int(t0Tcp) 
+            deltaFeatureTcp1 = int(featureTimestamp) - int(t0Tcp)
+            deltaOfpTcp1 = int(t0Ofp) - int(t0Tcp)
             
             if deltaTcpOfp1 > thresholdMin and\
                deltaTcpOfp1 < thresholdMax and i >= iterIgnore:
                 tcpToOfpLatIter.append(deltaTcpOfp1)
-                main.log.info('ONOS1 iter' + str(i) +
+            main.log.info('ONOS1 iter' + str(i) +
                               ' tcp-to-ofp: ' +
                               str(deltaTcpOfp1) + ' ms')
-            else:
-                tcpToOfpLatIter.append(0)
-                main.log.info('ONOS1 iter' + str(i) +
-                        ' tcp-to-ofp: ' + str(deltaTcpOfp1) +
-                        ' ms - ignored this iteration')
+            if deltaFeatureTcp1 > thresholdMin and\
+               deltaFeatureTcp1 < thresholdMax and i >= iterIgnore:
+                tcpToFeatureLatIter.append(deltaFeatureTcp1)
+            main.log.info('ONOS1 iter' + str(i) +
+                            ' tcp-to-feature-reply: ' +
+                            str(deltaFeatureTcp1) + ' ms')
+            if deltaRoleTcp1 > thresholdMin and\
+               deltaRoleTcp1 < thresholdMax and i >= iterIgnore:
+                tcpToRoleLatIter.append(deltaRoleTcp1)
+            main.log.info('ONOS1 iter' + str(i) +
+                            ' tcp-to-role-request: ' +
+                            str(deltaRoleTcp1) + ' ms')
             if deltaGraph1 > thresholdMin and\
                deltaGraph1 < thresholdMax and i >= iterIgnore:
                 endToEndLatNodeIter[0][i] = deltaGraph1
-                main.log.info('ONOS1 iter' + str(i) +
+            main.log.info('ONOS1 iter' + str(i) +
                               ' end-to-end: ' +
                               str(deltaGraph1) + ' ms')
-            else:
-                main.log.info('ONOS1 iter' + str(i) +
-                        ' end-to-end: ' + str(deltaGraph1) +
-                        ' ms - ignored this iteration')
             if deltaOfpGraph1 > thresholdMin and \
                deltaOfpGraph1 < thresholdMax and i >= iterIgnore:
                 ofpToGraphLatNodeIter[0][i] = deltaOfpGraph1
-                main.log.info('ONOS1 iter' + str(i) +
+            main.log.info('ONOS1 iter' + str(i) +
                         ' ofp-to-graph: ' +
                         str(deltaOfpGraph1) + ' ms')
             if deltaOfpDevice1 > thresholdMin and\
                deltaOfpDevice1 < thresholdMax and i >= iterIgnore:
                 ofpToDeviceLatNodeIter[0][i] = deltaOfpDevice1
-                main.log.info('ONOS1 iter' + str(i) +
+            main.log.info('ONOS1 iter' + str(i) +
                         ' ofp-to-device: ' +
                         str(deltaOfpDevice1))
             
@@ -342,36 +445,36 @@
                 if deltaGraph2 > thresholdMin and\
                    deltaGraph2 < thresholdMax and i >= iterIgnore:
                     endToEndLatNodeIter[1][i] = deltaGraph2
-                    main.log.info('ONOS2 iter' + str(i) +
+                main.log.info('ONOS2 iter' + str(i) +
                             ' end-to-end: ' +
                             str(deltaGraph2) + ' ms')
                 if deltaOfpGraph2 > thresholdMin and\
                    deltaOfpGraph2 < thresholdMax and i >= iterIgnore:
                     ofpToGraphLatNodeIter[1][i] = deltaOfpGraph2
-                    main.log.info('ONOS2 iter' + str(i) +
+                main.log.info('ONOS2 iter' + str(i) +
                             ' ofp-to-graph: ' +
                             str(deltaOfpGraph2) + ' ms')
                 if deltaOfpDevice2 > thresholdMin and\
                    deltaOfpDevice2 < thresholdMax and i >= iterIgnore:
                     ofpToDeviceLatNodeIter[1][i] = deltaOfpDevice2
-                    main.log.info('ONOS2 iter' + str(i) +
+                main.log.info('ONOS2 iter' + str(i) +
                             ' ofp-to-device: ' +
-                            str(deltaOfpDevice2))
+                            str(deltaOfpDevice2)+ ' ms')
                 if deltaGraph3 > thresholdMin and\
                    deltaGraph3 < thresholdMax and i >= iterIgnore:
                     endToEndLatNodeIter[2][i] = deltaGraph3
-                    main.log.info('ONOS3 iter' + str(i) +
+                main.log.info('ONOS3 iter' + str(i) +
                             ' end-to-end: ' + str(deltaGraph3) + ' ms')
                 if deltaOfpGraph3 > thresholdMin and\
                    deltaOfpGraph3 < thresholdMax and i >= iterIgnore:
                     ofpToGraphLatNodeIter[2][i] = deltaOfpGraph3
-                    main.log.info('ONOS3 iter' + str(i) +
+                main.log.info('ONOS3 iter' + str(i) +
                             ' ofp-to-graph: ' +
                             str(deltaOfpGraph3) + ' ms')
                 if deltaOfpDevice3 > thresholdMin and\
-                        deltaOfpDevice3 < thresholdMax and i >= iterIgnore:
+                   deltaOfpDevice3 < thresholdMax and i >= iterIgnore:
                     ofpToDeviceLatNodeIter[2][i] = deltaOfpDevice3
-                    main.log.info('ONOS3 iter' + str(i) +
+                main.log.info('ONOS3 iter' + str(i) +
                             ' ofp-to-device: ' + str(deltaOfpDevice3))
             if clusterCount >= 5:
                 jsonStr4 = main.ONOS4cli.topologyEventsMetrics()
@@ -393,32 +496,32 @@
                 if deltaGraph4 > thresholdMin and \
                    deltaGraph4 < thresholdMax and i >= iterIgnore:
                     endToEndLatNodeIter[3][i] = deltaGraph4
-                    main.log.info('ONOS4 iter' + str(i) +
+                main.log.info('ONOS4 iter' + str(i) +
                             ' end-to-end: ' + str(deltaGraph4) + ' ms')
                 if deltaOfpDevice4 > thresholdMin and \
                    deltaOfpDevice4 < thresholdMax and i >= iterIgnore:
                     ofpToDeviceLatNodeIter[3][i] = deltaOfpDevice4
-                    main.log.info('ONOS4 iter' + str(i) +
+                main.log.info('ONOS4 iter' + str(i) +
                             ' ofp-to-device: ' + str(deltaOfpDevice4))
                 if deltaOfpGraph4 > thresholdMin and \
                         deltaOfpGraph4 < thresholdMax and i >= iterIgnore:
                     ofpToGraphLatNodeIter[3][i] = deltaOfpGraph4
-                    main.log.info('ONOS4 iter' + str(i) +
+                main.log.info('ONOS4 iter' + str(i) +
                             ' ofp-to-graph: ' + str(deltaOfpGraph4) + ' ms')
                 if deltaGraph5 > thresholdMin and\
                         deltaGraph5 < thresholdMax and i >= iterIgnore:
                     endToEndLatNodeIter[4][i] = deltaGraph5
-                    main.log.info('ONOS5 iter' + str(i) +
+                main.log.info('ONOS5 iter' + str(i) +
                             ' end-to-end: ' + str(deltaGraph5) + ' ms')
                 if deltaOfpDevice5 > thresholdMin and\
                         deltaOfpDevice5 < thresholdMax and i >= iterIgnore:
                     ofpToDeviceLatNodeIter[4][i] = deltaOfpDevice5
-                    main.log.info('ONOS5 iter' + str(i) +
+                main.log.info('ONOS5 iter' + str(i) +
                             ' ofp-to-device: ' + str(deltaOfpDevice5))
                 if deltaOfpGraph5 > thresholdMin and\
                         deltaOfpGraph5 < thresholdMax and i >= iterIgnore:
                     ofpToGraphLatNodeIter[4][i] = deltaOfpGraph5
-                    main.log.info('ONOS5 iter' + str(i) +
+                main.log.info('ONOS5 iter' + str(i) +
                             ' ofp-to-graph: ' +
                             str(deltaOfpGraph5) + ' ms')
             if clusterCount >= 7:
@@ -441,38 +544,38 @@
                 if deltaGraph6 > thresholdMin and \
                    deltaGraph6 < thresholdMax and i >= iterIgnore:
                     endToEndLatNodeIter[5][i] = deltaGraph6
-                    main.log.info('ONOS6 iter' + str(i) +
+                main.log.info('ONOS6 iter' + str(i) +
                             ' end-to-end: ' + str(deltaGraph6) + ' ms')
                 if deltaOfpDevice6 > thresholdMin and\
                    deltaOfpDevice6 < thresholdMax and i >= iterIgnore:
                     ofpToDeviceLatNodeIter[5][i] = deltaOfpDevice6
-                    main.log.info('ONOS6 iter' + str(i) +
+                main.log.info('ONOS6 iter' + str(i) +
                             ' ofp-to-device: ' + str(deltaOfpDevice6))
                 if deltaOfpGraph6 > thresholdMin and\
                    deltaOfpGraph6 < thresholdMax and i >= iterIgnore:
                     ofpToGraphLatNodeIter[5][i] = deltaOfpGraph6
-                    main.log.info('ONOS6 iter' + str(i) +
+                main.log.info('ONOS6 iter' + str(i) +
                             ' ofp-to-graph: ' +
                             str(deltaOfpGraph6) + ' ms')
                 if deltaGraph7 > thresholdMin and \
                    deltaGraph7 < thresholdMax and i >= iterIgnore:
                     endToEndLatNodeIter[6][i] = deltaGraph7
-                    main.log.info('ONOS7 iter' + str(i) +
+                main.log.info('ONOS7 iter' + str(i) +
                             ' end-to-end: ' + 
                             str(deltaGraph7) + ' ms')
                 if deltaOfpDevice7 > thresholdMin and\
                         deltaOfpDevice7 < thresholdMax and i >= iterIgnore:
                     ofpToDeviceLatNodeIter[6][i] = deltaOfpDevice7
-                    main.log.info('ONOS7 iter' + str(i) +
+                main.log.info('ONOS7 iter' + str(i) +
                             ' ofp-to-device: ' +
                             str(deltaOfpDevice7))
                 if deltaOfpGraph7 > thresholdMin and \
                         deltaOfpGraph7 < thresholdMax and i >= iterIgnore:
                     ofpToGraphLatNodeIter[6][i] = deltaOfpGraph7
-                    main.log.info('ONOS7 iter' + str(i) +
+                main.log.info('ONOS7 iter' + str(i) +
                             ' ofp-to-graph: ' +
                             str(deltaOfpGraph7) + ' ms')
-            
+
             time.sleep(5)
         
             # Get device id to remove
@@ -499,11 +602,19 @@
 
         endToEndAvg = 0
         ofpToGraphAvg = 0
-        endToEndList = []
-        ofpToGraphList = []
-        ofpToDeviceList = []
         dbCmdList = []
         for node in range(0, clusterCount):
+            # List of latency for each node
+            endToEndList = []
+            ofpToGraphList = []
+            ofpToDeviceList = []
+            tcpToOfpList = []
+            tcpToFeatureList = []
+            tcpToRoleList = []
+
+            # LatNodeIter 2d arrays contain all iteration latency
+            # for each node of the current scale cluster size
+
             for item in endToEndLatNodeIter[node]:
                 if item > 0.0:
                     endToEndList.append(item)
@@ -516,7 +627,22 @@
                 if item > 0.0:
                     ofpToDeviceList.append(item)
 
+            for item in tcpToOfpLatIter:
+                if item > 0.0:
+                    tcpToOfpList.append(item)
+
+            for item in tcpToFeatureLatIter:
+                if item > 0.0:
+                    tcpToFeatureList.append(item)
+
+            for item in tcpToRoleLatIter:
+                if item > 0.0:
+                    tcpToRoleList.append(item)
+
             endToEndAvg = round(numpy.mean(endToEndList), 2)
+            tcpToOfpAvg = round(numpy.mean(tcpToOfpList), 2)
+            tcpToFeatureAvg = round(numpy.mean(tcpToFeatureList), 2)
+            tcpToRoleAvg = round(numpy.mean(tcpToRoleList), 2)
             ofpToGraphAvg = round(numpy.mean(ofpToGraphList), 2)
             endToEndStd = round(numpy.std(endToEndList), 2)
             ofpToGraphStd = round(numpy.std(ofpToGraphList), 2)
@@ -526,6 +652,9 @@
             main.log.report(' End-to-end Avg: ' + str(endToEndAvg) +
                     ' ms' + ' End-to-end Std dev: ' +
                     str(endToEndStd) + ' ms')
+            main.log.report(' Tcp-to-role-reply : ' + str(tcpToOfpAvg) + ' ms')
+            main.log.report(' Tcp-to-feature-reply : ' + str(tcpToFeatureAvg) + ' ms')
+            main.log.report(' Tcp-to-role-request : ' + str(tcpToRoleAvg) + ' ms')
             main.log.report(' Ofp-to-graph Avg: ' + str(ofpToGraphAvg) +
                     ' ms' + ' Ofp-to-graph Std dev: ' +
                     str(ofpToGraphStd) + ' ms')
@@ -658,7 +787,59 @@
                         ' results: ' + str(objDown))
                 timestampBeginPtDown = 0
             fPortDown.close()
-            
+          
+            """
+            # TODO: Refactor in progress
+
+            for node in range(0, clusterCount):
+                nodeNum = node+1
+                exec "metricsDown = main.ONOS%scli.topologyEventsMetrics"%str(nodeNum) 
+                jsonStrDown = metricsDown()
+                jsonObj = json.loads(jsonStrDown)
+                
+                graphTimestamp = jsonObj[graphTimestamp]['value']
+                deviceTimestamp = jsonObj[deviceTimestamp]['value']
+                linkTimestamp = jsonObj[linkTimestamp]['value']
+                
+                ptDownGraphToOfp = int(graphTimestamp) - int(timestampBeginPtDown)
+                ptDownDeviceToOfp = int(deviceTimestamp) - int(timestampBeginPtDown)
+                ptDownLinkToOfp = int(linkTimestamp) - int(timestampBeginPtDown)
+
+                if ptDownGraphToOfp > downThresholdMin and\
+                   ptDownGraphToOfp < downThresholdMax and i > iterIgnore:
+                    portDownGraphNodeIter[node][i] = ptDownGraphToOfp
+                    main.log.info("ONOS "+str(nodeNum)+ 
+                            " port down graph-to-ofp: "+
+                            str(ptDownGraphToOfp) + " ms") 
+                else:
+                    main.log.info("ONOS "+str(nodeNum)+
+                            " port down graph-to-ofp ignored"+
+                            " due to excess in threshold or premature iteration")
+
+                if ptDownDeviceToOfp > downThresholdMin and\
+                   ptDownDeviceToOfp < downThresholdMax and i > iterIgnore:
+                    portDownDeviceNodeIter[node][i] = ptDownDeviceToOfp
+                    main.log.info("ONOS "+str(nodeNum)+ 
+                            " port down device-to-ofp: "+
+                            str(ptDownDeviceToOfp) + " ms") 
+                else:
+                    main.log.info("ONOS "+str(nodeNum)+
+                            " port down device-to-ofp ignored"+
+                            " due to excess in threshold or premature iteration")
+
+                if ptDownLinkToOfp > downThresholdMin and\
+                   ptDownLinkToOfp < downThresholdMax and i > iterIgnore:
+                    portDownLinkNodeIter[node][i] = ptDownLinkToOfp
+                    main.log.info("ONOS "+str(nodeNum)+
+                            " port down link-to-ofp: "+
+                            str(ptDownLinkToOfp) + " ms")
+                else:
+                    main.log.info("ONOS "+str(nodeNum)+
+                            " port down link-to-ofp ignored"+
+                            " due to excess in threshold or premature iteration")
+            """
+            # *************************
+
             main.step('Obtain t1 by metrics call')
             
             jsonStrUp1 = main.ONOS1cli.topologyEventsMetrics()
@@ -669,36 +850,27 @@
             ptDownGraphToOfp1 = int(graphTimestamp1) - int(timestampBeginPtDown)
             ptDownDeviceToOfp1 = int(deviceTimestamp1) - int(timestampBeginPtDown)
             ptDownLinkToOfp1 = int(linkTimestamp1) - int(timestampBeginPtDown)
-            
+           
             if ptDownGraphToOfp1 > downThresholdMin and\
                ptDownGraphToOfp1 < downThresholdMax and i > iterIgnore:
                 portDownGraphNodeIter[0][i] = ptDownGraphToOfp1
                 main.log.info('ONOS1 iter' + str(i) +
                         ' port down graph-to-ofp: ' +
                         str(ptDownGraphToOfp1) + ' ms')
-            else:
-                main.log.info('ONOS1 iter' + str(i) + 
-                        ' skipped. Result: ' +
-                        str(ptDownGraphToOfp1) + ' ms')
+            
             if ptDownDeviceToOfp1 > downThresholdMin and \
                ptDownDeviceToOfp1 < downThresholdMax and i > iterIgnore:
                 portDownDevNodeIter[0][i] = ptDownDeviceToOfp1
                 main.log.info('ONOS1 iter' + str(i) + 
                         ' port down device-to-ofp: ' +
                         str(ptDownDeviceToOfp1) + ' ms')
-            else:
-                main.log.info('ONOS1 iter' + str(i) +
-                        ' skipped. Result: ' +
-                        str(ptDownDeviceToOfp1) + ' ms')
             if ptDownLinkToOfp1 > downThresholdMin and\
                ptDownLinkToOfp1 < downThresholdMax and i > iterIgnore:
                 portDownLinkNodeIter[0][i] = ptDownLinkToOfp1
                 main.log.info('ONOS1 iter' + str(i) +
                         ' port down link-to-ofp: ' +
                         str(ptDownLinkToOfp1) + ' ms')
-            else:
-                main.log.info('ONOS1 Link-to-ofp skipped. Result: ' +
-                        str(ptDownLinkToOfp1) + ' ms')
+            
             if clusterCount >= 3:
                 jsonStrUp2 = main.ONOS2cli.topologyEventsMetrics()
                 jsonStrUp3 = main.ONOS3cli.topologyEventsMetrics()
@@ -858,7 +1030,7 @@
                     main.log.info('ONOS7 iter' + str(i) +
                             ' link-to-ofp: ' +
                             str(ptDownLinkToOfp7) + ' ms')
-            
+
             time.sleep(3)
             
             main.step('Starting wireshark capture for port status up')
@@ -888,6 +1060,62 @@
                 main.log.info('Tshark output file returned unexpected' + ' results.')
                 timestampBeginPtUp = 0
             fPortUp.close()
+            """ 
+            # TODO: Refactoring in progress
+            
+            for node in range(0, clusterCount):
+                nodeNum = node+1
+                exec "metricsUp = main.ONOS%scli.topologyEventsMetrics"%str(nodeNum) 
+                jsonStrUp = metricsUp()
+                jsonObj = json.loads(jsonStrUp)
+                
+                print jsonObj
+
+                graphTimestamp = jsonObj[graphTimestamp]['value']
+                deviceTimestamp = jsonObj[deviceTimestamp]['value']
+                linkTimestamp = jsonObj[linkTimestamp]['value']
+                
+                ptUpGraphToOfp = int(graphTimestamp) - int(timestampBeginPtUp)
+                ptUpDeviceToOfp = int(deviceTimestamp) - int(timestampBeginPtUp)
+                ptUpLinkToOfp = int(linkTimestamp) - int(timestampBeginPtUp)
+
+                if ptUpGraphToOfp > upThresholdMin and\
+                   ptUpGraphToOfp < upThresholdMax and i > iterIgnore:
+                    portUpGraphNodeIter[node][i] = ptUpGraphToOfp
+                    main.log.info("ONOS "+str(nodeNum)+ 
+                            " port up graph-to-ofp: "+
+                            str(ptUpGraphToOfp) + " ms") 
+                else:
+                    main.log.info("ONOS "+str(nodeNum)+
+                            " port up graph-to-ofp ignored"+
+                            " due to excess in threshold or premature iteration")
+
+                if ptUpDeviceToOfp > upThresholdMin and\
+                   ptUpDeviceToOfp < upThresholdMax and i > iterIgnore:
+                    portUpDeviceNodeIter[node][i] = ptUpDeviceToOfp
+                    main.log.info("ONOS "+str(nodeNum)+ 
+                            " port up device-to-ofp: "+
+                            str(ptUpDeviceToOfp) + " ms") 
+                else:
+                    main.log.info("ONOS "+str(nodeNum)+
+                            " port up device-to-ofp ignored"+
+                            " due to excess in threshold or premature iteration")
+
+                if ptUpLinkToOfp > upThresholdMin and\
+                   ptUpLinkToOfp < upThresholdMax and i > iterIgnore:
+                    portUpLinkNodeIter[node][i] = ptUpLinkToOfp
+                    main.log.info("ONOS "+str(nodeNum)+
+                            " port up link-to-ofp: "+
+                            str(ptUpLinkToOfp) + " ms")
+                else:
+                    main.log.info("ONOS "+str(nodeNum)+
+                            " port up link-to-ofp ignored"+
+                            " due to excess in threshold or premature iteration")
+
+            """
+
+            # *****************************
+            
             main.step('Obtain t1 by REST call')
             jsonStrUp1 = main.ONOS1cli.topologyEventsMetrics()
             jsonObj1 = json.loads(jsonStrUp1)
@@ -903,20 +1131,12 @@
                 main.log.info('ONOS1 iter' + str(i) +
                         ' port up graph-to-ofp: ' +
                         str(ptUpGraphToOfp1) + ' ms')
-            else:
-                main.log.info('ONOS1 iter' + str(i) +
-                        ' skipped. Result: ' +
-                        str(ptUpGraphToOfp1) + ' ms')
             if ptUpDeviceToOfp1 > upThresholdMin and \
                ptUpDeviceToOfp1 < upThresholdMax and i > iterIgnore:
                 portUpDevNodeIter[0][i] = ptUpDeviceToOfp1
                 main.log.info('ONOS1 iter' + str(i) +
                         ' port up device-to-ofp: ' +
                         str(ptUpDeviceToOfp1) + ' ms')
-            else:
-                main.log.info('ONOS1 iter' + str(i) +
-                        ' skipped. Result: ' +
-                        str(ptUpDeviceToOfp1) + ' ms')
             if ptUpLinkToOfp1 > downThresholdMin and\
                ptUpLinkToOfp1 < downThresholdMax and i > iterIgnore:
                 portUpLinkNodeIter[0][i] = ptUpLinkToOfp1
@@ -1005,10 +1225,16 @@
                     main.log.info('ONOS4 iter' + str(i) +
                             ' port up device-to-ofp: ' +
                             str(ptUpDeviceToOfp4) + ' ms')
+                if ptUpLinkToOfp4 > downThresholdMin and\
+                   ptUpLinkToOfp4 < downThresholdMax and i > iterIgnore:
+                    portUpLinkNodeIter[3][i] = ptUpLinkToOfp4
+                    main.log.info('ONOS4 iter' + str(i) +
+                            ' port up link-to-ofp: ' +
+                            str(ptUpLinkToOfp4) + ' ms')
                 if ptUpGraphToOfp5 > upThresholdMin and\
                     ptUpGraphToOfp5 < upThresholdMax and i > iterIgnore:
                     portUpGraphNodeIter[4][i] = ptUpGraphToOfp5
-                    main.log.info('ONSO5 iter' + str(i) +
+                    main.log.info('ONOS5 iter' + str(i) +
                             ' port up graph-to-ofp: ' +
                             str(ptUpGraphToOfp5) + ' ms')
                 if ptUpDeviceToOfp5 > upThresholdMin and \
@@ -1017,6 +1243,13 @@
                     main.log.info('ONOS5 iter' + str(i) +
                             ' port up device-to-ofp: ' +
                             str(ptUpDeviceToOfp5) + ' ms')
+                if ptUpLinkToOfp5 > downThresholdMin and\
+                   ptUpLinkToOfp5 < downThresholdMax and i > iterIgnore:
+                    portUpLinkNodeIter[4][i] = ptUpLinkToOfp5
+                    main.log.info('ONOS5 iter' + str(i) +
+                            ' port up link-to-ofp: ' +
+                            str(ptUpLinkToOfp5) + ' ms')
+            
             if clusterCount >= 7:
                 jsonStrUp6 = main.ONOS6cli.topologyEventsMetrics()
                 jsonStrUp7 = main.ONOS7cli.topologyEventsMetrics()
@@ -1026,45 +1259,67 @@
                 graphTimestamp7 = jsonObj7[graphTimestamp]['value']
                 deviceTimestamp6 = jsonObj6[deviceTimestamp]['value']
                 deviceTimestamp7 = jsonObj7[deviceTimestamp]['value']
+                linkTimestamp6 = jsonObj6[linkTimestamp]['value']
+                linkTimestamp7 = jsonObj7[linkTimestamp]['value']
                 ptUpGraphToOfp6 = int(graphTimestamp6) - int(timestampBeginPtUp)
                 ptUpGraphToOfp7 = int(graphTimestamp7) - int(timestampBeginPtUp)
                 ptUpDeviceToOfp6 = int(deviceTimestamp6) - int(timestampBeginPtUp)
                 ptUpDeviceToOfp7 = int(deviceTimestamp7) - int(timestampBeginPtUp)
+                ptUpLinkToOfp6 = int(linkTimestamp6) - int(timestampBeginPtUp)
+                ptUpLinkToOfp7 = int(linkTimestamp7) - int(timestampBeginPtUp)
                 if ptUpGraphToOfp6 > upThresholdMin and\
                    ptUpGraphToOfp6 < upThresholdMax and i > iterIgnore:
                     portUpGraphNodeIter[5][i] = ptUpGraphToOfp6
-                    main.log.info('iter' + str(i) +
+                    main.log.info('ONOS6 iter' + str(i) +
                             ' port up graph-to-ofp: ' +
                             str(ptUpGraphToOfp6) + ' ms')
                 if ptUpDeviceToOfp6 > upThresholdMin and\
                    ptUpDeviceToOfp6 < upThresholdMax and i > iterIgnore:
                     portUpDevNodeIter[5][i] = ptUpDeviceToOfp6
-                    main.log.info('iter' + str(i) +
+                    main.log.info('ONOS6 iter' + str(i) +
                             ' port up device-to-ofp: ' + 
                             str(ptUpDeviceToOfp6) + ' ms')
+                if ptUpLinkToOfp6 > downThresholdMin and\
+                   ptUpLinkToOfp6 < downThresholdMax and i > iterIgnore:
+                    portUpLinkNodeIter[5][i] = ptUpLinkToOfp6
+                    main.log.info('ONOS6 iter' + str(i) +
+                            ' port up link-to-ofp: ' +
+                            str(ptUpLinkToOfp6) + ' ms')
                 if ptUpGraphToOfp7 > upThresholdMin and \
                    ptUpGraphToOfp7 < upThresholdMax and i > iterIgnore:
                     portUpGraphNodeIter[6][i] = ptUpGraphToOfp7
-                    main.log.info('iter' + str(i) +
+                    main.log.info('ONOS7 iter' + str(i) +
                             ' port up graph-to-ofp: ' + 
                             str(ptUpGraphToOfp7) + ' ms')
                 if ptUpDeviceToOfp7 > upThresholdMin and\
                    ptUpDeviceToOfp7 < upThresholdMax and i > iterIgnore:
                     portUpDevNodeIter[6][i] = ptUpDeviceToOfp7
-                    main.log.info('iter' + str(i) +
+                    main.log.info('ONOS7 iter' + str(i) +
                             ' port up device-to-ofp: ' +
                             str(ptUpDeviceToOfp7) + ' ms')
+                if ptUpLinkToOfp7 > downThresholdMin and\
+                   ptUpLinkToOfp7 < downThresholdMax and i > iterIgnore:
+                    portUpLinkNodeIter[6][i] = ptUpLinkToOfp7
+                    main.log.info('ONOS7 iter' + str(i) +
+                            ' port up link-to-ofp: ' +
+                            str(ptUpLinkToOfp7) + ' ms')
 
         dbCmdList = []
         for node in range(0, clusterCount):
             portUpDevList = []
             portUpGraphList = []
+            portUpLinkList = []
             portDownDevList = []
             portDownGraphList = []
+            portDownLinkList = []
+
             portUpDevAvg = 0
             portUpGraphAvg = 0
+            portUpLinkAvg = 0
             portDownDevAvg = 0
             portDownGraphAvg = 0
+            portDownLinkAvg = 0
+
             for item in portUpDevNodeIter[node]:
                 if item > 0.0:
                     portUpDevList.append(item)
@@ -1073,6 +1328,10 @@
                 if item > 0.0:
                     portUpGraphList.append(item)
 
+            for item in portUpLinkNodeIter[node]:
+                if item > 0.0:
+                    portUpLinkList.append(item)
+
             for item in portDownDevNodeIter[node]:
                 if item > 0.0:
                     portDownDevList.append(item)
@@ -1081,21 +1340,36 @@
                 if item > 0.0:
                     portDownGraphList.append(item)
 
+            for item in portDownLinkNodeIter[node]:
+                if item > 0.0:
+                    portDownLinkList.append(item)
+
             portUpDevAvg = round(numpy.mean(portUpDevList), 2)
             portUpGraphAvg = round(numpy.mean(portUpGraphList), 2)
+            portUpLinkAvg = round(numpy.mean(portUpLinkList), 2)
+
             portDownDevAvg = round(numpy.mean(portDownDevList), 2)
             portDownGraphAvg = round(numpy.mean(portDownGraphList), 2)
+            portDownLinkAvg = round(numpy.mean(portDownLinkList), 2)
+            
             portUpStdDev = round(numpy.std(portUpGraphList), 2)
             portDownStdDev = round(numpy.std(portDownGraphList), 2)
+           
             main.log.report(' - Node ' + str(node + 1) + ' Summary - ')
             main.log.report(' Port up ofp-to-device ' +
-                    str(round(portUpDevAvg, 2)) + ' ms')
+                    str(portUpDevAvg) + ' ms')
             main.log.report(' Port up ofp-to-graph ' +
                     str(portUpGraphAvg) + ' ms')
+            main.log.report(' Port up ofp-to-link ' +
+                    str(portUpLinkAvg) + ' ms')
+            
             main.log.report(' Port down ofp-to-device ' +
                     str(round(portDownDevAvg, 2)) + ' ms')
             main.log.report(' Port down ofp-to-graph ' +
                     str(portDownGraphAvg) + ' ms')
+            main.log.report(' Port down ofp-to-link ' +
+                    str(portDownLinkAvg) + ' ms')
+
             dbCmdList.append("INSERT INTO port_latency_tests VALUES('" + 
                     timeToPost + "','port_latency_results'," + runNum +
                     ',' + str(clusterCount) + ",'baremetal" + str(node + 1) +
diff --git a/TestON/tests/flowTP1g/flowTP1g.params b/TestON/tests/flowTP1g/flowTP1g.params
index 93b3923..5771a62 100644
--- a/TestON/tests/flowTP1g/flowTP1g.params
+++ b/TestON/tests/flowTP1g/flowTP1g.params
@@ -17,8 +17,8 @@
         <skipCleanInstall>yes</skipCleanInstall> 
         <warmUp>4</warmUp>                               #number of runs to warm up the system
         <sampleSize>20</sampleSize>                      #number of runs to take data from
-        <neighbors>6</neighbors>                    #list of number of neighbors
-        <servers>7</servers>                      #list of servers
+        <neighbors>4,2,0</neighbors>                    #list of number of neighbors
+        <servers>7,5,3,1</servers>                      #list of servers
         <flows>122500</flows>
         <switches>35</switches>
 
diff --git a/TestON/tests/flowTP1g/flowTP1g.py b/TestON/tests/flowTP1g/flowTP1g.py
index b8450fd..8261a47 100644
--- a/TestON/tests/flowTP1g/flowTP1g.py
+++ b/TestON/tests/flowTP1g/flowTP1g.py
@@ -182,7 +182,7 @@
             serviceConfig.write("# Starts ONOS Apache Karaf container\n ")
             serviceConfig.write("#------------------------------------- \n ")
             serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ")
-            serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms256m -Xmx8G}" \n """)
+            serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G}" \n """)
             serviceConfig.write("")
             serviceConfig.write("ONOS_HOME=/opt/onos \n ")
             serviceConfig.write("")
diff --git a/TestON/tests/pushTestIntents/pushTestIntents.params b/TestON/tests/pushTestIntents/pushTestIntents.params
index c6b79d5..067ff8e 100644
--- a/TestON/tests/pushTestIntents/pushTestIntents.params
+++ b/TestON/tests/pushTestIntents/pushTestIntents.params
@@ -1,6 +1,6 @@
 <PARAMS>
 
-    <testcases>1,2,3,2,3,2,3</testcases>
+    <testcases>1,3,2,3,2,3,2,3</testcases>
 
     <SCALE>2</SCALE>
     <availableNodes>7</availableNodes>
@@ -16,8 +16,8 @@
         <warmUp>4</warmUp>
         <sampleSize>10</sampleSize>                     
         <wait></wait>
-        <intents>1,1000</intents>                       #list format, will be split on ','
-        <debug></debug>                          #empty for false/no
+        <intents>1000</intents>                       #list format, will be split on ','
+        <debug>False</debug>                                        #"True" for true
     </TEST>
 
     <GIT>
@@ -28,36 +28,36 @@
     <CTRL>
         <USER>admin</USER>
         
-        <ip1>10.128.5.51</ip1>
+        <ip1>10.254.1.201</ip1>
         <port1>6633</port1>
         
-        <ip2>10.128.5.52</ip2>
+        <ip2>10.254.1.202</ip2>
         <port2>6633</port2>
         
-        <ip3>10.128.5.53</ip3>
+        <ip3>10.254.1.203</ip3>
         <port3>6633</port3>
         
-        <ip4>10.128.5.54</ip4>
+        <ip4>10.254.1.204</ip4>
         <port4>6633</port4>
         
-        <ip5>10.128.5.65</ip5>
+        <ip5>10.254.1.205</ip5>
         <port5>6633</port5>
         
-        <ip6>10.128.5.66</ip6>
+        <ip6>10.254.1.206</ip6>
         <port6>6633</port6> 
        
-        <ip7>10.128.5.67</ip7>
+        <ip7>10.254.1.207</ip7>
         <port7>6633</port7>
 
     </CTRL>
 
     <MN>
-        <ip1>10.128.5.59</ip1>
+        <ip1>10.254.1.200</ip1>
     </MN>
 
     <BENCH>
         <user>admin</user>
-        <ip1>10.128.5.55</ip1>
+        <ip1>10.254.1.200</ip1>
     </BENCH>
 
     <JSON>
diff --git a/TestON/tests/pushTestIntents/pushTestIntents.py b/TestON/tests/pushTestIntents/pushTestIntents.py
index d5623cf..1594345 100644
--- a/TestON/tests/pushTestIntents/pushTestIntents.py
+++ b/TestON/tests/pushTestIntents/pushTestIntents.py
@@ -175,16 +175,21 @@
         debug = main.params[ 'TEST' ][ 'switchCount' ]
         for i in range(0,len(intentsList)):
             intentsList[i] = int(intentsList[i]) 
-         
+  
+        if debug == "True": 
+            debug = True
+        else: 
+            debug = False
    
         linkCount = 0
-        while True:
+        for i in range(0,10):
             main.ONOSbench.handle.sendline("onos $OC1 links|wc -l")
             main.ONOSbench.handle.expect(":~")
             linkCount = main.ONOSbench.handle.before    
             if debug: main.log.info("Link Count check: " + linkCount)   
             if str((switchCount*2)-2) in linkCount: 
                 break 
+            time.sleep(2)
     
         links = "--" 
         while "=null:" not in links:
@@ -225,6 +230,8 @@
             withdrawn = []
 
             for run in range(0, (warmUp + sampleSize)):
+                if run > warmUp: 
+                    time.sleep(5)
         
                 myRawResult = "--"
                 while "ms" not in myRawResult:
@@ -233,22 +240,32 @@
                     myRawResult = main.ONOSbench.handle.before
                     if debug: main.log.info(myRawResult)
 
-                main.log.info(myRawResult)  
+                if debug: main.log.info(myRawResult)  
 
                 if run >= warmUp: 
                     myRawResult = myRawResult.splitlines()
                     for line in myRawResult:
                         if "install" in line:
-                            installed.append(line.split(" ")[5])  
-                        if "withdrawn" in line: 
-                            withdrawn.append(line.split(" ")[5])
-                    print(installed)
-                    print(withdrawn)
-            
-            main.log.info("Scale: " + str(clusterCount) + "\tIntent batch size: " + str(intentSize)) 
-            
+                            installed.append(int(line.split(" ")[5]))  
+                    
+                    for line in myRawResult:
+                        if "withdraw" in line: 
+                            withdrawn.append(int(line.split(" ")[5]))
+
+                    print("installed: " + str(installed))
+                    print("withraw: " + str(withdrawn) + "\n")
+    
+            main.log.report("----------------------------------------------------")
+            main.log.report("Scale: " + str(clusterCount) + "\tIntent batch size: " + str(intentSize)) 
+            main.log.report("Installed average: " + str(numpy.mean(installed)))
+            main.log.report("Installed standard deviation: " + str(numpy.std(installed)))
+            main.log.report("Withdraw average: " + str(numpy.mean(withdrawn)))
+            main.log.report("Withdraw standard deviation: " + str(numpy.std(withdrawn)))
+            main.log.report("     ")
+
+        
                 
-                time.sleep(5)
+            
 
 
 
diff --git a/TestON/tests/pushTestIntents/pushTestIntents.topo b/TestON/tests/pushTestIntents/pushTestIntents.topo
index 30a1467..0e45e0f 100644
--- a/TestON/tests/pushTestIntents/pushTestIntents.topo
+++ b/TestON/tests/pushTestIntents/pushTestIntents.topo
@@ -3,7 +3,7 @@
     <COMPONENT>
 
         <ONOSbench>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosDriver</type>
@@ -12,7 +12,7 @@
         </ONOSbench>
 
         <ONOS1cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -21,7 +21,7 @@
         </ONOS1cli>
 
         <ONOS2cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -30,7 +30,7 @@
         </ONOS2cli>
 
         <ONOS3cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -39,7 +39,7 @@
         </ONOS3cli>
 
         <ONOS4cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -48,7 +48,7 @@
         </ONOS4cli>
 
         <ONOS5cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -57,7 +57,7 @@
         </ONOS5cli>
 
         <ONOS6cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -66,7 +66,7 @@
         </ONOS6cli>
 
         <ONOS7cli>
-            <host>10.128.5.55</host>
+            <host>10.254.1.200</host>
             <user>admin</user>
             <password>onos_test</password>
             <type>OnosCliDriver</type>
@@ -75,7 +75,7 @@
         </ONOS7cli>
 
         <ONOS1>
-            <host>10.128.5.51</host>
+            <host>10.254.1.201</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -84,7 +84,7 @@
         </ONOS1>
 
         <ONOS2>
-            <host>10.128.5.52</host>
+            <host>10.254.1.202</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -93,7 +93,7 @@
         </ONOS2>
 
         <ONOS3>
-            <host>10.128.5.53</host>
+            <host>10.254.1.203</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -102,7 +102,7 @@
         </ONOS3>
 
         <ONOS4>
-            <host>10.128.5.54</host>
+            <host>10.254.1.204</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -112,7 +112,7 @@
 
     
         <ONOS5>
-            <host>10.128.5.65</host>
+            <host>10.254.1.205</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -121,7 +121,7 @@
         </ONOS5>
 
         <ONOS6>
-            <host>10.128.5.66</host>
+            <host>10.254.1.206</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>
@@ -130,7 +130,7 @@
         </ONOS6>
 
         <ONOS7>
-            <host>10.128.5.67</host>
+            <host>10.254.1.207</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosDriver</type>