Workaround to avoid port_stats_update DeviceEvent probes
diff --git a/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py
index 276de24..d4dc087 100644
--- a/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py
+++ b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py
@@ -192,8 +192,8 @@
         resultPath = main.params['DB']['switchEventResultPath']
         thresholdStr = main.params['TEST']['singleSwThreshold']
         thresholdObj = thresholdStr.split(',')
-        thresholdMin = float(thresholdObj[0])
-        thresholdMax = float(thresholdObj[1])
+        thresholdMin = int(thresholdObj[0])
+        thresholdMax = int(thresholdObj[1])
        
         # Look for 'role-request' messages,
         # which replaces the 'vendor' messages previously seen
@@ -266,8 +266,13 @@
             main.log.info('Assigning s3 to controller')
             main.Mininet1.assignSwController(sw='3',
                     ip1=nodeIpList[0], port1=defaultSwPort)
-            
-            time.sleep(10)
+               
+            jsonStr = []
+            for node in range (0, clusterCount): 
+                metricsSwUp = CLIs[node].topologyEventsMetrics()
+                jsonStr.append(metricsSwUp)
+           
+            time.sleep(1)
             
             main.log.info('Stopping all Tshark processes')
             main.ONOS1.tsharkStop()
@@ -283,7 +288,7 @@
                       nodeIpList[0] + ':' + tsharkOfOutput + ' /tmp/')
            
             # Get tcp syn / ack output
-            time.sleep(5)
+            # time.sleep(1)
             tcpFile = open(tsharkTcpOutput, 'r')
             tempText = tcpFile.readline()
             tempText = tempText.split(' ')
@@ -300,7 +305,6 @@
             tcpFile.close()
            
             # Get Role reply output
-            time.sleep(5)
             ofFile = open(tsharkOfOutput, 'r')
             lineOfp = ''
             while True:
@@ -351,16 +355,11 @@
                 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
-                metricsSwUp = CLIs[node].topologyEventsMetrics
-                jsonStr = metricsSwUp()
-                jsonObj = json.loads(jsonStr)
+                #metricsSwUp = CLIs[node].topologyEventsMetrics
+                #jsonStr = metricsSwUp()
+                jsonObj = json.loads(jsonStr[node])
                 if jsonObj:
                     graphTimestamp = jsonObj[graphTimestampKey]['value']
                     deviceTimestamp = jsonObj[deviceTimestampKey]['value']
@@ -398,8 +397,9 @@
                 else:
                     main.log.info("ONOS "+str(nodeNum)+ " end-to-end "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
-
+                            "threshold or premature iteration: ")
+                    main.log.info(str(endToEnd))
+                        
                 if tcpToFeature >= thresholdMin and\
                    tcpToFeature < thresholdMax and i >= iterIgnore:
                     tcpToFeatureLatNodeIter[node][i] = tcpToFeature 
@@ -408,7 +408,8 @@
                 else:
                     main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
+                            "threshold or premature iteration: ")
+                    main.log.info(str(tcpToFeature))
 
                 if featureToRole >= thresholdMin and\
                    featureToRole < thresholdMax and i >= iterIgnore:
@@ -418,7 +419,8 @@
                 else:
                     main.log.info("ONOS "+str(nodeNum)+ " feature-to-role "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
+                            "threshold or premature iteration: ")
+                    main.log.info(str(featureToRole))
 
                 if roleToOfp >= thresholdMin and\
                    roleToOfp < thresholdMax and i >= iterIgnore:
@@ -428,7 +430,8 @@
                 else:
                     main.log.info("ONOS "+str(nodeNum)+ " role-to-reply "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
+                            "threshold or premature iteration: ")
+                    main.log.info(str(roleToOfp))
                 
                 if ofpToDevice >= thresholdMin and\
                    ofpToDevice < thresholdMax and i >= iterIgnore:
@@ -438,7 +441,8 @@
                 else:
                     main.log.info("ONOS "+str(nodeNum)+ " reply-to-device "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
+                            "threshold or premature iteration: ")
+                    main.log.info(str(ofpToDevice))
 
                 if deviceToGraph >= thresholdMin and\
                    deviceToGraph < thresholdMax and i >= iterIgnore:
