Fix checkStatus function in drivers

Change-Id: I62f521ea2a1f643fa69375a4655fa028232901a3
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 93026c2..67ed5fa 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2572,27 +2572,52 @@
             main.cleanup()
             main.exit()
 
-    def checkStatus( self, ip, numoswitch, numolink, logLevel="info" ):
+    def getTopology( self, topologyOutput ):
+        """
+        Definition:
+            Loads a json topology output
+        Return:
+            topology = current ONOS topology
+        """
+        import json
+        try:
+            # either onos:topology or 'topology' will work in CLI
+            topology = json.loads(topologyOutput)
+            print topology
+            return topology
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
+    def checkStatus(
+            self,
+            topologyResult,
+            numoswitch,
+            numolink,
+            logLevel="info" ):
         """
         Checks the number of switches & links that ONOS sees against the
         supplied values. By default this will report to main.log, but the
-        log level can be specified.
+        log level can be specific.
 
-        Params: ip = ip used for the onos cli
+        Params: topologyResult = the output of topology command
                 numoswitch = expected number of switches
                 numolink = expected number of links
-                logLevel = level to log to. Currently accepts
-                'info', 'warn' and 'report'
-
-
-        logLevel can
+                logLevel = level to log to.
+                Currently accepts 'info', 'warn' and 'report'
 
         Returns: main.TRUE if the number of switches and links are correct,
                  main.FALSE if the number of switches and links is incorrect,
                  and main.ERROR otherwise
         """
         try:
-            topology = self.getTopology( ip )
+            topology = self.getTopology( topologyResult )
             if topology == {}:
                 return main.ERROR
             output = ""
@@ -2604,29 +2629,27 @@
             switchCheck = ( int( devices ) == int( numoswitch ) )
             # Is the number of links is what we expected
             linkCheck = ( int( links ) == int( numolink ) )
-            if ( switchCheck and linkCheck ):
+            if switchCheck and linkCheck:
                 # We expected the correct numbers
-                output += "The number of links and switches match " +\
-                          "what was expected"
+                output = output + "The number of links and switches match "\
+                    + "what was expected"
                 result = main.TRUE
             else:
-                output += "The number of links and switches does not match " +\
-                          "what was expected"
+                output = output + \
+                    "The number of links and switches does not match " + \
+                    "what was expected"
                 result = main.FALSE
-            output = output + "\n ONOS sees %i devices (%i expected) \
-                    and %i links (%i expected)" % (
-                int( devices ), int( numoswitch ), int( links ),
-                int( numolink ) )
+            output = output + "\n ONOS sees %i devices" % int( devices )
+            output = output + " (%i expected) " % int( numoswitch )
+            output = output + "and %i links " % int( links )
+            output = output + "(%i expected)" % int( numolink )
             if logLevel == "report":
                 main.log.report( output )
             elif logLevel == "warn":
                 main.log.warn( output )
             else:
-                main.log.info( self.name + ": " + output )
+                main.log.info( output )
             return result
-        except TypeError:
-            main.log.exception( self.name + ": Object not as expected" )
-            return None
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 4f32aab..ad8a284 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1345,97 +1345,6 @@
             main.cleanup()
             main.exit()
 
