Merge "Fixes and improvements to intent, link and pingall checking functions"
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 54e7d0f..a34741a 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -181,7 +181,7 @@
                     main.log.info(
                         "Starting Mininet from topo file " +
                         topoFile )
-                    cmdString += topoFile + " "
+                    cmdString +=  "-E python " + topoFile + " "
                     if args is None:
                         args = ''
                         # TODO: allow use of args from .topo file?
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index b55f98a..9dee93e 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -671,7 +671,7 @@
             main.exit()
 
     def createCellFile( self, benchIp, fileName, mnIpAddrs,
-                        appString, onosIpAddrs ):
+                        appString, onosIpAddrs, onosUser="sdn" ):
         """
         Creates a cell file based on arguments
         Required:
@@ -683,6 +683,8 @@
                   supported currently
             * ONOS IP addresses ( onosIpAddrs )
                 - Must be passed in as last arguments
+            * ONOS USER (onosUser)
+                - optional argument to set ONOS_USER environment variable
 
         NOTE: Assumes cells are located at:
             ~/<self.home>/tools/test/cells/
@@ -702,6 +704,8 @@
         # Note that you  may not want certain apps listed
         # on here.
         appString = "export ONOS_APPS=" + appString
+        onosGroup = "export ONOS_GROUP=" + onosUser
+        onosUser = "export ONOS_USER=" + onosUser
         mnString = "export OCN="
         if mnIpAddrs == "":
             mnString = ""
@@ -734,6 +738,8 @@
             cellFile.write( "export OCI=$OC1\n" )
             cellFile.write( mnString + "\"" + mnIpAddrs + "\"\n" )
             cellFile.write( appString + "\n" )
+            cellFile.write( onosGroup + "\n" )
+            cellFile.write( onosUser + "\n" )
             cellFile.close()
 
             # We use os.system to send the command to TestON cluster
@@ -936,6 +942,8 @@
             i = self.handle.expect( [ "Network\sis\sunreachable",
                                       "onos\sstart/running,\sprocess",
                                       "ONOS\sis\salready\sinstalled",
+                                      "already\sup-to-date",
+                                      "\$",
                                       pexpect.TIMEOUT ], timeout=60 )
             if i == 0:
                 main.log.warn( "Network is unreachable" )
@@ -953,6 +961,13 @@
                 self.handle.expect( "\$" )
                 return main.TRUE
             elif i == 3:
+                main.log.info( "ONOS is already installed on " + node )
+                self.handle.expect( "\$" )
+                return main.TRUE
+            elif i == 4:
+                main.log.info( "ONOS was installed on " + node )
+                return main.TRUE
+            elif i == 5:
                 main.log.info(
                     "Installation of ONOS on " +
                     node +
@@ -982,16 +997,22 @@
             i = self.handle.expect( [
                 "Job\sis\salready\srunning",
                 "start/running",
+                "\$",
                 "Unknown\sinstance",
                 pexpect.TIMEOUT ], timeout=120 )
-            self.handle.expect( "\$" )
             if i == 0:
+                self.handle.expect( "\$" )
                 main.log.info( "Service is already running" )
                 return main.TRUE
             elif i == 1:
+                self.handle.expect( "\$" )
+                main.log.info( "ONOS service started" )
+                return main.TRUE
+            elif i == 2:
                 main.log.info( "ONOS service started" )
                 return main.TRUE
             else:
+                self.handle.expect( "\$" )
                 main.log.error( "ONOS service failed to start" )
                 main.cleanup()
                 main.exit()
@@ -1019,18 +1040,24 @@
                 "stop/waiting",
                 "Could not resolve hostname",
                 "Unknown\sinstance",
+                "\$",
                 pexpect.TIMEOUT ], timeout=60 )
-            self.handle.expect( "\$" )
             if i == 0:
+                self.handle.expect( "\$" )
                 main.log.info( "ONOS service stopped" )
                 return main.TRUE
             elif i == 1:
+                self.handle.expect( "\$" )
                 main.log.info( "onosStop() Unknown ONOS instance specified: " +
                                str( nodeIp ) )
                 return main.FALSE
             elif i == 2:
+                self.handle.expect( "\$" )
                 main.log.warn( "ONOS wasn't running" )
                 return main.TRUE
+            elif i == 3:
+                main.log.info( "ONOS service stopped" )
+                return main.TRUE
             else:
                 main.log.error( "ONOS service failed to stop" )
                 return main.FALSE
@@ -1663,13 +1690,15 @@
                                   " status" )
             i = self.handle.expect( [
                 "start/running",
+                "Running ...",
                 "stop/waiting",
+                "Not Running ...",
                 pexpect.TIMEOUT ], timeout=120 )
 
-            if i == 0:
+            if i == 0 or i == 1:
                 main.log.info( "ONOS is running" )
                 return main.TRUE
-            elif i == 1:
+            elif i == 2 or i == 3:
                 main.log.info( "ONOS is stopped" )
                 main.log.error( "ONOS service failed to check the status" )
                 main.cleanup()
diff --git a/TestON/tests/SCPFhostLat/README b/TestON/tests/SCPFhostLat/README
new file mode 100644
index 0000000..d0ff2d7
--- /dev/null
+++ b/TestON/tests/SCPFhostLat/README
@@ -0,0 +1,12 @@
+Host LATENCY
+
+Summary: This is a performance test suite to measure the time it takes ONOS
+        to recognize a host going up and down.
+
+Pre-requisites: To run out-of-the box this test requires 7 NODES.
+    OC1->OC7 must be set before initiating the test. Passwordless login
+    must be set from TestStation "admin" root user. The 7 NODES must have
+    their clocks synced to TestStation via ptpd and be accurate to the
+    millisecond. You will also need the Wireshark disector to see openflow packets.
+
+NOTE: Only scale sizes 1,3,5 and 7 will be functional
diff --git a/TestON/tests/SCPFhostLat/SCPFhostLat.params b/TestON/tests/SCPFhostLat/SCPFhostLat.params
new file mode 100644
index 0000000..390304e
--- /dev/null
+++ b/TestON/tests/SCPFhostLat/SCPFhostLat.params
@@ -0,0 +1,52 @@
+<PARAMS>
+    <testcases>0,1,2,11,20,1,2,11,20,1,2,11,20,1,2,11,20</testcases>
+
+    <SCALE>1,3,5,7</SCALE>
+
+    <ENV>
+        <cellName>topo_perf_test</cellName>
+        <cellApps>drivers,metrics,openflow</cellApps>
+    </ENV>
+
+    <DEPENDENCY>
+        <path>/tests/SCPFhostLat/Dependency/</path>
+        <topology>topo-perf-1h1s.py</topology>
+    </DEPENDENCY>
+
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+
+    <CTRL>
+        <port>6653</port>
+    </CTRL>
+
+    <SLEEP>
+        <startup>10</startup>
+        <install>10</install>
+        <measurement>5</measurement>
+        <timeout>10</timeout>
+    </SLEEP>
+
+    <TSHARK>
+        <tsharkPath>/tmp/hostLatTshark</tsharkPath>
+        <tsharkPacketIn>OF 1.3 150 of_packet_in</tsharkPacketIn>
+    </TSHARK>
+
+    <TEST>
+        # Number of times to iterate each case
+        <numIter>25</numIter>
+        # Number of iterations to ignore initially( warm up )
+        <iterIgnore>5</iterIgnore>
+        <singleSwThreshold>0,1000</singleSwThreshold>
+        <hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
+    </TEST>
+
+    <DATABASE>
+        <file>/tmp/HostAddLatency</file>
+        <nic>1gig</nic>
+        <node>baremetal</node>
+    </DATABASE>
+
+</PARAMS>
diff --git a/TestON/tests/SCPFhostLat/SCPFhostLat.py b/TestON/tests/SCPFhostLat/SCPFhostLat.py
new file mode 100644
index 0000000..c24b6a7
--- /dev/null
+++ b/TestON/tests/SCPFhostLat/SCPFhostLat.py
@@ -0,0 +1,355 @@
+"""
+    SCPFhostLat
+    This test will test the host found latency.
+    Host will arping a ip address, tshark will caputure the package time, then compare with the topology event timestamp.
+    Test will run with 1 node from start, and scale up to 7 nodes.
+    The event timestamp will only greb the latest one, then calculate average and standar dev.
+
+    yunpeng@onlab.us
+"""
+class SCPFhostLat:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE0( self, main):
+        import sys
+        import json
+        import time
+        import os
+        import imp
+
+        main.case( "Constructing test variables and building ONOS package" )
+        main.step( "Constructing test variables" )
+        stepResult = main.FALSE
+
+        # Test variables
+        main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
+        main.cellName = main.params[ 'ENV' ][ 'cellName' ]
+        main.apps = main.params[ 'ENV' ][ 'cellApps' ]
+        main.scale = ( main.params[ 'SCALE' ] ).split( "," )
+        main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
+        main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+        main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
+        main.measurementSleep = int( main.params['SLEEP']['measurement'])
+        main.timeout = int( main.params['SLEEP']['timeout'] )
+        main.dbFileName = main.params['DATABASE']['file']
+        main.cellData = {} # for creating cell file
+
+        # Tshark params
+        main.tsharkResultPath = main.params['TSHARK']['tsharkPath']
+        main.tsharkPacketIn = main.params['TSHARK']['tsharkPacketIn']
+
+        main.numlter = main.params['TEST']['numIter']
+        main.iterIgnore = int(main.params['TEST']['iterIgnore'])
+        main.hostTimestampKey = main.params['TEST']['hostTimestamp']
+        main.thresholdStr = main.params['TEST']['singleSwThreshold']
+        main.thresholdObj = main.thresholdStr.split(',')
+        main.thresholdMin = int(main.thresholdObj[0])
+        main.thresholdMax = int(main.thresholdObj[1])
+        main.threadID = 0
+
+        main.CLIs = []
+        main.ONOSip = []
+        main.maxNumBatch = 0
+        main.ONOSip = main.ONOSbench.getOnosIps()
+        main.log.info(main.ONOSip)
+        main.setupSkipped = False
+
+        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']
+        stepResult = main.TRUE
+
+        main.log.info("Cresting DB file")
+        with open(main.dbFileName, "w+") as dbFile:
+            dbFile.write("")
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="environment set up successfull",
+                                 onfail="environment set up Failed" )
+
+    def CASE1( self ):
+        # main.scale[ 0 ] determines the current number of ONOS controller
+        main.CLIs = []
+        main.numCtrls = int( main.scale[ 0 ] )
+        main.log.info( "Creating list of ONOS cli handles" )
+        for i in range(main.numCtrls):
+            main.CLIs.append( getattr( main, 'ONOScli%s' % (i+1) ) )
+
+        main.log.info(main.CLIs)
+        if not main.CLIs:
+            main.log.error( "Failed to create the list of ONOS cli handles" )
+            main.cleanup()
+            main.exit()
+
+        main.commit = main.ONOSbench.getVersion(report=True)
+        main.commit = main.commit.split(" ")[1]
+
+        if gitPull == 'True':
+            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" )
+        with open(main.dbFileName, "a") as dbFile:
+            temp = "'" + main.commit + "',"
+            temp += "'" + nic + "',"
+            dbFile.write(temp)
+            dbFile.close()
+
+    def CASE2( self, main ):
+        """
+        - Uninstall ONOS cluster
+        - Verify ONOS start up
+        - Install ONOS cluster
+        - Connect to cli
+        """
+        main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls)
+        main.log.info( "Safety check, killing all ONOS processes" +
+                       " before initiating environment setup" )
+
+        for i in range( main.numCtrls ):
+            main.ONOSbench.onosDie( main.ONOSip[ i ] )
+
+        main.log.info( "NODE COUNT = %s" % main.numCtrls)
+
+        tempOnosIp = []
+        for i in range( main.numCtrls ):
+            tempOnosIp.append( main.ONOSip[i] )
+
+        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
+                                       "temp",
+                                       main.Mininet1.ip_address,
+                                       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.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" )
+
+        main.step( "Uninstall ONOS package on all Nodes" )
+        uninstallResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            main.log.info( "Uninstalling package on ONOS Node IP: " + main.ONOSip[i] )
+            u_result = main.ONOSbench.onosUninstall( main.ONOSip[i] )
+            utilities.assert_equals( expect=main.TRUE, actual=u_result,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+            uninstallResult = ( uninstallResult and u_result )
+
+        main.step( "Install ONOS package on all Nodes" )
+        installResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            main.log.info( "Installing package on ONOS Node IP: " + main.ONOSip[i] )
+            i_result = main.ONOSbench.onosInstall( node=main.ONOSip[i] )
+            utilities.assert_equals( expect=main.TRUE, actual=i_result,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+            installResult = installResult and i_result
+        time.sleep( main.startUpSleep )
+        main.step( "Verify ONOS nodes UP status" )
+        statusResult = main.TRUE
+        for i in range( int( main.numCtrls ) ):
+            main.log.info( "ONOS Node " + main.ONOSip[i] + " status:" )
+            onos_status = main.ONOSbench.onosStatus( node=main.ONOSip[i] )
+            utilities.assert_equals( expect=main.TRUE, actual=onos_status,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+            statusResult = ( statusResult and onos_status )
+
+        main.step( "Start ONOS CLI on all nodes" )
+        cliResult = main.TRUE
+        main.log.step(" Start ONOS cli using thread ")
+        time.sleep( main.startUpSleep )
+        startCliResult  = main.TRUE
+        pool = []
+
+        for i in range( int( main.numCtrls) ):
+            t = main.Thread( target=main.CLIs[i].startOnosCli,
+                             threadID=main.threadID,
+                             name="startOnosCli",
+                             args=[ main.ONOSip[i] ],
+                             kwargs = {"onosStartTimeout":main.timeout} )
+            pool.append(t)
+            t.start()
+            main.threadID = main.threadID + 1
+        for t in pool:
+            t.join()
+            startCliResult = startCliResult and t.result
+        time.sleep( main.startUpSleep )
+
+    def CASE11( self, main ):
+        main.log.info( "set and configure Application" )
+        import json
+        import time
+        time.sleep(main.startUpSleep)
+        main.step( "Activating org.onosproject.proxyarp" )
+        appStatus = utilities.retry( main.ONOSrest1.activateApp,
+                                     main.FALSE,
+                                     ['org.onosproject.proxyarp'],
+                                     sleep=3,
+                                     attempts=3 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=appStatus,
+                                 onpass="Successfully activated proxyarp",
+                                 onfail="Failed to activated proxyarp")
+
+        main.step( "Set up Default Topology Provider" )
+        appStatus = main.TRUE
+        configName = 'org.onosproject.net.topology.impl.DefaultTopologyProvider'
+        configParam = 'maxEvents'
+        appStatus = appStatus and main.CLIs[0].setCfg(  configName, configParam,'1' )
+        configParam = 'maxBatchMs'
+        appStatus = appStatus and main.CLIs[0].setCfg( configName, configParam, '0')
+        configParam = 'maxIdleMs'
+        appStatus = appStatus and main.CLIs[0].setCfg( configName, configParam,'0' )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=appStatus,
+                                 onpass="Successfully set DefaultTopologyProvider",
+                                 onfail="Failed to set DefaultTopologyProvider" )
+
+        time.sleep(main.startUpSleep)
+        main.step('Starting mininet topology')
+        mnStatus = main.Mininet1.startNet(args='--topo=linear,1')
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=mnStatus,
+                                 onpass="Successfully started Mininet",
+                                 onfail="Failed to activate Mininet" )
+        main.step("Assinging masters to switches")
+        switches = main.Mininet1.getSwitches()
+        swStatus = main.Mininet1.assignSwController( sw=switches.keys(), ip=main.ONOSip[0] )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=swStatus,
+                                 onpass="Successfully assigned switches to masters",
+                                 onfail="Failed assign switches to masters" )
+
+        time.sleep(main.startUpSleep)
+
+    def CASE20(self, main):
+        """
+        host1 send arping package and measure latency
+
+        There are only 1 levels of latency measurements to this test:
+        1 ) ARPING-to-device measurement: Measurement the time from host1
+        send apring package to onos processing the host event
+
+        """
+        import time
+        import subprocess
+        import json
+        import requests
+        import os
+        import numpy
+
+        # Host adding measurement
+        assertion = main.TRUE
+
+        main.log.report('Latency of adding one host to ONOS')
+        main.log.report('First ' + str(main.iterIgnore) + ' iterations ignored' + ' for jvm warmup time')
+        main.log.report('Total iterations of test: ' + str(main.numlter))
+
+        addingHostTime = []
+        metricsResultList = []
+        for i in range(0, int(main.numlter)):
+            main.log.info('Clean up data file')
+            with open(main.tsharkResultPath, "w") as dbFile:
+                dbFile.write("")
+
+            main.log.info('Starting tshark capture')
+            main.ONOSbench.tsharkGrep(main.tsharkPacketIn, main.tsharkResultPath)
+            time.sleep(main.measurementSleep)
+
+            main.log.info('host 1 arping...')
+            main.Mininet1.arping(srcHost='h1', dstHost='10.0.0.2')
+
+            time.sleep(main.measurementSleep)
+
+            main.log.info('Stopping all Tshark processes')
+            main.ONOSbench.tsharkStop()
+
+            time.sleep(main.measurementSleep)
+
+            # Get tshark output
+            with open(main.tsharkResultPath, "r") as resultFile:
+                resultText = resultFile.readline()
+                main.log.info('Capture result:' + resultText)
+                resultText = resultText.split(' ')
+                if len(resultText) > 1:
+                    tsharkResultTime = float(resultText[1]) * 1000.0
+                else:
+                    main.log.error('Tshark output file for packet_in' + ' returned unexpected results')
+                    hostTime = 0
+                    caseResult = main.FALSE
+                resultFile.close()
+            # Compare the timestemps, and get the lowest one.
+            temp = 0;
+            # Get host event timestamps from each nodes
+            for node in range (0, main.numCtrls):
+                metricsResult = json.loads(main.CLIs[node].topologyEventsMetrics())
+                metricsResult = metricsResult.get(main.hostTimestampKey).get("value")
+                main.log.info("ONOS topology event matrics timestemp: {}".format(str(metricsResult)) )
+
+                if temp < metricsResult:
+                    temp = metricsResult
+                metricsResult = temp
+
+            addingHostTime.append(float(metricsResult) - tsharkResultTime)
+            main.log.info("Result of this iteration: {}".format( str( float(metricsResult) - tsharkResultTime) ))
+            # gethost to remove
+            gethost = main.ONOSrest1.hosts()
+            HosttoRemove = []
+            HosttoRemove.append( json.loads( gethost[1:len(gethost)-1] ).get('id') )
+            main.CLIs[0].removeHost(HosttoRemove)
+
+        main.log.info("Result List: {}".format(addingHostTime))
+
+        # calculate average latency from each nodes
+        averageResult = numpy.average(addingHostTime)
+        main.log.info("Average Latency: {}".format(averageResult))
+
+        # calculate std
+        stdResult = numpy.std(addingHostTime)
+        main.log.info("std: {}".format(stdResult))
+
+        # write to DB file
+        main.log.info("Writing results to DS file")
+        with open(main.dbFileName, "a") as dbFile:
+            # Scale number
+            temp = str(main.numCtrls)
+            temp += ",'" + "baremetal1" + "'"
+            # average latency
+            temp += "," + str( averageResult )
+            # std of latency
+            temp += "," + str(stdResult)
+            temp += "\n"
+            dbFile.write( temp )
+
+        assertion = main.TRUE
+
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+                onpass='Host latency test successful',
+                onfail='Host latency test failed')
+
+        main.Mininet1.stopNet()
+        del main.scale[0]
diff --git a/TestON/tests/SCPFhostLat/SCPFhostLat.topo b/TestON/tests/SCPFhostLat/SCPFhostLat.topo
new file mode 100644
index 0000000..0b81b6e
--- /dev/null
+++ b/TestON/tests/SCPFhostLat/SCPFhostLat.topo
@@ -0,0 +1,112 @@
+<TOPOLOGY>
+
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS>
+                <home>~/onos</home>
+                <nodes>7</nodes> 
+            </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+        <ONOScli2>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+        <ONOScli3>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+        <ONOScli4>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli4>
+
+        <ONOScli5>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli5>
+
+        <ONOScli6>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli6>
+
+        <ONOScli7>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli7>
+
+        <ONOS1>
+            <host>OC1</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <Mininet1>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>16</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </Mininet1>
+
+        <ONOSrest1>
+            <host>OC1</host>
+            <port>8181</port>
+            <user>onos</user>
+            <password>rocks</password>
+            <type>OnosRestDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENT>
+            </COMPONENT>
+        </ONOSrest1>
+
+    </COMPONENT>
+
+</TOPOLOGY>
diff --git a/TestON/tests/SCPFhostLat/__init__.py b/TestON/tests/SCPFhostLat/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/SCPFhostLat/__init__.py
diff --git a/TestON/tests/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPFscaleTopo/SCPFscaleTopo.py
index 68b040f..830fbf2 100644
--- a/TestON/tests/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPFscaleTopo/SCPFscaleTopo.py
@@ -341,7 +341,7 @@
 
     def CASE100( self, main ):
         '''
-            Balance masters, ping and bring third ONOS node down
+           Bring Down node 3 
         '''
 
         main.case("Balancing Masters and bring ONOS node 3 down: TORUS %sx%s" % (main.currScale, main.currScale))
@@ -360,7 +360,10 @@
         main.log.info( "Removing dead node from list of active nodes" )
         main.activeNodes.pop( main.deadNode )
 
-
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully bring down node 3",
+                                 onfail="Failed to bring down node 3" )
 
     def CASE200( self, main ):
         '''
diff --git a/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
index 03d6c56..27bc5c2 100644
--- a/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
+++ b/TestON/tests/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
@@ -402,6 +402,8 @@
         offtmp = 0
         main.step( "Pushing intents" )
         stepResult = main.TRUE
+        # temp variable to contain the number of flows
+        flowsNum = 0
 
         for i in range(limit):
 
@@ -457,9 +459,8 @@
                         break
                     intentVerify = main.FALSE
                     k = k+1
-
                 if not intentVerify:
-                    # If some intents are not installed, finished this test case
+                    # If some intents are not installed, grep the previous flows list, and finished this test case
                     main.log.warn( "Some intens did not install" )
                     # We don't want to check flows if intents not installed, because onos will drop flows
                     if currFlows == 0:
@@ -471,13 +472,16 @@
                 main.log.info("Verify Flows states")
                 k = 1
                 flowsVerify = main.TRUE
-
                 while k <= main.verifyAttempts:
                     # while loop for check flows by using REST api
                     time.sleep(3)
                     temp = 0
                     flowsStateCount = []
                     flowsState = json.loads( main.ONOSrest1.flows() )
+                    main.log.info("Total flows now: {}".format(len(flowsState)))
+                    if ( flowsNum < len(flowsState) ):
+                        flowsNum = len(flowsState)
+                    print(flowsNum)
                     for f in flowsState:
                         # get PENDING_ADD flows
                         if f.get("state") == "PENDING_ADD":
@@ -531,7 +535,7 @@
 
         # we need the total intents before crash
         totalIntents = len(intentsState)
-        totalFlows = len(flowsState)
+        totalFlows = flowsNum
 
         main.log.info( "Total Intents Installed before crash: {}".format( totalIntents ) )
         main.log.info( "Total Flows ADDED before crash: {}".format( totalFlows ) )
diff --git a/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py b/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py
index ddd8c1e..428cbce 100644
--- a/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py
+++ b/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py
@@ -1,11 +1,16 @@
 
 def checkRouteNum( main, routeNumExpected ):
+    import time
     main.step( "Check routes installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Route number expected:" )
     main.log.info( routeNumExpected )
     main.log.info( "Route number from ONOS CLI:" )
 
     routeNumActual = main.ONOScli.ipv4RouteNumber()
+    if routeNumActual != routeNumExpected:
+        time.sleep( wait )
+        routeNumActual = main.ONOScli.ipv4RouteNumber()
     main.log.info( routeNumActual )
     utilities.assertEquals( \
         expect = routeNumExpected, actual = routeNumActual,
@@ -13,13 +18,20 @@
         onfail = "Route number is wrong!" )
 
 def checkM2SintentNum( main, intentNumExpected ):
+    import time
     main.step( "Check M2S intents installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     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']
+    if intentNumActual != intentNumExpected:
+        time.sleep( wait )
+        jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                           TYPE = "multiPointToSinglePoint" )
+        intentNumActual = jsonResult['installed']
     main.log.info( intentNumActual )
     utilities.assertEquals( \
         expect = intentNumExpected, actual = intentNumActual,
@@ -27,13 +39,21 @@
         onfail = "M2S intent number is wrong!" )
 
 def checkP2PintentNum( main, intentNumExpected ):
+    import time
     main.step( "Check P2P intents installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     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']
+
+    if intentNumActual != intentNumExpected:
+        time.sleep( wait )
+        jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                           TYPE = "pointToPoint" )
+        intentNumActual = jsonResult['installed']
     main.log.info( intentNumActual )
     utilities.assertEquals( \
         expect = intentNumExpected, actual = intentNumActual,
@@ -41,11 +61,16 @@
         onfail = "P2P intent number is wrong!" )
 
 def checkFlowNum( main, switch, flowNumExpected ):
+    import time
     main.step( "Check flow entry number in " + switch )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Flow number expected:" )
     main.log.info( flowNumExpected )
     main.log.info( "Flow number actual:" )
     flowNumActual = main.Mininet.getSwitchFlowCount( switch )
+    if flowNumActual != flowNumExpected :
+        time.sleep( wait )
+        flowNumActual = main.Mininet.getSwitchFlowCount( switch )
     main.log.info( flowNumActual )
     utilities.assertEquals( \
         expect = flowNumExpected, actual = flowNumActual,
@@ -109,7 +134,8 @@
         * 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" )
+    main.step( "Check ping between each host pair, expect all to succede=" +
+               str( expectAllSuccess ) )
     if len( hosts ) == 0:
         main.log.error( "Parameter hosts can not be empty." )
         main.cleanup()
diff --git a/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.params b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.params
index a7a8f72..404aa10 100644
--- a/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.params
+++ b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.params
@@ -1,10 +1,11 @@
 <PARAMS>
 
-    <testcases>100, 101, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10</testcases>
+    <testcases>101, 100, 200, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10</testcases>
 
     #Environment variables
     <ENV>
-        <cellName>sdnip_single_instance</cellName>
+        <cellName>sdnip_single</cellName>
+        <appString>drivers,openflow,proxyarp</appString>
     </ENV>
 
     <CTRL>
@@ -13,16 +14,6 @@
         <port1>6653</port1>
     </CTRL>
 
-    <GIT>
-        <branch1>master</branch1>
-        <branch2>onos-1.3</branch2>
-    </GIT>
-
-    <JSON>
-        <prefix>prefix</prefix>
-        <nextHop>nextHop</nextHop>
-    </JSON>
-
     <DEPENDENCY>
         <path>/USECASE_SdnipFunction/Dependency/</path>
         <topology>USECASE_SdnipI2MN.py</topology>
diff --git a/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py
index ee0b120..8e601a3 100644
--- a/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py
+++ b/TestON/tests/USECASE_SdnipFunction/USECASE_SdnipFunction.py
@@ -5,7 +5,6 @@
         self.default = ''
         global branchName
 
-    # This case is to setup Mininet testbed
     def CASE100( self, main ):
         """
             Start mininet
@@ -19,11 +18,11 @@
 
         main.step( "Starting Mininet Topology" )
         topology = main.dependencyPath + main.topology
-        topoResult = main.Mininet.startNet( topoFile = topology )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = topoResult,
-                                 onpass = "Successfully loaded topology",
-                                 onfail = "Failed to load topology" )
+        topoResult = main.Mininet.startNet( topoFile=topology )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=topoResult,
+                                 onpass="Successfully loaded topology",
+                                 onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
             main.cleanup()
@@ -37,11 +36,10 @@
         for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
             sw = "sw%s" % ( i )
             swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip )
-            # swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip, port = "6633" )
-        utilities.assert_equals( expect = main.TRUE,
-                             actual = swResult,
-                             onpass = "Successfully connect all switches to ONOS",
-                             onfail = "Failed to connect all switches to ONOS" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=swResult,
+                                 onpass="Successfully connect all switches to ONOS",
+                                 onfail="Failed to connect all switches to ONOS" )
         if not swResult:
             main.cleanup()
             main.exit()
@@ -53,16 +51,14 @@
 
         tunnelResult = main.TRUE
         tunnelResult = main.Mininet.node( "root", command )
-        utilities.assert_equals( expect = True,
-                             actual = ( "PasswordAuthentication" in tunnelResult ),
-                             onpass = "Created tunnel succeeded",
-                             onfail = "Create tunnel failed" )
+        utilities.assert_equals( expect=True,
+                                 actual=( "PasswordAuthentication" in tunnelResult ),
+                                 onpass="Created tunnel succeeded",
+                                 onfail="Create tunnel failed" )
         if ("PasswordAuthentication" not in tunnelResult) :
             main.cleanup()
             main.exit()
 
-
-    # This case is to setup ONOS
     def CASE101( self, main ):
         """
            Package ONOS and install it
@@ -75,123 +71,141 @@
         """
         import json
         import time
+        import os
         from operator import eq
 
-        main.case( "Setting up test environment" )
+        main.case( "Setting up ONOS environment" )
 
         cellName = main.params[ 'ENV' ][ 'cellName' ]
+        global ONOS1Ip
+        ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
+        ipList = [ ONOS1Ip ]
+
+        main.step( "Create cell file" )
+        cellAppString = main.params[ 'ENV' ][ 'appString' ]
+        main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
+                                       main.Mininet.ip_address,
+                                       cellAppString, ipList )
 
         main.step( "Applying cell variable to environment" )
         cellResult = main.ONOSbench.setCell( cellName )
-        utilities.assert_equals( expect = main.TRUE,
-                             actual = cellResult,
-                             onpass = "Set cell succeeded",
-                             onfail = "Set cell failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cellResult,
+                                 onpass="Set cell succeeded",
+                                 onfail="Set cell failed" )
 
         verifyResult = main.ONOSbench.verifyCell()
-        utilities.assert_equals( expect = main.TRUE,
-                             actual = verifyResult,
-                             onpass = "Verify cell succeeded",
-                             onfail = "Verify cell failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=verifyResult,
+                                 onpass="Verify cell succeeded",
+                                 onfail="Verify cell failed" )
 
         branchName = main.ONOSbench.getBranchName()
         main.log.report( "ONOS is on branch: " + branchName )
 
         main.log.step( "Uninstalling ONOS" )
         uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
-        utilities.assert_equals( expect = main.TRUE,
-                                actual = uninstallResult,
-                                onpass = "Uninstall ONOS succeeded",
-                                onfail = "Uninstall ONOS failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=uninstallResult,
+                                 onpass="Uninstall ONOS succeeded",
+                                 onfail="Uninstall ONOS failed" )
         '''
         main.step( "Git pull" )
         gitPullResult = main.ONOSbench.gitPull()
         main.log.info( "gitPullResult" )
         main.log.info( gitPullResult )
         gitPullResult2 = ( gitPullResult == main.TRUE ) or ( gitPullResult == 3 )
-        utilities.assert_equals( expect = True,
-                                 actual = gitPullResult2,
-                                 onpass = "Git pull ONOS succeeded",
-                                 onfail = "Git pull ONOS failed" )
+        utilities.assert_equals( expect=True,
+                                 actual=gitPullResult2,
+                                 onpass="Git pull ONOS succeeded",
+                                 onfail="Git pull ONOS failed" )
 
         main.step( "Using mvn clean install" )
         if gitPullResult == main.TRUE:
-            mciResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 )
-            utilities.assert_equals( expect = main.TRUE,
-                                     actual = mciResult,
-                                     onpass = "Maven clean install ONOS succeeded",
-                                     onfail = "Maven clean install ONOS failed" )
+            mciResult = main.ONOSbench.cleanInstall( mciTimeout=1000 )
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=mciResult,
+                                     onpass="Maven clean install ONOS succeeded",
+                                     onfail="Maven clean install ONOS failed" )
         else:
              main.log.warn( "Did not pull new code so skipping mvn " +
                             "clean install" )
              mciResult = main.TRUE
         '''
 
-        main.ONOSbench.getVersion( report = True )
+        main.ONOSbench.getVersion( report=True )
 
         main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = packageResult,
-                                 onpass = "Package ONOS succeeded",
-                                 onfail = "Package ONOS failed" )
+        packageResult = main.ONOSbench.onosPackage( opTimeout=500 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=packageResult,
+                                 onpass="Package ONOS succeeded",
+                                 onfail="Package ONOS failed" )
 
         main.step( "Installing ONOS package" )
-        onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
-                                                         node = ONOS1Ip )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = onos1InstallResult,
-                                 onpass = "Install ONOS succeeded",
-                                 onfail = "Install ONOS failed" )
+        onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                         node=ONOS1Ip )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onos1InstallResult,
+                                 onpass="Install ONOS succeeded",
+                                 onfail="Install ONOS failed" )
 
         main.step( "Checking if ONOS is up yet" )
-        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = onos1UpResult,
-                                 onpass = "ONOS is up",
-                                 onfail = "ONOS is NOT up" )
+        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onos1UpResult,
+                                 onpass="ONOS is up",
+                                 onfail="ONOS is NOT up" )
 
         main.step( "Checking if ONOS CLI is ready" )
         cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
-                commandlineTimeout = 100, onosStartTimeout = 600 )
-        utilities.assert_equals( expect = main.TRUE,
-                         actual = cliResult,
-                         onpass = "ONOS CLI is ready",
-                         onfail = "ONOS CLI is NOT ready" )
+                commandlineTimeout=100, onosStartTimeout=600 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cliResult,
+                                 onpass="ONOS CLI is ready",
+                                 onfail="ONOS CLI is not ready" )
 
-        caseResult = ( cellResult and verifyResult and
-                       packageResult and
-                       onos1InstallResult and onos1UpResult and cliResult )
+        for i in range( 10 ):
+            ready = True
+            output = main.ONOScli.summary()
+            if not output:
+                ready = False
+            if ready:
+                break
+            time.sleep( 30 )
+        utilities.assert_equals( expect=True, actual=ready,
+                                 onpass="ONOS summary command succeded",
+                                 onfail="ONOS summary command failed" )
 
-        utilities.assert_equals( expect = main.TRUE, actual = caseResult,
-                                 onpass = "ONOS startup successful",
-                                 onfail = "ONOS startup NOT successful" )
-
-        if caseResult == main.FALSE:
-            main.log.info( "ONOS startup failed!" )
+        if not ready:
+            main.log.error( "ONOS startup failed!" )
             main.cleanup()
             main.exit()
 
+    def CASE200( self, main ):
+        main.case( "Activate sdn-ip application" )
+        main.log.info( "waiting link discovery......" )
+        time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
+
         main.log.info( "Get links in the network" )
-        time.sleep( int ( main.params['timers']['TopoDiscovery'] ) )
         summaryResult = main.ONOScli.summary()
         linkNum = json.loads( summaryResult )[ "links" ]
+        listResult = main.ONOScli.links( jsonFormat=False )
+        main.log.info( listResult )
         if linkNum < 100:
-            main.log.info( "Link number is wrong!" )
-            listResult = main.ONOScli.links( jsonFormat = False )
+            main.log.error( "Link number is wrong!" )
+            time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
+            listResult = main.ONOScli.links( jsonFormat=False )
             main.log.info( listResult )
             main.cleanup()
             main.exit()
 
-        listResult = main.ONOScli.links( jsonFormat = False )
-        main.log.info( listResult )
-
         main.step( "Activate sdn-ip application" )
         activeSDNIPresult = main.ONOScli.activateApp( "org.onosproject.sdnip" )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = activeSDNIPresult,
-                                 onpass = "Activate SDN-IP succeeded",
-                                 onfail = "Activate SDN-IP failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=activeSDNIPresult,
+                                 onpass="Activate SDN-IP succeeded",
+                                 onfail="Activate SDN-IP failed" )
         if not activeSDNIPresult:
             main.log.info( "Activate SDN-IP failed!" )
             main.cleanup()
@@ -226,39 +240,45 @@
         '''
 
         main.case( "Ping tests between BGP peers and speakers" )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["peer64514", "peer64515", "peer64516"],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
 
 
     def CASE2( self, main ):
         '''
         point-to-point intents test for each BGP peer and BGP speaker pair
         '''
+        import time
         main.case( "Check point-to-point intents" )
         main.log.info( "There are %s BGP peers in total "
                        % main.params[ 'config' ][ 'peerNum' ] )
         main.step( "Check P2P intents number from ONOS CLI" )
 
-        getIntentsResult = main.ONOScli.intents( jsonFormat = True )
+        getIntentsResult = main.ONOScli.intents( jsonFormat=True )
         bgpIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
         bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
+        if bgpIntentsActualNum != bgpIntentsExpectedNum:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            bgpIntentsActualNum = \
+                main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
         main.log.info( "bgpIntentsExpected num is:" )
         main.log.info( bgpIntentsExpectedNum )
         main.log.info( "bgpIntentsActual num is:" )
         main.log.info( bgpIntentsActualNum )
         utilities.assertEquals( \
-            expect = True,
-            actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
-            onpass = "PointToPointIntent Intent Num is correct!",
-            onfail = "PointToPointIntent Intent Num is wrong!" )
+            expect=True,
+            actual=eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
+            onpass="PointToPointIntent Intent Num is correct!",
+            onfail="PointToPointIntent Intent Num is wrong!" )
 
 
     def CASE3( self, main ):
         '''
         routes and intents check to all BGP peers
         '''
+        import time
         main.case( "Check routes and M2S intents to all BGP peers" )
 
         allRoutesExpected = []
@@ -266,11 +286,16 @@
         allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
         allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
 
-        getRoutesResult = main.ONOScli.routes( jsonFormat = True )
+        getRoutesResult = main.ONOScli.routes( jsonFormat=True )
         allRoutesActual = \
             main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
         allRoutesStrExpected = str( sorted( allRoutesExpected ) )
         allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
+        if allRoutesStrActual != allRoutesStrExpected:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            allRoutesActual = \
+                main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
+            allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
 
         main.step( "Check routes installed" )
         main.log.info( "Routes expected:" )
@@ -278,32 +303,40 @@
         main.log.info( "Routes get from ONOS CLI:" )
         main.log.info( allRoutesStrActual )
         utilities.assertEquals( \
-            expect = allRoutesStrExpected, actual = allRoutesStrActual,
-            onpass = "Routes are correct!",
-            onfail = "Routes are wrong!" )
+            expect=allRoutesStrExpected, actual=allRoutesStrActual,
+            onpass="Routes are correct!",
+            onfail="Routes are wrong!" )
 
         main.step( "Check M2S intents installed" )
-        getIntentsResult = main.ONOScli.intents( jsonFormat = True )
+        getIntentsResult = main.ONOScli.intents( jsonFormat=True )
         routeIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
         routeIntentsExpectedNum = 3
+        if routeIntentsActualNum != routeIntentsExpectedNum:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            routeIntentsActualNum = \
+                main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
 
         main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
         main.log.info( routeIntentsExpectedNum )
         main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
         main.log.info( routeIntentsActualNum )
         utilities.assertEquals( \
-            expect = True,
-            actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
-            onpass = "MultiPointToSinglePoint Intent Num is correct!",
-            onfail = "MultiPointToSinglePoint Intent Num is wrong!" )
+            expect=routeIntentsExpectedNum,
+            actual=routeIntentsActualNum,
+            onpass="MultiPointToSinglePoint Intent Num is correct!",
+            onfail="MultiPointToSinglePoint Intent Num is wrong!" )
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
 
     def CASE4( self, main ):
@@ -312,8 +345,8 @@
         '''
         main.case( "Ping test for each route, all hosts behind BGP peers" )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE5( self, main ):
@@ -323,68 +356,72 @@
         import time
         main.case( "Bring down links and check routes/intents" )
         main.step( "Bring down the link between sw32 and peer64514" )
-        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult1,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="peer64514",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult1,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
 
         if linkResult1 == 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.log.error( "Bring down link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Bring down the link between sw8 and peer64515" )
-        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult2,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="peer64515",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult2,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
         if linkResult2 == 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.log.error( "Bring down link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Bring down the link between sw28 and peer64516" )
-        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult3,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="peer64516",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult3,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
         if linkResult3 == 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.log.error( "Bring down link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=False )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = False )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=False )
 
 
     def CASE6( self, main ):
@@ -394,67 +431,71 @@
         import time
         main.case( "Bring up links and check routes/intents" )
         main.step( "Bring up the link between sw32 and peer64514" )
-        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult1,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="peer64514",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult1,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult1 == 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.log.error( "Bring up link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Bring up the link between sw8 and peer64515" )
-        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult2,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="peer64515",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult2,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult2 == 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.log.error( "Bring up link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Bring up the link between sw28 and peer64516" )
-        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult3,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="peer64516",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult3,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult3 == 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.log.error( "Bring up link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE7( self, main ):
@@ -464,10 +505,10 @@
         import time
         main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
         main.step( "Stop sw32" )
-        result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
-        utilities.assertEquals( expect = main.TRUE, actual = result,
-                                onpass = "Stopping switch succeeded!",
-                                onfail = "Stopping switch failed!" )
+        result = main.Mininet.switch( SW="sw32", OPTION="stop" )
+        utilities.assertEquals( expect=main.TRUE, actual=result,
+                                onpass="Stopping switch succeeded!",
+                                onfail="Stopping switch failed!" )
 
         if result == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -475,46 +516,50 @@
             main.Functions.checkM2SintentNum( main, 2 )
             main.Functions.checkP2PintentNum( main, 12 )
         else:
-            main.log.info( "Stopping switch failed!" )
+            main.log.error( "Stopping switch failed!" )
             main.cleanup()
             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" )
+        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" )
+        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" )
+        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" )
+        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" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
 
     def CASE8( self, main ):
@@ -525,19 +570,19 @@
         import time
         main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
         main.step( "Start sw32" )
-        result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
+        result1 = main.Mininet.switch( SW="sw32", OPTION="start" )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = result1,
-            onpass = "Starting switch succeeded!",
-            onfail = "Starting switch failed!" )
+            expect=main.TRUE,
+            actual=result1,
+            onpass="Starting switch succeeded!",
+            onfail="Starting switch failed!" )
 
         result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = result2,
-            onpass = "Connect switch to ONOS succeeded!",
-            onfail = "Connect switch to ONOS failed!" )
+            expect=main.TRUE,
+            actual=result2,
+            onpass="Connect switch to ONOS succeeded!",
+            onfail="Connect switch to ONOS failed!" )
 
         if result1 and result2:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -545,24 +590,28 @@
             main.Functions.checkM2SintentNum( main, 3 )
             main.Functions.checkP2PintentNum( main, 18 )
         else:
-            main.log.info( "Starting switch failed!" )
+            main.log.error( "Starting switch failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE9( self, main ):
@@ -577,15 +626,15 @@
         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.log.debug( main.Mininet.checkFlows( "sw11" ) )
+        main.log.debug( main.Mininet.checkFlows( "sw1" ) )
+        main.log.debug( main.Mininet.checkFlows( "sw7" ) )
 
         main.step( "Stop sw11" )
-        result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
-        utilities.assertEquals( expect = main.TRUE, actual = result,
-                                onpass = "Stopping switch succeeded!",
-                                onfail = "Stopping switch failed!" )
+        result = main.Mininet.switch( SW="sw11", OPTION="stop" )
+        utilities.assertEquals( expect=main.TRUE, actual=result,
+                                onpass="Stopping switch succeeded!",
+                                onfail="Stopping switch failed!" )
         if result:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -593,23 +642,27 @@
             main.Functions.checkM2SintentNum( main, 3 )
             main.Functions.checkP2PintentNum( main, 18 )
         else:
-            main.log.info( "Stopping switch failed!" )
+            main.log.error( "Stopping switch failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE10( self, main ):
@@ -623,18 +676,18 @@
         main.log.info( "Check the flow status before starting sw11" )
         main.Functions.checkFlowNum( main, "sw1", 11 )
         main.Functions.checkFlowNum( main, "sw7", 5 )
-        main.log.info( main.Mininet.checkFlows( "sw1" ) )
-        main.log.info( main.Mininet.checkFlows( "sw7" ) )
+        main.log.debug( main.Mininet.checkFlows( "sw1" ) )
+        main.log.debug( main.Mininet.checkFlows( "sw7" ) )
 
         main.step( "Start sw11" )
-        result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" )
-        utilities.assertEquals( expect = main.TRUE, actual = result1,
-                                onpass = "Starting switch succeeded!",
-                                onfail = "Starting switch failed!" )
+        result1 = main.Mininet.switch( SW="sw11", OPTION="start" )
+        utilities.assertEquals( expect=main.TRUE, actual=result1,
+                                onpass="Starting switch succeeded!",
+                                onfail="Starting switch failed!" )
         result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip )
-        utilities.assertEquals( expect = main.TRUE, actual = result2,
-                                onpass = "Connect switch to ONOS succeeded!",
-                                onfail = "Connect switch to ONOS failed!" )
+        utilities.assertEquals( expect=main.TRUE, actual=result2,
+                                onpass="Connect switch to ONOS succeeded!",
+                                onfail="Connect switch to ONOS failed!" )
         if result1 and result2:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 3 )
@@ -645,20 +698,24 @@
             main.log.debug( main.Mininet.checkFlows( "sw1" ) )
             main.log.debug( main.Mininet.checkFlows( "sw7" ) )
         else:
-            main.log.info( "Starting switch failed!" )
+            main.log.error( "Starting switch failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/Functions.py b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/Functions.py
index 8d4007a..5f78896 100644
--- a/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/Functions.py
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/Dependency/Functions.py
@@ -1,14 +1,20 @@
 
-def checkRouteNum( main, routeNumExpected, ONOScli = "ONOScli1" ):
+def checkRouteNum( main, routeNumExpected, ONOScli="ONOScli1" ):
+    import time
     main.step( "Check routes installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Route number expected:" )
     main.log.info( routeNumExpected )
     main.log.info( "Route number from ONOS CLI:" )
 
     if ONOScli == "ONOScli1":
-        routeNumActual = main.ONOScli1.ipv4RouteNumber()
+        cli = main.ONOScli1
     else:
-        routeNumActual = main.ONOScli2.ipv4RouteNumber()
+        cli = main.ONOScli2
+    routeNumActual = cli.ipv4RouteNumber()
+    if routeNumActual != routeNumExpected:
+        time.sleep( wait )
+        routeNumActual = cli.ipv4RouteNumber()
 
     main.log.info( routeNumActual )
     utilities.assertEquals( \
@@ -17,17 +23,24 @@
         onfail = "Route number is wrong!" )
 
 def checkM2SintentNum( main, intentNumExpected, ONOScli = "ONOScli1" ):
+    import time
     main.step( "Check M2S intents installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Intent number expected:" )
     main.log.info( intentNumExpected )
     main.log.info( "Intent number from ONOS CLI:" )
     if ONOScli == "ONOScli1":
-        jsonResult = main.ONOScli1.intents( jsonFormat = True, summary = True,
-                                            TYPE = "multiPointToSinglePoint" )
+        cli = main.ONOScli1
     else:
-        jsonResult = main.ONOScli2.intents( jsonFormat = True, summary = True,
-                                            TYPE = "multiPointToSinglePoint" )
+        cli = main.ONOScli2
+    jsonResult = cli.intents( jsonFormat = True, summary = True,
+                              TYPE = "multiPointToSinglePoint" )
     intentNumActual = jsonResult['installed']
+    if intentNumActual != intentNumExpected:
+        time.sleep( wait )
+        jsonResult = cli.intents( jsonFormat = True, summary = True,
+                                  TYPE = "multiPointToSinglePoint" )
+        intentNumActual = jsonResult['installed']
     main.log.info( intentNumActual )
     utilities.assertEquals( \
         expect = intentNumExpected, actual = intentNumActual,
@@ -35,17 +48,25 @@
         onfail = "M2S intent number is wrong!" )
 
 def checkP2PintentNum( main, intentNumExpected, ONOScli = "ONOScli1" ):
+    import time
     main.step( "Check P2P intents installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Intent number expected:" )
     main.log.info( intentNumExpected )
     main.log.info( "Intent number from ONOS CLI:" )
     if ONOScli == "ONOScli1":
-        jsonResult = main.ONOScli1.intents( jsonFormat = True, summary = True,
-                                            TYPE = "pointToPoint" )
+        cli = main.ONOScli1
     else:
-        jsonResult = main.ONOScli2.intents( jsonFormat = True, summary = True,
-                                            TYPE = "pointToPoint" )
+        cli = main.ONOScli2
+    jsonResult = cli.intents( jsonFormat = True, summary = True,
+                              TYPE = "pointToPoint" )
     intentNumActual = jsonResult['installed']
+
+    if intentNumActual != intentNumExpected:
+        time.sleep( wait )
+        jsonResult = cli.intents( jsonFormat = True, summary = True,
+                                  TYPE = "pointToPoint" )
+        intentNumActual = jsonResult['installed']
     main.log.info( intentNumActual )
     utilities.assertEquals( \
         expect = intentNumExpected, actual = intentNumActual,
@@ -53,11 +74,16 @@
         onfail = "P2P intent number is wrong!" )
 
 def checkFlowNum( main, switch, flowNumExpected ):
+    import time
     main.step( "Check flow entry number in " + switch )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Flow number expected:" )
     main.log.info( flowNumExpected )
     main.log.info( "Flow number actual:" )
     flowNumActual = main.Mininet.getSwitchFlowCount( switch )
+    if flowNumActual != flowNumExpected :
+        time.sleep( wait )
+        flowNumActual = main.Mininet.getSwitchFlowCount( switch )
     main.log.info( flowNumActual )
     utilities.assertEquals( \
         expect = flowNumExpected, actual = flowNumActual,
@@ -121,7 +147,8 @@
         * 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" )
+    main.step( "Check ping between each host pair, expect all to succede=" +
+               str( expectAllSuccess ) )
     if len( hosts ) == 0:
         main.log.error( "Parameter hosts can not be empty." )
         main.cleanup()
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params
index c746f55..aef817d 100644
--- a/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.params
@@ -3,7 +3,8 @@
     <testcases>101, 100, 200, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12</testcases>
     #Environment variables
     <ENV>
-        <cellName>sdnip_multiple_instance_BM</cellName>
+        <cellName>SDNIP</cellName>
+        <appString>drivers,openflow,proxyarp</appString>
     </ENV>
 
     <CTRL>
@@ -14,16 +15,6 @@
         <port1>6653</port1>
     </CTRL>
 
-    <GIT>
-        <branch1>master</branch1>
-        <branch2>onos-1.3</branch2>
-    </GIT>
-
-    <JSON>
-        <prefix>prefix</prefix>
-        <nextHop>nextHop</nextHop>
-    </JSON>
-
     <DEPENDENCY>
         <path>/USECASE_SdnipFunctionCluster/Dependency/</path>
         <topology>USECASE_SdnipI2MN_Cluster.py</topology>
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
index 7d97c10..42b4bc8 100644
--- a/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
+++ b/TestON/tests/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
@@ -17,11 +17,11 @@
 
         main.step( "Starting Mininet Topology" )
         topology = main.dependencyPath + main.topology
-        topoResult = main.Mininet.startNet( topoFile = topology )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = topoResult,
-                                 onpass = "Successfully loaded topology",
-                                 onfail = "Failed to load topology" )
+        topoResult = main.Mininet.startNet( topoFile=topology )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=topoResult,
+                                 onpass="Successfully loaded topology",
+                                 onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
             main.cleanup()
@@ -35,10 +35,10 @@
             swResult = swResult and main.Mininet.assignSwController( sw,
                                                  [ONOS1Ip, ONOS2Ip, ONOS3Ip] )
 
-        utilities.assert_equals( expect = main.TRUE,
-                             actual = swResult,
-                             onpass = "Successfully connect all switches to ONOS",
-                             onfail = "Failed to connect all switches to ONOS" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=swResult,
+                                 onpass="Successfully connect all switches to ONOS",
+                                 onfail="Failed to connect all switches to ONOS" )
         if not swResult:
             main.cleanup()
             main.exit()
@@ -68,6 +68,7 @@
         ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
         ONOS2Ip = os.getenv( main.params[ 'CTRL' ][ 'ip2' ] )
         ONOS3Ip = os.getenv( main.params[ 'CTRL' ][ 'ip3' ] )
+        ipList = [ ONOS1Ip, ONOS2Ip, ONOS3Ip ]
 
         global peer64514
         global peer64515
@@ -76,18 +77,24 @@
         peer64515 = main.params['config']['peer64515']
         peer64516 = main.params['config']['peer64516']
 
+        main.step( "Create cell file" )
+        cellAppString = main.params[ 'ENV' ][ 'appString' ]
+        main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
+                                       main.Mininet.ip_address,
+                                       cellAppString, ipList )
+
         main.step( "Applying cell variable to environment" )
         cellResult = main.ONOSbench.setCell( cellName )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = cellResult,
-                                 onpass = "Set cell succeeded",
-                                 onfail = "Set cell failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cellResult,
+                                 onpass="Set cell succeeded",
+                                 onfail="Set cell failed" )
 
         verifyResult = main.ONOSbench.verifyCell()
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = verifyResult,
-                                 onpass = "Verify cell succeeded",
-                                 onfail = "Verify cell failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=verifyResult,
+                                 onpass="Verify cell succeeded",
+                                 onfail="Verify cell failed" )
 
         branchName = main.ONOSbench.getBranchName()
         main.log.report( "ONOS is on branch: " + branchName )
@@ -96,92 +103,105 @@
         uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip ) \
                           and main.ONOSbench.onosUninstall( ONOS2Ip ) \
                           and main.ONOSbench.onosUninstall( ONOS3Ip )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = uninstallResult,
-                                 onpass = "Uninstall ONOS from nodes succeeded",
-                                 onfail = "Uninstall ONOS form nodes failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=uninstallResult,
+                                 onpass="Uninstall ONOS from nodes succeeded",
+                                 onfail="Uninstall ONOS form nodes failed" )
 
-        main.ONOSbench.getVersion( report = True )
+        main.ONOSbench.getVersion( report=True )
 
         main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = packageResult,
-                                 onpass = "Package ONOS succeeded",
-                                 onfail = "Package ONOS failed" )
+        packageResult = main.ONOSbench.onosPackage( opTimeout=500 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=packageResult,
+                                 onpass="Package ONOS succeeded",
+                                 onfail="Package ONOS failed" )
 
         main.step( "Installing ONOS package" )
-        onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
-                                                         node = ONOS1Ip )
-        onos2InstallResult = main.ONOSbench.onosInstall( options = "-f",
-                                                         node = ONOS2Ip )
-        onos3InstallResult = main.ONOSbench.onosInstall( options = "-f",
-                                                         node = ONOS3Ip )
+        onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                         node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                         node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                         node=ONOS3Ip )
         onosInstallResult = onos1InstallResult and onos2InstallResult \
                             and onos3InstallResult
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = onosInstallResult,
-                                 onpass = "Install ONOS to nodes succeeded",
-                                 onfail = "Install ONOS to nodes failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onosInstallResult,
+                                 onpass="Install ONOS to nodes succeeded",
+                                 onfail="Install ONOS to nodes failed" )
 
         main.step( "Checking if ONOS is up yet" )
-        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
-        onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout = 420 )
-        onos3UpResult = main.ONOSbench.isup( ONOS3Ip, timeout = 420 )
+        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
+        onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout=420 )
+        onos3UpResult = main.ONOSbench.isup( ONOS3Ip, timeout=420 )
         onosUpResult = onos1UpResult and onos2UpResult and onos3UpResult
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = onos1UpResult and onosUpResult,
-                                 onpass = "ONOS nodes are up",
-                                 onfail = "ONOS nodes are NOT up" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onosUpResult,
+                                 onpass="ONOS nodes are up",
+                                 onfail="ONOS nodes are NOT up" )
 
         main.step( "Checking if ONOS CLI is ready" )
+        main.CLIs = []
         cliResult1 = main.ONOScli1.startOnosCli( ONOS1Ip,
-                commandlineTimeout = 100, onosStartTimeout = 600 )
+                commandlineTimeout=100, onosStartTimeout=600 )
+        main.CLIs.append( main.ONOScli1 )
         cliResult2 = main.ONOScli2.startOnosCli( ONOS2Ip,
-                commandlineTimeout = 100, onosStartTimeout = 600 )
-        cliResult = cliResult1 and cliResult2
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = cliResult,
-                                 onpass = "ONOS CLI (on node1) is ready",
-                                 onfail = "ONOS CLI (on node1) ready" )
+                commandlineTimeout=100, onosStartTimeout=600 )
+        main.CLIs.append( main.ONOScli2 )
+        cliResult3 = main.ONOScli3.startOnosCli( ONOS3Ip,
+                commandlineTimeout=100, onosStartTimeout=600 )
+        main.CLIs.append( main.ONOScli3 )
+        cliResult = cliResult1 and cliResult2 and cliResult3
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cliResult,
+                                 onpass="ONOS CLIs are ready",
+                                 onfail="ONOS CLIs are not ready" )
 
-        caseResult = ( cellResult and verifyResult and
-                       packageResult and
-                       onosInstallResult and onosUpResult and cliResult )
+        for i in range( 10 ):
+            ready = True
+            for cli in main.CLIs:
+                output = cli.summary()
+                if not output:
+                    ready = False
+            if ready:
+                break
+            time.sleep( 30 )
+        utilities.assert_equals( expect=True, actual=ready,
+                                 onpass="ONOS summary command succeded",
+                                 onfail="ONOS summary command failed" )
 
-        utilities.assert_equals( expect = main.TRUE, actual = caseResult,
-                                 onpass = "ONOS startup successful",
-                                 onfail = "ONOS startup NOT successful" )
-
-        if caseResult == main.FALSE:
+        if not ready:
             main.log.error( "ONOS startup failed!" )
             main.cleanup()
             main.exit()
 
-
     def CASE200( self, main ):
         main.case( "Activate sdn-ip application" )
         main.log.info( "waiting link discovery......" )
-        time.sleep( int ( main.params['timers']['TopoDiscovery'] ) )
+        time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
 
         main.log.info( "Get links in the network" )
         summaryResult = main.ONOScli1.summary()
         linkNum = json.loads( summaryResult )[ "links" ]
-        listResult = main.ONOScli1.links( jsonFormat = False )
+        listResult = main.ONOScli1.links( jsonFormat=False )
         main.log.info( listResult )
-
         if linkNum < 100:
             main.log.error( "Link number is wrong!" )
+            time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
+            listResult = main.ONOScli1.links( jsonFormat=False )
+            main.log.info( listResult )
             main.cleanup()
             main.exit()
 
         main.step( "Activate sdn-ip application" )
         activeSDNIPresult = main.ONOScli1.activateApp( "org.onosproject.sdnip" )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = activeSDNIPresult,
-                                 onpass = "Activate SDN-IP succeeded",
-                                 onfail = "Activate SDN-IP failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=activeSDNIPresult,
+                                 onpass="Activate SDN-IP succeeded",
+                                 onfail="Activate SDN-IP failed" )
         if not activeSDNIPresult:
+            main.log.info( "Activate SDN-IP failed!" )
             main.cleanup()
             main.exit()
 
@@ -211,18 +231,6 @@
         main.log.info( "Wait Quagga to finish delivery all routes to each \
         other and to sdn-ip, plus finish installing all intents..." )
         time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
-        # TODO
-        # time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
-
-        '''
-        # TODO: use for together with wrapperFile1
-        wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
-        main.USECASE_SdnipI2MN_Cluster = imp.load_source( wrapperFile2,
-                                                         main.dependencyPath +
-                                                         wrapperFile2 +
-                                                         ".py" )
-        '''
-
 
     def CASE1( self, main ):
         '''
@@ -230,42 +238,47 @@
         '''
 
         main.case( "Ping tests between BGP peers and speakers" )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["peer64514", "peer64515", "peer64516"],
-                       expectAllSuccess = True )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [peer64514, peer64515, peer64516],
-                       expectAllSuccess = True )
-
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[peer64514, peer64515, peer64516],
+                       expectAllSuccess=True )
 
     def CASE2( self, main ):
         '''
         point-to-point intents test for each BGP peer and BGP speaker pair
         '''
+        import time
         main.case( "Check point-to-point intents" )
         main.log.info( "There are %s BGP peers in total "
                        % main.params[ 'config' ][ 'peerNum' ] )
         main.step( "Check P2P intents number from ONOS CLI" )
 
-        getIntentsResult = main.ONOScli1.intents( jsonFormat = True )
+        getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
         bgpIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
         bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 * 2
+        if bgpIntentsActualNum != bgpIntentsExpectedNum:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            bgpIntentsActualNum = \
+                main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
         main.log.info( "bgpIntentsExpected num is:" )
         main.log.info( bgpIntentsExpectedNum )
         main.log.info( "bgpIntentsActual num is:" )
         main.log.info( bgpIntentsActualNum )
         utilities.assertEquals( \
-            expect = True,
-            actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
-            onpass = "PointToPointIntent Intent Num is correct!",
-            onfail = "PointToPointIntent Intent Num is wrong!" )
+            expect=True,
+            actual=eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
+            onpass="PointToPointIntent Intent Num is correct!",
+            onfail="PointToPointIntent Intent Num is wrong!" )
 
 
     def CASE3( self, main ):
         '''
         routes and intents check to all BGP peers
         '''
+        import time
         main.case( "Check routes and M2S intents to all BGP peers" )
 
         allRoutesExpected = []
@@ -273,11 +286,16 @@
         allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
         allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
 
-        getRoutesResult = main.ONOScli1.routes( jsonFormat = True )
+        getRoutesResult = main.ONOScli1.routes( jsonFormat=True )
         allRoutesActual = \
             main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
         allRoutesStrExpected = str( sorted( allRoutesExpected ) )
         allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
+        if allRoutesStrActual != allRoutesStrExpected:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            allRoutesActual = \
+                main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
+            allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
 
         main.step( "Check routes installed" )
         main.log.info( "Routes expected:" )
@@ -285,32 +303,40 @@
         main.log.info( "Routes get from ONOS CLI:" )
         main.log.info( allRoutesStrActual )
         utilities.assertEquals( \
-            expect = allRoutesStrExpected, actual = allRoutesStrActual,
-            onpass = "Routes are correct!",
-            onfail = "Routes are wrong!" )
+            expect=allRoutesStrExpected, actual=allRoutesStrActual,
+            onpass="Routes are correct!",
+            onfail="Routes are wrong!" )
 
         main.step( "Check M2S intents installed" )
-        getIntentsResult = main.ONOScli1.intents( jsonFormat = True )
+        getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
         routeIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
         routeIntentsExpectedNum = 3
+        if routeIntentsActualNum != routeIntentsExpectedNum:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            routeIntentsActualNum = \
+                main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
 
         main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
         main.log.info( routeIntentsExpectedNum )
         main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
         main.log.info( routeIntentsActualNum )
         utilities.assertEquals( \
-            expect = True,
-            actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
-            onpass = "MultiPointToSinglePoint Intent Num is correct!",
-            onfail = "MultiPointToSinglePoint Intent Num is wrong!" )
+            expect=routeIntentsExpectedNum,
+            actual=routeIntentsActualNum,
+            onpass="MultiPointToSinglePoint Intent Num is correct!",
+            onfail="MultiPointToSinglePoint Intent Num is wrong!" )
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
 
     def CASE4( self, main ):
@@ -319,8 +345,8 @@
         '''
         main.case( "Ping test for each route, all hosts behind BGP peers" )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE5( self, main ):
@@ -330,12 +356,12 @@
         import time
         main.case( "Bring down links and check routes/intents" )
         main.step( "Bring down the link between sw32 and peer64514" )
-        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult1,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="peer64514",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult1,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
 
         if linkResult1 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -347,12 +373,12 @@
             main.exit()
 
         main.step( "Bring down the link between sw8 and peer64515" )
-        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult2,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="peer64515",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult2,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
         if linkResult2 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 1 )
@@ -363,12 +389,12 @@
             main.exit()
 
         main.step( "Bring down the link between sw28 and peer64516" )
-        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult3,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="peer64516",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult3,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
         if linkResult3 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 0 )
@@ -379,19 +405,23 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=False )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = False )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=False )
 
 
     def CASE6( self, main ):
@@ -401,12 +431,12 @@
         import time
         main.case( "Bring up links and check routes/intents" )
         main.step( "Bring up the link between sw32 and peer64514" )
-        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult1,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="peer64514",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult1,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult1 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 1 )
@@ -417,12 +447,12 @@
             main.exit()
 
         main.step( "Bring up the link between sw8 and peer64515" )
-        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult2,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="peer64515",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult2,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult2 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 2 )
@@ -433,12 +463,12 @@
             main.exit()
 
         main.step( "Bring up the link between sw28 and peer64516" )
-        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult3,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="peer64516",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult3,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult3 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 3 )
@@ -449,19 +479,23 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE7( self, main ):
@@ -471,10 +505,10 @@
         import time
         main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
         main.step( "Stop sw32" )
-        result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
-        utilities.assertEquals( expect = main.TRUE, actual = result,
-                                onpass = "Stopping switch succeeded!",
-                                onfail = "Stopping switch failed!" )
+        result = main.Mininet.switch( SW="sw32", OPTION="stop" )
+        utilities.assertEquals( expect=main.TRUE, actual=result,
+                                onpass="Stopping switch succeeded!",
+                                onfail="Stopping switch failed!" )
 
         if result == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -487,30 +521,30 @@
             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" )
+        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" )
+        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 speaker1" )
-        result4 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" )
-        result5 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" )
-        result6 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" )
+        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" )
+        utilities.assert_equals( expect=True, actual=pingResult2,
+                                 onpass="Speaker1 ping peers successful",
+                                 onfail="Speaker1 ping peers NOT successful" )
 
         if pingResult2 == False:
             main.cleanup()
@@ -518,26 +552,30 @@
 
         main.step( "Check ping between BGP peers and speaker2" )
         # TODO
-        result7 = main.Mininet.pingHost( src = "speaker2", target = peer64514 )
-        result8 = main.Mininet.pingHost( src = "speaker2", target = peer64515 )
-        result9 = main.Mininet.pingHost( src = "speaker2", target = peer64516 )
+        result7 = main.Mininet.pingHost( src="speaker2", target=peer64514 )
+        result8 = main.Mininet.pingHost( src="speaker2", target=peer64515 )
+        result9 = main.Mininet.pingHost( src="speaker2", target=peer64516 )
 
         pingResult3 = ( result7 == main.FALSE ) and ( result8 == main.TRUE ) \
                                                 and ( result9 == main.TRUE )
-        utilities.assert_equals( expect = True, actual = pingResult2,
-                                 onpass = "Speaker2 ping peers successful",
-                                 onfail = "Speaker2 ping peers NOT successful" )
+        utilities.assert_equals( expect=True, actual=pingResult2,
+                                 onpass="Speaker2 ping peers successful",
+                                 onfail="Speaker2 ping peers NOT successful" )
 
         if pingResult3 == False:
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
 
     def CASE8( self, main ):
@@ -548,19 +586,19 @@
         import time
         main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
         main.step( "Start sw32" )
-        result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
+        result1 = main.Mininet.switch( SW="sw32", OPTION="start" )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = result1,
-            onpass = "Starting switch succeeded!",
-            onfail = "Starting switch failed!" )
+            expect=main.TRUE,
+            actual=result1,
+            onpass="Starting switch succeeded!",
+            onfail="Starting switch failed!" )
 
         result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = result2,
-            onpass = "Connect switch to ONOS succeeded!",
-            onfail = "Connect switch to ONOS failed!" )
+            expect=main.TRUE,
+            actual=result2,
+            onpass="Connect switch to ONOS succeeded!",
+            onfail="Connect switch to ONOS failed!" )
 
         if result1 and result2:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -573,22 +611,26 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [peer64514, peer64515, peer64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[peer64514, peer64515, peer64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE9( self, main ):
@@ -608,10 +650,10 @@
         main.log.info( main.Mininet.checkFlows( "sw7" ) )
 
         main.step( "Stop sw11" )
-        result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
-        utilities.assertEquals( expect = main.TRUE, actual = result,
-                                onpass = "Stopping switch succeeded!",
-                                onfail = "Stopping switch failed!" )
+        result = main.Mininet.switch( SW="sw11", OPTION="stop" )
+        utilities.assertEquals( expect=main.TRUE, actual=result,
+                                onpass="Stopping switch succeeded!",
+                                onfail="Stopping switch failed!" )
         if result:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -624,21 +666,25 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [peer64514, peer64515, peer64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[peer64514, peer64515, peer64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE10( self, main ):
@@ -656,14 +702,14 @@
         main.log.info( main.Mininet.checkFlows( "sw7" ) )
 
         main.step( "Start sw11" )
-        result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" )
-        utilities.assertEquals( expect = main.TRUE, actual = result1,
-                                onpass = "Starting switch succeeded!",
-                                onfail = "Starting switch failed!" )
+        result1 = main.Mininet.switch( SW="sw11", OPTION="start" )
+        utilities.assertEquals( expect=main.TRUE, actual=result1,
+                                onpass="Starting switch succeeded!",
+                                onfail="Starting switch failed!" )
         result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip )
-        utilities.assertEquals( expect = main.TRUE, actual = result2,
-                                onpass = "Connect switch to ONOS succeeded!",
-                                onfail = "Connect switch to ONOS failed!" )
+        utilities.assertEquals( expect=main.TRUE, actual=result2,
+                                onpass="Connect switch to ONOS succeeded!",
+                                onfail="Connect switch to ONOS failed!" )
         if result1 and result2:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 3 )
@@ -679,21 +725,25 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            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.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [peer64514, peer64515, peer64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[peer64514, peer64515, peer64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE11(self, main):
@@ -705,21 +755,25 @@
         main.Functions.checkM2SintentNum( main, 3 )
         main.Functions.checkP2PintentNum( main, 18 * 2 )
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["peer64514", "peer64515", "peer64516"],
-                       expectAllSuccess = True )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [peer64514, peer64515, peer64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[peer64514, peer64515, peer64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
         main.step( "Kill speaker1" )
         command1 = "ps -e | grep bgp -c"
@@ -737,10 +791,10 @@
 
         result3 = main.Mininet.node( "root", command1 )
 
-        utilities.assert_equals( expect = True,
-                                 actual = ( "4" in result3 ),
-                                 onpass = "Kill speaker1 succeeded",
-                                 onfail = "Kill speaker1 failed" )
+        utilities.assert_equals( expect=True,
+                                 actual=( "4" in result3 ),
+                                 onpass="Kill speaker1 succeeded",
+                                 onfail="Kill speaker1 failed" )
         if ( "4" not in result3 ) :
             main.log.info( result3 )
             main.cleanup()
@@ -752,23 +806,27 @@
         main.Functions.checkP2PintentNum( main, 18 * 2 )
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
         '''
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["peer64514", "peer64515", "peer64516"],
-                       expectAllSuccess = False )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=False )
         '''
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [peer64514, peer64515, peer64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[peer64514, peer64515, peer64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE12( self, main ):
@@ -794,44 +852,52 @@
         else:
             uninstallResult = main.ONOSbench.onosStop( ONOS3Ip )
 
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = uninstallResult,
-                                 onpass = "Uninstall ONOS leader succeeded",
-                                 onfail = "Uninstall ONOS leader failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=uninstallResult,
+                                 onpass="Uninstall ONOS leader succeeded",
+                                 onfail="Uninstall ONOS leader failed" )
         if uninstallResult != main.TRUE:
             main.cleanup()
             main.exit()
         time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
 
         if leaderIP == ONOS1Ip:
-            main.Functions.checkRouteNum( main, 3, ONOScli = "ONOScli2" )
-            main.Functions.checkM2SintentNum( main, 3, ONOScli = "ONOScli2" )
-            main.Functions.checkP2PintentNum( main, 18 * 2, ONOScli = "ONOScli2" )
+            main.Functions.checkRouteNum( main, 3, ONOScli="ONOScli2" )
+            main.Functions.checkM2SintentNum( main, 3, ONOScli="ONOScli2" )
+            main.Functions.checkP2PintentNum( main, 18 * 2, ONOScli="ONOScli2" )
 
             main.step( "Check whether all flow status are ADDED" )
+            flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                         main.FALSE,
+                                         kwargs={'isPENDING':False},
+                                         attempts=10 )
             utilities.assertEquals( \
-                expect = main.TRUE,
-                actual = main.ONOScli2.checkFlowsState( isPENDING_ADD = False ),
-                onpass = "Flow status is correct!",
-                onfail = "Flow status is wrong!" )
+                expect=main.TRUE,
+                actual=flowCheck,
+                onpass="Flow status is correct!",
+                onfail="Flow status is wrong!" )
         else:
             main.Functions.checkRouteNum( main, 3 )
             main.Functions.checkM2SintentNum( main, 3 )
             main.Functions.checkP2PintentNum( main, 18 * 2 )
 
             main.step( "Check whether all flow status are ADDED" )
+            flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                         main.FALSE,
+                                         kwargs={'isPENDING':False},
+                                         attempts=10 )
             utilities.assertEquals( \
-                expect = main.TRUE,
-                actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-                onpass = "Flow status is correct!",
-                onfail = "Flow status is wrong!" )
+                expect=main.TRUE,
+                actual=flowCheck,
+                onpass="Flow status is correct!",
+                onfail="Flow status is wrong!" )
 
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["peer64514", "peer64515", "peer64516"],
-                       expectAllSuccess = True )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [peer64514, peer64515, peer64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["peer64514", "peer64515", "peer64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[peer64514, peer64515, peer64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/Functions.py b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/Functions.py
index 97a432a..a3c7540 100644
--- a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/Functions.py
+++ b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/Functions.py
@@ -1,14 +1,20 @@
 
-def checkRouteNum( main, routeNumExpected, ONOScli = "ONOScli1" ):
+def checkRouteNum( main, routeNumExpected, ONOScli="ONOScli1" ):
+    import time
     main.step( "Check routes installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Route number expected:" )
     main.log.info( routeNumExpected )
     main.log.info( "Route number from ONOS CLI:" )
 
     if ONOScli == "ONOScli1":
-        routeNumActual = main.ONOScli1.ipv4RouteNumber()
+        cli = main.ONOScli1
     else:
-        routeNumActual = main.ONOScli2.ipv4RouteNumber()
+        cli = main.ONOScli2
+    routeNumActual = cli.ipv4RouteNumber()
+    if routeNumActual != routeNumExpected:
+        time.sleep( wait )
+        routeNumActual = cli.ipv4RouteNumber()
 
     main.log.info( routeNumActual )
     utilities.assertEquals( \
@@ -17,17 +23,24 @@
         onfail = "Route number is wrong!" )
 
 def checkM2SintentNum( main, intentNumExpected, ONOScli = "ONOScli1" ):
+    import time
     main.step( "Check M2S intents installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Intent number expected:" )
     main.log.info( intentNumExpected )
     main.log.info( "Intent number from ONOS CLI:" )
     if ONOScli == "ONOScli1":
-        jsonResult = main.ONOScli1.intents( jsonFormat = True, summary = True,
-                                            TYPE = "multiPointToSinglePoint" )
+        cli = main.ONOScli1
     else:
-        jsonResult = main.ONOScli2.intents( jsonFormat = True, summary = True,
-                                            TYPE = "multiPointToSinglePoint" )
+        cli = main.ONOScli2
+    jsonResult = cli.intents( jsonFormat = True, summary = True,
+                              TYPE = "multiPointToSinglePoint" )
     intentNumActual = jsonResult['installed']
+    if intentNumActual != intentNumExpected:
+        time.sleep( wait )
+        jsonResult = cli.intents( jsonFormat = True, summary = True,
+                                  TYPE = "multiPointToSinglePoint" )
+        intentNumActual = jsonResult['installed']
     main.log.info( intentNumActual )
     utilities.assertEquals( \
         expect = intentNumExpected, actual = intentNumActual,
@@ -35,17 +48,25 @@
         onfail = "M2S intent number is wrong!" )
 
 def checkP2PintentNum( main, intentNumExpected, ONOScli = "ONOScli1" ):
+    import time
     main.step( "Check P2P intents installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Intent number expected:" )
     main.log.info( intentNumExpected )
     main.log.info( "Intent number from ONOS CLI:" )
     if ONOScli == "ONOScli1":
-        jsonResult = main.ONOScli1.intents( jsonFormat = True, summary = True,
-                                            TYPE = "pointToPoint" )
+        cli = main.ONOScli1
     else:
-        jsonResult = main.ONOScli2.intents( jsonFormat = True, summary = True,
-                                            TYPE = "pointToPoint" )
+        cli = main.ONOScli2
+    jsonResult = cli.intents( jsonFormat = True, summary = True,
+                              TYPE = "pointToPoint" )
     intentNumActual = jsonResult['installed']
+
+    if intentNumActual != intentNumExpected:
+        time.sleep( wait )
+        jsonResult = cli.intents( jsonFormat = True, summary = True,
+                                  TYPE = "pointToPoint" )
+        intentNumActual = jsonResult['installed']
     main.log.info( intentNumActual )
     utilities.assertEquals( \
         expect = intentNumExpected, actual = intentNumActual,
@@ -53,11 +74,16 @@
         onfail = "P2P intent number is wrong!" )
 
 def checkFlowNum( main, switch, flowNumExpected ):
+    import time
     main.step( "Check flow entry number in " + switch )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Flow number expected:" )
     main.log.info( flowNumExpected )
     main.log.info( "Flow number actual:" )
     flowNumActual = main.Mininet.getSwitchFlowCount( switch )
+    if flowNumActual != flowNumExpected :
+        time.sleep( wait )
+        flowNumActual = main.Mininet.getSwitchFlowCount( switch )
     main.log.info( flowNumActual )
     utilities.assertEquals( \
         expect = flowNumExpected, actual = flowNumActual,
@@ -121,7 +147,8 @@
         * 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" )
+    main.step( "Check ping between each host pair, expect all to succede=" +
+               str( expectAllSuccess ) )
     if len( hosts ) == 0:
         main.log.error( "Parameter hosts can not be empty." )
         main.cleanup()
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.params b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.params
index 8124dfe..a36059e 100644
--- a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.params
+++ b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.params
@@ -2,10 +2,11 @@
 
     <testcases>101, 100, 200, 102, 1, 2, 3, 4, 7, 8, 9, 10, 11, 12</testcases>
     # case6 needs a new driver, will enable it after this new driver
-    #<testcases>101, 100, 200, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12</testcases>
+    #101, 100, 200, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
     #Environment variables
     <ENV>
-        <cellName>sdnip_multiple_instance_VM</cellName>
+        <cellName>SDNIP</cellName>
+        <appString>drivers,openflow,proxyarp</appString>
     </ENV>
 
     <CTRL>
@@ -19,16 +20,6 @@
         <port1>6653</port1>
     </CTRL>
 
-    <GIT>
-        <branch1>master</branch1>
-        <branch2>onos-1.3</branch2>
-    </GIT>
-
-    <JSON>
-        <prefix>prefix</prefix>
-        <nextHop>nextHop</nextHop>
-    </JSON>
-
     <DEPENDENCY>
         <path>/USECASE_SdnipFunctionCluster_fsfw/Dependency/</path>
         <topology>USECASE_SdnipI2MN_Cluster.py</topology>
diff --git a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
index 782110c..98c28bb 100644
--- a/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
+++ b/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
@@ -5,12 +5,10 @@
         self.default = ''
         global branchName
 
-    # This case is to setup Mininet testbed
     def CASE100( self, main ):
         """
             Start mininet
         """
-        import os
         import imp
         main.log.case( "Setup the Mininet testbed" )
         main.dependencyPath = main.testDir + \
@@ -19,11 +17,11 @@
 
         main.step( "Starting Mininet Topology" )
         topology = main.dependencyPath + main.topology
-        topoResult = main.Mininet.startNet( topoFile = topology )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = topoResult,
-                                 onpass = "Successfully loaded topology",
-                                 onfail = "Failed to load topology" )
+        topoResult = main.Mininet.startNet( topoFile=topology )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=topoResult,
+                                 onpass="Successfully loaded topology",
+                                 onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
             main.cleanup()
@@ -34,12 +32,12 @@
         for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
             sw = "sw%s" % ( i )
             swResult = swResult and main.Mininet.assignSwController( sw, fsfwIp,
-                                                                     port = fsfwPort )
+                                                                     port=fsfwPort )
 
-        utilities.assert_equals( expect = main.TRUE,
-                             actual = swResult,
-                             onpass = "Successfully connect all switches to FSFW",
-                             onfail = "Failed to connect all switches to FSFW" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=swResult,
+                                 onpass="Successfully connect all switches to FSFW",
+                                 onfail="Failed to connect all switches to FSFW" )
         if not swResult:
             main.cleanup()
             main.exit()
@@ -69,6 +67,7 @@
         ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
         ONOS2Ip = os.getenv( main.params[ 'CTRL' ][ 'ip2' ] )
         ONOS3Ip = os.getenv( main.params[ 'CTRL' ][ 'ip3' ] )
+        ipList = [ ONOS1Ip, ONOS2Ip, ONOS3Ip ]
 
         global pr64514
         global pr64515
@@ -82,18 +81,24 @@
         fsfwIp = main.params[ 'CTRL' ][ 'fsfwIp' ]
         fsfwPort = main.params[ 'CTRL' ][ 'fsfwPort' ]
 
+        main.step( "Create cell file" )
+        cellAppString = main.params[ 'ENV' ][ 'appString' ]
+        main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
+                                       main.Mininet.ip_address,
+                                       cellAppString, ipList )
+
         main.step( "Applying cell variable to environment" )
         cellResult = main.ONOSbench.setCell( cellName )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = cellResult,
-                                 onpass = "Set cell succeeded",
-                                 onfail = "Set cell failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cellResult,
+                                 onpass="Set cell succeeded",
+                                 onfail="Set cell failed" )
 
         verifyResult = main.ONOSbench.verifyCell()
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = verifyResult,
-                                 onpass = "Verify cell succeeded",
-                                 onfail = "Verify cell failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=verifyResult,
+                                 onpass="Verify cell succeeded",
+                                 onfail="Verify cell failed" )
 
         branchName = main.ONOSbench.getBranchName()
         main.log.report( "ONOS is on branch: " + branchName )
@@ -102,92 +107,105 @@
         uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip ) \
                           and main.ONOSbench.onosUninstall( ONOS2Ip ) \
                           and main.ONOSbench.onosUninstall( ONOS3Ip )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = uninstallResult,
-                                 onpass = "Uninstall ONOS from nodes succeeded",
-                                 onfail = "Uninstall ONOS form nodes failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=uninstallResult,
+                                 onpass="Uninstall ONOS from nodes succeeded",
+                                 onfail="Uninstall ONOS form nodes failed" )
 
-        main.ONOSbench.getVersion( report = True )
+        main.ONOSbench.getVersion( report=True )
 
         main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = packageResult,
-                                 onpass = "Package ONOS succeeded",
-                                 onfail = "Package ONOS failed" )
+        packageResult = main.ONOSbench.onosPackage( opTimeout=500 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=packageResult,
+                                 onpass="Package ONOS succeeded",
+                                 onfail="Package ONOS failed" )
 
         main.step( "Installing ONOS package" )
-        onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
-                                                         node = ONOS1Ip )
-        onos2InstallResult = main.ONOSbench.onosInstall( options = "-f",
-                                                         node = ONOS2Ip )
-        onos3InstallResult = main.ONOSbench.onosInstall( options = "-f",
-                                                         node = ONOS3Ip )
+        onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                         node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                         node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                         node=ONOS3Ip )
         onosInstallResult = onos1InstallResult and onos2InstallResult \
                             and onos3InstallResult
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = onosInstallResult,
-                                 onpass = "Install ONOS to nodes succeeded",
-                                 onfail = "Install ONOS to nodes failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onosInstallResult,
+                                 onpass="Install ONOS to nodes succeeded",
+                                 onfail="Install ONOS to nodes failed" )
 
         main.step( "Checking if ONOS is up yet" )
-        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
-        onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout = 420 )
-        onos3UpResult = main.ONOSbench.isup( ONOS3Ip, timeout = 420 )
+        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
+        onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout=420 )
+        onos3UpResult = main.ONOSbench.isup( ONOS3Ip, timeout=420 )
         onosUpResult = onos1UpResult and onos2UpResult and onos3UpResult
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = onos1UpResult and onosUpResult,
-                                 onpass = "ONOS nodes are up",
-                                 onfail = "ONOS nodes are NOT up" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onosUpResult,
+                                 onpass="ONOS nodes are up",
+                                 onfail="ONOS nodes are NOT up" )
 
         main.step( "Checking if ONOS CLI is ready" )
+        main.CLIs = []
         cliResult1 = main.ONOScli1.startOnosCli( ONOS1Ip,
-                commandlineTimeout = 100, onosStartTimeout = 600 )
+                commandlineTimeout=100, onosStartTimeout=600 )
+        main.CLIs.append( main.ONOScli1 )
         cliResult2 = main.ONOScli2.startOnosCli( ONOS2Ip,
-                commandlineTimeout = 100, onosStartTimeout = 600 )
-        cliResult = cliResult1 and cliResult2
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = cliResult,
-                                 onpass = "ONOS CLI (on node1) is ready",
-                                 onfail = "ONOS CLI (on node1) ready" )
+                commandlineTimeout=100, onosStartTimeout=600 )
+        main.CLIs.append( main.ONOScli2 )
+        cliResult3 = main.ONOScli3.startOnosCli( ONOS3Ip,
+                commandlineTimeout=100, onosStartTimeout=600 )
+        main.CLIs.append( main.ONOScli3 )
+        cliResult = cliResult1 and cliResult2 and cliResult3
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cliResult,
+                                 onpass="ONOS CLIs are ready",
+                                 onfail="ONOS CLIs are not ready" )
 
-        caseResult = ( cellResult and verifyResult and
-                       packageResult and
-                       onosInstallResult and onosUpResult and cliResult )
+        for i in range( 10 ):
+            ready = True
+            for cli in main.CLIs:
+                output = cli.summary()
+                if not output:
+                    ready = False
+            if ready:
+                break
+            time.sleep( 30 )
+        utilities.assert_equals( expect=True, actual=ready,
+                                 onpass="ONOS summary command succeded",
+                                 onfail="ONOS summary command failed" )
 
-        utilities.assert_equals( expect = main.TRUE, actual = caseResult,
-                                 onpass = "ONOS startup successful",
-                                 onfail = "ONOS startup NOT successful" )
-
-        if caseResult == main.FALSE:
+        if not ready:
             main.log.error( "ONOS startup failed!" )
             main.cleanup()
             main.exit()
 
-
     def CASE200( self, main ):
         main.case( "Activate sdn-ip application" )
         main.log.info( "waiting link discovery......" )
-        time.sleep( int ( main.params['timers']['TopoDiscovery'] ) )
+        time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
 
         main.log.info( "Get links in the network" )
         summaryResult = main.ONOScli1.summary()
         linkNum = json.loads( summaryResult )[ "links" ]
-        listResult = main.ONOScli1.links( jsonFormat = False )
+        listResult = main.ONOScli1.links( jsonFormat=False )
         main.log.info( listResult )
-
         if linkNum < 100:
             main.log.error( "Link number is wrong!" )
+            time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
+            listResult = main.ONOScli1.links( jsonFormat=False )
+            main.log.info( listResult )
             main.cleanup()
             main.exit()
 
         main.step( "Activate sdn-ip application" )
         activeSDNIPresult = main.ONOScli1.activateApp( "org.onosproject.sdnip" )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = activeSDNIPresult,
-                                 onpass = "Activate SDN-IP succeeded",
-                                 onfail = "Activate SDN-IP failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=activeSDNIPresult,
+                                 onpass="Activate SDN-IP succeeded",
+                                 onfail="Activate SDN-IP failed" )
         if not activeSDNIPresult:
+            main.log.info( "Activate SDN-IP failed!" )
             main.cleanup()
             main.exit()
 
@@ -217,18 +235,6 @@
         main.log.info( "Wait Quagga to finish delivery all routes to each \
         other and to sdn-ip, plus finish installing all intents..." )
         time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
-        # TODO
-        # time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
-
-        '''
-        # TODO: use for together with wrapperFile1
-        wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
-        main.USECASE_SdnipI2MN_Cluster = imp.load_source( wrapperFile2,
-                                                         main.dependencyPath +
-                                                         wrapperFile2 +
-                                                         ".py" )
-        '''
-
 
     def CASE1( self, main ):
         '''
@@ -236,42 +242,47 @@
         '''
 
         main.case( "Ping tests between BGP peers and speakers" )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [pr64514, pr64515, pr64516],
-                       expectAllSuccess = True )
-
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[pr64514, pr64515, pr64516],
+                       expectAllSuccess=True )
 
     def CASE2( self, main ):
         '''
         point-to-point intents test for each BGP peer and BGP speaker pair
         '''
+        import time
         main.case( "Check point-to-point intents" )
         main.log.info( "There are %s BGP peers in total "
                        % main.params[ 'config' ][ 'peerNum' ] )
         main.step( "Check P2P intents number from ONOS CLI" )
 
-        getIntentsResult = main.ONOScli1.intents( jsonFormat = True )
+        getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
         bgpIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
         bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 * 2
+        if bgpIntentsActualNum != bgpIntentsExpectedNum:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            bgpIntentsActualNum = \
+                main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
         main.log.info( "bgpIntentsExpected num is:" )
         main.log.info( bgpIntentsExpectedNum )
         main.log.info( "bgpIntentsActual num is:" )
         main.log.info( bgpIntentsActualNum )
         utilities.assertEquals( \
-            expect = True,
-            actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
-            onpass = "PointToPointIntent Intent Num is correct!",
-            onfail = "PointToPointIntent Intent Num is wrong!" )
+            expect=True,
+            actual=eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
+            onpass="PointToPointIntent Intent Num is correct!",
+            onfail="PointToPointIntent Intent Num is wrong!" )
 
 
     def CASE3( self, main ):
         '''
         routes and intents check to all BGP peers
         '''
+        import time
         main.case( "Check routes and M2S intents to all BGP peers" )
 
         allRoutesExpected = []
@@ -279,11 +290,16 @@
         allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
         allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
 
-        getRoutesResult = main.ONOScli1.routes( jsonFormat = True )
+        getRoutesResult = main.ONOScli1.routes( jsonFormat=True )
         allRoutesActual = \
             main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
         allRoutesStrExpected = str( sorted( allRoutesExpected ) )
         allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
+        if allRoutesStrActual != allRoutesStrExpected:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            allRoutesActual = \
+                main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
+            allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
 
         main.step( "Check routes installed" )
         main.log.info( "Routes expected:" )
@@ -291,32 +307,40 @@
         main.log.info( "Routes get from ONOS CLI:" )
         main.log.info( allRoutesStrActual )
         utilities.assertEquals( \
-            expect = allRoutesStrExpected, actual = allRoutesStrActual,
-            onpass = "Routes are correct!",
-            onfail = "Routes are wrong!" )
+            expect=allRoutesStrExpected, actual=allRoutesStrActual,
+            onpass="Routes are correct!",
+            onfail="Routes are wrong!" )
 
         main.step( "Check M2S intents installed" )
-        getIntentsResult = main.ONOScli1.intents( jsonFormat = True )
+        getIntentsResult = main.ONOScli1.intents( jsonFormat=True )
         routeIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
         routeIntentsExpectedNum = 3
+        if routeIntentsActualNum != routeIntentsExpectedNum:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            routeIntentsActualNum = \
+                main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
 
         main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
         main.log.info( routeIntentsExpectedNum )
         main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
         main.log.info( routeIntentsActualNum )
         utilities.assertEquals( \
-            expect = True,
-            actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
-            onpass = "MultiPointToSinglePoint Intent Num is correct!",
-            onfail = "MultiPointToSinglePoint Intent Num is wrong!" )
+            expect=routeIntentsExpectedNum,
+            actual=routeIntentsActualNum,
+            onpass="MultiPointToSinglePoint Intent Num is correct!",
+            onfail="MultiPointToSinglePoint Intent Num is wrong!" )
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
 
     def CASE4( self, main ):
@@ -325,8 +349,8 @@
         '''
         main.case( "Ping test for each route, all hosts behind BGP peers" )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE5( self, main ):
@@ -336,16 +360,16 @@
         import time
         main.case( "Bring down links and check routes/intents" )
         main.step( "Bring down the link between sw32 and peer64514" )
-        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "pr64514",
-                                         OPTION = "down" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="pr64514",
+                                         OPTION="down" )
         # When bring down a link, Mininet will bring down both the interfaces
         # at the two sides of the link. Here we do not want to bring down the
         # host side interface, since I noticed when bring up in CASE6, some of
         # the configuration information will lost.
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult1,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult1,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
 
         if linkResult1 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -357,12 +381,12 @@
             main.exit()
 
         main.step( "Bring down the link between sw8 and peer64515" )
-        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "pr64515",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult2,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="pr64515",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult2,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
         if linkResult2 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 1 )
@@ -373,12 +397,12 @@
             main.exit()
 
         main.step( "Bring down the link between sw28 and peer64516" )
-        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "pr64516",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult3,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="pr64516",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult3,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
         if linkResult3 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 0 )
@@ -389,19 +413,23 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = False )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=False )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = False )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=False )
 
 
     def CASE6( self, main ):
@@ -411,12 +439,12 @@
         import time
         main.case( "Bring up links and check routes/intents" )
         main.step( "Bring up the link between sw32 and peer64514" )
-        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "pr64514",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult1,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="pr64514",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult1,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult1 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 1 )
@@ -427,12 +455,12 @@
             main.exit()
 
         main.step( "Bring up the link between sw8 and peer64515" )
-        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "pr64515",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult2,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="pr64515",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult2,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult2 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 2 )
@@ -443,12 +471,12 @@
             main.exit()
 
         main.step( "Bring up the link between sw28 and peer64516" )
-        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "pr64516",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult3,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="pr64516",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult3,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult3 == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 3 )
@@ -459,19 +487,23 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE7( self, main ):
@@ -481,10 +513,10 @@
         import time
         main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
         main.step( "Stop sw32" )
-        result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
-        utilities.assertEquals( expect = main.TRUE, actual = result,
-                                onpass = "Stopping switch succeeded!",
-                                onfail = "Stopping switch failed!" )
+        result = main.Mininet.switch( SW="sw32", OPTION="stop" )
+        utilities.assertEquals( expect=main.TRUE, actual=result,
+                                onpass="Stopping switch succeeded!",
+                                onfail="Stopping switch failed!" )
 
         if result == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -497,30 +529,30 @@
             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" )
+        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" )
+        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 speaker1" )
-        result4 = main.Mininet.pingHost( src = "speaker1", target = "pr64514" )
-        result5 = main.Mininet.pingHost( src = "speaker1", target = "pr64515" )
-        result6 = main.Mininet.pingHost( src = "speaker1", target = "pr64516" )
+        result4 = main.Mininet.pingHost( src="speaker1", target="pr64514" )
+        result5 = main.Mininet.pingHost( src="speaker1", target="pr64515" )
+        result6 = main.Mininet.pingHost( src="speaker1", target="pr64516" )
 
         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" )
+        utilities.assert_equals( expect=True, actual=pingResult2,
+                                 onpass="Speaker1 ping peers successful",
+                                 onfail="Speaker1 ping peers NOT successful" )
 
         if pingResult2 == False:
             main.cleanup()
@@ -528,26 +560,30 @@
 
         main.step( "Check ping between BGP peers and speaker2" )
         # TODO
-        result7 = main.Mininet.pingHost( src = "speaker2", target = pr64514 )
-        result8 = main.Mininet.pingHost( src = "speaker2", target = pr64515 )
-        result9 = main.Mininet.pingHost( src = "speaker2", target = pr64516 )
+        result7 = main.Mininet.pingHost( src="speaker2", target=pr64514 )
+        result8 = main.Mininet.pingHost( src="speaker2", target=pr64515 )
+        result9 = main.Mininet.pingHost( src="speaker2", target=pr64516 )
 
         pingResult3 = ( result7 == main.FALSE ) and ( result8 == main.TRUE ) \
                                                 and ( result9 == main.TRUE )
-        utilities.assert_equals( expect = True, actual = pingResult2,
-                                 onpass = "Speaker2 ping peers successful",
-                                 onfail = "Speaker2 ping peers NOT successful" )
+        utilities.assert_equals( expect=True, actual=pingResult2,
+                                 onpass="Speaker2 ping peers successful",
+                                 onfail="Speaker2 ping peers NOT successful" )
 
         if pingResult3 == False:
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
 
     def CASE8( self, main ):
@@ -558,20 +594,20 @@
         import time
         main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
         main.step( "Start sw32" )
