Refactored test
    - Add test information
    - Chenge database path
    - Added link down and up driver
    - Added checkIntentSummary driver
    - Modified checkFlowsState driver to be more efficient
    - Refactored pushTestIntents driver
    - Modified sendline driver to handle pexpect timeout
    - Modify CASE20 and delete CASE21. Now Reroute part will in CASE20
    - Modify checkFlowsState drive function, make sure other tests can
      use it
    - Add a param, to control reroute or not
    - Change batch size, min_Intents, Max_Intents, and check_interval in
      params file

Change-Id: Id7fba74e880530a1817f17f576a1180170753143
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 21eb959..35527d4 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1235,30 +1235,33 @@
 
     def link( self, **linkargs ):
         """
-           Bring link( s ) between two nodes up or down"""
-        args = utilities.parse_args( [ "END1", "END2", "OPTION" ], **linkargs )
-        end1 = args[ "END1" ] if args[ "END1" ] is not None else ""
-        end2 = args[ "END2" ] if args[ "END2" ] is not None else ""
-        option = args[ "OPTION" ] if args[ "OPTION" ] is not None else ""
-        main.log.info(
-            "Bring link between '" +
-            end1 +
-            "' and '" +
-            end2 +
-            "' '" +
-            option +
-            "'" )
-        command = "link " + \
-            str( end1 ) + " " + str( end2 ) + " " + str( option )
+           Bring link( s ) between two nodes up or down
+        """
         try:
-            self.handle.sendline( command )
+            args = utilities.parse_args( [ "END1", "END2", "OPTION" ], **linkargs )
+            end1 = args[ "END1" ] if args[ "END1" ] is not None else ""
+            end2 = args[ "END2" ] if args[ "END2" ] is not None else ""
+            option = args[ "OPTION" ] if args[ "OPTION" ] is not None else ""
+
+            main.log.info( "Bring link between " + str( end1 ) + " and " + str( end2 ) + " " + str( option ) )
+            cmd = "link {} {} {}".format( end1, end2, option )
+            self.handle.sendline( cmd )
             self.handle.expect( "mininet>" )
+            response = self.handle.before
+            main.log.info( response )
+
+            return main.TRUE
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": Command timed out" )
+            return None
         except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":     " + self.handle.before )
+            main.log.exception( self.name + ": connection closed." )
             main.cleanup()
             main.exit()
-        return main.TRUE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def switch( self, **switchargs ):
         """