Merge "[Emu] Changes default OpenFlow port to 6653. Remove trailing spaces."
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 7a4605c..be42136 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -281,7 +281,7 @@
         topoDict = self.numSwitchesNlinks( *topoArgList )
         return topoDict
 
-    def pingall( self, timeout=300, shortCircuit=False, acceptableFailed=0 ):
+    def pingall( self, protocol="IPv4", timeout=300, shortCircuit=False, acceptableFailed=0 ):
         """
            Verifies the reachability of the hosts using pingall command.
            Optional parameter timeout allows you to specify how long to
@@ -306,7 +306,10 @@
                 response = ""
                 failedPings = 0
                 returnValue = main.TRUE
-                self.handle.sendline( "pingall" )
+                cmd = "pingall"
+                if protocol == "IPv6":
+                    cmd = "py net.pingAll6()"
+                self.handle.sendline( cmd )
                 startTime = time.time()
                 while True:
                     i = self.handle.expect( [ "mininet>", "X",
@@ -1235,6 +1238,29 @@
             main.exit()
         return main.TRUE
 
+    def switch( self, **switchargs ):
+        """
+           start/stop a switch
+        """
+        args = utilities.parse_args( [ "SW", "OPTION" ], **switchargs )
+        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
+        option = args[ "OPTION" ] if args[ "OPTION" ] is not None else ""
+        command = "switch " + str( sw ) + " " + str( option )
+        main.log.info( command )
+        try:
+            self.handle.sendline( command )
+            self.handle.expect( "mininet>" )
+        except pexpect.TIMEOUT:
+            main.log.error( self.name + ": pexpect.TIMEOUT found" )
+            main.cleanup()
+            main.exit()
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        return main.TRUE
+
     def yank( self, **yankargs ):
         """
            yank a mininet switch interface to a host"""
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index a361aca..2eca3da 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1787,43 +1787,38 @@
             main.cleanup()
             main.exit()
 
-    def intents( self, jsonFormat=True ):
+    def intents( self, jsonFormat = True, summary = False, **intentargs):
         """
         Optional:
             * jsonFormat: enable output formatting in json
+            * summary: whether only output the intent summary
+            * type: only output a certain type of intent
+              This options is valid only when jsonFormat is true and summary is
+              true
         Description:
-            Obtain intents currently installed
+            Obtain intents
         """
         try:
             cmdStr = "intents"
+            if summary:
+                cmdStr += " -s"
             if jsonFormat:
                 cmdStr += " -j"
             handle = self.sendline( cmdStr )
-            return handle
-        except TypeError:
-            main.log.exception( self.name + ": Object not as expected" )
-            return None
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
-        except Exception:
-            main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
-
-    def m2SIntentInstalledNumber( self ):
-        """
-        Description:
-            Obtain the number of multiple point to single point intents
-            installed
-        """
-        try:
-            cmdStr = "intents -s -j"
-            handle = self.sendline( cmdStr )
-            jsonResult = json.loads( handle )
-            return jsonResult['multiPointToSinglePoint']['installed']
+            args = utilities.parse_args( [ "TYPE" ], **intentargs )
+            if "TYPE" in args.keys():
+                type = args[ "TYPE" ]
+            else:
+                type = ""
+            if jsonFormat and summary and ( type != "" ):
+                jsonResult = json.loads( handle )
+                if type in jsonResult.keys():
+                    return jsonResult[ type ]
+                else:
+                    main.log.error( "unknown TYPE, return all types of intents" )
+                    return handle
+            else:
+                return handle
 
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
@@ -1838,6 +1833,7 @@
             main.cleanup()
             main.exit()
 
+
     def getIntentState(self, intentsId, intentsJson=None):
         """
             Check intent state.
@@ -1994,31 +1990,44 @@
             main.cleanup()
             main.exit()
 
-    def checkFlowsState( self ):
+    def checkFlowsState( self, isPENDING_ADD = True ):
         """
         Description:
             Check the if all the current flows are in ADDED state or
             PENDING_ADD state
+        Optional:
+            * isPENDING_ADD: whether the PENDING_ADD is also a correct status
         Return:
             returnValue - Returns main.TRUE only if all flows are in
-                          ADDED state or PENDING_ADD, return main.FALSE
-                          otherwise.
+                          ADDED state or PENDING_ADD if the PENDING_ADD
+                          parameter is set true, return main.FALSE otherwise.
         """
         try:
             tempFlows = json.loads( self.flows() )
             #print tempFlows[0]
             returnValue = main.TRUE
 
-            for device in tempFlows:
-                for flow in device.get( 'flows' ):
-                    if flow.get( 'state' ) != 'ADDED' and flow.get( 'state' ) != \
-                            'PENDING_ADD':
+            if isPENDING_ADD:
+                for device in tempFlows:
+                    for flow in device.get( 'flows' ):
+                        if flow.get( 'state' ) != 'ADDED' and \
+                            flow.get( 'state' ) != 'PENDING_ADD':
 
-                        main.log.info( self.name + ": flow Id: " +
-                                       str( flow.get( 'groupId' ) ) +
-                                       " | state:" +
-                                       str( flow.get( 'state' ) ) )
-                        returnValue = main.FALSE
+                            main.log.info( self.name + ": flow Id: " +
+                                           str( flow.get( 'groupId' ) ) +
+                                           " | state:" +
+                                           str( flow.get( 'state' ) ) )
+                            returnValue = main.FALSE
+            else:
+                for device in tempFlows:
+                    for flow in device.get( 'flows' ):
+                        if flow.get( 'state' ) != 'ADDED':
+
+                            main.log.info( self.name + ": flow Id: " +
+                                           str( flow.get( 'groupId' ) ) +
+                                           " | state:" +
+                                           str( flow.get( 'state' ) ) )
+                            returnValue = main.FALSE
 
             return returnValue
         except TypeError:
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 2b37186..c261872 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -708,10 +708,11 @@
                 #   export OC1="10.128.20.11"
                 #   export OC2="10.128.20.12"
                 cellFile.write( onosString + str( tempCount ) +
-                                "=" + "\"" + arg + "\"" + "\n" )
+                                "=\"" + arg + "\"\n" )
                 tempCount = tempCount + 1
 
-            cellFile.write( mnString + "\"" + mnIpAddrs + "\"" + "\n" )
+            cellFile.write( "export OCI=$OC1\n" )
+            cellFile.write( mnString + "\"" + mnIpAddrs + "\"\n" )
             cellFile.write( appString + "\n" )
             cellFile.close()
 
@@ -1435,9 +1436,9 @@
             self.handle.expect( "\$" )
 
             self.handle.sendline( "tshark -i " + str( interface ) + " -t e -w " + str( dirFile ) + " &" )
-            self.handle.sendline( "\r" )
+            self.handle.sendline( "\n" )
             self.handle.expect( "Capturing on" )
-            self.handle.sendline( "\r" )
+            self.handle.sendline( "\n" )
             self.handle.expect( "\$" )
 
             main.log.info( "Tshark started capturing files on " +
@@ -1661,7 +1662,7 @@
                 cmd += " old"
             self.handle.sendline( cmd )
             self.handle.expect( cmd )
-            self.handle.expect( "\$" )
+            self.handle.expect( "\$ " )
             response = self.handle.before
             return response
         except pexpect.EOF:
@@ -1730,7 +1731,6 @@
         * This function uses root privilege iptables command which may result
           in unwanted network errors. USE WITH CAUTION
         """
-        import time
 
         # NOTE*********
         #   The strict checking methods of this driver function is intentional
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index fd1a401..0202a15 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -232,7 +232,7 @@
         i = handle.expect( [ ".ssword:*", default, pexpect.EOF ] )
         if i == 0:
             handle.sendline( pwd )
-            handle.sendline( "\r" )
+            handle.sendline( "\n" )
 
         if i == 1:
             handle.expect( default )
@@ -272,57 +272,61 @@
         returnVal = main.TRUE
         ssh_newkey = 'Are you sure you want to continue connecting'
         refused = "ssh: connect to host " + \
-            ipAddress + " port 22: Connection refused"
+                  ipAddress + " port 22: Connection refused"
 
         if direction == "from":
             cmd = 'scp ' + str( userName ) + '@' + str( ipAddress ) + ':' + \
-            str( filePath ) + ' ' + str( dstPath )
+                  str( filePath ) + ' ' + str( dstPath )
         elif direction == "to":
             cmd = 'scp ' + str( filePath ) + ' ' + str( userName ) + \
-            '@' + str( ipAddress ) + ':' + str( dstPath )
+                  '@' + str( ipAddress ) + ':' + str( dstPath )
         else:
             main.log.debug( "Wrong direction using secure copy command!" )
             return main.FALSE
 
         main.log.info( "Sending: " + cmd )
         self.handle.sendline( cmd )
-        i = self.handle.expect( [
-                            ssh_newkey,
-                            'password:',
-                            "100%",
-                            pexpect.EOF,
-                            pexpect.TIMEOUT,
-                            refused ],
-                            120 )
+        i = 0
+        while i < 2:
+            i = self.handle.expect( [
+                                ssh_newkey,
+                                'password:',
+                                "100%",
+                                refused,
+                                "No such file or directory",
+                                pexpect.EOF,
+                                pexpect.TIMEOUT ],
+                                120 )
 
-        if i == 0:
-            main.log.info( "ssh key confirmation received, send yes" )
-            self.handle.sendline( 'yes' )
-            i = self.handle.expect( [ ssh_newkey, 'password:', pexpect.EOF ] )
-        if i == 1:
-            main.log.info( "ssh connection asked for password, gave password" )
-            self.handle.sendline( pwd )
-            # self.handle.expect( userName )
-        if i == 2:
-            main.log.info( "Secure copy successful\n" + self.handle.before  )
-            returnVal = main.TRUE
-        elif i == 3:
-            main.log.error( "Pexpect.EOF found!!!" )
-            main.cleanup()
-            main.exit()
-        elif i == 4:  # timeout
-            main.log.error(
-                "No route to the Host " +
-                userName +
-                "@" +
-                ipAddress )
-            returnVal = main.FALSE
-        elif i == 5:
-            main.log.error(
-                "ssh: connect to host " +
-                ipAddress +
-                " port 22: Connection refused" )
-            returnVal = main.FALSE
+            if i == 0:  # ask for ssh key confirmation
+                main.log.info( "ssh key confirmation received, sending yes" )
+                self.handle.sendline( 'yes' )
+            elif i == 1:  # Asked for ssh password
+                main.log.info( "ssh connection asked for password, gave password" )
+                self.handle.sendline( pwd )
+            elif i == 2:  # File finished transfering
+                main.log.info( "Secure copy successful" )
+                returnVal = main.TRUE
+            elif i == 3:  # Connection refused
+                main.log.error(
+                    "ssh: connect to host " +
+                    ipAddress +
+                    " port 22: Connection refused" )
+                returnVal = main.FALSE
+            elif i == 4:  # File Not found
+                main.log.error( "No such file found" )
+                returnVal = main.FALSE
+            elif i == 5:  # EOF
+                main.log.error( "Pexpect.EOF found!!!" )
+                main.cleanup()
+                main.exit()
+            elif i == 6:  # timeout
+                main.log.error(
+                    "No route to the Host " +
+                    userName +
+                    "@" +
+                    ipAddress )
+                returnVal = main.FALSE
 
         self.handle.sendline( "" )
         self.handle.expect( "$" )
diff --git a/TestON/tests/CHOtest/CHOtest.params b/TestON/tests/CHOtest/CHOtest.params
index a4fabb0..f7ae88b 100644
--- a/TestON/tests/CHOtest/CHOtest.params
+++ b/TestON/tests/CHOtest/CHOtest.params
@@ -29,7 +29,7 @@
 
     <CTRL>
         <numCtrl>3</numCtrl>
-        <karafCliTimeout>3600000</karafCliTimeout>
+        <karafCliTimeout>7200000</karafCliTimeout>
     </CTRL>
 
     <TOPO1>
diff --git a/TestON/tests/CHOtest/CHOtest.py b/TestON/tests/CHOtest/CHOtest.py
index 779f8e9..c604014 100644
--- a/TestON/tests/CHOtest/CHOtest.py
+++ b/TestON/tests/CHOtest/CHOtest.py
@@ -507,9 +507,12 @@
         time.sleep( 10 )
 
         main.step( "Verify Pingall" )
-        ping_result = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again...")
+            pingResult = main.Mininet1.pingall( timeout=main.pingTimeout)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -517,12 +520,12 @@
             str( timeDiff ) +
             " seconds" )
 
-        if ping_result == main.TRUE:
+        if pingResult == main.TRUE:
             main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
         else:
             main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
 
-        case40Result =  appCheck and ping_result
+        case40Result =  appCheck and pingResult
         utilities.assert_equals( expect=main.TRUE, actual=case40Result,
                                  onpass="Reactive Mode IPv4 Pingall test PASS",
                                  onfail="Reactive Mode IPv4 Pingall test FAIL" )
@@ -563,9 +566,12 @@
         time.sleep( 10 )
 
         main.step( "Verify Pingall" )
-        ping_result = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again...")
+            pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -573,12 +579,12 @@
             str( timeDiff ) +
             " seconds" )
 
-        if ping_result == main.TRUE:
+        if pingResult == main.TRUE:
             main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
         else:
             main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
 
-        case41Result =  appCheck and ping_result
+        case41Result =  appCheck and pingResult
         utilities.assert_equals( expect=main.TRUE, actual=case41Result,
                                  onpass="Reactive Mode IPv4 Pingall test PASS",
                                  onfail="Reactive Mode IPv4 Pingall test FAIL" )
@@ -619,9 +625,12 @@
         time.sleep( 10 )
 
         main.step( "Verify Pingall" )
-        ping_result = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingall( timeout=main.pingTimeout )
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again...")
+            pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -629,12 +638,12 @@
             str( timeDiff ) +
             " seconds" )
 
-        if ping_result == main.TRUE:
+        if pingResult == main.TRUE:
             main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
         else:
             main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
 
-        case42Result =  appCheck and ping_result
+        case42Result =  appCheck and pingResult
         utilities.assert_equals( expect=main.TRUE, actual=case42Result,
                                  onpass="Reactive Mode IPv4 Pingall test PASS",
                                  onfail="Reactive Mode IPv4 Pingall test FAIL" )
@@ -660,9 +669,12 @@
                                  onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
 
         main.step( "Verify IPv6 Pingall" )
-        ping_result = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again..")
+            pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -670,7 +682,7 @@
             str( timeDiff ) +
             " seconds" )
 
-        if ping_result == main.TRUE:
+        if pingResult == main.TRUE:
             main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
         else:
             main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
@@ -700,7 +712,7 @@
 
         # Waiting for reative flows to be cleared.
         time.sleep( 30 )
-        case140Result =  appCheck and cfgResult and ping_result
+        case140Result =  appCheck and cfgResult and pingResult
         utilities.assert_equals( expect=main.TRUE, actual=case140Result,
                                  onpass="Reactive Mode IPv6 Pingall test PASS",
                                  onfail="Reactive Mode IPv6 Pingall test FAIL" )
@@ -726,9 +738,12 @@
                                  onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
 
         main.step( "Verify IPv6 Pingall" )
-        ping_result = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again..")
+            pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -736,7 +751,7 @@
             str( timeDiff ) +
             " seconds" )
 
-        if ping_result == main.TRUE:
+        if pingResult == main.TRUE:
             main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
         else:
             main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
@@ -766,7 +781,7 @@
 
         # Waiting for reative flows to be cleared.
         time.sleep( 30 )
-        case140Result =  appCheck and cfgResult and ping_result
+        case140Result =  appCheck and cfgResult and pingResult
         utilities.assert_equals( expect=main.TRUE, actual=case140Result,
                                  onpass="Reactive Mode IPv6 Pingall test PASS",
                                  onfail="Reactive Mode IPv6 Pingall test FAIL" )
@@ -792,9 +807,12 @@
                                  onfail="Failed to cfg set Reactive mode ipv6Fowarding" )
 
         main.step( "Verify IPv6 Pingall" )
-        ping_result = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout)
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again..")
+            pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -802,7 +820,7 @@
             str( timeDiff ) +
             " seconds" )
 
-        if ping_result == main.TRUE:
+        if pingResult == main.TRUE:
             main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
         else:
             main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
@@ -832,7 +850,7 @@
 
         # Waiting for reative flows to be cleared.
         time.sleep( 30 )
-        case142Result =  appCheck and cfgResult and ping_result
+        case142Result =  appCheck and cfgResult and pingResult
         utilities.assert_equals( expect=main.TRUE, actual=case142Result,
                                  onpass="Reactive Mode IPv6 Pingall test PASS",
                                  onfail="Reactive Mode IPv6 Pingall test FAIL" )
@@ -1143,6 +1161,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -1174,6 +1195,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -1205,6 +1229,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2004,6 +2031,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2035,6 +2065,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2066,6 +2099,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2097,6 +2133,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2128,6 +2167,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2159,6 +2201,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2190,6 +2235,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2221,6 +2269,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2252,6 +2303,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2283,6 +2337,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2314,6 +2371,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2345,6 +2405,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2872,6 +2935,10 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2903,6 +2970,9 @@
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
+        if not pingResult:
+            main.log.warn("Failed to ping Ipv6 hosts. Retrying...")
+            pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' )
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -3095,9 +3165,9 @@
         main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1))
 
         main.step( "Verify Pingall" )
-        ping_result = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingall(timeout=600)
+        pingResult = main.Mininet1.pingall(timeout=600)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -3105,7 +3175,7 @@
             str( timeDiff ) +
             " seconds" )
 
-        if ping_result == main.TRUE:
+        if pingResult == main.TRUE:
             main.log.report( "Pingall Test in Reactive mode successful" )
         else:
             main.log.report( "Pingall Test in Reactive mode failed" )
@@ -3141,7 +3211,7 @@
         # Waiting for reative flows to be cleared.
         time.sleep( 10 )
 
-        case11Result = installResult and ping_result and uninstallResult
+        case11Result = installResult and pingResult and uninstallResult
         utilities.assert_equals( expect=main.TRUE, actual=case11Result,
                                  onpass="Intent based Reactive forwarding Pingall test PASS",
                                  onfail="Intent based Reactive forwarding Pingall test FAIL" )
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index 1580260..4dab42c 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -211,6 +211,7 @@
         else:
             main.log.report( "ONOS instance may not be up, stop and " +
                              "start ONOS again " )
+
             for i in range( main.numCtrls ):
                 stopResult = stopResult and \
                         main.ONOSbench.onosStop( main.ONOSip[ i ] )
@@ -289,10 +290,15 @@
                     "Error" not in devices[ controller ] and\
                     "Error" not in ports[ controller ]:
 
-                    currentDevicesResult = main.Mininet1.compareSwitches(
-                            mnSwitches,
-                            json.loads( devices[ controller ] ),
-                            json.loads( ports[ controller ] ) )
+                    try:
+                        deviceData = json.loads( devices[ controller ] )
+                        portData = json.loads( ports[ controller ] )
+                    except (TypeError,ValueError):
+                        main.log.error("Could not load json:" + str( devices[ controller ] ) + ' or ' + str( ports[ controller ] ))
+                        currentDevicesResult = main.FALSE
+                    else:
+                        currentDevicesResult = main.Mininet1.compareSwitches(
+                            mnSwitches,deviceData,portData )
                 else:
                     currentDevicesResult = main.FALSE
                 if not currentDevicesResult:
@@ -300,19 +306,29 @@
                 devicesResults = devicesResults and currentDevicesResult
                 # Compare Links
                 if links[ controller ] and "Error" not in links[ controller ]:
-                    currentLinksResult = main.Mininet1.compareLinks(
-                            mnSwitches, mnLinks,
-                            json.loads( links[ controller ] ) )
+                    try:
+                        linkData = json.loads( links[ controller ] )
+                    except (TypeError,ValueError):
+                        main.log.error("Could not load json:" + str( links[ controller ] ) )
+                        currentLinksResult = main.FALSE
+                    else:
+                        currentLinksResult = main.Mininet1.compareLinks(
+                            mnSwitches, mnLinks,linkData )
                 else:
                     currentLinksResult = main.FALSE
                 if not currentLinksResult:
                     linkFails.append( controllerStr )
                 linksResults = linksResults and currentLinksResult
                 # Compare Hosts
-                if hosts[ controller ] or "Error" not in hosts[ controller ]:
-                    currentHostsResult = main.Mininet1.compareHosts(
-                            mnHosts,
-                            json.loads( hosts[ controller ] ) )
+                if hosts[ controller ] and "Error" not in hosts[ controller ]:
+                    try:
+                        hostData = json.loads( hosts[ controller ] )
+                    except (TypeError,ValueError):
+                        main.log.error("Could not load json:" + str( hosts[ controller ] ) )
+                        currentHostsResult = main.FALSE
+                    else:
+                        currentHostsResult = main.Mininet1.compareHosts(
+                                mnHosts,hostData )
                 else:
                     currentHostsResult = main.FALSE
                 if not currentHostsResult:
@@ -958,29 +974,36 @@
                                ";\nThe test will use OF " + main.OFProtocol +\
                                " OVS running in Mininet"
 
-        main.step( "NOOPTION: Add single point to multi point intents" )
-        stepResult = main.TRUE
         hostNames = [ 'h8', 'h16', 'h24' ]
         devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
                     'of:0000000000000007/8' ]
         macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
-        stepResult = main.intentFunction.singleToMultiIntent(
-                                         main,
-                                         name="NOOPTION",
-                                         hostNames=hostNames,
-                                         devices=devices,
-                                         sw1="s5",
-                                         sw2="s2",
-                                         expectedLink=18 )
 
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="NOOPTION: Successfully added single "
-                                        + " point to multi point intents" +
-                                        " with no match action",
-                                 onfail="NOOPTION: Failed to add single point"
-                                        + " point to multi point intents" +
-                                        " with no match action" )
+        # This test as written attempts something that is improbable to succeed
+        # Single to Multi Point Raw intent cannot be bi-directional, so pings are not usable to test it
+        # This test should be re-written so that one single-to-multi NOOPTION
+        # intent is installed, with listeners at the destinations, so that one way
+        # packets can be detected
+        #
+        # main.step( "NOOPTION: Add single point to multi point intents" )
+        # stepResult = main.TRUE
+        # stepResult = main.intentFunction.singleToMultiIntent(
+        #                                  main,
+        #                                  name="NOOPTION",
+        #                                  hostNames=hostNames,
+        #                                  devices=devices,
+        #                                  sw1="s5",
+        #                                  sw2="s2",
+        #                                  expectedLink=18 )
+        #
+        # utilities.assert_equals( expect=main.TRUE,
+        #                          actual=stepResult,
+        #                          onpass="NOOPTION: Successfully added single "
+        #                                 + " point to multi point intents" +
+        #                                 " with no match action",
+        #                          onfail="NOOPTION: Failed to add single point"
+        #                                 + " point to multi point intents" +
+        #                                 " with no match action" )
 
         main.step( "IPV4: Add single point to multi point intents" )
         stepResult = main.TRUE
diff --git a/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.params b/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.params
index f3ae511..a922e75 100644
--- a/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.params
+++ b/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.params
@@ -11,7 +11,7 @@
     # 9 - Update Virtualport northbound test
     #10 - Delete Virtualport northbound test
 
-    <testcases>1,2,3,4,5,6,7</testcases>
+    <testcases>1,2,3,4,5,6,7,8,9,10</testcases>
 
     <SLEEP>
         <startup>15</startup>
diff --git a/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py b/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py
index 4d65bc6..7577d49 100644
--- a/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py
+++ b/TestON/tests/FUNCvirNetNB/FUNCvirNetNB.py
@@ -57,16 +57,22 @@
         cellName = main.params['ENV']['cellName']
         ipList = os.getenv( main.params['CTRL']['ip1'] )
 
-        main.step("Create cell file")
+        main.step("Create cell file and apply to environment")
         cellAppString = main.params['ENV']['cellApps']
         main.ONOSbench.createCellFile(main.ONOSbench.ip_address,cellName,
                                       main.Mininet1.ip_address,
                                       cellAppString,ipList )
 
-        main.step( "Applying cell variable to environment" )
         cellResult = main.ONOSbench.setCell(cellName)
         verifyResult = main.ONOSbench.verifyCell()
 
+        stepResult = cellResult and verifyResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully applied cell to " + \
+                                        "environment",
+                                 onfail="Failed to apply cell to environment " )
+
         #FIXME:this is short term fix
         main.log.info( "Removing raft logs" )
         main.ONOSbench.onosRemoveRaftLogs()
@@ -97,7 +103,7 @@
 
         cleanInstallResult = main.TRUE
         gitPullResult = main.TRUE
-        main.step( "Git checkout and pull " + gitBranch )
+        main.log.info( "Git checkout and pull " + gitBranch )
         if PULLCODE:
             main.ONOSbench.gitCheckout ( gitBranch )
             gitPullResult = main.ONOSbench.gitPull()
@@ -209,7 +215,7 @@
         port = main.params['HTTP']['port']
         path = main.params['HTTP']['path']
 
-        main.step( "Generate Post Data" )
+        main.log.info( "Generate Post Data" )
         network = NetworkData()
         network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
         network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
@@ -283,7 +289,7 @@
         port = main.params['HTTP']['port']
         path = main.params['HTTP']['path']
 
-        main.step( "Generate Post Data" )
+        main.log.info( "Generate Post Data" )
         network = NetworkData()
         network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
         network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
@@ -370,7 +376,7 @@
         port = main.params['HTTP']['port']
         path = main.params['HTTP']['path']
 
-        main.step( "Generate Post Data" )
+        main.log.info( "Generate Post Data" )
         network = NetworkData()
         network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
         network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
@@ -431,7 +437,7 @@
         port = main.params['HTTP']['port']
         path = main.params['HTTP']['path']
 
-        main.step( "Generate Post Data" )
+        main.log.info( "Generate Post Data" )
         network = NetworkData()
         network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
         network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
@@ -520,7 +526,7 @@
         port = main.params['HTTP']['port']
         path = main.params['HTTP']['path']
 
-        main.step( "Generate Post Data" )
+        main.log.info( "Generate Post Data" )
         network = NetworkData()
         network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
         network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
@@ -626,7 +632,7 @@
         port = main.params['HTTP']['port']
         path = main.params['HTTP']['path']
 
-        main.step( "Generate Post Data" )
+        main.log.info( "Generate Post Data" )
         network = NetworkData()
         network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
         network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
@@ -703,7 +709,7 @@
         httpport = main.params['HTTP']['port']
         path = main.params['HTTP']['path']
 
-        main.step( "Generate Post Data" )
+        main.log.info( "Generate Post Data" )
         network = NetworkData()
         network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
         network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
@@ -811,7 +817,7 @@
         httpport = main.params['HTTP']['port']
         path = main.params['HTTP']['path']
 
-        main.step( "Generate Post Data" )
+        main.log.info( "Generate Post Data" )
         network = NetworkData()
         network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
         network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
@@ -934,7 +940,7 @@
         httpport = main.params['HTTP']['port']
         path = main.params['HTTP']['path']
 
-        main.step( "Generate Post Data" )
+        main.log.info( "Generate Post Data" )
         network = NetworkData()
         network.id = '030d6d3d-fa36-45bf-ae2b-4f4bc43a54dc'
         network.tenant_id = '26cd996094344a0598b0a1af1d525cdc'
@@ -1007,4 +1013,4 @@
                 expect='200',
                 actual=deletestatus,
                 onpass="Delete Network Success",
-                onfail="Delete Network Failed" )
\ No newline at end of file
+                onfail="Delete Network Failed" )
diff --git a/TestON/tests/FUNCvirNetNB/dependencies/Nbdata.py b/TestON/tests/FUNCvirNetNB/dependencies/Nbdata.py
index df2121e..9b3b978 100644
--- a/TestON/tests/FUNCvirNetNB/dependencies/Nbdata.py
+++ b/TestON/tests/FUNCvirNetNB/dependencies/Nbdata.py
@@ -184,7 +184,7 @@
         if self.allowedAddressPairs != '':
             Dicdata['allowed_address_pairs'] = self.allowedAddressPairs
         if self.deviceOwner != '':
-            Dicdata['device_owner'] = self.deviceOwner            
+            Dicdata['device_owner'] = self.deviceOwner
         if self.securityGroups != '':
             Dicdata['security_groups'] = self.securityGroups
         if self.adminStateUp != '':
diff --git a/TestON/tests/HAclusterRestart/HAclusterRestart.params b/TestON/tests/HAclusterRestart/HAclusterRestart.params
index 228e769..f10636e 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.params
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.params
@@ -40,7 +40,7 @@
         <port7>6653</port7>
     </CTRL>
     <BACKUP>
-        <ENABLED> False </ENABLED>
+        <ENABLED>True</ENABLED>
         <TESTONUSER>admin</TESTONUSER>
         <TESTONIP>10.128.30.9</TESTONIP>
     </BACKUP>
diff --git a/TestON/tests/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HAclusterRestart/HAclusterRestart.py
index b5ebe7d..3026c1e 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.py
@@ -510,19 +510,22 @@
         # FIXME: Once we have a host discovery mechanism, use that instead
         # REACTIVE FWD test
         pingResult = main.FALSE
-        for i in range(2):  # Retry if pingall fails first time
-            time1 = time.time()
+        passMsg = "Reactive Pingall test passed"
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again...")
             pingResult = main.Mininet1.pingall()
-            if i == 0:
-                utilities.assert_equals(
-                    expect=main.TRUE,
-                    actual=pingResult,
-                    onpass="Reactive Pingall test passed",
-                    onfail="Reactive Pingall failed, " +
-                           "one or more ping pairs failed" )
-            time2 = time.time()
-            main.log.info( "Time for pingall: %2f seconds" %
-                           ( time2 - time1 ) )
+            passMsg += " on the second try"
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=pingResult,
+            onpass= passMsg,
+            onfail="Reactive Pingall failed, " +
+                   "one or more ping pairs failed" )
+        main.log.info( "Time for pingall: %2f seconds" %
+                       ( time2 - time1 ) )
         # timeout for fwd flows
         time.sleep( 11 )
         # uninstall onos-app-fwd
@@ -1717,6 +1720,11 @@
 
         main.case( "Restart entire ONOS cluster" )
 
+        main.step( "Checking ONOS Logs for errors" )
+        for node in main.nodes:
+            main.log.debug( "Checking logs for errors on " + node.name + ":" )
+            main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
+
         main.step( "Killing ONOS nodes" )
         killResults = main.TRUE
         killTime = time.time()
@@ -2146,10 +2154,6 @@
                                 " and ONOS"
 
         main.step( "Comparing ONOS topology to MN" )
-        devicesResults = main.TRUE
-        linksResults = main.TRUE
-        hostsResults = main.TRUE
-        hostAttachmentResults = True
         topoResult = main.FALSE
         elapsed = 0
         count = 0
@@ -2157,6 +2161,10 @@
         startTime = time.time()
         # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
+            devicesResults = main.TRUE
+            linksResults = main.TRUE
+            hostsResults = main.TRUE
+            hostAttachmentResults = True
             count += 1
             cliStart = time.time()
             devices = []
@@ -2694,49 +2702,36 @@
         main.Mininet2.stopTcpdump()
 
         testname = main.TEST
-        if main.params[ 'BACKUP' ] == "True":
+        if main.params[ 'BACKUP' ][ 'ENABLED' ] == "True":
             main.step( "Copying MN pcap and ONOS log files to test station" )
             teststationUser = main.params[ 'BACKUP' ][ 'TESTONUSER' ]
             teststationIP = main.params[ 'BACKUP' ][ 'TESTONIP' ]
-            # NOTE: MN Pcap file is being saved to ~/packet_captures
-            #       scp this file as MN and TestON aren't necessarily the same vm
-            # FIXME: scp
-            # mn files
+            # NOTE: MN Pcap file is being saved to logdir.
+            #       We scp this file as MN and TestON aren't necessarily the same vm
+
+            # FIXME: To be replaced with a Jenkin's post script
             # TODO: Load these from params
             # NOTE: must end in /
             logFolder = "/opt/onos/log/"
             logFiles = [ "karaf.log", "karaf.log.1" ]
             # NOTE: must end in /
-            dstDir = "~/packet_captures/"
             for f in logFiles:
                 for node in main.nodes:
-                    main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
-                                                    ":" + logFolder + f + " " +
-                                                    teststationUser + "@" +
-                                                    teststationIP + ":" +
-                                                    dstDir + str( testname ) +
-                                                    "-" + node.name + "-" + f )
-                    main.ONOSbench.handle.expect( "\$" )
-
+                    dstName =  main.logdir + "/" + node.name + "-" + f
+                    main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+                                               logFolder + f, dstName )
             # std*.log's
             # NOTE: must end in /
             logFolder = "/opt/onos/var/"
             logFiles = [ "stderr.log", "stdout.log" ]
             # NOTE: must end in /
-            dstDir = "~/packet_captures/"
             for f in logFiles:
                 for node in main.nodes:
-                    main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
-                                                    ":" + logFolder + f + " " +
-                                                    teststationUser + "@" +
-                                                    teststationIP + ":" +
-                                                    dstDir + str( testname ) +
-                                                    "-" + node.name + "-" + f )
-                    main.ONOSbench.handle.expect( "\$" )
-            # sleep so scp can finish
-            time.sleep( 10 )
-            main.step( "Packing and rotating pcap archives" )
-            os.system( "~/TestON/dependencies/rotate.sh " + str( testname ) )
+                    dstName =  main.logdir + "/" + node.name + "-" + f
+                    main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+                                               logFolder + f, dstName )
+        else:
+            main.log.debug( "skipping saving log files" )
 
         main.step( "Stopping Mininet" )
         mnResult = main.Mininet1.stopNet()
@@ -2746,9 +2741,8 @@
 
         main.step( "Checking ONOS Logs for errors" )
         for node in main.nodes:
-            print colors[ 'purple' ] + "Checking logs for errors on " + \
-                node.name + ":" + colors[ 'end' ]
-            print main.ONOSbench.checkLogs( node.ip_address, restart=True )
+            main.log.debug( "Checking logs for errors on " + node.name + ":" )
+            main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
 
         try:
             timerLog = open( main.logdir + "/Timers.csv", 'w')
diff --git a/TestON/tests/HAminorityRestart/HAminorityRestart.py b/TestON/tests/HAminorityRestart/HAminorityRestart.py
index 855f380..69c0645 100644
--- a/TestON/tests/HAminorityRestart/HAminorityRestart.py
+++ b/TestON/tests/HAminorityRestart/HAminorityRestart.py
@@ -494,19 +494,22 @@
         # FIXME: Once we have a host discovery mechanism, use that instead
         # REACTIVE FWD test
         pingResult = main.FALSE
-        for i in range(2):  # Retry if pingall fails first time
-            time1 = time.time()
+        passMsg = "Reactive Pingall test passed"
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again...")
             pingResult = main.Mininet1.pingall()
-            if i == 0:
-                utilities.assert_equals(
-                    expect=main.TRUE,
-                    actual=pingResult,
-                    onpass="Reactive Pingall test passed",
-                    onfail="Reactive Pingall failed, " +
-                           "one or more ping pairs failed" )
-            time2 = time.time()
-            main.log.info( "Time for pingall: %2f seconds" %
-                           ( time2 - time1 ) )
+            passMsg += " on the second try"
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=pingResult,
+            onpass= passMsg,
+            onfail="Reactive Pingall failed, " +
+                   "one or more ping pairs failed" )
+        main.log.info( "Time for pingall: %2f seconds" %
+                       ( time2 - time1 ) )
         # timeout for fwd flows
         time.sleep( 11 )
         # uninstall onos-app-fwd
@@ -1671,6 +1674,12 @@
         assert main.CLIs, "main.CLIs not defined"
         assert main.nodes, "main.nodes not defined"
         main.case( "Restart minority of ONOS nodes" )
+
+        main.step( "Checking ONOS Logs for errors" )
+        for node in main.nodes:
+            main.log.debug( "Checking logs for errors on " + node.name + ":" )
+            main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
+
         main.step( "Killing 3 ONOS nodes" )
         killTime = time.time()
         # TODO: Randomize these nodes or base this on partitions
@@ -2095,10 +2104,6 @@
                                 " and ONOS"
 
         main.step( "Comparing ONOS topology to MN" )
-        devicesResults = main.TRUE
-        linksResults = main.TRUE
-        hostsResults = main.TRUE
-        hostAttachmentResults = True
         topoResult = main.FALSE
         elapsed = 0
         count = 0
@@ -2106,6 +2111,10 @@
         startTime = time.time()
         # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
+            devicesResults = main.TRUE
+            linksResults = main.TRUE
+            hostsResults = main.TRUE
+            hostAttachmentResults = True
             count += 1
             cliStart = time.time()
             devices = []
@@ -2638,49 +2647,36 @@
         main.Mininet2.stopTcpdump()
 
         testname = main.TEST
-        if main.params[ 'BACKUP' ] == "True":
+        if main.params[ 'BACKUP' ][ 'ENABLED' ] == "True":
             main.step( "Copying MN pcap and ONOS log files to test station" )
             teststationUser = main.params[ 'BACKUP' ][ 'TESTONUSER' ]
             teststationIP = main.params[ 'BACKUP' ][ 'TESTONIP' ]
-            # NOTE: MN Pcap file is being saved to ~/packet_captures
-            #       scp this file as MN and TestON aren't necessarily the same vm
-            # FIXME: scp
-            # mn files
+            # NOTE: MN Pcap file is being saved to logdir.
+            #       We scp this file as MN and TestON aren't necessarily the same vm
+
+            # FIXME: To be replaced with a Jenkin's post script
             # TODO: Load these from params
             # NOTE: must end in /
             logFolder = "/opt/onos/log/"
             logFiles = [ "karaf.log", "karaf.log.1" ]
             # NOTE: must end in /
-            dstDir = "~/packet_captures/"
             for f in logFiles:
                 for node in main.nodes:
-                    main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
-                                                    ":" + logFolder + f + " " +
-                                                    teststationUser + "@" +
-                                                    teststationIP + ":" +
-                                                    dstDir + str( testname ) +
-                                                    "-" + node.name + "-" + f )
-                    main.ONOSbench.handle.expect( "\$" )
-
+                    dstName =  main.logdir + "/" + node.name + "-" + f
+                    main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+                                               logFolder + f, dstName )
             # std*.log's
             # NOTE: must end in /
             logFolder = "/opt/onos/var/"
             logFiles = [ "stderr.log", "stdout.log" ]
             # NOTE: must end in /
-            dstDir = "~/packet_captures/"
             for f in logFiles:
                 for node in main.nodes:
-                    main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
-                                                    ":" + logFolder + f + " " +
-                                                    teststationUser + "@" +
-                                                    teststationIP + ":" +
-                                                    dstDir + str( testname ) +
-                                                    "-" + node.name + "-" + f )
-                    main.ONOSbench.handle.expect( "\$" )
-            # sleep so scp can finish
-            time.sleep( 10 )
-            main.step( "Packing and rotating pcap archives" )
-            os.system( "~/TestON/dependencies/rotate.sh " + str( testname ) )
+                    dstName =  main.logdir + "/" + node.name + "-" + f
+                    main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+                                               logFolder + f, dstName )
+        else:
+            main.log.debug( "skipping saving log files" )
 
         main.step( "Stopping Mininet" )
         mnResult = main.Mininet1.stopNet()
@@ -2690,9 +2686,8 @@
 
         main.step( "Checking ONOS Logs for errors" )
         for node in main.nodes:
-            print colors[ 'purple' ] + "Checking logs for errors on " + \
-                node.name + ":" + colors[ 'end' ]
-            print main.ONOSbench.checkLogs( node.ip_address, restart=True )
+            main.log.debug( "Checking logs for errors on " + node.name + ":" )
+            main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
 
         try:
             timerLog = open( main.logdir + "/Timers.csv", 'w')
diff --git a/TestON/tests/HAsanity/HAsanity.py b/TestON/tests/HAsanity/HAsanity.py
index 6ceaead..e136d5e 100644
--- a/TestON/tests/HAsanity/HAsanity.py
+++ b/TestON/tests/HAsanity/HAsanity.py
@@ -494,19 +494,22 @@
         # FIXME: Once we have a host discovery mechanism, use that instead
         # REACTIVE FWD test
         pingResult = main.FALSE
-        for i in range(2):  # Retry if pingall fails first time
-            time1 = time.time()
+        passMsg = "Reactive Pingall test passed"
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again...")
             pingResult = main.Mininet1.pingall()
-            if i == 0:
-                utilities.assert_equals(
-                    expect=main.TRUE,
-                    actual=pingResult,
-                    onpass="Reactive Pingall test passed",
-                    onfail="Reactive Pingall failed, " +
-                           "one or more ping pairs failed" )
-            time2 = time.time()
-            main.log.info( "Time for pingall: %2f seconds" %
-                           ( time2 - time1 ) )
+            passMsg += " on the second try"
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=pingResult,
+            onpass= passMsg,
+            onfail="Reactive Pingall failed, " +
+                   "one or more ping pairs failed" )
+        main.log.info( "Time for pingall: %2f seconds" %
+                       ( time2 - time1 ) )
         # timeout for fwd flows
         time.sleep( 11 )
         # uninstall onos-app-fwd
@@ -515,11 +518,6 @@
         utilities.assert_equals( expect=main.TRUE, actual=uninstallResult,
                                  onpass="Uninstall fwd successful",
                                  onfail="Uninstall fwd failed" )
-        '''
-        main.Mininet1.handle.sendline( "py [ h.cmd( \"arping -c 1 10.1.1.1 \" ) for h in net.hosts ] ")
-        import time
-        time.sleep(60)
-        '''
 
         main.step( "Check app ids" )
         threads = []
@@ -2048,10 +2046,6 @@
                                 " and ONOS"
 
         main.step( "Comparing ONOS topology to MN" )
-        devicesResults = main.TRUE
-        linksResults = main.TRUE
-        hostsResults = main.TRUE
-        hostAttachmentResults = True
         topoResult = main.FALSE
         elapsed = 0
         count = 0
@@ -2059,6 +2053,10 @@
         startTime = time.time()
         # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
+            devicesResults = main.TRUE
+            linksResults = main.TRUE
+            hostsResults = main.TRUE
+            hostAttachmentResults = True
             count += 1
             cliStart = time.time()
             devices = []
@@ -2601,49 +2599,36 @@
         main.Mininet2.stopTcpdump()
 
         testname = main.TEST
-        if main.params[ 'BACKUP' ] == "True":
+        if main.params[ 'BACKUP' ][ 'ENABLED' ] == "True":
             main.step( "Copying MN pcap and ONOS log files to test station" )
             teststationUser = main.params[ 'BACKUP' ][ 'TESTONUSER' ]
             teststationIP = main.params[ 'BACKUP' ][ 'TESTONIP' ]
-            # NOTE: MN Pcap file is being saved to ~/packet_captures
-            #       scp this file as MN and TestON aren't necessarily the same vm
-            # FIXME: scp
-            # mn files
+            # NOTE: MN Pcap file is being saved to logdir.
+            #       We scp this file as MN and TestON aren't necessarily the same vm
+
+            # FIXME: To be replaced with a Jenkin's post script
             # TODO: Load these from params
             # NOTE: must end in /
             logFolder = "/opt/onos/log/"
             logFiles = [ "karaf.log", "karaf.log.1" ]
             # NOTE: must end in /
-            dstDir = "~/packet_captures/"
             for f in logFiles:
                 for node in main.nodes:
-                    main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
-                                                    ":" + logFolder + f + " " +
-                                                    teststationUser + "@" +
-                                                    teststationIP + ":" +
-                                                    dstDir + str( testname ) +
-                                                    "-" + node.name + "-" + f )
-                    main.ONOSbench.handle.expect( "\$" )
-
+                    dstName =  main.logdir + "/" + node.name + "-" + f
+                    main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+                                               logFolder + f, dstName )
             # std*.log's
             # NOTE: must end in /
             logFolder = "/opt/onos/var/"
             logFiles = [ "stderr.log", "stdout.log" ]
             # NOTE: must end in /
-            dstDir = "~/packet_captures/"
             for f in logFiles:
                 for node in main.nodes:
-                    main.ONOSbench.handle.sendline( "scp sdn@" + node.ip_address +
-                                                    ":" + logFolder + f + " " +
-                                                    teststationUser + "@" +
-                                                    teststationIP + ":" +
-                                                    dstDir + str( testname ) +
-                                                    "-" + node.name + "-" + f )
-                    main.ONOSbench.handle.expect( "\$" )
-            # sleep so scp can finish
-            time.sleep( 10 )
-            main.step( "Packing and rotating pcap archives" )
-            os.system( "~/TestON/dependencies/rotate.sh " + str( testname ) )
+                    dstName =  main.logdir + "/" + node.name + "-" + f
+                    main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+                                               logFolder + f, dstName )
+        else:
+            main.log.debug( "skipping saving log files" )
 
         main.step( "Stopping Mininet" )
         mnResult = main.Mininet1.stopNet()
@@ -2653,9 +2638,8 @@
 
         main.step( "Checking ONOS Logs for errors" )
         for node in main.nodes:
-            print colors[ 'purple' ] + "Checking logs for errors on " + \
-                node.name + ":" + colors[ 'end' ]
-            print main.ONOSbench.checkLogs( node.ip_address )
+            main.log.debug( "Checking logs for errors on " + node.name + ":" )
+            main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
 
         try:
             timerLog = open( main.logdir + "/Timers.csv", 'w')
diff --git a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index 8a86647..a2602d1 100644
--- a/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -391,19 +391,22 @@
         # FIXME: Once we have a host discovery mechanism, use that instead
         # REACTIVE FWD test
         pingResult = main.FALSE
-        for i in range(2):  # Retry if pingall fails first time
-            time1 = time.time()
+        passMsg = "Reactive Pingall test passed"
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        if not pingResult:
+            main.log.warn("First pingall failed. Trying again...")
             pingResult = main.Mininet1.pingall()
-            if i == 0:
-                utilities.assert_equals(
-                    expect=main.TRUE,
-                    actual=pingResult,
-                    onpass="Reactive Pingall test passed",
-                    onfail="Reactive Pingall failed, " +
-                           "one or more ping pairs failed" )
-            time2 = time.time()
-            main.log.info( "Time for pingall: %2f seconds" %
-                           ( time2 - time1 ) )
+            passMsg += " on the second try"
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=pingResult,
+            onpass= passMsg,
+            onfail="Reactive Pingall failed, " +
+                   "one or more ping pairs failed" )
+        main.log.info( "Time for pingall: %2f seconds" %
+                       ( time2 - time1 ) )
         # timeout for fwd flows
         time.sleep( 11 )
         # uninstall onos-app-fwd
@@ -1184,6 +1187,12 @@
         main.case( "Restart ONOS node" )
         main.caseExplanation = "Killing ONOS process and restart cli " +\
                                 "sessions once onos is up."
+
+        main.step( "Checking ONOS Logs for errors" )
+        for node in main.nodes:
+            main.log.debug( "Checking logs for errors on " + node.name + ":" )
+            main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
+
         main.step( "Killing ONOS processes" )
         killResult = main.ONOSbench.onosKill( main.nodes[0].ip_address )
         start = time.time()
@@ -1423,10 +1432,6 @@
                                 " and ONOS"
 
         main.step( "Comparing ONOS topology to MN" )
-        devicesResults = main.TRUE
-        linksResults = main.TRUE
-        hostsResults = main.TRUE
-        hostAttachmentResults = True
         topoResult = main.FALSE
         elapsed = 0
         count = 0
@@ -1434,6 +1439,10 @@
         startTime = time.time()
         # Give time for Gossip to work
         while topoResult == main.FALSE and elapsed < 60:
+            devicesResults = main.TRUE
+            linksResults = main.TRUE
+            hostsResults = main.TRUE
+            hostAttachmentResults = True
             count += 1
             cliStart = time.time()
             devices = []
@@ -1765,45 +1774,36 @@
         main.Mininet2.stopTcpdump()
 
         testname = main.TEST
-        if main.params[ 'BACKUP' ] == "True":
+        if main.params[ 'BACKUP' ][ 'ENABLED' ] == "True":
             main.step( "Copying MN pcap and ONOS log files to test station" )
             teststationUser = main.params[ 'BACKUP' ][ 'TESTONUSER' ]
             teststationIP = main.params[ 'BACKUP' ][ 'TESTONIP' ]
-            # NOTE: MN Pcap file is being saved to ~/packet_captures
-            #       scp this file as MN and TestON aren't necessarily the same vm
-            # FIXME: scp
-            # mn files
+            # NOTE: MN Pcap file is being saved to logdir.
+            #       We scp this file as MN and TestON aren't necessarily the same vm
+
+            # FIXME: To be replaced with a Jenkin's post script
             # TODO: Load these from params
             # NOTE: must end in /
             logFolder = "/opt/onos/log/"
             logFiles = [ "karaf.log", "karaf.log.1" ]
             # NOTE: must end in /
-            dstDir = "~/packet_captures/"
             for f in logFiles:
-                main.ONOSbench.handle.sendline( "scp sdn@" + main.nodes[0].ip_address + ":" +
-                                                logFolder + f + " " +
-                                                teststationUser + "@" +
-                                                teststationIP + ":" + dstDir +
-                                                str( testname ) + "-ONOS1-" + f )
-                main.ONOSbench.handle.expect( "\$" )
-
+                for node in main.nodes:
+                    dstName =  main.logdir + "/" + node.name + "-" + f
+                    main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+                                               logFolder + f, dstName )
             # std*.log's
             # NOTE: must end in /
             logFolder = "/opt/onos/var/"
             logFiles = [ "stderr.log", "stdout.log" ]
             # NOTE: must end in /
-            dstDir = "~/packet_captures/"
             for f in logFiles:
-                main.ONOSbench.handle.sendline( "scp sdn@" + main.nodes[0].ip_address + ":" +
-                                                logFolder + f + " " +
-                                                teststationUser + "@" +
-                                                teststationIP + ":" + dstDir +
-                                                str( testname ) + "-ONOS1-" + f )
-                main.ONOSbench.handle.expect( "\$" )
-            # sleep so scp can finish
-            time.sleep( 10 )
-            main.step( "Packing and rotating pcap archives" )
-            os.system( "~/TestON/dependencies/rotate.sh " + str( testname ) )
+                for node in main.nodes:
+                    dstName =  main.logdir + "/" + node.name + "-" + f
+                    main.ONOSbench.secureCopy( node.user_name, node.ip_address,
+                                               logFolder + f, dstName )
+        else:
+            main.log.debug( "skipping saving log files" )
 
         main.step( "Stopping Mininet" )
         mnResult = main.Mininet1.stopNet()
@@ -1812,9 +1812,9 @@
                                  onfail="MN cleanup NOT successful" )
 
         main.step( "Checking ONOS Logs for errors" )
-        print colors[ 'purple' ] + "Checking logs for errors on ONOS1:" + \
-            colors[ 'end' ]
-        print main.ONOSbench.checkLogs( main.nodes[0].ip_address, restart=True )
+        for node in main.nodes:
+            main.log.debug( "Checking logs for errors on " + node.name + ":" )
+            main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
 
         try:
             timerLog = open( main.logdir + "/Timers.csv", 'w')
diff --git a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
index bc7d17e..eb581ea 100644
--- a/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPFintentEventTp/SCPFintentEventTp.py
@@ -22,7 +22,7 @@
         global init
         try:
             if type(init) is not bool:
-                init = Fals
+                init = False
         except NameError:
             init = False
 
@@ -178,34 +178,17 @@
         main.ONOSbench.handle.expect(":~")
         print main.ONOSbench.handle.before
 
-        lastOutput = "--"
-        origin = time.time()
-        clockStarted = False
-        while True:
-
-            main.ONOSbench.handle.sendline("")
-            main.ONOSbench.handle.expect(":~")
-
-            main.ONOSbench.handle.sendline("onos $OC1 summary")
-            main.ONOSbench.handle.expect(":~")
-
-            main.log.info("before" + main.ONOSbench.handle.before)
-            clusterCheck = main.ONOSbench.handle.before
-            print("\nBefore: " + str(clusterCheck))
-            if ("SCC(s)=1,") in clusterCheck:
+        for i in range(3):
+            passed = main.ONOSbench.verifySummary( ONOSIp[0] )
+            if passed:
+                main.log.info("Clusters have converged")
                 break
-            if clusterCheck != lastOutput:
-                sameOutput = False
-            elif clusterCheck == lastOutput:
-                if clockStarted == False:
-                    start = time.time()
-                    clockStarted = True
-                if time.time() > (start + 30):
-                    main.log.error("TIMEOUT EXCEEDED: Clusters have not converged, continuing anyway...")
-                    break
-            lastOutput = clusterCheck
-            time.sleep(5)
+            else:
+                main.log.error("Clusters have not converged, retying...")
+            time.sleep(3)
+
         main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"])
+
     def CASE2( self, main ):
         import time
         import json
@@ -322,17 +305,16 @@
             main.ONOSbench.handle.expect(":~")
             main.log.info("Stopping intentperf" )
 
-            resultsDB = open("/tmp/IntentEventTPDB", "a")
-            for node in groupResult:
-
-                resultString = "'" + commit + "',"
-                resultString += "'1gig',"
-                resultString += str(clusterCount) + ","
-                resultString += "'baremetal" + str(int(groupResult.index(node)) + 1) + "',"
-                resultString += n + ","
-                resultString += str(node) + ","
-                resultString += str(0) + "\n" #no stddev
-                resultsDB.write(resultString)
+            with open("/tmp/IntentEventTPDB", "a") as resultsDB:
+                for node in groupResult:
+                    resultString = "'" + commit + "',"
+                    resultString += "'1gig',"
+                    resultString += str(clusterCount) + ","
+                    resultString += "'baremetal" + str(int(groupResult.index(node)) + 1) + "',"
+                    resultString += n + ","
+                    resultString += str(node) + ","
+                    resultString += str(0) + "\n" #no stddev
+                    resultsDB.write(resultString)
 
             resultsDB.close()
 
diff --git a/TestON/tests/SCPFmaxIntents/Dependency/maxIntentFunctions.py b/TestON/tests/SCPFmaxIntents/Dependency/maxIntentFunctions.py
index 87f2015..268279c 100644
--- a/TestON/tests/SCPFmaxIntents/Dependency/maxIntentFunctions.py
+++ b/TestON/tests/SCPFmaxIntents/Dependency/maxIntentFunctions.py
@@ -72,7 +72,7 @@
         main.log.exception("Timeout exception caught in pushIntents")
     return main.FALSE
 
-def verifyFlows( main, expectedFlows, state="ADDED", sleep=1,  timeout=120):
+def verifyFlows( main, expectedFlows, state="ADDED", sleep=1, numcheck=10, timeout=120):
     '''
         This function returns main.TRUE if the number of expected flows are in
         the specified state
@@ -80,17 +80,19 @@
         @params
             expectedFlows: the flows you expect to see in the specified state
             state: the state of the flow to check for
+            sleep: how long it should sleep for each check
+            numcheck: how many times it should check
             timeout: the timeout for pexpect
     '''
     cmd = "flows | grep " + state + " | wc -l"
-    for i in range(10):
+    for i in range(numcheck):
         flows = getFlows( main, state, sleep, timeout )
         if expectedFlows == flows:
             return main.TRUE
 
     return main.FALSE
 
-def verifyIntents( main, expectedIntents, state="INSTALLED", sleep=1, timeout=120):
+def verifyIntents( main, expectedIntents, state="INSTALLED", sleep=1, numcheck=10, timeout=120):
     '''
         This function returns main.TRUE if the number of expected intents are in
         the specified state
@@ -98,12 +100,15 @@
         @params
             expectedFlows: the intents you expect to see in the specified state
             state: the state of the intent to check for
+            sleep: how long it should sleep for each check
+            numcheck: how many times it should check
             timeout: the timeout for pexpect
     '''
     cmd = "intents | grep " + state + " | wc -l"
-    for i in range(10):
+    for i in range(numcheck):
         intents = getIntents( main, state, sleep, timeout )
         if expectedIntents == intents:
             return main.TRUE
+        time.sleep(sleep)
 
     return main.FALSE
diff --git a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.params b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.params
index 7009498..7a08c48 100755
--- a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.params
+++ b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.params
@@ -1,9 +1,12 @@
 <PARAMS>
 
-    # 0-init, 1-setup, 10-null provider setup,
-    # 11-mininet setup, 20-pushing intents,
+    # 0-init
+    # 1-setup
+    # 10-null provider setup
+    # 11-mininet setup
+    # 20-pushing intents,
     # 21-rerouting intents
-    # 0,1,10,20,1,11,20,1,10,21,1,11,21,100
+    # 0,1,11,20,1,11,21,1,10,20,1,10,21,100
     <testcases>0,1,11,20,1,11,21,1,10,20,1,10,21,100</testcases>
 
     <SCALE>
@@ -34,23 +37,24 @@
 
     <SLEEP>
         <startup>3</startup>
-        <install>5</install>
-        <verify>15</verify>
-        <reroute>15</reroute>
+        <install>0</install>
+        <verify>0</verify>
+        <reroute>3</reroute>
         # timeout for pexpect
         <timeout>120</timeout>
     </SLEEP>
 
     <DATABASE>
+        <file>MaxIntentDB</file>
         <nic>1gig</nic>
         <node>baremetal</node>
     </DATABASE>
 
     <TEST>
-        <batch_size>1000</batch_size>
+        <batch_size>10000</batch_size>
         <min_intents>800000</min_intents>
         <max_intents>1000000</max_intents>
-        <check_interval>10000</check_interval>
+        <check_interval>20000</check_interval>
     </TEST>
 
 </PARAMS>
diff --git a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py
index 762f6fd..a790864 100644
--- a/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py
+++ b/TestON/tests/SCPFmaxIntents/SCPFmaxIntents.py
@@ -37,7 +37,6 @@
                 main.params['DEPENDENCY']['path']
         main.cellName = main.params[ 'ENV' ][ 'cellName' ]
         main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-        gitBranch = main.params[ 'GIT' ][ 'branch' ]
         main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
         main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
         main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
@@ -46,32 +45,42 @@
         main.minIntents = int(main.params['TEST']['min_intents'])
         main.maxIntents = int(main.params['TEST']['max_intents'])
         main.checkInterval = int(main.params['TEST']['check_interval'])
-        wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
-        wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
         main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
         main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
         main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
         main.rerouteSleep = int ( main.params['SLEEP']['reroute'] )
-        gitPull = main.params[ 'GIT' ][ 'pull' ]
         main.batchSize = int(main.params['TEST']['batch_size'])
-        nic = main.params['DATABASE']['nic']
-        node = main.params['DATABASE']['node']
+        main.dbFileName = main.params['DATABASE']['file']
         main.cellData = {} # for creating cell file
         main.CLIs = []
         main.ONOSip = []
         main.maxNumBatch = 0
-
         main.ONOSip = main.ONOSbench.getOnosIps()
         main.log.info(main.ONOSip)
+        main.setupSkipped = False
+
+        wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+        wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
+        gitBranch = main.params[ 'GIT' ][ 'branch' ]
+        gitPull = main.params[ 'GIT' ][ 'pull' ]
+        nic = main.params['DATABASE']['nic']
+        node = main.params['DATABASE']['node']
+        nic = main.params['DATABASE']['nic']
+        node = main.params['DATABASE']['node']
 
         # main.scale[ 0 ] determines the current number of ONOS controller
         main.numCtrls = int( main.scale[ 0 ] )
 
-        # Assigning ONOS cli handles to a list
-        for i in range( 1,  main.maxNodes + 1 ):
-            main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+        main.log.info("Creating list of ONOS cli handles")
+        for i in range(main.maxNodes):
+            main.CLIs.append( getattr( main, 'ONOScli' + str( i+1 )))
 
-        # -- INIT SECTION, ONLY RUNS ONCE -- #
+        if not main.CLIs:
+            main.log.error("Failed to create the list of ONOS cli handles")
+            main.cleanup()
+            main.exit()
+
+        main.log.info("Loading wrapper files")
         main.startUp = imp.load_source( wrapperFile1,
                                         main.dependencyPath +
                                         wrapperFile1 +
@@ -87,43 +96,26 @@
                                                     main.Mininet1.user_name,
                                                     main.Mininet1.ip_address )
 
-        if main.CLIs:
-            stepResult = main.TRUE
-        else:
-            main.log.error( "Did not properly created list of ONOS CLI handle" )
-            stepResult = main.FALSE
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully construct " +
-                                        "test variables ",
-                                 onfail="Failed to construct test variables" )
+        commit = main.ONOSbench.getVersion(report=True)
+        commit = commit.split(" ")[1]
 
         if gitPull == 'True':
-            main.step( "Building ONOS in " + gitBranch + " branch" )
-            onosBuildResult = main.startUp.onosBuild( main, gitBranch )
-            stepResult = onosBuildResult
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=stepResult,
-                                     onpass="Successfully compiled " +
-                                            "latest ONOS",
-                                     onfail="Failed to compile " +
-                                            "latest ONOS" )
+            if not main.startUp.onosBuild( main, gitBranch ):
+                main.log.error("Failed to build ONOS")
+                main.cleanup()
+                main.exit()
         else:
             main.log.warn( "Did not pull new code so skipping mvn " +
                            "clean install" )
 
-        main.case( "Starting up " + str( main.numCtrls ) +
-                   " node(s) ONOS cluster" )
-
-        # kill off all onos processes
+        main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
         main.log.info( "Safety check, killing all ONOS processes" +
                        " before initiating enviornment setup" )
 
         for i in range( main.maxNodes ):
             main.ONOSbench.onosDie( main.ONOSip[ i ] )
 
-        main.log.info( "NODE COUNT = " + str( main.numCtrls))
+        main.log.info( "NODE COUNT = %s" % main.numCtrls)
 
         tempOnosIp = []
         for i in range( main.numCtrls ):
@@ -135,42 +127,27 @@
                                        main.apps,
                                        tempOnosIp )
 
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " + \
-                                        "environment",
-                                 onfail="Failed to apply cell to environment " )
+        main.log.info( "Applying cell to environment" )
+        cell = main.ONOSbench.setCell( "temp" )
+        verify = main.ONOSbench.verifyCell()
+        if not cell or not verify:
+            main.log.error("Failed to apply cell to environment")
+            main.cleanup()
+            main.exit()
 
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
-        stepResult = packageResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        commit = main.ONOSbench.getVersion()
-        commit = commit.split(" ")[1]
+        main.log.info( "Creating ONOS package" )
+        if not main.ONOSbench.onosPackage():
+            main.log.error("Failed to create ONOS package")
+            main.cleanup()
+            main.exit()
 
         main.log.info("Creating DB file")
-        nic = main.params['DATABASE']['nic']
-        node = main.params['DATABASE']['node']
-
-        try:
-            dbFileName="/tmp/MaxIntentDB"
-            dbfile = open(dbFileName, "w+")
+        with open(main.dbFileName, "w+") as dbFile:
             temp = "'" + commit + "',"
             temp += "'" + nic + "',"
             temp += str(main.numCtrls) + ","
             temp += "'" + node + "1" + "'"
-            dbfile.write(temp)
-            dbfile.close()
-        except IOError:
-            main.log.warn("Error opening " + dbFileName + " to write results.")
+            dbFile.write(temp)
 
     def CASE1( self, main ):
         """
@@ -179,63 +156,37 @@
         - Install ONOS cluster
         - Connect to cli
         """
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
+
+        main.log.info( "Uninstalling ONOS package" )
+        main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[i] )
         for i in range( main.maxNodes ):
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
+            if not main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[i] ):
+                main.log.error("Failed to uninstall onos on node %s" % (i+1))
+                main.cleanup()
+                main.exit()
 
-        time.sleep( main.startUpSleep )
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.TRUE
+        main.log.info( "Installing ONOS package" )
         for i in range( main.numCtrls ):
-            onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
-        stepResult = onosInstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
+            if not main.ONOSbench.onosInstall( node=main.ONOSip[i] ):
+                main.log.error("Failed to install onos on node %s" % (i+1))
+                main.cleanup()
+                main.exit()
 
-        main.step( "Starting ONOS service" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onosIsUp = main.TRUE
-
+        main.log.info( "Starting ONOS service" )
         for i in range( main.numCtrls ):
-            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
-        if onosIsUp == main.TRUE:
-            main.log.report( "ONOS instance is up and ready" )
-        else:
-            main.log.report( "ONOS instance may not be up, stop and " +
-                             "start ONOS again " )
-            for i in range( main.numCtrls ):
-                stopResult = stopResult and \
-                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
-            for i in range( main.numCtrls ):
-                startResult = startResult and \
-                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
-        stepResult = onosIsUp and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="ONOS service is ready",
-                                 onfail="ONOS service did not start properly" )
+            start = main.ONOSbench.onosStart( main.ONOSip[i] )
+            isup = main.ONOSbench.isup( main.ONOSip[i] )
+            if not start or not isup:
+                main.log.error("Failed to start onos service on node %s" % (i+1))
+                main.cleanup()
+                main.exit()
 
-        main.step( "Start ONOS cli" )
-        cliResult = main.TRUE
+        main.log.info( "Starting ONOS cli" )
         for i in range( main.numCtrls ):
-            cliResult = cliResult and \
-                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
-        stepResult = cliResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully start ONOS cli",
-                                 onfail="Failed to start ONOS cli" )
+            if not main.CLIs[i].startOnosCli( main.ONOSip[i] ):
+                main.log.error("Failed to start onos cli on node %s" % (i+1))
+                main.cleanup()
+                main.exit()
 
     def CASE10( self, main ):
         """
@@ -245,49 +196,36 @@
         import pexpect
 
         # Activate apps
-        main.log.step("Activating apps")
-        stepResult = main.CLIs[0].activateApp('org.onosproject.null')
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully activated null-provider",
-                                 onfail="Failed to activate null-provider")
+        main.log.info("Activating null-provider")
+        appStatus = main.CLIs[0].activateApp('org.onosproject.null')
+        if not appStatus:
+            main.log.error("Failed to activate null-provider")
 
         # Setup the null-provider
-        main.log.step("Configuring null-provider")
-        stepResult = main.FALSE
-        for i in range(3):
-            main.ONOSbench.onosCfgSet( main.ONOSip[0],
-                                                    'org.onosproject.provider.nil.NullProviders',
-                                                    'deviceCount 3' )
-            main.ONOSbench.onosCfgSet( main.ONOSip[0],
-                                                    'org.onosproject.provider.nil.NullProviders',
-                                                    'topoShape reroute' )
-            main.ONOSbench.onosCfgSet( main.ONOSip[0],
-                                                    'org.onosproject.provider.nil.NullProviders',
-                                                    'enabled true' )
-            # give onos some time to settle
-            time.sleep(main.startUpSleep)
-            jsonSum = json.loads(main.CLIs[0].summary())
-            if jsonSum['devices'] == 3 and jsonSum['SCC(s)'] == 1:
-                stepResult = main.TRUE
-                break
-        utilities.assert_equals( expect=stepResult,
-                                     actual=stepResult,
-                                     onpass="Successfully configured the null-provider",
-                                     onfail="Failed to configure the null-provider")
+        main.log.info("Configuring null-provider")
+        cfgStatus = main.ONOSbench.onosCfgSet( main.ONOSip[0],
+                'org.onosproject.provider.nil.NullProviders', 'deviceCount 3' )
+        cfgStatus = cfgStatus and main.ONOSbench.onosCfgSet( main.ONOSip[0],
+                'org.onosproject.provider.nil.NullProviders', 'topoShape reroute' )
+        cfgStatus = cfgStatus and main.ONOSbench.onosCfgSet( main.ONOSip[0],
+                'org.onosproject.provider.nil.NullProviders', 'enabled true' )
 
+        if not cfgStatus:
+            main.log.error("Failed to configure null-provider")
 
-        main.log.step("Get default flows")
-        jsonSum = json.loads(main.CLIs[0].summary())
+        # give onos some time to settle
+        time.sleep(main.startUpSleep)
 
-        # flows installed by the null-provider
-        main.defaultFlows = jsonSum["flows"]
+        main.defaultFlows = 0
         main.ingress =  ":0000000000000001/3"
         main.egress = ":0000000000000003/2"
         main.switch = "null"
         main.linkUpCmd = "null-link null:0000000000000001/3 null:0000000000000003/1 up"
         main.linkDownCmd = "null-link null:0000000000000001/3 null:0000000000000003/1 down"
 
+        if not appStatus or not cfgStatus:
+            main.setupSkipped = True
+
     def CASE11( self, main ):
         '''
             Setting up mininet
@@ -295,37 +233,33 @@
         import json
         import time
 
-        # Activate apps
-        main.log.step("Activating apps")
-        stepResult = main.CLIs[0].activateApp('org.onosproject.openflow')
+        main.log.step("Activating openflow")
+        appStatus = main.CLIs[0].activateApp('org.onosproject.openflow')
+        if appStatus:
+            main.log.error("Failed to activate openflow")
 
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully activated openflow",
-                                 onfail="Failed to activate openflow")
-        # give onos some time settle
         time.sleep(main.startUpSleep)
 
-        main.log.step('Starting mininet topology')
-        main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
-        main.Mininet1.assignSwController(sw='s1', ip=main.ONOSip[0])
-        main.Mininet1.assignSwController(sw='s2', ip=main.ONOSip[0])
-        main.Mininet1.assignSwController(sw='s3', ip=main.ONOSip[0])
+        main.log.info('Starting mininet topology')
+        mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py')
+        if mnStatus:
+            main.log.error("Failed to start mininet")
+
+        main.log.info("Assinging masters to switches")
+        swStatus =  main.Mininet1.assignSwController(sw='s1', ip=main.ONOSip[0])
+        swStatus = swStatus and  main.Mininet1.assignSwController(sw='s2', ip=main.ONOSip[0])
+        swStatus = swStatus and main.Mininet1.assignSwController(sw='s3', ip=main.ONOSip[0])
+        if not swStatus:
+            main.log.info("Failed to assign masters to switches")
+
         time.sleep(main.startUpSleep)
 
         jsonSum = json.loads(main.CLIs[0].summary())
-        if jsonSum['devices'] == 3 and jsonSum['SCC(s)'] == 1:
-            stepResult = main.TRUE
+        sumStatus = (jsonSum['devices'] == 3 and jsonSum['SCC(s)'] == 1)
 
-        utilities.assert_equals( expect=stepResult,
-                                     actual=stepResult,
-                                     onpass="Successfully assigned switches to their master",
-                                     onfail="Failed to assign switches")
-
-        main.log.step("Get default flows")
+        main.log.step("Getting default flows")
         jsonSum = json.loads(main.CLIs[0].summary())
 
-        # flows installed by the null-provider
         main.defaultFlows = jsonSum["flows"]
         main.ingress =  ":0000000000000001/3"
         main.egress = ":0000000000000003/2"
@@ -333,12 +267,20 @@
         main.linkDownCmd = 'link s1 s3 down'
         main.linkUpCmd = 'link s1 s3 up'
 
+        if not appStatus or not mnStatus or not swStatus or not sumStatus:
+            main.setupSkipped = True
 
     def CASE20( self, main ):
         import pexpect
         '''
             Pushing intents
         '''
+
+        # check if the setup case has been skipped
+        if main.setupSkipped:
+            main.setupSkipped = False
+            main.skipCase()
+
         # the index where the next intents will be installed
         offset = 0
         # the number of intents we expect to be in the installed state
@@ -354,77 +296,52 @@
 
         for i in range(limit):
             # Push intents
-            main.log.step("Pushing intents")
-            stepResult = main.intentFunctions.pushIntents( main,
-                                                           main.switch,
-                                                           main.ingress,
-                                                           main.egress,
-                                                           main.batchSize,
-                                                           offset,
-                                                           sleep=main.installSleep,
-                                                           timeout=main.timeout,
-                                                           options="-i" )
-            utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully pushed intents",
-                                 onfail="Failed to push intents")
-            if stepResult == main.FALSE:
-                break
+            main.log.info("Pushing intents")
+            main.intentFunctions.pushIntents( main,
+                                              main.switch,
+                                              main.ingress,
+                                              main.egress,
+                                              main.batchSize,
+                                              offset,
+                                              sleep=main.installSleep,
+                                              timeout=main.timeout,
+                                              options="-i" )
 
             offset += main.batchSize
             expectedIntents = offset
             expectedFlows += main.batchSize*2
 
+            main.log.info("Grabbing number of installed intents and flows")
             maxIntents = main.intentFunctions.getIntents( main )
             maxFlows = main.intentFunctions.getFlows( main )
 
             if offset >= main.minIntents and offset % main.checkInterval == 0 or expectedIntents == main.maxIntents:
                 # Verifying intents
-                main.log.step("Verifying intents")
-                main.log.info("Expected intents: " + str(expectedIntents))
-                stepResult = main.intentFunctions.verifyIntents( main,
-                                                                 expectedIntents,
-                                                                 sleep=main.verifySleep,
-                                                                 timeout=main.timeout)
-                utilities.assert_equals( expect=main.TRUE,
-                                         actual=stepResult,
-                                         onpass="Successfully verified intents",
-                                         onfail="Failed to verify intents")
-
-                if stepResult == main.FALSE:
-                    break
-
+                main.log.info("Verifying intents\nExpected intents: " + str(expectedIntents))
+                intentStatus = main.intentFunctions.verifyIntents( main,
+                                                                   expectedIntents,
+                                                                   sleep=main.verifySleep,
+                                                                   timeout=main.timeout)
                 # Verfying flows
-                main.log.step("Verifying flows")
-                main.log.info("Expected Flows: " + str(expectedFlows))
-                stepResult = main.intentFunctions.verifyFlows( main,
+                main.log.info("Verifying flows\nExpected Flows: " + str(expectedFlows))
+                flowStatus = main.intentFunctions.verifyFlows( main,
                                                                expectedFlows,
                                                                sleep=main.verifySleep,
                                                                timeout=main.timeout)
 
-                utilities.assert_equals( expect=main.TRUE,
-                                         actual=stepResult,
-                                         onpass="Successfully verified flows",
-                                         onfail="Failed to verify flows")
-
-                if stepResult == main.FALSE:
+                if not flowStatus or not intentsStataus:
+                    main.log.error("Failed to verify")
                     break
 
-        main.log.report("Done pushing intents")
         main.log.info("Summary: Intents=" + str(expectedIntents) + " Flows=" + str(expectedFlows))
         main.log.info("Installed intents: " + str(maxIntents) +
                       " Added flows: " + str(maxFlows))
 
         main.log.info("Writing results to DB file")
-        try:
-            dbFileName="/tmp/MaxIntentDB"
-            dbfile = open(dbFileName, "a")
+        with open(dbFileName, "a") as dbFile:
             temp = "," + str(maxIntents)
             temp += "," + str(maxFlows)
-            dbfile.write(temp)
-            dbfile.close()
-        except IOError:
-            main.log.warn("Error opening " + dbFileName + " to write results.")
+            dbFile.write(temp)
 
         # Stopping mininet
         if main.switch == "of":
@@ -437,6 +354,12 @@
         '''
             Reroute
         '''
+
+        # check if the setup case has been skipped
+        if main.setupSkipped:
+            main.setupSkipped = False
+            main.skipCase()
+
         # the index where the next intents will be installed
         offset = 0
         # the number of intents we expect to be in the installed state
@@ -452,59 +375,41 @@
 
         for i in range(limit):
             # Push intents
-            main.log.step("Pushing intents")
-            stepResult = main.intentFunctions.pushIntents( main,
-                                                           main.switch,
-                                                           main.ingress,
-                                                           main.egress,
-                                                           main.batchSize,
-                                                           offset,
-                                                           sleep=main.installSleep,
-                                                           options="-i",
-                                                           timeout=main.timeout )
-            utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully pushed intents",
-                                 onfail="Failed to push intents")
-            if stepResult == main.FALSE:
-                break
-
-            maxIntents = main.intentFunctions.getIntents( main )
-            maxFlows = main.intentFunctions.getFlows( main )
+            main.log.info("Pushing intents")
+            main.intentFunctions.pushIntents( main,
+                                              main.switch,
+                                              main.ingress,
+                                              main.egress,
+                                              main.batchSize,
+                                              offset,
+                                              sleep=main.installSleep,
+                                              timeout=main.timeout,
+                                              options="-i" )
 
             offset += main.batchSize
             expectedIntents = offset
             expectedFlows += main.batchSize*2
 
+            main.log.info("Grabbing number of installed intents and flows")
+            maxIntents = main.intentFunctions.getIntents( main )
+            maxFlows = main.intentFunctions.getFlows( main )
+
             # Verifying intents
-            main.log.step("Verifying intents")
-            main.log.info("Expected intents: " + str(expectedIntents))
-            stepResult = main.intentFunctions.verifyIntents( main,
-                                                             expectedIntents,
-                                                             sleep=main.verifySleep,
-                                                             timeout=main.timeout )
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=stepResult,
-                                     onpass="Successfully verified intents",
-                                     onfail="Failed to verify intents")
-
-            if stepResult == main.FALSE:
-                break
-
+            main.log.info("Verifying intents\n\tExpected intents: " + str(expectedIntents))
+            intentStatus = main.intentFunctions.verifyIntents( main,
+                                                               expectedIntents,
+                                                               sleep=main.verifySleep,
+                                                               timeout=main.timeout)
             # Verfying flows
-            main.log.step("Verifying flows")
-            main.log.info("Expected Flows: " + str(expectedFlows))
-            stepResult = main.intentFunctions.verifyFlows( main,
+            main.log.info("Verifying flows\n\tExpected Flows: " + str(expectedFlows))
+            flowStatus = main.intentFunctions.verifyFlows( main,
                                                            expectedFlows,
                                                            sleep=main.verifySleep,
-                                                           timeout=main.timeout )
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=stepResult,
-                                     onpass="Successfully verified flows",
-                                     onfail="Failed to verify flows")
+                                                           timeout=main.timeout)
 
-            if stepResult == main.FALSE:
-                break
+            if not flowStatus or not intentsStataus:
+                main.log.error("Failed to verify\n\tSkipping case")
+                main.log.skipCase()
 
             # tear down a link
             main.log.step("Tearing down link")
@@ -516,28 +421,27 @@
                 main.log.info("Sending: " + main.linkDownCmd)
                 main.CLIs[0].handle.sendline(main.linkDownCmd)
                 main.CLIs[0].handle.expect('onos>')
+
             time.sleep(main.rerouteSleep)
 
             # rerouting adds a 1000 flows
             expectedFlows += 1000
 
+            main.log.info("Grabbing number of added flows")
+            maxFlows = main.intentFunctions.getFlows( main )
+
             # Verfying flows
-            main.log.step("Verifying flows")
-            main.log.info("Expected Flows: " + str(expectedFlows))
-            stepResult = main.intentFunctions.verifyFlows( main,
+            main.log.info("Verifying flows\n\tExpected Flows: " + str(expectedFlows))
+            flowStatus = main.intentFunctions.verifyFlows( main,
                                                            expectedFlows,
                                                            sleep=main.verifySleep,
                                                            timeout=main.timeout)
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=stepResult,
-                                     onpass="Successfully verified flows",
-                                     onfail="Failed to verify flows")
-
-            if stepResult == main.FALSE:
-                break
+            if not flowStatus:
+                main.log.error("Failed to verify flows\n\tSkipping case")
+                main.skipCase()
 
             # Bring link back up
-            main.log.step("Tearing down link")
+            main.log.step("Bringing link back up")
             if main.switch == "of":
                 main.log.info("Sending: " + main.linkUpCmd)
                 main.Mininet1.handle.sendline(main.linkUpCmd)
@@ -546,22 +450,17 @@
                 main.log.info("Sending: " + main.linkUpCmd)
                 main.CLIs[0].handle.sendline(main.linkUpCmd)
                 main.CLIs[0].handle.expect('onos>')
+
             time.sleep(main.rerouteSleep)
 
-        main.log.report("Done pushing intents")
         main.log.info("Summary: Intents=" + str(expectedIntents) + " Flows=" + str(expectedFlows))
         main.log.info("Installed intents: " + str(maxIntents) +
                       " Added flows: " + str(maxFlows))
 
-        try:
-            dbFileName="/tmp/MaxIntentDB"
-            dbfile = open(dbFileName, "a")
+        with open(main.dbFileName, "a") as dbFile:
             temp = "," + str(maxIntents)
             temp += "," + str(maxFlows)
-            dbfile.write(temp)
-            dbfile.close()
-        except IOError:
-            main.log.warn("Error opening " + dbFileName + " to write results.")
+            dbFile.write(temp)
 
         # Stopping mininet
         if main.switch == "of":
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/Functions.py b/TestON/tests/USECASE_SdnipI2/Dependency/Functions.py
new file mode 100644
index 0000000..1b93f49
--- /dev/null
+++ b/TestON/tests/USECASE_SdnipI2/Dependency/Functions.py
@@ -0,0 +1,143 @@
+
+def checkRouteNum( main, routeNumExpected ):
+    main.step( "Check routes installed" )
+    main.log.info( "Route number expected:" )
+    main.log.info( routeNumExpected )
+    main.log.info( "Route number from ONOS CLI:" )
+
+    routeNumActual = main.ONOScli.ipv4RouteNumber()
+    main.log.info( routeNumActual )
+    utilities.assertEquals( \
+        expect = routeNumExpected, actual = routeNumActual,
+        onpass = "***Route number is correct!***",
+        onfail = "***Route number is wrong!***" )
+
+def checkM2SintentNum( main, intentNumExpected ):
+    main.step( "Check M2S intents installed" )
+    main.log.info( "Intent number expected:" )
+    main.log.info( intentNumExpected )
+    main.log.info( "Intent number from ONOS CLI:" )
+    jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                       TYPE = "multiPointToSinglePoint" )
+    intentNumActual = jsonResult['installed']
+    main.log.info( intentNumActual )
+    utilities.assertEquals( \
+        expect = intentNumExpected, actual = intentNumActual,
+        onpass = "***M2S intent number is correct!***",
+        onfail = "***M2S intent number is wrong!***" )
+
+def checkP2PintentNum( main, intentNumExpected ):
+    main.step( "Check P2P intents installed" )
+    main.log.info( "Intent number expected:" )
+    main.log.info( intentNumExpected )
+    main.log.info( "Intent number from ONOS CLI:" )
+    jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                       TYPE = "pointToPoint" )
+    intentNumActual = jsonResult['installed']
+    main.log.info( intentNumActual )
+    utilities.assertEquals( \
+        expect = intentNumExpected, actual = intentNumActual,
+        onpass = "***P2P intent number is correct!***",
+        onfail = "***P2P intent number is wrong!***" )
+
+def checkFlowNum( main, switch, flowNumExpected ):
+    main.step( "Check flow entry number in " + switch )
+    main.log.info( "Flow number expected:" )
+    main.log.info( flowNumExpected )
+    main.log.info( "Flow number actual:" )
+    flowNumActual = main.Mininet.getSwitchFlowCount( switch )
+    main.log.info( flowNumActual )
+    utilities.assertEquals( \
+        expect = flowNumExpected, actual = flowNumActual,
+        onpass = "***Flow number in " + switch + " is correct!***",
+        onfail = "***Flow number in " + switch + " is wrong!***" )
+
+
+def pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True ):
+    """
+    Carry out ping test between each BGP speaker and peer pair
+    Optional argument:
+        * speakers - BGP speakers
+        * peers - BGP peers
+        * expectAllSuccess - boolean indicating if you expect all results
+        succeed if True, otherwise expect all results fail if False
+    """
+    if len( speakers ) == 0:
+        main.log.error( "Parameter speakers can not be empty." )
+        main.clearUp()
+        main.exit()
+    if len( peers ) == 0:
+        main.log.error( "Parameter speakers can not be empty." )
+        main.clearUp()
+        main.exit()
+
+    if expectAllSuccess:
+        main.step( "Check ping between BGP peers and speakers, expect all tests\
+        will SUCCEED" )
+    else:
+        main.step( "Check ping between BGP peers and speakers, expect all tests\
+        will FAIL" )
+
+    result = True
+    if expectAllSuccess:
+        for speaker in speakers:
+            for peer in peers:
+                tmpResult = main.Mininet.pingHost( src = speaker,
+                                                   target = peer )
+                result = result and ( tmpResult == main.TRUE )
+    else:
+        for speaker in speakers:
+            for peer in peers:
+                tmpResult = main.Mininet.pingHost( src = speaker,
+                                                   target = peer )
+
+    utilities.assert_equals( expect = True, actual = result,
+                             onpass = "Ping test results are expected",
+                             onfail = "Ping test results are Not expected" )
+
+    if result == False:
+        main.clearUp()
+        main.exit()
+
+
+def pingHostToHost( main, hosts = ["host64514", "host64515", "host64516"],
+                expectAllSuccess = True ):
+    """
+    Carry out ping test between each BGP host pair
+    Optional argument:
+        * hosts - hosts behind BGP peer routers
+        * expectAllSuccess - boolean indicating if you expect all results
+        succeed if True, otherwise expect all results fail if False
+    """
+    main.step( "Check ping between each host pair" )
+    if len( hosts ) == 0:
+        main.log.error( "Parameter hosts can not be empty." )
+        main.clearUp()
+        main.exit()
+
+    result = True
+    if expectAllSuccess:
+        for srcHost in hosts:
+            for targetHost in hosts:
+                if srcHost != targetHost:
+                    tmpResult = main.Mininet.pingHost( src = srcHost,
+                                                       target = targetHost )
+                    result = result and ( tmpResult == main.TRUE )
+    else:
+        for srcHost in hosts:
+            for targetHost in hosts:
+                if srcHost != targetHost:
+                    tmpResult = main.Mininet.pingHost( src = srcHost,
+                                                       target = targetHost )
+                    result = result and ( tmpResult == main.FALSE )
+
+    utilities.assert_equals( expect = True, actual = result,
+                             onpass = "Ping test results are expected",
+                             onfail = "Ping test results are Not expected" )
+
+    if result == False:
+        main.cleanup()
+        main.exit()
+
diff --git a/TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py b/TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py
index d2d7eca..30b7b25 100755
--- a/TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py
+++ b/TestON/tests/USECASE_SdnipI2/Dependency/USECASE_SdnipI2MN.py
@@ -25,6 +25,7 @@
 
 QUAGGA_DIR = '/usr/lib/quagga'
 QUAGGA_RUN_DIR = '/usr/local/var/run/quagga'
+QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipI2/Dependency/'
 onos1IP = '10.128.4.52'
 numSw = 39
 
@@ -239,6 +240,7 @@
 
 def startquagga( host, num, config_file ):
     info( '*** Starting Quagga on %s\n' % host )
+    host.cmd( "cd %s" % QUAGGA_CONFIG_DIR )
     zebra_cmd = \
     '%s/zebra -d -f  ./zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid'\
      % ( QUAGGA_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num )
@@ -380,5 +382,5 @@
     net.stop()
 
 if __name__ == '__main__':
-    # setLogLevel( 'debug' )
+    setLogLevel( 'debug' )
     sdn1net()
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
index e94f1c3..1575799 100644
--- a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
+++ b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.params
@@ -1,6 +1,6 @@
 <PARAMS>
 
-    <testcases>100, 101, 1, 4</testcases>
+    <testcases>100, 101, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10</testcases>
 
     #Environment variables
     <ENV>
@@ -27,6 +27,7 @@
     <DEPENDENCY>
         <path>/USECASE_SdnipI2/Dependency/</path>
         <topology>USECASE_SdnipI2MN.py</topology>
+        <wrapper1>Functions</wrapper1>
     </DEPENDENCY>
 
     <config>
diff --git a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
index 740304f..ebc4545 100644
--- a/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
+++ b/TestON/tests/USECASE_SdnipI2/USECASE_SdnipI2.py
@@ -11,6 +11,7 @@
             Start mininet
         """
         import os
+        import imp
         main.log.case( "Start Mininet topology" )
         main.dependencyPath = main.testDir + \
                               main.params[ 'DEPENDENCY' ][ 'path' ]
@@ -49,6 +50,7 @@
         main.case( "Setting up test environment" )
 
         cellName = main.params[ 'ENV' ][ 'cellName' ]
+        global ONOS1Ip
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
 
         main.step( "Applying cell variable to environment" )
@@ -123,23 +125,29 @@
         time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
 
 
+    def CASE102( self, main ):
+        '''
+        This test case is to load the methods from other Python files.
+        '''
+        main.case( "Loading the methods from other Python file" )
+        # load the methods from other file
+        wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+        main.Functions = imp.load_source( wrapperFile,
+                                          main.dependencyPath +
+                                          wrapperFile +
+                                          ".py" )
+
+
     def CASE1( self, main ):
         '''
         ping test from 3 bgp peers to BGP speaker
         '''
+
         main.case( "This case is to check ping between BGP peers and speakers" )
-        result1 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
-        result2 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
-        result3 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
 
-        caseResult = result1 and result2 and result3
-        utilities.assert_equals( expect = main.TRUE, actual = caseResult,
-                                 onpass = "Speaker1 ping peers successful",
-                                 onfail = "Speaker1 ping peers NOT successful" )
-
-        if caseResult == main.FALSE:
-            main.cleanup()
-            main.exit()
 
     def CASE2( self, main ):
         '''
@@ -210,3 +218,335 @@
             onfail = "***MultiPointToSinglePoint Intent Num in SDN-IP is \
             wrong!***" )
 
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "***Flow status is correct!***",
+            onfail = "***Flow status is wrong!***" )
+
+
+    def CASE4( self, main ):
+        '''
+        Ping test in data plane for each route
+        '''
+        main.case( "This case is to check ping for each route, \
+        all hosts behind BGP peers" )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE5( self, main ):
+        '''
+        Cut links to peers one by one, check routes/intents
+        '''
+        import time
+        main.case( "This case is to bring down links and check routes/intents" )
+        main.step( "Bring down the link between sw32 and peer64514" )
+        result = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
+                                    OPTION = "down" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+        else:
+            main.log.info( "Bring down link failed!!!" )
+            main.exit();
+
+        main.step( "Bring down the link between sw8 and peer64515" )
+        result = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
+                                    OPTION = "down" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 1 )
+            main.Functions.checkM2SintentNum( main, 1 )
+        else:
+            main.log.info( "Bring down link failed!!!" )
+            main.exit();
+
+        main.step( "Bring down the link between sw28 and peer64516" )
+        result = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
+                                    OPTION = "down" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 0 )
+            main.Functions.checkM2SintentNum( main, 0 )
+        else:
+            main.log.info( "Bring down link failed!!!" )
+            main.exit();
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "***Flow status is correct!***",
+            onfail = "***Flow status is wrong!***" )
+
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = False )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = False )
+
+
+    def CASE6( self, main ):
+        '''
+        Recover links to peers one by one, check routes/intents
+        '''
+        import time
+        main.case( "This case is to bring up links and check routes/intents" )
+        main.step( "Bring up the link between sw32 and peer64514" )
+        result = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
+                                    OPTION = "up" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 1 )
+            main.Functions.checkM2SintentNum( main, 1 )
+        else:
+            main.log.info( "Bring up link failed!!!" )
+            main.exit();
+
+        main.step( "Bring up the link between sw8 and peer64515" )
+        result = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
+                                    OPTION = "up" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+        else:
+            main.log.info( "Bring up link failed!!!" )
+            main.exit();
+
+        main.step( "Bring up the link between sw28 and peer64516" )
+        result = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
+                                    OPTION = "up" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+        else:
+            main.log.info( "Bring up link failed!!!" )
+            main.exit();
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "***Flow status is correct!***",
+            onfail = "***Flow status is wrong!***" )
+
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE7( self, main ):
+        '''
+        Shut down a edge switch, check P-2-P and M-2-S intents, ping test
+        '''
+        import time
+        main.case( "This case is to stop 1 edge switch,\
+        check P-2-P and M-2-S intents, ping test" )
+        main.step( "Stop sw32" )
+        result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 2 )
+            main.Functions.checkM2SintentNum( main, 2 )
+            main.Functions.checkP2PintentNum( main, 12 )
+        else:
+            main.log.info( "Stop switch failed!!!" )
+            main.exit();
+
+        main.step( "Check ping between hosts behind BGP peers" )
+        result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" )
+        result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" )
+        result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" )
+
+        pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \
+                                                and ( result3 == main.FALSE )
+        utilities.assert_equals( expect = True, actual = pingResult1,
+                                 onpass = "Ping test result is correct",
+                                 onfail = "Ping test result is wrong" )
+
+        if pingResult1 == False:
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check ping between BGP peers and speakers" )
+        result4 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
+        result5 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
+        result6 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
+
+        pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \
+                                                and ( result6 == main.TRUE )
+        utilities.assert_equals( expect = True, actual = pingResult2,
+                                 onpass = "Speaker1 ping peers successful",
+                                 onfail = "Speaker1 ping peers NOT successful" )
+
+        if pingResult2 == False:
+            main.cleanup()
+            main.exit()
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "***Flow status is correct!***",
+            onfail = "***Flow status is wrong!***" )
+
+        '''
+        main.step( "Stop sw8" )
+        result = main.Mininet.switch( SW = "sw8", OPTION = "stop" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 1 )
+
+            # Note: there should be 0 M2S intent, not 1.
+            main.Functions.checkM2SintentNum( main, 0 )
+            main.Functions.checkP2PintentNum( main, 6 )
+        else:
+            main.log.info( "Stop switch failed!!!" )
+            main.exit();
+
+        main.step( "Stop sw28" )
+        result = main.Mininet.switch( SW = "sw28", OPTION = "stop" )
+        if result == main.TRUE:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 0 )
+            main.Functions.checkM2SintentNum( main, 0 )
+            main.Functions.checkP2PintentNum( main, 0 )
+        else:
+            main.log.info( "Stop switch failed!!!" )
+            main.exit();
+        '''
+
+
+    def CASE8( self, main ):
+        '''
+        Bring up the edge switch which was shut down in CASE7,
+        check P-2-P and M-2-S intents, ping test
+        '''
+        import time
+        main.case( "This case is to start the switch which was shut down in CASE7,\
+        check P-2-P and M-2-S intents, ping test" )
+        main.step( "Start sw32" )
+        result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
+        result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
+
+        if result1 and result2:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 )
+        else:
+            main.log.info( "Start switch failed!!!" )
+            main.cleanup()
+            main.exit();
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "***Flow status is correct!***",
+            onfail = "***Flow status is wrong!***" )
+
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE9( self, main ):
+        '''
+        Bring down a switch in best path, check:
+        route number, P2P intent number, M2S intent number, ping test
+        '''
+        main.case( "This case is to stop switch in best path, \
+        check route number, P2P intent number, M2S intent number, ping test" )
+
+        main.step( "Check the flow status before stopping sw11" )
+        main.Functions.checkFlowNum( main, "sw11", 13 )
+        main.Functions.checkFlowNum( main, "sw1", 3 )
+        main.Functions.checkFlowNum( main, "sw7", 3 )
+        main.log.info( main.Mininet.checkFlows( "sw11" ) )
+        main.log.info( main.Mininet.checkFlows( "sw1" ) )
+        main.log.info( main.Mininet.checkFlows( "sw7" ) )
+
+        main.step( "Stop sw11" )
+        result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
+        if result:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 )
+        else:
+            main.log.info( "Stop switch failed!!!" )
+            main.cleanup()
+            main.exit();
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "***Flow status is correct!***",
+            onfail = "***Flow status is wrong!***" )
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )
+
+
+    def CASE10( self, main ):
+        '''
+        Bring up the switch which was stopped in CASE9, check:
+        route number, P2P intent number, M2S intent number, ping test
+        '''
+        main.case( "This case is to start switch which was stopped in CASE9, \
+        check route number, P2P intent number, M2S intent number, ping test" )
+        main.step( "Start sw11" )
+        result = main.Mininet.switch( SW = "sw11", OPTION = "start" )
+        if result:
+            time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
+            main.Functions.checkRouteNum( main, 3 )
+            main.Functions.checkM2SintentNum( main, 3 )
+            main.Functions.checkP2PintentNum( main, 18 )
+
+            main.step( "Check the flow status after stop and start sw11" )
+            main.Functions.checkFlowNum( main, "sw11", 3 )
+            main.Functions.checkFlowNum( main, "sw1", 11 )
+            main.Functions.checkFlowNum( main, "sw7", 5 )
+            main.log.info( main.Mininet.checkFlows( "sw11" ) )
+            main.log.info( main.Mininet.checkFlows( "sw1" ) )
+            main.log.info( main.Mininet.checkFlows( "sw7" ) )
+        else:
+            main.log.info( "Start switch failed!!!" )
+            main.cleanup()
+            main.exit();
+
+        main.step( "Check whether all flow status are ADDED" )
+        utilities.assertEquals( \
+            expect = main.TRUE,
+            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
+            onpass = "***Flow status is correct!***",
+            onfail = "***Flow status is wrong!***" )
+        # Ping test
+        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
+                       peers = ["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess = True )
+        main.Functions.pingHostToHost( main,
+                        hosts = ["host64514", "host64515", "host64516"],
+                        expectAllSuccess = True )