-        result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
+        result1 = main.Mininet.switch( SW="sw32", OPTION="start" )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = result1,
-            onpass = "Starting switch succeeded!",
-            onfail = "Starting switch failed!" )
+            expect=main.TRUE,
+            actual=result1,
+            onpass="Starting switch succeeded!",
+            onfail="Starting switch failed!" )
 
         result2 = main.Mininet.assignSwController( "sw32", fsfwIp,
-                                                   port = fsfwPort )
+                                                   port=fsfwPort )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = result2,
-            onpass = "Connect switch to FSFW succeeded!",
-            onfail = "Connect switch to FSFW failed!" )
+            expect=main.TRUE,
+            actual=result2,
+            onpass="Connect switch to FSFW succeeded!",
+            onfail="Connect switch to FSFW failed!" )
 
         if result1 and result2:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -584,22 +620,26 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [pr64514, pr64515, pr64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[pr64514, pr64515, pr64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE9( self, main ):
@@ -619,10 +659,10 @@
         main.log.info( main.Mininet.checkFlows( "sw7" ) )
 
         main.step( "Stop sw11" )
-        result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
-        utilities.assertEquals( expect = main.TRUE, actual = result,
-                                onpass = "Stopping switch succeeded!",
-                                onfail = "Stopping switch failed!" )
+        result = main.Mininet.switch( SW="sw11", OPTION="stop" )
+        utilities.assertEquals( expect=main.TRUE, actual=result,
+                                onpass="Stopping switch succeeded!",
+                                onfail="Stopping switch failed!" )
         if result:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -635,21 +675,25 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [pr64514, pr64515, pr64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[pr64514, pr64515, pr64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE10( self, main ):
@@ -667,15 +711,15 @@
         main.log.info( main.Mininet.checkFlows( "sw7" ) )
 
         main.step( "Start sw11" )
-        result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" )
-        utilities.assertEquals( expect = main.TRUE, actual = result1,
-                                onpass = "Starting switch succeeded!",
-                                onfail = "Starting switch failed!" )
+        result1 = main.Mininet.switch( SW="sw11", OPTION="start" )
+        utilities.assertEquals( expect=main.TRUE, actual=result1,
+                                onpass="Starting switch succeeded!",
+                                onfail="Starting switch failed!" )
         result2 = main.Mininet.assignSwController( "sw11", fsfwIp,
-                                                   port = fsfwPort )
-        utilities.assertEquals( expect = main.TRUE, actual = result2,
-                                onpass = "Connect switch to FSFW succeeded!",
-                                onfail = "Connect switch to FSFW failed!" )
+                                                   port=fsfwPort )
+        utilities.assertEquals( expect=main.TRUE, actual=result2,
+                                onpass="Connect switch to FSFW succeeded!",
+                                onfail="Connect switch to FSFW failed!" )
         if result1 and result2:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 3 )
@@ -691,21 +735,25 @@
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [pr64514, pr64515, pr64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[pr64514, pr64515, pr64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE11(self, main):
@@ -717,21 +765,25 @@
         main.Functions.checkM2SintentNum( main, 3 )
         main.Functions.checkP2PintentNum( main, 18 * 2 )
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [pr64514, pr64515, pr64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[pr64514, pr64515, pr64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
         main.step( "Kill speaker1" )
         command1 = "ps -e | grep bgp -c"
@@ -749,10 +801,10 @@
 
         result3 = main.Mininet.node( "root", command1 )
 
-        utilities.assert_equals( expect = True,
-                                 actual = ( "4" in result3 ),
-                                 onpass = "Kill speaker1 succeeded",
-                                 onfail = "Kill speaker1 failed" )
+        utilities.assert_equals( expect=True,
+                                 actual=( "4" in result3 ),
+                                 onpass="Kill speaker1 succeeded",
+                                 onfail="Kill speaker1 failed" )
         if ( "4" not in result3 ) :
             main.log.info( result3 )
             main.cleanup()
@@ -764,23 +816,27 @@
         main.Functions.checkP2PintentNum( main, 18 * 2 )
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
         '''
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = False )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=False )
         '''
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [pr64514, pr64515, pr64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[pr64514, pr64515, pr64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE12( self, main ):
@@ -806,44 +862,52 @@
         else:
             uninstallResult = main.ONOSbench.onosStop( ONOS3Ip )
 
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = uninstallResult,
-                                 onpass = "Uninstall ONOS leader succeeded",
-                                 onfail = "Uninstall ONOS leader failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=uninstallResult,
+                                 onpass="Uninstall ONOS leader succeeded",
+                                 onfail="Uninstall ONOS leader failed" )
         if uninstallResult != main.TRUE:
             main.cleanup()
             main.exit()
         time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
 
         if leaderIP == ONOS1Ip:
-            main.Functions.checkRouteNum( main, 3, ONOScli = "ONOScli2" )
-            main.Functions.checkM2SintentNum( main, 3, ONOScli = "ONOScli2" )
-            main.Functions.checkP2PintentNum( main, 18 * 2, ONOScli = "ONOScli2" )
+            main.Functions.checkRouteNum( main, 3, ONOScli="ONOScli2" )
+            main.Functions.checkM2SintentNum( main, 3, ONOScli="ONOScli2" )
+            main.Functions.checkP2PintentNum( main, 18 * 2, ONOScli="ONOScli2" )
 
             main.step( "Check whether all flow status are ADDED" )
+            flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                         main.FALSE,
+                                         kwargs={'isPENDING':False},
+                                         attempts=10 )
             utilities.assertEquals( \
-                expect = main.TRUE,
-                actual = main.ONOScli2.checkFlowsState( isPENDING_ADD = False ),
-                onpass = "Flow status is correct!",
-                onfail = "Flow status is wrong!" )
+                expect=main.TRUE,
+                actual=flowCheck,
+                onpass="Flow status is correct!",
+                onfail="Flow status is wrong!" )
         else:
             main.Functions.checkRouteNum( main, 3 )
             main.Functions.checkM2SintentNum( main, 3 )
             main.Functions.checkP2PintentNum( main, 18 * 2 )
 
             main.step( "Check whether all flow status are ADDED" )
+            flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                         main.FALSE,
+                                         kwargs={'isPENDING':False},
+                                         attempts=10 )
             utilities.assertEquals( \
-                expect = main.TRUE,
-                actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ),
-                onpass = "Flow status is correct!",
-                onfail = "Flow status is wrong!" )
+                expect=main.TRUE,
+                actual=flowCheck,
+                onpass="Flow status is correct!",
+                onfail="Flow status is wrong!" )
 
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"],
-                       peers = [pr64514, pr64515, pr64516],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker2"],
+                       peers=[pr64514, pr64515, pr64516],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/Functions.py b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/Functions.py
index d79bc76..dd0b29f 100644
--- a/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/Functions.py
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/Dependency/Functions.py
@@ -1,11 +1,16 @@
 
 def checkRouteNum( main, routeNumExpected ):
+    import time
     main.step( "Check routes installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Route number expected:" )
     main.log.info( routeNumExpected )
     main.log.info( "Route number from ONOS CLI:" )
 
     routeNumActual = main.ONOScli.ipv4RouteNumber()
+    if routeNumActual != routeNumExpected:
+        time.sleep( wait )
+        routeNumActual = main.ONOScli.ipv4RouteNumber()
     main.log.info( routeNumActual )
     utilities.assertEquals( \
         expect = routeNumExpected, actual = routeNumActual,
@@ -13,13 +18,20 @@
         onfail = "Route number is wrong!" )
 
 def checkM2SintentNum( main, intentNumExpected ):
+    import time
     main.step( "Check M2S intents installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     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']
+    if intentNumActual != intentNumExpected:
+        time.sleep( wait )
+        jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                           TYPE = "multiPointToSinglePoint" )
+        intentNumActual = jsonResult['installed']
     main.log.info( intentNumActual )
     utilities.assertEquals( \
         expect = intentNumExpected, actual = intentNumActual,
@@ -27,13 +39,21 @@
         onfail = "M2S intent number is wrong!" )
 
 def checkP2PintentNum( main, intentNumExpected ):
+    import time
     main.step( "Check P2P intents installed" )
+    wait = int( main.params['timers']['PathAvailable'] )
     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']
+
+    if intentNumActual != intentNumExpected:
+        time.sleep( wait )
+        jsonResult = main.ONOScli.intents( jsonFormat = True, summary = True,
+                                           TYPE = "pointToPoint" )
+        intentNumActual = jsonResult['installed']
     main.log.info( intentNumActual )
     utilities.assertEquals( \
         expect = intentNumExpected, actual = intentNumActual,
@@ -41,11 +61,16 @@
         onfail = "P2P intent number is wrong!" )
 
 def checkFlowNum( main, switch, flowNumExpected ):
+    import time
     main.step( "Check flow entry number in " + switch )
+    wait = int( main.params['timers']['PathAvailable'] )
     main.log.info( "Flow number expected:" )
     main.log.info( flowNumExpected )
     main.log.info( "Flow number actual:" )
     flowNumActual = main.Mininet.getSwitchFlowCount( switch )
+    if flowNumActual != flowNumExpected :
+        time.sleep( wait )
+        flowNumActual = main.Mininet.getSwitchFlowCount( switch )
     main.log.info( flowNumActual )
     utilities.assertEquals( \
         expect = flowNumExpected, actual = flowNumActual,
@@ -109,7 +134,8 @@
         * 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" )
+    main.step( "Check ping between each host pair, expect all to succede=" +
+               str( expectAllSuccess ) )
     if len( hosts ) == 0:
         main.log.error( "Parameter hosts can not be empty." )
         main.cleanup()
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params
index 8f0dc3f..98d6bad 100644
--- a/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.params
@@ -1,11 +1,12 @@
 <PARAMS>
 
     <testcases>100, 101, 102, 1, 2, 3, 4, 7, 8, 9, 10</testcases>
-    #<testcases>100, 101, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10</testcases>
+    #100, 101, 102, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
     # case6 needs a new driver, will enable it after this new driver
     #Environment variables
     <ENV>
-        <cellName>sdnip_single_instance</cellName>
+        <cellName>SDNIP</cellName>
+        <appString>drivers,openflow,proxyarp</appString>
     </ENV>
 
     <CTRL>
@@ -17,16 +18,6 @@
         <port1>6653</port1>
     </CTRL>
 
-    <GIT>
-        <branch1>master</branch1>
-        <branch2>onos-1.3</branch2>
-    </GIT>
-
-    <JSON>
-        <prefix>prefix</prefix>
-        <nextHop>nextHop</nextHop>
-    </JSON>
-
     <DEPENDENCY>
         <path>/USECASE_SdnipFunction_fsfw/Dependency/</path>
         <topology>USECASE_SdnipI2MN.py</topology>
diff --git a/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
index 9a2144e..938b6e0 100644
--- a/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
+++ b/TestON/tests/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
@@ -5,7 +5,6 @@
         self.default = ''
         global branchName
 
-    # This case is to setup Mininet testbed
     def CASE100( self, main ):
         """
             Start mininet
@@ -19,11 +18,11 @@
 
         main.step( "Starting Mininet Topology" )
         topology = main.dependencyPath + main.topology
-        topoResult = main.Mininet.startNet( topoFile = topology )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = topoResult,
-                                 onpass = "Successfully loaded topology",
-                                 onfail = "Failed to load topology" )
+        topoResult = main.Mininet.startNet( topoFile=topology )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=topoResult,
+                                 onpass="Successfully loaded topology",
+                                 onfail="Failed to load topology" )
         # Exit if topology did not load properly
         if not topoResult:
             main.cleanup()
@@ -44,32 +43,31 @@
         for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ):
             sw = "sw%s" % ( i )
             swResult = swResult and main.Mininet.assignSwController( sw, fsfwIp,
-                                                                     port = fsfwPort )
-        utilities.assert_equals( expect = main.TRUE,
-                             actual = swResult,
-                             onpass = "Successfully connect all switches to ONOS",
-                             onfail = "Failed to connect all switches to ONOS" )
+                                                                     port=fsfwPort )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=swResult,
+                                 onpass="Successfully connect all switches to ONOS",
+                                 onfail="Failed to connect all switches to ONOS" )
         if not swResult:
             main.cleanup()
             main.exit()
 
         main.step( "Set up tunnel from Mininet node to onos node" )
         forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', ONOS1Ip )
-        command = 'ssh -nNT -o "PasswordAuthentication no" \
-        -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, ONOS1Ip )
+        command = 'ssh -nNT -o "PasswordAuthentication no"'
+        command += ' -o "StrictHostKeyChecking no" -l sdn'
+        command += ' -L %s %s & ' % ( forwarding1, ONOS1Ip )
 
         tunnelResult = main.TRUE
         tunnelResult = main.Mininet.node( "root", command )
-        utilities.assert_equals( expect = True,
-                             actual = ( "PasswordAuthentication" in tunnelResult ),
-                             onpass = "Created tunnel succeeded",
-                             onfail = "Create tunnel failed" )
+        utilities.assert_equals( expect=True,
+                                 actual=( "PasswordAuthentication" in tunnelResult ),
+                                 onpass="Created tunnel succeeded",
+                                 onfail="Create tunnel failed" )
         if ("PasswordAuthentication" not in tunnelResult) :
             main.cleanup()
             main.exit()
 
-
-    # This case is to setup ONOS
     def CASE101( self, main ):
         """
            Package ONOS and install it
@@ -82,100 +80,92 @@
         """
         import json
         import time
+        import os
         from operator import eq
 
         main.case( "Setting up test environment" )
 
         cellName = main.params[ 'ENV' ][ 'cellName' ]
+        global ONOS1Ip
+        ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
+        ipList = [ ONOS1Ip ]
+
+        main.step( "Create cell file" )
+        cellAppString = main.params[ 'ENV' ][ 'appString' ]
+        main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
+                                       main.Mininet.ip_address,
+                                       cellAppString, ipList )
 
         main.step( "Applying cell variable to environment" )
         cellResult = main.ONOSbench.setCell( cellName )
-        utilities.assert_equals( expect = main.TRUE,
-                             actual = cellResult,
-                             onpass = "Set cell succeeded",
-                             onfail = "Set cell failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cellResult,
+                                 onpass="Set cell succeeded",
+                                 onfail="Set cell failed" )
 
         verifyResult = main.ONOSbench.verifyCell()
-        utilities.assert_equals( expect = main.TRUE,
-                             actual = verifyResult,
-                             onpass = "Verify cell succeeded",
-                             onfail = "Verify cell failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=verifyResult,
+                                 onpass="Verify cell succeeded",
+                                 onfail="Verify cell failed" )
 
         branchName = main.ONOSbench.getBranchName()
         main.log.report( "ONOS is on branch: " + branchName )
 
         main.log.step( "Uninstalling ONOS" )
         uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
-        utilities.assert_equals( expect = main.TRUE,
-                                actual = uninstallResult,
-                                onpass = "Uninstall ONOS succeeded",
-                                onfail = "Uninstall ONOS failed" )
-        '''
-        main.step( "Git pull" )
-        gitPullResult = main.ONOSbench.gitPull()
-        main.log.info( "gitPullResult" )
-        main.log.info( gitPullResult )
-        gitPullResult2 = ( gitPullResult == main.TRUE ) or ( gitPullResult == 3 )
-        utilities.assert_equals( expect = True,
-                                 actual = gitPullResult2,
-                                 onpass = "Git pull ONOS succeeded",
-                                 onfail = "Git pull ONOS failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=uninstallResult,
+                                 onpass="Uninstall ONOS succeeded",
+                                 onfail="Uninstall ONOS failed" )
 
-        main.step( "Using mvn clean install" )
-        if gitPullResult == main.TRUE:
-            mciResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 )
-            utilities.assert_equals( expect = main.TRUE,
-                                     actual = mciResult,
-                                     onpass = "Maven clean install ONOS succeeded",
-                                     onfail = "Maven clean install ONOS failed" )
-        else:
-             main.log.warn( "Did not pull new code so skipping mvn " +
-                            "clean install" )
-             mciResult = main.TRUE
-        '''
-
-        main.ONOSbench.getVersion( report = True )
+        main.ONOSbench.getVersion( report=True )
 
         main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage( opTimeout = 500 )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = packageResult,
-                                 onpass = "Package ONOS succeeded",
-                                 onfail = "Package ONOS failed" )
+        packageResult = main.ONOSbench.onosPackage( opTimeout=500 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=packageResult,
+                                 onpass="Package ONOS succeeded",
+                                 onfail="Package ONOS failed" )
 
         main.step( "Installing ONOS package" )
-        onos1InstallResult = main.ONOSbench.onosInstall( options = "-f",
-                                                         node = ONOS1Ip )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = onos1InstallResult,
-                                 onpass = "Install ONOS succeeded",
-                                 onfail = "Install ONOS failed" )
+        onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                         node=ONOS1Ip )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onos1InstallResult,
+                                 onpass="Install ONOS succeeded",
+                                 onfail="Install ONOS failed" )
 
         main.step( "Checking if ONOS is up yet" )
-        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = onos1UpResult,
-                                 onpass = "ONOS is up",
-                                 onfail = "ONOS is NOT up" )
+        onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout=420 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=onos1UpResult,
+                                 onpass="ONOS is up",
+                                 onfail="ONOS is NOT up" )
 
         main.step( "Checking if ONOS CLI is ready" )
         cliResult = main.ONOScli.startOnosCli( ONOS1Ip,
-                commandlineTimeout = 100, onosStartTimeout = 600 )
-        utilities.assert_equals( expect = main.TRUE,
-                         actual = cliResult,
-                         onpass = "ONOS CLI is ready",
-                         onfail = "ONOS CLI is NOT ready" )
+                                               commandlineTimeout=100,
+                                               onosStartTimeout=600 )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cliResult,
+                                 onpass="ONOS CLI is ready",
+                                 onfail="ONOS CLI is not ready" )
 
-        caseResult = ( cellResult and verifyResult and
-                       packageResult and
-                       onos1InstallResult and onos1UpResult and cliResult )
+        for i in range( 10 ):
+            ready = True
+            output = main.ONOScli.summary()
+            if not output:
+                ready = False
+            if ready:
+                break
+            time.sleep( 30 )
+        utilities.assert_equals( expect=True, actual=ready,
+                                 onpass="ONOS summary command succeded",
+                                 onfail="ONOS summary command failed" )
 
-        utilities.assert_equals( expect = main.TRUE, actual = caseResult,
-                                 onpass = "ONOS startup successful",
-                                 onfail = "ONOS startup NOT successful" )
-
-        if caseResult == main.FALSE:
-            main.log.info( "ONOS startup failed!" )
+        if not ready:
+            main.log.error( "ONOS startup failed!" )
             main.cleanup()
             main.exit()
 
@@ -183,33 +173,33 @@
         time.sleep( int ( main.params['timers']['TopoDiscovery'] ) )
         summaryResult = main.ONOScli.summary()
         linkNum = json.loads( summaryResult )[ "links" ]
+        listResult = main.ONOScli.links( jsonFormat=False )
+        main.log.info( listResult )
         if linkNum < 100:
-            main.log.info( "Link number is wrong!" )
-            listResult = main.ONOScli.links( jsonFormat = False )
+            main.log.error( "Link number is wrong!" )
+            time.sleep( int( main.params['timers']['TopoDiscovery'] ) )
+            listResult = main.ONOScli.links( jsonFormat=False )
             main.log.info( listResult )
             main.cleanup()
             main.exit()
 
-        listResult = main.ONOScli.links( jsonFormat = False )
-        main.log.info( listResult )
-
         main.step( "Activate sdn-ip application" )
         activeSDNIPresult = main.ONOScli.activateApp( "org.onosproject.sdnip" )
-        utilities.assert_equals( expect = main.TRUE,
-                                 actual = activeSDNIPresult,
-                                 onpass = "Activate SDN-IP succeeded",
-                                 onfail = "Activate SDN-IP failed" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=activeSDNIPresult,
+                                 onpass="Activate SDN-IP succeeded",
+                                 onfail="Activate SDN-IP failed" )
         if not activeSDNIPresult:
             main.log.info( "Activate SDN-IP failed!" )
             main.cleanup()
             main.exit()
 
 
-        main.log.info( "Wait SDN-IP to finish installing connectivity intents \
-        and the BGP paths in data plane are ready..." )
+        main.log.info( "Wait for SDN-IP to finish installing connectivity intents " +
+                       "and for the BGP paths in the data plane to be ready..." )
         time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) )
-        main.log.info( "Wait Quagga to finish delivery all routes to each \
-        other and to sdn-ip, plus finish installing all intents..." )
+        main.log.info( "Wait for Quagga to finish delivery of all routes to each " +
+                       "other and sdn-ip, plus finish installing all intents..." )
         time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
         time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) )
 
@@ -233,39 +223,45 @@
         '''
 
         main.case( "Ping tests between BGP peers and speakers" )
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
 
 
     def CASE2( self, main ):
         '''
         point-to-point intents test for each BGP peer and BGP speaker pair
         '''
+        import time
         main.case( "Check point-to-point intents" )
         main.log.info( "There are %s BGP peers in total "
                        % main.params[ 'config' ][ 'peerNum' ] )
         main.step( "Check P2P intents number from ONOS CLI" )
 
-        getIntentsResult = main.ONOScli.intents( jsonFormat = True )
+        getIntentsResult = main.ONOScli.intents( jsonFormat=True )
         bgpIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
         bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6
+        if bgpIntentsActualNum != bgpIntentsExpectedNum:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            bgpIntentsActualNum = \
+                main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult )
         main.log.info( "bgpIntentsExpected num is:" )
         main.log.info( bgpIntentsExpectedNum )
         main.log.info( "bgpIntentsActual num is:" )
         main.log.info( bgpIntentsActualNum )
         utilities.assertEquals( \
-            expect = True,
-            actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
-            onpass = "PointToPointIntent Intent Num is correct!",
-            onfail = "PointToPointIntent Intent Num is wrong!" )
+            expect=True,
+            actual=eq( bgpIntentsExpectedNum, bgpIntentsActualNum ),
+            onpass="PointToPointIntent Intent Num is correct!",
+            onfail="PointToPointIntent Intent Num is wrong!" )
 
 
     def CASE3( self, main ):
         '''
         routes and intents check to all BGP peers
         '''
+        import time
         main.case( "Check routes and M2S intents to all BGP peers" )
 
         allRoutesExpected = []
@@ -273,11 +269,16 @@
         allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" )
         allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" )
 
-        getRoutesResult = main.ONOScli.routes( jsonFormat = True )
+        getRoutesResult = main.ONOScli.routes( jsonFormat=True )
         allRoutesActual = \
             main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
         allRoutesStrExpected = str( sorted( allRoutesExpected ) )
         allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
+        if allRoutesStrActual != allRoutesStrExpected:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            allRoutesActual = \
+                main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult )
+            allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" )
 
         main.step( "Check routes installed" )
         main.log.info( "Routes expected:" )
@@ -285,32 +286,40 @@
         main.log.info( "Routes get from ONOS CLI:" )
         main.log.info( allRoutesStrActual )
         utilities.assertEquals( \
-            expect = allRoutesStrExpected, actual = allRoutesStrActual,
-            onpass = "Routes are correct!",
-            onfail = "Routes are wrong!" )
+            expect=allRoutesStrExpected, actual=allRoutesStrActual,
+            onpass="Routes are correct!",
+            onfail="Routes are wrong!" )
 
         main.step( "Check M2S intents installed" )
-        getIntentsResult = main.ONOScli.intents( jsonFormat = True )
+        getIntentsResult = main.ONOScli.intents( jsonFormat=True )
         routeIntentsActualNum = \
             main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
         routeIntentsExpectedNum = 3
+        if routeIntentsActualNum != routeIntentsExpectedNum:
+            time.sleep( int( main.params['timers']['RouteDelivery'] ) )
+            routeIntentsActualNum = \
+                main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult )
 
         main.log.info( "MultiPointToSinglePoint Intent Num expected is:" )
         main.log.info( routeIntentsExpectedNum )
         main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" )
         main.log.info( routeIntentsActualNum )
         utilities.assertEquals( \
-            expect = True,
-            actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ),
-            onpass = "MultiPointToSinglePoint Intent Num is correct!",
-            onfail = "MultiPointToSinglePoint Intent Num is wrong!" )
+            expect=routeIntentsExpectedNum,
+            actual=routeIntentsActualNum,
+            onpass="MultiPointToSinglePoint Intent Num is correct!",
+            onfail="MultiPointToSinglePoint Intent Num is wrong!" )
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
 
     def CASE4( self, main ):
@@ -319,8 +328,8 @@
         '''
         main.case( "Ping test for each route, all hosts behind BGP peers" )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE5( self, main ):
@@ -330,68 +339,72 @@
         import time
         main.case( "Bring down links and check routes/intents" )
         main.step( "Bring down the link between sw32 and peer64514" )
-        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "pr64514",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult1,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="pr64514",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult1,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
 
         if linkResult1 == 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.log.error( "Bring down link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Bring down the link between sw8 and peer64515" )
-        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "pr64515",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult2,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="pr64515",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult2,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
         if linkResult2 == 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.log.error( "Bring down link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Bring down the link between sw28 and peer64516" )
-        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "pr64516",
-                                         OPTION = "down" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult3,
-                                onpass = "Bring down link succeeded!",
-                                onfail = "Bring down link failed!" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="pr64516",
+                                         OPTION="down" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult3,
+                                onpass="Bring down link succeeded!",
+                                onfail="Bring down link failed!" )
         if linkResult3 == 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.log.error( "Bring down link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = False )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=False )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = False )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=False )
 
 
     def CASE6( self, main ):
@@ -401,67 +414,71 @@
         import time
         main.case( "Bring up links and check routes/intents" )
         main.step( "Bring up the link between sw32 and peer64514" )
-        linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "pr64514",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult1,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult1 = main.Mininet.link( END1="sw32", END2="pr64514",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult1,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult1 == 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.log.error( "Bring up link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Bring up the link between sw8 and peer64515" )
-        linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "pr64515",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult2,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult2 = main.Mininet.link( END1="sw8", END2="pr64515",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult2,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult2 == 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.log.error( "Bring up link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Bring up the link between sw28 and peer64516" )
-        linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "pr64516",
-                                         OPTION = "up" )
-        utilities.assertEquals( expect = main.TRUE,
-                                actual = linkResult3,
-                                onpass = "Bring up link succeeded!",
-                                onfail = "Bring up link failed!" )
+        linkResult3 = main.Mininet.link( END1="sw28", END2="pr64516",
+                                         OPTION="up" )
+        utilities.assertEquals( expect=main.TRUE,
+                                actual=linkResult3,
+                                onpass="Bring up link succeeded!",
+                                onfail="Bring up link failed!" )
         if linkResult3 == 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.log.error( "Bring up link failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE7( self, main ):
@@ -471,10 +488,10 @@
         import time
         main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" )
         main.step( "Stop sw32" )
-        result = main.Mininet.switch( SW = "sw32", OPTION = "stop" )
-        utilities.assertEquals( expect = main.TRUE, actual = result,
-                                onpass = "Stopping switch succeeded!",
-                                onfail = "Stopping switch failed!" )
+        result = main.Mininet.switch( SW="sw32", OPTION="stop" )
+        utilities.assertEquals( expect=main.TRUE, actual=result,
+                                onpass="Stopping switch succeeded!",
+                                onfail="Stopping switch failed!" )
 
         if result == main.TRUE:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -482,46 +499,50 @@
             main.Functions.checkM2SintentNum( main, 2 )
             main.Functions.checkP2PintentNum( main, 12 )
         else:
-            main.log.info( "Stopping switch failed!" )
+            main.log.error( "Stopping switch failed!" )
             main.cleanup()
             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" )
+        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" )
+        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 = "pr64514" )
-        result5 = main.Mininet.pingHost( src = "speaker1", target = "pr64515" )
-        result6 = main.Mininet.pingHost( src = "speaker1", target = "pr64516" )
+        result4 = main.Mininet.pingHost( src="speaker1", target="pr64514" )
+        result5 = main.Mininet.pingHost( src="speaker1", target="pr64515" )
+        result6 = main.Mininet.pingHost( src="speaker1", target="pr64516" )
 
         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" )
+        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" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
 
     def CASE8( self, main ):
@@ -532,20 +553,20 @@
         import time
         main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" )
         main.step( "Start sw32" )
-        result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" )
+        result1 = main.Mininet.switch( SW="sw32", OPTION="start" )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = result1,
-            onpass = "Starting switch succeeded!",
-            onfail = "Starting switch failed!" )
+            expect=main.TRUE,
+            actual=result1,
+            onpass="Starting switch succeeded!",
+            onfail="Starting switch failed!" )
 
         result2 = main.Mininet.assignSwController( "sw32", fsfwIp,
-                                                   port = fsfwPort )
+                                                   port=fsfwPort )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = result2,
-            onpass = "Connect switch to FSFW succeeded!",
-            onfail = "Connect switch to FSFW failed!" )
+            expect=main.TRUE,
+            actual=result2,
+            onpass="Connect switch to FSFW succeeded!",
+            onfail="Connect switch to FSFW failed!" )
 
         if result1 and result2:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -553,24 +574,28 @@
             main.Functions.checkM2SintentNum( main, 3 )
             main.Functions.checkP2PintentNum( main, 18 )
         else:
-            main.log.info( "Starting switch failed!" )
+            main.log.error( "Starting switch failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
 
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE9( self, main ):
@@ -585,15 +610,15 @@
         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.log.debug( main.Mininet.checkFlows( "sw11" ) )
+        main.log.debug( main.Mininet.checkFlows( "sw1" ) )
+        main.log.debug( main.Mininet.checkFlows( "sw7" ) )
 
         main.step( "Stop sw11" )
-        result = main.Mininet.switch( SW = "sw11", OPTION = "stop" )
-        utilities.assertEquals( expect = main.TRUE, actual = result,
-                                onpass = "Stopping switch succeeded!",
-                                onfail = "Stopping switch failed!" )
+        result = main.Mininet.switch( SW="sw11", OPTION="stop" )
+        utilities.assertEquals( expect=main.TRUE, actual=result,
+                                onpass="Stopping switch succeeded!",
+                                onfail="Stopping switch failed!" )
         if result:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
@@ -601,23 +626,27 @@
             main.Functions.checkM2SintentNum( main, 3 )
             main.Functions.checkP2PintentNum( main, 18 )
         else:
-            main.log.info( "Stopping switch failed!" )
+            main.log.error( "Stopping switch failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
 
 
     def CASE10( self, main ):
@@ -631,19 +660,19 @@
         main.log.info( "Check the flow status before starting sw11" )
         main.Functions.checkFlowNum( main, "sw1", 11 )
         main.Functions.checkFlowNum( main, "sw7", 5 )
-        main.log.info( main.Mininet.checkFlows( "sw1" ) )
-        main.log.info( main.Mininet.checkFlows( "sw7" ) )
+        main.log.debug( main.Mininet.checkFlows( "sw1" ) )
+        main.log.debug( main.Mininet.checkFlows( "sw7" ) )
 
         main.step( "Start sw11" )
-        result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" )
-        utilities.assertEquals( expect = main.TRUE, actual = result1,
-                                onpass = "Starting switch succeeded!",
-                                onfail = "Starting switch failed!" )
+        result1 = main.Mininet.switch( SW="sw11", OPTION="start" )
+        utilities.assertEquals( expect=main.TRUE, actual=result1,
+                                onpass="Starting switch succeeded!",
+                                onfail="Starting switch failed!" )
         result2 = main.Mininet.assignSwController( "sw11", fsfwIp,
-                                                   port = fsfwPort )
-        utilities.assertEquals( expect = main.TRUE, actual = result2,
-                                onpass = "Connect switch to FSFW succeeded!",
-                                onfail = "Connect switch to FSFW failed!" )
+                                                   port=fsfwPort )
+        utilities.assertEquals( expect=main.TRUE, actual=result2,
+                                onpass="Connect switch to FSFW succeeded!",
+                                onfail="Connect switch to FSFW failed!" )
         if result1 and result2:
             time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) )
             main.Functions.checkRouteNum( main, 3 )
@@ -654,20 +683,24 @@
             main.log.debug( main.Mininet.checkFlows( "sw1" ) )
             main.log.debug( main.Mininet.checkFlows( "sw7" ) )
         else:
-            main.log.info( "Starting switch failed!" )
+            main.log.error( "Starting switch failed!" )
             main.cleanup()
             main.exit()
 
         main.step( "Check whether all flow status are ADDED" )
+        flowCheck = utilities.retry( main.ONOScli1.checkFlowsState,
+                                     main.FALSE,
+                                     kwargs={'isPENDING':False},
+                                     attempts=10 )
         utilities.assertEquals( \
-            expect = main.TRUE,
-            actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ),
-            onpass = "Flow status is correct!",
-            onfail = "Flow status is wrong!" )
+            expect=main.TRUE,
+            actual=flowCheck,
+            onpass="Flow status is correct!",
+            onfail="Flow status is wrong!" )
         # Ping test
-        main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"],
-                       peers = ["pr64514", "pr64515", "pr64516"],
-                       expectAllSuccess = True )
+        main.Functions.pingSpeakerToPeer( main, speakers=["speaker1"],
+                       peers=["pr64514", "pr64515", "pr64516"],
+                       expectAllSuccess=True )
         main.Functions.pingHostToHost( main,
-                        hosts = ["host64514", "host64515", "host64516"],
-                        expectAllSuccess = True )
+                        hosts=["host64514", "host64515", "host64516"],
+                        expectAllSuccess=True )
diff --git a/TestON/tests/USECASE_SegmentRouting/2x2.json b/TestON/tests/USECASE_SegmentRouting/2x2.json
new file mode 100644
index 0000000..c6c2eb8
--- /dev/null
+++ b/TestON/tests/USECASE_SegmentRouting/2x2.json
@@ -0,0 +1,104 @@
+{
+    "ports" : {
+    "of:0000000000000001/3" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000001/4" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000002/3" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.2.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000002/4" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.2.254/24" ]
+        }
+        ]
+    }
+    },
+    "devices" : {
+        "of:0000000000000001" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Leaf-R1",
+                "nodeSid" : 1,
+                "routerIp" : "192.168.0.1",
+                "routerMac" : "00:00:00:00:00:01",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000002" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Leaf-R2",
+                "nodeSid" : 2,
+                "routerIp" : "192.168.0.2",
+                "routerMac" : "00:00:00:00:00:02",
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000101" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Spine-R1",
+                "nodeSid" : 101,
+                "routerIp" : "192.168.0.101",
+                "routerMac" : "00:00:00:00:01:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000102" : {
+            "basic":{ "driver" : "ofdpa-cpqd" },
+            "segmentrouting" : {
+                "name" : "Spine-R2",
+                "nodeSid" : 102,
+                "routerIp" : "192.168.0.102",
+                "routerMac" : "00:00:00:00:01:02",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            }
+        }
+    },
+    "hosts" : {
+        "00:00:00:00:00:01/4093" : {
+            "basic": {
+                "ips": ["10.0.1.1"],
+                "location": "of:0000000000000001/3"
+            }
+        },
+        "00:00:00:00:00:02/4093" : {
+            "basic": {
+                "ips": ["10.0.1.2"],
+                "location": "of:0000000000000001/4"
+            }
+        },
+        "00:00:00:00:00:03/4093" : {
+            "basic": {
+                "ips": ["10.0.2.1"],
+                "location": "of:0000000000000002/3"
+            }
+        },
+        "00:00:00:00:00:04/4093" : {
+            "basic": {
+                "ips": ["10.0.2.2"],
+                "location": "of:0000000000000002/4"
+            }
+        }
+    }
+}
diff --git a/TestON/tests/USECASE_SegmentRouting/Dependency/cord_fabric.py b/TestON/tests/USECASE_SegmentRouting/Dependency/cord_fabric.py
new file mode 100755
index 0000000..b710b12
--- /dev/null
+++ b/TestON/tests/USECASE_SegmentRouting/Dependency/cord_fabric.py
@@ -0,0 +1,93 @@
+#!/usr/bin/python
+
+import os
+from optparse import OptionParser
+
+from mininet.net import Mininet
+from mininet.topo import Topo
+from mininet.node import RemoteController, UserSwitch, Host
+from mininet.link import TCLink
+from mininet.log import setLogLevel
+from mininet.cli import CLI
+
+# Parse command line options and dump results
+def parseOptions():
+    """Parse command line options"""
+    parser = OptionParser()
+    parser.add_option('--spine', dest='spine', type='int', default=2,
+                      help='number of spine switches, default=2')
+    parser.add_option('--leaf', dest='leaf', type='int', default=2,
+                      help='number of leaf switches, default=2')
+    parser.add_option('--fanout', dest='fanout', type='int', default=2,
+                      help='number of hosts per leaf switch, default=2')
+    parser.add_option('--onos', dest='onos', type='int', default=0,
+                      help='number of ONOS Instances, default=0, 0 means localhost, 1 will use OC1 and so on')
+
+    (options, args) = parser.parse_args()
+    return options, args
+
+opts, args = parseOptions()
+
+class LeafAndSpine(Topo):
+    def __init__(self, spine=2, leaf=2, fanout=2, **opts):
+        "Create Leaf and Spine Topo."
+
+        Topo.__init__(self, **opts)
+
+        # Add spine switches
+        spines = {}
+        for s in range(spine):
+            spines[s] = self.addSwitch('spine10%s' % (s + 1), dpid="00000000010%s" % (s + 1))
+        # Set link speeds to 100Mb/s
+        linkopts = dict(bw=10)
+
+        # Add Leaf switches
+        for ls in range(leaf):
+            leafSwitch = self.addSwitch('leaf%s' % (ls + 1), dpid="00000000000%s" % (1+ls))
+            # Connect leaf to all spines
+            for s in range(spine):
+                switch = spines[s]
+                self.addLink(leafSwitch, switch, **linkopts)
+            # Add hosts under a leaf, fanout hosts per leaf switch
+            for f in range(fanout):
+                host = self.addHost('h%s' % (ls * fanout + f + 1),
+                                         cls=IpHost,
+                                         ip='10.0.%s.%s/24' % ((ls + 1), (f + 1)),
+                                         gateway='10.0.%s.254' % (ls + 1))
+                self.addLink(host, leafSwitch, **linkopts)
+
+class IpHost(Host):
+    def __init__(self, name, gateway, *args, **kwargs):
+        super(IpHost, self).__init__(name, *args, **kwargs)
+        self.gateway = gateway
+
+    def config(self, **kwargs):
+        Host.config(self, **kwargs)
+        mtu = "ifconfig "+self.name+"-eth0 mtu 1490"
+        self.cmd(mtu)
+        self.cmd('ip route add default via %s' % self.gateway)
+
+def config(opts):
+    spine = opts.spine
+    leaf = opts.leaf
+    fanout = opts.fanout 
+    controllers= [ os.environ['OC%s' % i] for i in range(1,opts.onos+1) ] if (opts.onos) else ['127.0.0.1']
+    topo = LeafAndSpine(spine=spine, leaf=leaf, fanout=fanout)
+    net = Mininet(topo=topo, link=TCLink, build=False,
+                  switch=UserSwitch,
+                  controller = None,
+                  autoSetMacs = True)
+    i = 0
+    for ip in controllers:
+        net.addController( "c%s" % (i), controller=RemoteController, ip=ip)
+        i += 1;
+    net.build()
+    net.start()
+    CLI(net)
+    net.stop()
+
+if __name__ == '__main__':
+    setLogLevel('info')
+    config(opts)
+    os.system('sudo mn -c')
+
diff --git a/TestON/tests/USECASE_SegmentRouting/Dependency/startUp.py b/TestON/tests/USECASE_SegmentRouting/Dependency/startUp.py
new file mode 100644
index 0000000..bf2a2b6
--- /dev/null
+++ b/TestON/tests/USECASE_SegmentRouting/Dependency/startUp.py
@@ -0,0 +1,38 @@
+"""
+    This wrapper function is use for starting up onos instance
+"""
+
+import time
+import os
+import json
+
+def onosBuild( main, gitBranch ):
+    """
+        This includes pulling ONOS and building it using maven install
+    """
+
+    buildResult = main.FALSE
+
+    # Git checkout a branch of ONOS
+    checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
+    # Does the git pull on the branch that was checked out
+    if not checkOutResult:
+        main.log.warn( "Failed to checked out " + gitBranch +
+                                           " branch")
+    else:
+        main.log.info( "Successfully checked out " + gitBranch +
+                                           " branch")
+    gitPullResult = main.ONOSbench.gitPull()
+    if gitPullResult == main.ERROR:
+        main.log.error( "Error pulling git branch" )
+    else:
+        main.log.info( "Successfully pulled " + gitBranch + " branch" )
+
+    # Maven clean install
+    buildResult = main.ONOSbench.cleanInstall()
+
+    return buildResult
+
+
+
+
diff --git a/TestON/tests/USECASE_SegmentRouting/README.md b/TestON/tests/USECASE_SegmentRouting/README.md
new file mode 100644
index 0000000..da75079
--- /dev/null
+++ b/TestON/tests/USECASE_SegmentRouting/README.md
@@ -0,0 +1,18 @@
+This test is designed to verify basic connectivity the SegmentRouting application.
+
+It consists of 
+
+1) Installing and Starting ONOS
+2) Starting Mininet and testing connectivity
+
+Requirements
+
+ - A single ONOS instance is required for the test, the application is currently not stable in a cluster.
+ - An updated version of the CPQD switch has to be running to make sure it supports group chaining.
+
+Step 1:
+In this step we copy the proper config file to ONOS, next we package ONOS and install it in the target machine.
+
+Step 2:
+
+In this step we start a 2x2 leaf-spine topology, connect to ONOS, and next we send several pings between hosts to test connectivity.
diff --git a/TestON/tests/USECASE_SegmentRouting/USECASE_SegmentRouting.params b/TestON/tests/USECASE_SegmentRouting/USECASE_SegmentRouting.params
new file mode 100755
index 0000000..93c957f
--- /dev/null
+++ b/TestON/tests/USECASE_SegmentRouting/USECASE_SegmentRouting.params
@@ -0,0 +1,35 @@
+<PARAMS>
+
+    <testcases>1,2,11,9</testcases>
+
+    <SCALE>
+        <size>1</size>
+        <max>1</max>
+    </SCALE>
+
+    <DEPENDENCY>
+        <path>/tests/USECASE_SegmentRouting/Dependency/</path>
+        <wrapper1>startUp</wrapper1>
+        <topology>cord_fabric.py</topology>
+    </DEPENDENCY>
+
+    <ENV>
+        <cellName>productionCell</cellName>
+        <cellApps>drivers,openflow-base,netcfghostprovider,netcfglinksprovider,segmentrouting,vrouter,hostprovider</cellApps>
+        <cellUser>sdn</cellUser>
+    </ENV>
+
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+
+    <CTRL>
+        <port>6653</port>
+    </CTRL>
+
+    <SLEEP>
+        <startup>15</startup>
+    </SLEEP>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE_SegmentRouting/USECASE_SegmentRouting.py b/TestON/tests/USECASE_SegmentRouting/USECASE_SegmentRouting.py
new file mode 100644
index 0000000..292f990
--- /dev/null
+++ b/TestON/tests/USECASE_SegmentRouting/USECASE_SegmentRouting.py
@@ -0,0 +1,237 @@
+
+# This test is to determine if the Segment Routing application is working properly
+
+class USECASE_SegmentRouting:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        import time
+        import os
+        import imp
+        import re
+
+        """
+        - Construct tests variables
+        - GIT ( optional )
+            - Checkout ONOS master branch
+            - Pull latest ONOS code
+        - Building ONOS ( optional )
+            - Install ONOS package
+            - Build ONOS package
+        """
+
+        main.case( "Constructing test variables and building ONOS package" )
+        main.step( "Constructing test variables" )
+        stepResult = main.FALSE
+
+        # Test variables
+        main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
+        main.cellName = main.params[ 'ENV' ][ 'cellName' ]
+        main.apps = main.params[ 'ENV' ][ 'cellApps' ]
+        gitBranch = main.params[ 'GIT' ][ 'branch' ]
+        main.dependencyPath = main.testOnDirectory + \
+                              main.params[ 'DEPENDENCY' ][ 'path' ]
+        main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+        main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
+        main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
+        main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
+        wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+        main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+        gitPull = main.params[ 'GIT' ][ 'pull' ]
+        main.cellData = {} # for creating cell file
+        main.CLIs = []
+        main.ONOSip = []
+
+        main.ONOSip = main.ONOSbench.getOnosIps()
+
+        # Assigning ONOS cli handles to a list
+        for i in range( 1,  main.maxNodes + 1 ):
+            main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+
+        # -- INIT SECTION, ONLY RUNS ONCE -- #
+        main.startUp = imp.load_source( wrapperFile1,
+                                        main.dependencyPath +
+                                        wrapperFile1 +
+                                        ".py" )
+
+        copyResult1 = main.ONOSbench.scp( main.Mininet1,
+                                          main.dependencyPath +
+                                          main.topology,
+                                          main.Mininet1.home,
+                                          direction="to" )
+        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" )
+
+        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" )
+        else:
+            main.log.warn( "Did not pull new code so skipping mvn " +
+                           "clean install" )
+
+    def CASE2( self, main ):
+        """
+        - Set up cell
+            - Create cell file
+            - Set cell file
+            - Verify cell file
+        - Kill ONOS process
+        - Uninstall ONOS cluster
+        - Verify ONOS start up
+        - Install ONOS cluster
+        - Connect to cli
+        """
+
+        # main.scale[ 0 ] determines the current number of ONOS controller
+        main.numCtrls = int( main.scale[ 0 ] )
+
+        main.case( "Starting up " + str( main.numCtrls ) +
+                   " node(s) ONOS cluster" )
+
+        #kill off all onos processes
+        main.log.info( "Safety check, killing all ONOS processes" +
+                       " before initiating environment setup" )
+
+        for i in range( main.maxNodes ):
+            main.ONOSbench.onosDie( main.ONOSip[ i ] )
+
+        print "NODE COUNT = ", main.numCtrls
+
+        tempOnosIp = []
+        for i in range( main.numCtrls ):
+            tempOnosIp.append( main.ONOSip[i] )
+
+        onosUser = main.params[ 'ENV' ][ 'cellUser' ]
+        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
+                                       "temp",
+                                       main.Mininet1.ip_address,
+                                       main.apps,
+                                       tempOnosIp,
+                                       onosUser)
+
+        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.step( "Creating ONOS package" )
+        main.ONOSbench.handle.sendline( "cp ~/OnosSystemTest/TestON/tests/USECASE_SegmentRouting/2x2.json ~/onos/tools/package/config/network-cfg.json")
+        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" )
+
+        time.sleep( main.startUpSleep )
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.TRUE
+        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" )
+
+        main.step( "Starting ONOS service" )
+        stopResult = main.TRUE
+        startResult = main.TRUE
+        onosIsUp = main.TRUE
+
+        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" )
+        time.sleep( main.startUpSleep )
+
+    def CASE9( self, main ):
+        '''
+            Report errors/warnings/exceptions
+        '''
+        #main.ONOSbench.logReport( main.ONOSip[ 0 ],
+        #                          [ "INFO" ],
+        #                          "a" )
+        #main.log.info("Error report: \n" )
+        main.ONOSbench.logReport( main.ONOSip[ 0 ],
+                                  [ "INFO",
+                                    "FOLLOWER",
+                                    "WARN",
+                                    "flow",
+                                    "ERROR",
+                                    "Except" ],
+                                  "s" )
+
+
+    def CASE11( self, main ):
+        """
+            Start mininet
+        """
+        main.log.report( "Start Mininet topology" )
+        main.log.case( "Start Mininet topology" )
+
+        main.step( "Starting Mininet Topology" )
+        topoResult = main.Mininet1.startNet( topoFile= main.dependencyPath + main.topology, args="--onos 1" )
+        stepResult = topoResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully loaded topology",
+                                 onfail="Failed to load topology" )
+        # Exit if topology did not load properly
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+        main.step("Waiting for switch initialization and configuration")
+        time.sleep( main.startUpSleep )
+        pa = main.Mininet1.pingall()
+        utilities.assert_equals( expect=main.TRUE, actual=pa,
+                                 onpass="Full connectivity successfully tested",
+                                 onfail="Full connectivity failed" )
+        # cleanup mininet
+        main.CLIs[0].logout()
+        main.ONOSbench.onosStop( main.ONOSip[0] )
+        main.Mininet1.stopNet()
+        main.Mininet1.disconnect()
+
+
+
+
+
diff --git a/TestON/tests/USECASE_SegmentRouting/USECASE_SegmentRouting.topo b/TestON/tests/USECASE_SegmentRouting/USECASE_SegmentRouting.topo
new file mode 100755
index 0000000..0484c01
--- /dev/null
+++ b/TestON/tests/USECASE_SegmentRouting/USECASE_SegmentRouting.topo
@@ -0,0 +1,37 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS>
+                <nodes>1</nodes>
+            </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>localhost</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOScli1>
+
+        <Mininet1>
+            <host>OCN</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS>
+                <home>~/mininet/custom/</home>
+            </COMPONENTS>
+        </Mininet1>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE_SegmentRouting/__init__.py b/TestON/tests/USECASE_SegmentRouting/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE_SegmentRouting/__init__.py