Merge "ONOS-2483 Added checkMasters and checkBalanceMasters functions"
diff --git a/TestON/bin/cleanup.sh b/TestON/bin/cleanup.sh
index d921147..2d78b1e 100755
--- a/TestON/bin/cleanup.sh
+++ b/TestON/bin/cleanup.sh
@@ -1,5 +1,6 @@
 #!/bin/bash 
 # This script will kill any TestON, ssh, and Mininet sessions that are running.
 sudo kill -9 `ps -ef | grep "./cli.py" | grep -v grep | awk '{print $2}'`
+sudo kill -9 `ps -ef | grep "bin/teston" | grep -v grep | awk '{print $2}'`
 sudo kill -9 `ps -ef | grep "ssh -X" | grep -v grep | awk '{print $2}'`
 sudo mn -c
diff --git a/TestON/bin/updatedriver.py b/TestON/bin/updatedriver.py
index bd6974d..ca5c0f2 100644
--- a/TestON/bin/updatedriver.py
+++ b/TestON/bin/updatedriver.py
@@ -349,8 +349,9 @@
         try :
             self.driverPath = self.configDict['config-driver']['importTypes'][self.driver]['driver-path']
 
-        except KeyError :
-            path = re.sub("(bin)$", "", os.getcwd())
+        except KeyError:
+            location = os.path.abspath( os.path.dirname( __file__ ) )
+            path = re.sub( "(bin)$", "", location )
             self.driverPath = path + "/lib/updatedriver/"
         return self.driverPath
 
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index e988577..af660d7 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1733,6 +1733,58 @@
             main.cleanup()
             main.exit()
 
+    def getFlowTable( self, protoVersion, sw ):
+        """
+        Returns certain fields of an OVS flow table. Will force output to
+        either OF 1.0 or 1.3 format for consistency.
+
+        TODO add option to look at cookies. ignoring them for now
+
+         NOTE: Use format to force consistent flow table output across
+         versions
+        """
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
+            command = "sh ovs-ofctl dump-flows " + sw
+            if protoVersion == 1.0:
+                command += " -F OpenFlow10-table_id | awk '{OFS=\",\" ;" +\
+                           " print $1  $3  $6  $7  $8}' | "
+            elif protoVersion == 1.3:
+                command += " -O OpenFlow13 | awk '{OFS=\",\" ;" +\
+                           " print $1  $3  $6  $7}' | "
+            else:
+                main.log.error(
+                    "Unknown protoVersion in getFlowTable(). given: (" +
+                    str( type( protoVersion ) ) +
+                    ") '" + str( protoVersion ) + "'" )
+                return None
+            command += "cut -d ',' -f 2- | sort -n -k1 -r"
+            self.handle.sendline( command )
+            self.handle.expect( "sort" )
+            self.handle.expect( "OFPST_FLOW" )
+            response = self.handle.before
+            return response
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": Timeout exception: " )
+            return None
+
+    def flowComp( self, flow1, flow2 ):
+        if flow1 == flow2:
+            return main.TRUE
+        else:
+            main.log.info( "Flow tables do not match, printing tables:" )
+            main.log.info( "Flow Table 1:" )
+            main.log.info( flow1 )
+            main.log.info( "Flow Table 2:" )
+            main.log.info( flow2 )
+            return main.FALSE
+
     def startTcpdump( self, filename, intf="eth0", port="port 6633" ):
         """
            Runs tpdump on an interface and saves the file
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index f11c172..6b7197f 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -112,31 +112,6 @@
             main.log.warn( outputs )
             return main.TRUE
 
-    def arping( self, host="", ip="10.128.20.211" ):
-        """
-        Description:
-            Sends arp message from mininet host for hosts discovery
-        Required:
-            host - hosts name
-        Optional:
-            ip - ip address that does not exist in the network so there would
-                 be no reply.
-        """
-        cmd = " py " + host  + ".cmd(\"arping -c 1 " + ip + "\")"
-        try:
-            main.log.warn( "Sending: " + cmd )
-            self.handle.sendline( cmd )
-            response = self.handle.before
-            self.handle.sendline( "" )
-            self.handle.expect( "mininet>" )
-            return main.TRUE
-
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":     " + self.handle.before )
-            main.cleanup()
-            main.exit()
-
     def pingLong( self, **pingParams ):
         """
         Starts a continuous ping on the mininet host outputting
@@ -480,63 +455,6 @@
             main.log.error( "Connection failed to the host" )
         return main.TRUE
 
-    def getFlowTable( self, protoVersion, sw ):
-        """
-         TODO document usage
-         TODO add option to look at cookies. ignoring them for now
-
-         print "get_flowTable(" + str( protoVersion ) +" " + str( sw ) +")"
-         NOTE: Use format to force consistent flow table output across
-         versions
-        """
-        try:
-            self.handle.sendline( "cd" )
-            self.handle.expect( "\$" )
-            if protoVersion == 1.0:
-                command = "sudo ovs-ofctl dump-flows " + sw + \
-                    " -F OpenFlow10-table_id | awk '{OFS=\",\" ; print $1  $3  $6 \
-                    $7  $8}' | cut -d ',' -f 2- | sort -n -k1 -r"
-                self.handle.sendline( command )
-                self.handle.expect( "sort" )
-                self.handle.expect( "OFPST_FLOW" )
-                response = self.handle.before
-                # print "response=", response
-                return response
-            elif protoVersion == 1.3:
-                command = "sudo ovs-ofctl dump-flows " + sw + \
-                    " -O OpenFlow13  | awk '{OFS=\",\" ; print $1  $3  $6  $7}'\
-                    | cut -d ',' -f 2- | sort -n -k1 -r"
-                self.handle.sendline( command )
-                self.handle.expect( "sort" )
-                self.handle.expect( "OFPST_FLOW" )
-                response = self.handle.before
-                # print "response=", response
-                return response
-            else:
-                main.log.error(
-                    "Unknown  protoVersion in get_flowTable(). given: (" +
-                    str( type( protoVersion ) ) +
-                    ") '" + str( protoVersion ) + "'" )
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":     " + self.handle.before )
-            main.cleanup()
-            main.exit()
-        except pexpect.TIMEOUT:
-            main.log.exception( self.name + ": Timeout exception: " )
-            return None
-
-    def flowComp( self, flow1, flow2 ):
-        if flow1 == flow2:
-            return main.TRUE
-        else:
-            main.log.info( "Flow tables do not match, printing tables:" )
-            main.log.info( "Flow Table 1:" )
-            main.log.info( flow1 )
-            main.log.info( "Flow Table 2:" )
-            main.log.info( flow2 )
-            return main.FALSE
-
     def setIpTablesOUTPUT( self, dstIp, dstPort, action='add',
                            packetType='tcp', rule='DROP' ):
         """
diff --git a/TestON/install.sh b/TestON/install.sh
new file mode 100755
index 0000000..3c62a5d
--- /dev/null
+++ b/TestON/install.sh
@@ -0,0 +1,95 @@
+#!/usr/bin/env bash
+
+# TestON install script for Ubuntu (Debian and Fedora)
+
+# Fail on error
+set -e
+
+# Fail on unset var usage
+set -o nounset
+
+# Identify Linux release
+DIST=Unknown
+RELEASE=Unknown
+CODENAME=Unknown
+
+ARCH=`uname -m`
+if [ "$ARCH" = "x86_64" ]; then ARCH="amd64"; fi
+if [ "$ARCH" = "i686" ]; then ARCH="i386"; fi
+
+if [ -e /etc/debian_version ]; then DIST="Debian"; fi
+if [ -e /etc/fedora-release ]; then DIST="Debian"; fi
+grep Ubuntu /etc/lsb-release &> /dev/null && DIST="Ubuntu"
+
+if [ "$DIST" = "Ubuntu" ] || [ "$DIST" = "Debian" ]; then
+    install='sudo apt-get -y install'
+    remove='sudo apt-get -y remove'
+    pipinstall='sudo pip install'
+    # Prereqs for this script
+    if ! which lsb_release &> /dev/null; then
+        $install lsb-release
+    fi
+fi
+
+if [ "$DIST" = "Fedora" ]; then
+    install='sudo yum -y install'
+    remove='sudo yum -y erase'
+    pipinstall='sudo pip install'
+    # Prereqs for this script
+    if ! which lsb_release &> /dev/null; then
+        $install redhat-lsb-core
+    fi
+fi
+if which lsb_release &> /dev/null; then
+    DIST=`lsb_release -is`
+    RELEASE=`lsb_release -rs`
+    CODENAME=`lsb_release -cs`
+fi
+echo "Detected Linux distribution: $DIST $RELEASE $CODENAME $ARCH"
+
+if ! echo $DIST | egrep 'Ubuntu|Debian|Fedora'; then
+    echo "Install.sh currently only supports Ubuntu, Debian and Fedora."
+    exit 1
+fi
+
+# Check OnosSystemTest is cloned in home directory.
+if [ ! -d ~/OnosSystemTest ]; then
+    echo "Could not find OnosSystemTest in your home directory."
+    echo "Exiting from running install script."
+    exit 1
+fi
+
+# Install TestON dependencies
+echo "Installing TestON dependencies"
+if [ "$DIST" = "Fedora" ]; then
+    $install python-pip build-essential python-dev pep8
+    $pipinstall pexpect==3.2 configobj==4.7.2 numpy
+else
+    $install python-pip build-essential python-dev pep8
+    $pipinstall pexpect==3.2 configobj==4.7.2 numpy
+fi
+
+# Add check here to make sure OnosSystemTest is cloned into home directory (place holder)
+
+# Add symbolic link to main TestON folder in Home dir
+pushd ~
+sudo ln -s ~/OnosSystemTest/TestON TestON
+echo "Added symbolic link to TestON folder in HOME directory."
+popd
+
+# OnosSystemTest git pre-commit hooks
+pushd ~/OnosSystemTest
+cp .git/hooks/pre-commit.sample .git/hooks/pre-commit
+popd
+
+# Add symbolic link to TestON cli in /usr/local/bin
+pushd /usr/local/bin
+sudo ln -s $HOME/OnosSystemTest/TestON/bin/cli.py teston
+echo "Added symbolic link to TestON CLI in /usr/local/bin."
+popd
+
+# Add log rotation configuration for TestON logs here (place holder)
+
+echo "Completed running install.sh script"
+echo "Run TestON CLI by typing teston at bash prompt"
+echo "Example: teston run <TestSuite Name>"
diff --git a/TestON/tests/FUNCintent/FUNCintent.params b/TestON/tests/FUNCintent/FUNCintent.params
index 81e5bb2..d1cd94c 100644
--- a/TestON/tests/FUNCintent/FUNCintent.params
+++ b/TestON/tests/FUNCintent/FUNCintent.params
@@ -51,8 +51,8 @@
     <SDNIP>
         <tcpProto>6</tcpProto>
         <icmpProto>1</icmpProto>
-        <srcPort>5001</srcPort>
-        <dstPort>5001</dstPort>
+        <srcPort>179</srcPort>
+        <dstPort>179</dstPort>
     </SDNIP>
 
 </PARAMS>
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index 49c2969..832311e 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -1,9 +1,5 @@
-
 # Testing the basic intent functionality of ONOS
 
-import time
-import json
-
 class FUNCintent:
 
     def __init__( self ):
@@ -13,6 +9,7 @@
         import time
         import os
         import imp
+        import re
 
         """
         - Construct tests variables