-    def getTopology( self, topologyOutput ):
-        """
-        Definition:
-            Loads a json topology output
-        Return:
-            topology = current ONOS topology
-        """
-        import json
-        try:
-            # either onos:topology or 'topology' will work in CLI
-            topology = json.loads(topologyOutput)
-            print topology
-            return topology
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
-        except Exception:
-            main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
-
-    def checkStatus(
-            self,
-            topologyResult,
-            numoswitch,
-            numolink,
-            logLevel="info" ):
-        """
-        Checks the number of switches & links that ONOS sees against the
-        supplied values. By default this will report to main.log, but the
-        log level can be specific.
-
-        Params: ip = ip used for the onos cli
-                numoswitch = expected number of switches
-                numolink = expected number of links
-                logLevel = level to log to.
-                Currently accepts 'info', 'warn' and 'report'
-
-
-        logLevel can
-
-        Returns: main.TRUE if the number of switches and links are correct,
-                 main.FALSE if the number of switches and links is incorrect,
-                 and main.ERROR otherwise
-        """
-        try:
-            topology = self.getTopology( topologyResult )
-            if topology == {}:
-                return main.ERROR
-            output = ""
-            # Is the number of switches is what we expected
-            devices = topology.get( 'devices', False )
-            links = topology.get( 'links', False )
-            if not devices or not links:
-                return main.ERROR
-            switchCheck = ( int( devices ) == int( numoswitch ) )
-            # Is the number of links is what we expected
-            linkCheck = ( int( links ) == int( numolink ) )
-            if switchCheck and linkCheck:
-                # We expected the correct numbers
-                output = output + "The number of links and switches match "\
-                    + "what was expected"
-                result = main.TRUE
-            else:
-                output = output + \
-                    "The number of links and switches does not match " + \
-                    "what was expected"
-                result = main.FALSE
-            output = output + "\n ONOS sees %i devices" % int( devices )
-            output = output + " (%i expected) " % int( numoswitch )
-            output = output + "and %i links " % int( links )
-            output = output + "(%i expected)" % int( numolink )
-            if logLevel == "report":
-                main.log.report( output )
-            elif logLevel == "warn":
-                main.log.warn( output )
-            else:
-                main.log.info( output )
-            return result
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
-        except Exception:
-            main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
-
     def tsharkPcap( self, interface, dirFile ):
         """
         Capture all packet activity and store in specified
diff --git a/TestON/tests/CHO/CHOtest/CHOtest.py b/TestON/tests/CHO/CHOtest/CHOtest.py
index a1fb04f..8c92c20 100644
--- a/TestON/tests/CHO/CHOtest/CHOtest.py
+++ b/TestON/tests/CHO/CHOtest/CHOtest.py
@@ -243,7 +243,7 @@
         time.sleep( 5 )
 
         topology_output = main.ONOScli1.topology()
-        topology_result = main.ONOSbench.getTopology( topology_output )
+        topology_result = main.ONOScli1.getTopology( topology_output )
         case2Result = ( switch_mastership and startStatus )
         utilities.assert_equals(
             expect=main.TRUE,
@@ -396,7 +396,7 @@
         main.case( "Collect and Store Topology Details from ONOS" )
         main.step( "Collect and store current number of switches and links" )
         topology_output = main.ONOScli1.topology()
-        topology_result = main.ONOSbench.getTopology( topology_output )
+        topology_result = main.ONOScli1.getTopology( topology_output )
         numOnosDevices = topology_result[ 'devices' ]
         numOnosLinks = topology_result[ 'links' ]
         topoResult = main.TRUE
diff --git a/TestON/tests/CHO/CHOtest/dependencies/CHOtestFunctions.py b/TestON/tests/CHO/CHOtest/dependencies/CHOtestFunctions.py
index 7441a5b..c8d40ac 100644
--- a/TestON/tests/CHO/CHOtest/dependencies/CHOtestFunctions.py
+++ b/TestON/tests/CHO/CHOtest/dependencies/CHOtestFunctions.py
@@ -140,7 +140,7 @@
         for e in range( int( main.numCtrls ) ):
             main.log.info( "Checking link number on ONOS%s" % (e+1) )
             topology_output = main.CLIs[e].topology()
-            linkResultIndividual = main.ONOSbench.checkStatus( topology_output,
+            linkResultIndividual = main.ONOScli1.checkStatus( topology_output,
                                                                main.numMNswitches,
                                                                str( linkNum ) )
             if not linkResultIndividual:
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index a596a01..88a0cad 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -1530,7 +1530,7 @@
 
     for i in range( main.numCtrls ):
         topologyResult = main.CLIs[ i ].topology()
-        statusResult = main.ONOSbench.checkStatus( topologyResult,
+        statusResult = main.CLIs[ i ].checkStatus( topologyResult,
                                                    main.numSwitch,
                                                    expectedLink )\
                        and statusResult
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
index 8a48a13..4ad42b2 100644
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -1413,7 +1413,7 @@
 
     for i in range( main.numCtrls ):
         topologyResult = main.CLIs[ i ].topology()
-        statusResult = main.ONOSbench.checkStatus( topologyResult,
+        statusResult = main.CLIs[ i ].checkStatus( topologyResult,
                                                    main.numSwitch,
                                                    expectedLink )\
                        and statusResult
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
index d7b2d82..40a125b 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/FUNCIpv6IntentFunction.py
@@ -1845,7 +1845,7 @@
 
     for i in range( main.numCtrls ):
         topologyResult = main.CLIs[ i ].topology()
-        statusResult = main.ONOSbench.checkStatus( topologyResult,
+        statusResult = main.CLIs[ i ].checkStatus( topologyResult,
                                                    main.numSwitch,
                                                    expectedLink )\
                        and statusResult
diff --git a/TestON/tests/FUNC/FUNCoptical/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCoptical/dependencies/FuncIntentFunction.py
index 377fd20..1d45f62 100644
--- a/TestON/tests/FUNC/FUNCoptical/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCoptical/dependencies/FuncIntentFunction.py
@@ -1437,7 +1437,7 @@
 
     for i in range( main.numCtrls ):
         topologyResult = main.CLIs[ i ].topology()
-        statusResult = main.ONOSbench.checkStatus( topologyResult,
+        statusResult = main.CLIs[ i ].checkStatus( topologyResult,
                                                    main.numSwitch,
                                                    expectedLink )\
                        and statusResult