@@ -451,13 +455,14 @@
                         main.log.info("ONOS "+str(nodeNum) +
                             " device-to-graph measurement "+
                             "was set to 0 ms because of precision "+
-                            "uncertainty")
+                            "uncertainty. ")
                     else:
                         main.log.info("ONOS "+str(nodeNum)+ 
                             " device-to-graph "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
-                                
+                            "threshold or premature iteration: ")
+                        main.log.info(str(deviceToGraph))   
+                            
             # ********************
             time.sleep(5)
         
@@ -520,12 +525,23 @@
                 index = 1
                 for line in tempLine:
                     obj = line.split(' ')
-            
-                    if len(obj) > 1:
+           
+                    # There are at least 3 objects in field (valid 
+                    # tshark output is lengthy)
+                    if len(obj) > 2:
+                        # If first index of object is like an epoch time
+                        if obj[1] > 1400000000:
+                            temp = obj[1] 
+                        elif obj[2] > 1400000000:
+                            temp = obj[2]
+                        else:
+                            temp = 0
+
                         if index == 1:
-                            tFinAck = float(obj[1]) * 1000.0
+                            tFinAck = float(temp) * 1000.0
                         elif index == 3:
-                            tAck = float(obj[1]) * 1000.0
+                            tAck = float(temp) * 1000.0
+                        
                     else:
                         main.log.error('Tshark output file for OFP' +
                             ' returned unexpected results')
@@ -571,7 +587,8 @@
                     main.log.info("ONOS " + str(nodeNum) + 
                             " end-to-end disconnection "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
+                            "threshold or premature iteration: ")
+                    main.log.info(str(endToEndDisc))
 
                 if finAckTransaction >= thresholdMin and\
                    finAckTransaction < thresholdMax and i >= iterIgnore:
@@ -583,8 +600,9 @@
                     main.log.info("ONOS "+str(nodeNum)+
                             " fin/ack transaction "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
-                
+                            "threshold or premature iteration: ")
+                    main.log.info(str(finAckTransaction))
+
                 if ackToDevice >= thresholdMin and\
                    ackToDevice < thresholdMax and i >= iterIgnore:
                     ackToDeviceLatNodeIter[node][i] = ackToDevice
@@ -595,8 +613,9 @@
                     main.log.info("ONOS "+str(nodeNum)+
                             " ack-to-device "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
-                
+                            "threshold or premature iteration: ")
+                    main.log.info(str(ackToDevice))
+
                 if deviceToGraph >= thresholdMin and\
                    deviceToGraph < thresholdMax and i >= iterIgnore:
                     deviceToGraphDiscLatNodeIter[node][i] = deviceToGraph
@@ -607,7 +626,8 @@
                     main.log.info("ONOS "+str(nodeNum)+
                             " device-to-graph disconnect "+
                             "measurement ignored due to excess in "+
-                            "threshold or premature iteration")
+                            "threshold or premature iteration: ")
+                    main.log.info(str(deviceToGraph))
 
         endToEndAvg = 0
         ofpToGraphAvg = 0
@@ -648,15 +668,15 @@
                     roleToOfpList.append(item)
 
             for item in roleReplyToDeviceLatNodeIter[node]:
-                if item > 0.0:
-                    tcpToFeatureList.append(item)
-
+                if item >= 0.0:
+                    ofpToDeviceList.append(item)
+            
             for item in featureToRoleRequestLatNodeIter[node]:
                 if item > 0.0:
                     featureToRoleList.append(item)
 
             for item in deviceToGraphLatNodeIter[node]:
-                if item > 0.0:
+                if item >= 0.0:
                     deviceToGraphList.append(item)
 
             # Switch disconnect measurements
@@ -673,9 +693,9 @@
                     ackToDeviceList.append(item)
 
             for item in deviceToGraphDiscLatNodeIter[node]:
-                if item > 0.0:
+                if item >= 0.0:
                     deviceToGraphDiscList.append(item)
-            
+
             endToEndAvg = round(numpy.mean(endToEndList), 2)
             endToEndStdDev = round(numpy.std(endToEndList), 2)
 
