diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 2b37186..6c36394 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -711,6 +711,7 @@
                                 "=" + "\"" + arg + "\"" + "\n" )
                 tempCount = tempCount + 1
 
+            cellFile.write( "export OCI=$OC1" )
             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..b6be81a 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 )
diff --git a/TestON/tests/HAclusterRestart/HAclusterRestart.params b/TestON/tests/HAclusterRestart/HAclusterRestart.params
index 627bec2..0f37220 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.params
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.params
@@ -40,7 +40,7 @@
         <port7>6633</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..f7eceb3 100644
--- a/TestON/tests/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HAclusterRestart/HAclusterRestart.py
@@ -1717,6 +1717,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()
@@ -2694,7 +2699,8 @@
         main.Mininet2.stopTcpdump()
 
         testname = main.TEST
-        if main.params[ 'BACKUP' ] == "True":
+        main.log.error( main.params[ 'BACKUP' ][ 'ENABLED' ] )
+        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' ]
@@ -2707,36 +2713,38 @@
             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( "\$" )
+                                                    main.logdir + "/" +
+                                                    node.name + "-" + f )
+                    main.ONOSbench.handle.expect( "\$ " )
+                    print main.ONOSbench.handle.before
 
             # 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( "\$" )
+                                                    main.logdir + "/" +
+                                                    node.name + "-" + f )
+                    main.ONOSbench.handle.expect( "\$ " )
+                    print main.ONOSbench.handle.before
             # sleep so scp can finish
             time.sleep( 10 )
-            main.step( "Packing and rotating pcap archives" )
-            os.system( "~/TestON/dependencies/rotate.sh " + str( testname ) )
+            # main.step( "Packing and rotating pcap archives" )
+            # os.system( "~/TestON/dependencies/rotate.sh " + str( testname ) )
+        else:
+            main.log.debug( "skipping saving log files" )
 
         main.step( "Stopping Mininet" )
         mnResult = main.Mininet1.stopNet()
@@ -2746,9 +2754,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/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 a4231d9..7c999f8 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":
