Update checkIntentState function in onosclidriver
diff --git a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
index 3ceb24b..75e586f 100644
--- a/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FuncIntent/Dependency/FuncIntentFunction.py
@@ -1008,19 +1008,39 @@
     return statusResult
 
 def checkIntentState( main, intentsId ):
+    """
+        This function will check intent state to make sure all the intents
+        are in INSTALLED state
+    """
 
     intentResult = main.TRUE
     results = []
 
     main.log.info( itemName + ": Checking intents state" )
+    # First check of intents
     for i in range( main.numCtrls ):
-        intentResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
-        results.append( intentResult )
+        tempResult = main.CLIs[ i ].checkIntentState( intentsId=intentsId )
+        results.append( tempResult )
+
+    expectedState = [ 'INSTALLED', 'INSTALLING' ]
 
     if all( result == main.TRUE for result in results ):
         main.log.info( itemName + ": Intents are installed correctly" )
     else:
-        main.log.error( itemName + ": Intents are NOT installed correctly" )
+        # Wait for at least 5 second before checking the intents again
+        time.sleep( 5 )
+        results = []
+        # Second check of intents since some of the intents may be in
+        # INSTALLING state, they should be in INSTALLED at this time
+        for i in range( main.numCtrls ):
+            tempResult = main.CLIs[ i ].checkIntentState(
+                                                        intentsId=intentsId )
+            results.append( tempResult )
+        if all( result == main.TRUE for result in results ):
+            main.log.info( itemName + ": Intents are installed correctly" )
+        else:
+            main.log.error( itemName + ": Intents are NOT installed correctly" )
+            intentResult = main.FALSE
 
     return intentResult
 
diff --git a/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
index 121a6dc..d4d3392 100644
--- a/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
+++ b/TestON/tests/FuncTopo/Dependency/FuncTopoFunction.py
@@ -48,6 +48,9 @@
     testTopoResult = startResult and topoObjectResult and \
                      compareTopoResult and getHostsResult
 
+    # Restart ONOS to clear hosts test new mininet topology
+    restartResult = restartONOS( main )
+
     return testTopoResult
 
 def startNewTopology( main, topoFile='', args='', mnCmd='', clean=True ):
@@ -250,3 +253,51 @@
     print main.hostsData
 
     return getDataResult
+
+def restartONOS( main ):
+    """
+    Description:
+        Stop and start ONOS that clears hosts,devices etc. in order to test
+        new mininet topology
+    Return:
+        Retruns main.TRUE for a successful restart, main.FALSE otherwise.
+    """
+    stopResult = []
+    startResult = []
+    restartResult = main.TRUE
+
+    main.log.info( main.topoName + ": Stopping ONOS cluster" )
+    for node in main.nodes:
+        startResult.append( main.ONOSbench.onosStop( nodeIp=node.ip_address ) )
+
+    if all( result == main.TRUE for result in stopResult ):
+        main.log.info( main.topoName + ": Successfully stopped ONOS cluster" )
+    else:
+        restartResult = main.FALSE
+        main.log.error( main.topoName + ": Failed to stop ONOS cluster" )
+
+    time.sleep( 15 )
+
+    main.log.info( main.topoName + ": Starting ONOS cluster" )
+    for node in main.nodes:
+        startResult.append( main.ONOSbench.onosStart( nodeIp=node.ip_address ) )
+
+    if all( result == main.TRUE for result in startResult ):
+        main.log.info( main.topoName + ": Successfully start ONOS cluster" )
+    else:
+        restartResult = main.FALSE
+        main.log.error( main.topoName + ": Failed to start ONOS cluster" )
+
+    # Start ONOS CLIs again
+    main.log.info( main.topoName + ": Starting ONOS CLI" )
+    cliResult = main.TRUE
+    for i in range( main.numCtrls ):
+        cliResult = cliResult and \
+                    main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
+
+    time.sleep( 15 )
+
+    return restartResult
+
+
+
diff --git a/TestON/tests/FuncTopo/FuncTopo.py b/TestON/tests/FuncTopo/FuncTopo.py
index eefdb39..829c582 100644
--- a/TestON/tests/FuncTopo/FuncTopo.py
+++ b/TestON/tests/FuncTopo/FuncTopo.py
@@ -178,7 +178,7 @@
         cliResult = main.TRUE
         for i in range( main.numCtrls ):
             cliResult = cliResult and \
-                        main.CLIs[i].startOnosCli( main.ONOSip[ i ] )
+                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
         stepResult = cliResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -201,13 +201,27 @@
             Test topology discovery
         """
         main.case( "Topology discovery test" )
+
+        main.topoName = "TREE3-3"
+        stepResult = main.TRUE
+        main.step( "Tree 3-3 topology" )
+        mnCmd = "mn --topo=tree,3,3 --controller=remote,ip=$OC1 --mac"
+        stepResult = main.wrapper.testTopology( main,
+                                                mnCmd=mnCmd,
+                                                clean=False )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Tree 3-3 topology successful",
+                                 onfail="Tree 3-3 topology failed" )
+
         main.step( "Torus 5-5 topology" )
         main.topoName = "TORUS5-5"
         mnCmd = "mn --topo=torus,5,5 --controller=remote,ip=$OC1 --mac"
         stepResult = main.wrapper.testTopology( main,
                                                 mnCmd=mnCmd,
-                                                clean=False)
+                                                clean=True )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Torus 5-5 topology successful",
                                  onfail="Torus 5-5 topology failed" )
+