@@ -837,10 +857,10 @@
         downThresholdStr = main.params['TEST']['portDownThreshold']
         upThresholdObj = upThresholdStr.split(',')
         downThresholdObj = downThresholdStr.split(',')
-        upThresholdMin = float(upThresholdObj[0])
-        upThresholdMax = float(upThresholdObj[1])
-        downThresholdMin = float(downThresholdObj[0])
-        downThresholdMax = float(downThresholdObj[1])
+        upThresholdMin = int(upThresholdObj[0])
+        upThresholdMax = int(upThresholdObj[1])
+        downThresholdMin = int(downThresholdObj[0])
+        downThresholdMax = int(downThresholdObj[1])
         
         interfaceConfig = 's1-eth1'
         main.log.report('Port enable / disable latency')
@@ -876,6 +896,11 @@
                     interfaceConfig + ' down')
             main.Mininet1.handle.expect('mininet>')
             
+            jsonStrPtDown = []
+            for node in range (0, clusterCount): 
+                metricsPortDown = CLIs[node].topologyEventsMetrics()
+                jsonStrPtDown.append(metricsPortDown)
+            
             time.sleep(3)
             
             main.ONOS1.tsharkStop()
@@ -906,9 +931,9 @@
           
             for node in range(0, clusterCount):
                 nodeNum = node+1
-                metricsDown = CLIs[node].topologyEventsMetrics
-                jsonStrDown = metricsDown()
-                jsonObj = json.loads(jsonStrDown)
+                # metricsDown = CLIs[node].topologyEventsMetrics
+                #jsonStrPtDown[node] = metricsDown()
+                jsonObj = json.loads(jsonStrPtDown[node])
                 
                 if jsonObj:
                     graphTimestamp = jsonObj[graphTimestampKey]['value']
@@ -979,6 +1004,11 @@
             main.Mininet1.handle.sendline('sh ifconfig ' + interfaceConfig + ' up')
             main.Mininet1.handle.expect('mininet>')
             
+            jsonStrPtUp = []
+            for node in range (0, clusterCount): 
+                metricsPortUp = CLIs[node].topologyEventsMetrics()
+                jsonStrPtUp.append(metricsPortUp)
+            
             time.sleep(5)
             main.ONOS1.tsharkStop()
             
@@ -1001,9 +1031,9 @@
             
             for node in range(0, clusterCount):
                 nodeNum = node+1
-                metricsUp = CLIs[node].topologyEventsMetrics
-                jsonStrUp = metricsUp()
-                jsonObj = json.loads(jsonStrUp)
+                #metricsUp = CLIs[node].topologyEventsMetrics
+                #jsonStrUp = metricsUp()
+                jsonObj = json.loads(jsonStrPtUp[node])
                
                 if jsonObj:
                     graphTimestamp = jsonObj[graphTimestampKey]['value']
@@ -1102,10 +1132,9 @@
                     portUpDevToLinkList.append(item)
 
             for item in portUpLinkToGraphNodeIter[node]:
-                if item > 0.0:
+                if item >= 0.0:
                     portUpLinkToGraphList.append(item)
 
-
             for item in portDownEndToEndNodeIter[node]:
                 if item > 0.0:
                     portDownEndToEndList.append(item)
@@ -1115,11 +1144,11 @@
                     portDownOfpToDevList.append(item)
 
             for item in portDownDevToLinkNodeIter[node]:
-                if item > 0.0:
+                if item >= 0.0:
                     portDownDevToLinkList.append(item)
 
             for item in portDownLinkToGraphNodeIter[node]:
-                if item > 0.0:
+                if item >= 0.0:
                     portDownLinkToGraphList.append(item)
 
             portUpEndToEndAvg = round(numpy.mean(portUpEndToEndList), 2)
@@ -1149,7 +1178,7 @@
                     str(round(portDownEndToEndAvg, 2)) + ' ms')
             main.log.report(' Port down Ofp-to-device ' +
                     str(portDownOfpToDevAvg) + ' ms')
-            main.log.report(' Port down Device-to-link' +
+            main.log.report(' Port down Device-to-link ' +
                     str(portDownDevToLinkAvg) + ' ms')
             main.log.report(' Port down Link-to-graph' +
                     str(portDownLinkToGraphAvg) + ' ms')