@@ -33,7 +30,7 @@
 
         # Test variables
         try:
-            main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+            main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
             main.apps = main.params[ 'ENV' ][ 'cellApps' ]
             gitBranch = main.params[ 'GIT' ][ 'branch' ]
             main.dependencyPath = main.testOnDirectory + \
@@ -282,6 +279,7 @@
                                      " Switches view is correct",
                                      onfail="ONOS" + controllerStr +
                                      " Switches view is incorrect" )
+            devicesResults = devicesResults and currentDevicesResult
 
             if links[ controller ] and "Error" not in links[ controller ]:
                 currentLinksResult = main.Mininet1.compareLinks(
@@ -295,6 +293,7 @@
                                      " links view is correct",
                                      onfail="ONOS" + controllerStr +
                                      " links view is incorrect" )
+            linksResults = linksResults and currentLinksResult
 
             if hosts[ controller ] or "Error" not in hosts[ controller ]:
                 currentHostsResult = main.Mininet1.compareHosts(
@@ -308,6 +307,12 @@
                                      " hosts exist in Mininet",
                                      onfail="ONOS" + controllerStr +
                                      " hosts don't match Mininet" )
+            hostsResults = hostsResults and currentHostsResult
+        topoResults = hostsResults and linksResults and devicesResults
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=topoResults,
+                                 onpass="ONOS correctly discovered the topology",
+                                 onfail="ONOS incorrectly discovered the topology" )
 
     def CASE9( self, main ):
         '''
@@ -732,7 +737,7 @@
                                         "failed using IPV4 type with " +
                                         "no MAC addresses" )
 
-        main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
+        main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
         stepResult = main.TRUE
         mac1 = main.hostsData[ 'h1' ][ 'mac' ]
         mac2 = main.hostsData[ 'h9' ][ 'mac' ]
@@ -752,7 +757,7 @@
 
         stepResult = main.intentFunction.pointIntent(
                                            main,
-                                           name="SDNIP-TCP",
+                                           name="SDNIP-ICMP",
                                            host1="h1",
                                            host2="h9",
                                            deviceId1="of:0000000000000005/1",
@@ -766,14 +771,14 @@
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
-                                 onpass="SDNIP-TCP: Point intent test " +
+                                 onpass="SDNIP-ICMP: Point intent test " +
                                         "successful using IPV4 type with " +
                                         "IP protocol TCP enabled",
-                                 onfail="SDNIP-TCP: Point intent test " +
+                                 onfail="SDNIP-ICMP: Point intent test " +
                                         "failed using IPV4 type with " +
                                         "IP protocol TCP enabled" )
 
-        main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
+        main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
         stepResult = main.TRUE
         mac1 = main.hostsData[ 'h1' ][ 'mac' ]
         mac2 = main.hostsData[ 'h9' ][ 'mac' ]
@@ -785,7 +790,7 @@
 
         stepResult = main.intentFunction.pointIntent(
                                            main,
-                                           name="SDNIP-ICMP",
+                                           name="SDNIP-TCP",
                                            host1="h1",
                                            host2="h9",
                                            deviceId1="of:0000000000000005/1",
@@ -793,14 +798,18 @@
                                            mac1=mac1,
                                            mac2=mac2,
                                            ethType="IPV4",
-                                           ipProto=ipProto )
+                                           ipProto=ipProto,
+                                           ip1=ip1,
+                                           ip2=ip2,
+                                           tcp1=tcp1,
+                                           tcp2=tcp2 )
 
         utilities.assert_equals( expect=main.TRUE,
                              actual=stepResult,
-                                 onpass="SDNIP-ICMP: Point intent test " +
+                                 onpass="SDNIP-TCP: Point intent test " +
                                         "successful using IPV4 type with " +
                                         "IP protocol ICMP enabled",
-                                 onfail="SDNIP-ICMP: Point intent test " +
+                                 onfail="SDNIP-TCP: Point intent test " +
                                         "failed using IPV4 type with " +
                                         "IP protocol ICMP enabled" )
 
diff --git a/TestON/tests/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HAclusterRestart/HAclusterRestart.py
index 8205ac9..85c5a3a 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.py
@@ -1407,7 +1407,7 @@
         global flows
         flows = []
         for i in range( 1, 29 ):
-            flows.append( main.Mininet2.getFlowTable( 1.3, "s" + str( i ) ) )
+            flows.append( main.Mininet1.getFlowTable( 1.3, "s" + str( i ) ) )
         if flowCheck == main.FALSE:
             for table in flows:
                 main.log.warn( table )
@@ -2052,9 +2052,9 @@
         flows2 = []
         for i in range( 28 ):
             main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet2.getFlowTable( 1.3, "s" + str( i + 1 ) )
+            tmpFlows = main.Mininet1.getFlowTable( 1.3, "s" + str( i + 1 ) )
             flows2.append( tmpFlows )
-            tempResult = main.Mininet2.flowComp(
+            tempResult = main.Mininet1.flowComp(
                 flow1=flows[ i ],
                 flow2=tmpFlows )
             FlowTables = FlowTables and tempResult
diff --git a/TestON/tests/HAminorityRestart/HAminorityRestart.py b/TestON/tests/HAminorityRestart/HAminorityRestart.py
index 94482ea..1103309 100644
--- a/TestON/tests/HAminorityRestart/HAminorityRestart.py
+++ b/TestON/tests/HAminorityRestart/HAminorityRestart.py
@@ -1380,7 +1380,7 @@
         global flows
         flows = []
         for i in range( 1, 29 ):
-            flows.append( main.Mininet2.getFlowTable( 1.3, "s" + str( i ) ) )
+            flows.append( main.Mininet1.getFlowTable( 1.3, "s" + str( i ) ) )
         if flowCheck == main.FALSE:
             for table in flows:
                 main.log.warn( table )
@@ -1995,9 +1995,9 @@
         flows2 = []
         for i in range( 28 ):
             main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet2.getFlowTable( 1.3, "s" + str( i + 1 ) )
+            tmpFlows = main.Mininet1.getFlowTable( 1.3, "s" + str( i + 1 ) )
             flows2.append( tmpFlows )
-            tempResult = main.Mininet2.flowComp(
+            tempResult = main.Mininet1.flowComp(
                 flow1=flows[ i ],
                 flow2=tmpFlows )
             FlowTables = FlowTables and tempResult
diff --git a/TestON/tests/HAsanity/HAsanity.py b/TestON/tests/HAsanity/HAsanity.py
index b52943c..9cbb10a 100644
--- a/TestON/tests/HAsanity/HAsanity.py
+++ b/TestON/tests/HAsanity/HAsanity.py
@@ -1391,7 +1391,7 @@
         global flows
         flows = []
         for i in range( 1, 29 ):
-            flows.append( main.Mininet2.getFlowTable( 1.3, "s" + str( i ) ) )
+            flows.append( main.Mininet1.getFlowTable( 1.3, "s" + str( i ) ) )
         if flowCheck == main.FALSE:
             for table in flows:
                 main.log.warn( table )
@@ -1955,9 +1955,9 @@
         flows2 = []
         for i in range( 28 ):
             main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet2.getFlowTable( 1.3, "s" + str( i + 1 ) )
+            tmpFlows = main.Mininet1.getFlowTable( 1.3, "s" + str( i + 1 ) )
             flows2.append( tmpFlows )
-            tempResult = main.Mininet2.flowComp(
+            tempResult = main.Mininet1.flowComp(
                 flow1=flows[ i ],
                 flow2=tmpFlows )
             FlowTables = FlowTables and tempResult
diff --git a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index 1fa2e33..3dbc561 100644
--- a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -1038,7 +1038,7 @@
         global flows
         flows = []
         for i in range( 1, 29 ):
-            flows.append( main.Mininet2.getFlowTable( 1.3, "s" + str( i ) ) )
+            flows.append( main.Mininet1.getFlowTable( 1.3, "s" + str( i ) ) )
         if flowCheck == main.FALSE:
             for table in flows:
                 main.log.warn( table )
@@ -1359,9 +1359,9 @@
         flows2 = []
         for i in range( 28 ):
             main.log.info( "Checking flow table on s" + str( i + 1 ) )
-            tmpFlows = main.Mininet2.getFlowTable( 1.3, "s" + str( i + 1 ) )
+            tmpFlows = main.Mininet1.getFlowTable( 1.3, "s" + str( i + 1 ) )
             flows2.append( tmpFlows )
-            tempResult = main.Mininet2.flowComp(
+            tempResult = main.Mininet1.flowComp(
                 flow1=flows[ i ],
                 flow2=tmpFlows )
             FlowTables = FlowTables and tempResult
diff --git a/TestON/tests/SAMPscaleTopo/SAMPscaleTopo.py b/TestON/tests/SAMPscaleTopo/SAMPscaleTopo.py
index 2458c71..9a77f64 100644
--- a/TestON/tests/SAMPscaleTopo/SAMPscaleTopo.py
+++ b/TestON/tests/SAMPscaleTopo/SAMPscaleTopo.py
@@ -11,6 +11,7 @@
         import time
         import os
         import imp
+        import re
 
         """
         - Construct tests variables
@@ -27,7 +28,7 @@
         stepResult = main.FALSE
 
         # Test variables
-        main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+        main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
         main.apps = main.params[ 'ENV' ][ 'cellApps' ]
         gitBranch = main.params[ 'GIT' ][ 'branch' ]
         main.dependencyPath = main.testOnDirectory + \
diff --git a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
index 96d24a9..464a0d3 100644
--- a/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
+++ b/TestON/tests/SAMPstartTemplate/SAMPstartTemplate.py
@@ -11,6 +11,7 @@
         import time
         import os
         import imp
+        import re
 
         """
         - Construct tests variables
@@ -27,7 +28,7 @@
         stepResult = main.FALSE
 
         # Test variables
-        main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+        main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
         main.cellName = main.params[ 'ENV' ][ 'cellName' ]
         main.apps = main.params[ 'ENV' ][ 'cellApps' ]
         gitBranch = main.params[ 'GIT' ][ 'branch' ]
diff --git a/TestON/tests/SCPFportLat/SCPFportLat.params b/TestON/tests/SCPFportLat/SCPFportLat.params
index 00c8c19..bc3d704 100644
--- a/TestON/tests/SCPFportLat/SCPFportLat.params
+++ b/TestON/tests/SCPFportLat/SCPFportLat.params
@@ -59,12 +59,12 @@
         </topoConfigName>
 
         #Number of times to iterate each case
-        <numIter>2</numIter>
+        <numIter>25</numIter>
         <numSwitch>2</numSwitch>
         #Number of iterations to ignore initially
-        <iterIgnore>0</iterIgnore>
+        <iterIgnore>5</iterIgnore>
 
-        <portUpThreshold>0,1000</portUpThreshold>
+        <portUpThreshold>0,5000</portUpThreshold>
         <portDownThreshold>0,1000</portDownThreshold>
 
         <tabletFile>tablets_3node.json</tabletFile>
diff --git a/TestON/tests/SCPFportLat/SCPFportLat.py b/TestON/tests/SCPFportLat/SCPFportLat.py
index 9c75cb8..b900825 100644
--- a/TestON/tests/SCPFportLat/SCPFportLat.py
+++ b/TestON/tests/SCPFportLat/SCPFportLat.py
@@ -9,7 +9,7 @@
 
     def CASE1( self, main ):
         import sys
-        import os.path
+        import re
         import os
         import time
 
@@ -32,9 +32,9 @@
         homeDir = os.path.expanduser('~')
         topoCfgFile = main.params['TEST']['topoConfigFile']
         topoCfgName = main.params['TEST']['topoConfigName']
-        portEventResultPath = main.params['DB']['portEventResultPath']
+        resultPath = main.params['DB']['portEventResultPath']
         skipMvn = main.params ['TEST']['mci']
-        testONpath = os.getcwd() #testON/bin
+        testONpath = re.sub( "(tests)$", "bin", main.testDir )  # TestON/bin
 
         # -- INIT SECTION, ONLY RUNS ONCE -- #
         if init == False:
@@ -90,7 +90,7 @@
             commit = (commit.split(" "))[1]
 
             main.step("Creating results file")
-            resultsDB = open("IntentEventTPDB", "w+")
+            resultsDB = open(resultPath, "w+")
             resultsDB.close()
 
             main.log.report('Commit information - ')
@@ -137,10 +137,6 @@
         main.step('Starting mininet topology ')
         main.Mininet1.startNet()
 
-        main.step('Clearing previous DB log file')
-        fPortLog = open(portEventResultPath, 'w+')
-        fPortLog.close()
-
         main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
         for node in range(clusterCount):
             main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
@@ -352,6 +348,8 @@
             main.Mininet1.handle.sendline('sh ifconfig ' + interfaceConfig + ' up')
             main.Mininet1.handle.expect('mininet>')
 
+            time.sleep(5)
+
             jsonStrPtUp = []
             for node in range (0, clusterCount):
                 metricsPortUp = CLIs[node].topologyEventsMetrics()
@@ -391,7 +389,7 @@
                     linkTimestamp = 0
 
 
-                main.log.info('ptDownTimestamp: ' + str(timestampBeginPtDown))
+                main.log.info('ptUpTimestamp: ' + str(timestampBeginPtUp))
                 main.log.info("graphTimestamp: " + str(graphTimestamp))
                 main.log.info("deviceTimestamp: " + str(deviceTimestamp))
                 main.log.info("linkTimestamp: " + str(linkTimestamp))
diff --git a/TestON/tests/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPFswitchLat/SCPFswitchLat.py
index 78ae16c..c0c4ba4 100644
--- a/TestON/tests/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPFswitchLat/SCPFswitchLat.py
@@ -9,7 +9,7 @@
 
     def CASE1( self, main ):
         import sys
-        import os.path
+        import re
         import os
         import time
 
@@ -34,7 +34,7 @@
         topoCfgName = main.params['TEST']['topoConfigName']
         switchEventResultPath = main.params['DB']['switchEventResultPath']
         skipMvn = main.params ['TEST']['mci']
-        testONpath = os.getcwd() #testON/bin
+        testONpath = re.sub( "(tests)$", "bin", main.testDir )  # TestON/bin
         user = main.params[ 'CTRL' ][ 'user' ]
 
         # -- INIT SECTION, ONLY RUNS ONCE -- #