Updated mininet driver pingall / Fixed logic issues in OnosCHO
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 192597b..9336590 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -248,11 +248,16 @@
         topoDict = self.numSwitchesN_links( *topoArgList )
         return topoDict
 
-    def pingall( self, timeout=300, shortCircuit = False ):
+    def pingall( self, timeout=300, shortCircuit = False ,numFailedPings = 1):
         """
            Verifies the reachability of the hosts using pingall command.
            Optional parameter timeout allows you to specify how long to
            wait for pingall to complete
+           Optional:
+           shortCircuit - Break the pingall based on the number of failed hosts
+           ping
+           numFailedPings - initialized the number required for the pingall to
+           break defaults to 1 
            Returns:
            main.TRUE if pingall completes with no pings dropped
            otherwise main.FALSE"""
@@ -268,7 +273,7 @@
                         timeout=int( timeout ) )
                 else:
                     self.handle.sendline( "pingall" )
-                    i = self.handle.expect( [ "mininet>","X X X",
+                    i = self.handle.expect( [ "mininet>","X",
                                               pexpect.EOF,
                                               pexpect.TIMEOUT ],
                                             timeout )
@@ -276,16 +281,52 @@
                         main.log.info( "mininet> prompt found!" )
                         response = str( self.handle.before )
                     if i == 1:
-                        main.log.info( self.name + ": Cannot ping some of the hosts")
+                        main.log.info( self.name + 
+                                       ": Cannot ping some of the hosts")
+                        failedPings = 1
+                        main.log.info( self.name + ": failed to ping " + 
+                                str( failedPings ) + " host" )
+                        while failedPings != numFailedPings:
+                            j = self.handle.expect( [ "mininet>","X",
+                                                      pexpect.EOF,
+                                                      pexpect.TIMEOUT ],
+                                                      timeout )
+                            if j == 0:
+                                main.log.info( self.name + ": pingall finished")
+                                break
+                            if j == 1:
+                                failedPings = failedPings + 1
+                                main.log.info( self.name + ": failed to ping " 
+                                        + str( failedPings ) + " host" )
+
+                            if j == 2:
+                                main.log.error( self.name + 
+                                                ": EOF exception found" )
+                                main.log.error( self.name + ":     " +
+                                                self.handle.before )
+                                main.cleanup()
+                                main.exit()
+                            if j == 3:
+                                main.log.error( self.name + 
+                                                ": TIMEOUT exception found" )
+                                main.log.error( self.name +
+                                                ":     " +
+                                                str( self.handle.before ) )
+                                break
+                        
+                        main.log.info( self.name + ": Cannot ping " 
+                                       + str( failedPings ) +" hosts")
                         main.log.info( str( self.handle.before ) )
                         response = str( self.handle.before )
                     if i == 2:
                         main.log.error( self.name + ": EOF exception found" )
-                        main.log.error( self.name + ":     " + self.handle.before )
+                        main.log.error( self.name + ":     "
+                                        + self.handle.before )
                         main.cleanup()
                         main.exit()
                     if i == 3:
-                        main.log.error( self.name + ": TIMEOUT exception found" )
+                        main.log.error( self.name +
+                                        ": TIMEOUT exception found" )
                         main.log.error( self.name +
                                         ":     " +
                                         str( self.handle.before ) )
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 3706a03..b48c44f 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -464,6 +464,8 @@
             for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ):
                 pool = []
                 for cli in main.CLIs:
+                    if i >= len( main.numMNswitches  ) + 1:
+                        break
                     dpid = "of:00000000000000" + format( i,'02x' )
                     t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid])
                     t.start()
@@ -486,6 +488,8 @@
             for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ):
                 pool = []
                 for cli in main.CLIs:
+                    if i >= len( main.numMNswitches  ) + 1:
+                        break
                     dpid = "of:00000000000000" + format( i,'02x' )
                     t = main.Thread( target = cli.getDeviceLinksActiveCount,
                                      threadID = main.threadID,
@@ -501,7 +505,7 @@
                     linkCountTemp = re.split( r'\t+', linkCountResult )
                     linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
                     main.deviceActiveLinksCount.append( linkCount )
-                print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
+            print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount )
             time2 = time.time()
             main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1))
 
@@ -1189,7 +1193,7 @@
 
     def CASE71( self, main ):
         """
-        Randomly bring some core links down and verify ping all ( Host Intents-Att Topo)
+        Randomly bring some core links down and verify ping all ( Point Intents-Att Topo)
         """
         import random
         main.randomLink1 = []
@@ -1204,9 +1208,9 @@
         switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
         link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
-        main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" )
+        main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" )
         main.log.report( "___________________________________________________________________________" )
-        main.case( "Host intents - Randomly bring some core links down and verify ping all" )
+        main.case( "Point intents - Randomly bring some core links down and verify ping all" )
         main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
         if ( int( switchLinksToToggle ) ==
              0 or int( switchLinksToToggle ) > 5 ):
@@ -1268,7 +1272,7 @@
 
     def CASE81( self, main ):
         """
-        Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
+        Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
         """
         import random
         link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ]
@@ -1278,11 +1282,11 @@
         switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ]
 
         main.log.report(
-            "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" )
+            "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" )
         main.log.report(
             "__________________________________________________________________" )
         main.case(
-            "Host intents - Bring the core links up that are down and verify ping all" )
+            "Point intents - Bring the core links up that are down and verify ping all" )
         main.step( "Bring randomly cut links on Core devices up" )
         for i in range( int( switchLinksToToggle ) ):
             main.Mininet1.link(
@@ -1446,15 +1450,15 @@
 
     def CASE73( self, main ):
         """
-        Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo)
+        Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo)
         """
         import random
         import itertools 
         link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
         
-        main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" )
+        main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" )
         main.log.report( "___________________________________________________________________________" )
-        main.case( "Host intents - Randomly bring some core links down and verify ping all" )
+        main.case( "Point intents - Randomly bring some core links down and verify ping all" )
         switches = []
         switchesComb = []
         for i in range( main.numMNswitches ):
@@ -1504,17 +1508,17 @@
 
     def CASE83( self, main ):
         """
-        Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
+        Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
         """
         import random
         link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
        
         main.log.report(
-            "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" )
+            "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" )
         main.log.report(
             "__________________________________________________________________" )
         main.case(
-            "Host intents - Bring the core links up that are down and verify ping all" )
+            "Point intents - Bring the core links up that are down and verify ping all" )
         main.step( "Bring randomly cut links on devices up" )
         
         for switch in main.randomLinks: