- Adds ping check functions to Quagga cli driver
- Adds ping check using the function in TestOn framework
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py b/TestON/drivers/common/cli/quaggaclidriver.py
index 98f83d2..e0a4338 100644
--- a/TestON/drivers/common/cli/quaggaclidriver.py
+++ b/TestON/drivers/common/cli/quaggaclidriver.py
@@ -412,6 +412,78 @@
             main.log.info( "NO HANDLE" )
             return main.FALSE
 
+    def pingTestAndCheckAllPass( self, ip_address):
+        main.log.info( "Start the ping test on host:" + str( ip_address ) )
+
+        self.name = self.options[ 'name' ]
+        self.handle = super( QuaggaCliDriver, self ).connect(
+            user_name=self.user_name, ip_address=ip_address,
+            port=self.port, pwd=self.pwd )
+        main.log.info( "connect parameters:" + str( self.user_name ) + ";"
+                       + str( self.ip_address ) + ";" + str( self.port )
+                       + ";" + str( self.pwd ) )
+
+        testPass = main.TRUE
+
+        if self.handle:
+            # self.handle.expect( "" )
+            # self.handle.expect( "\$" )
+            main.log.info( "I in host " + str( ip_address ) )
+ 
+            # Ping to 3.0.x.1 is just for sanity check. It always succeeds.
+            for m in range( 3, 6 ):
+                for n in range( 1, 11 ):
+                    hostIp = str( m ) + ".0." + str( n ) + ".1"
+                    main.log.info( "Ping to " + hostIp )
+                    try:
+                        self.handle.sendline("ping -c 1 " + hostIp)
+                        self.handle.expect( "64 bytes from", timeout=1 )
+                    except:
+                        main.log.warn("Ping error")
+                        testPass = main.FALSE
+
+            return testPass
+        else:
+            main.log.info( "NO HANDLE" )
+            return main.FALSE
+
+    def pingTestAndCheckAllFail( self, ip_address):
+        main.log.info( "Start the ping test on host:" + str( ip_address ) )
+
+        self.name = self.options[ 'name' ]
+        self.handle = super( QuaggaCliDriver, self ).connect(
+            user_name=self.user_name, ip_address=ip_address,
+            port=self.port, pwd=self.pwd )
+        main.log.info( "connect parameters:" + str( self.user_name ) + ";"
+                       + str( self.ip_address ) + ";" + str( self.port )
+                       + ";" + str( self.pwd ) )
+
+        testPass = main.TRUE
+
+        if self.handle:
+            # self.handle.expect( "" )
+            # self.handle.expect( "\$" )
+            main.log.info( "I in host " + str( ip_address ) )
+
+            for m in range( 4, 6 ):
+                for n in range( 1, 11 ):
+                    hostIp = str( m ) + ".0." + str( n ) + ".1"
+                    main.log.info( "Ping to " + hostIp )
+                    try:
+                        self.handle.sendline("ping -c 1 " + hostIp)
+                        self.handle.expect( "64 bytes from", timeout=1 )
+                        testPass = main.FALSE
+                    except:
+                        main.log.warn("Ping error")
+
+            return testPass
+        else:
+            main.log.info( "NO HANDLE" )
+            return main.FALSE
+
+
+
+
     # Please use the generateRoutes plus addRoutes instead of this one!
     def addRoute( self, net, numRoutes, routeRate ):
         try: