Merge "[ONOS-7781] Migrate SRRouting test case 1 to POD"
diff --git a/TestON/JenkinsFile/FabricJenkinsfileTrigger b/TestON/JenkinsFile/FabricJenkinsfileTrigger
index 139c72e..f5a7dc2 100644
--- a/TestON/JenkinsFile/FabricJenkinsfileTrigger
+++ b/TestON/JenkinsFile/FabricJenkinsfileTrigger
@@ -30,7 +30,7 @@
 
 // set the versions of the onos.
 current_version = "master"
-previous_version = "1.13"
+previous_version = "1.15"
 before_previous_version = "1.14"
 
 // Function that will initialize the configuration of the Fabric.
diff --git a/TestON/JenkinsFile/README b/TestON/JenkinsFile/README
index 2c24fd6..1e837e4 100644
--- a/TestON/JenkinsFile/README
+++ b/TestON/JenkinsFile/README
@@ -11,8 +11,8 @@
   1) go to VM_BMJenkinsfileTrigger
   2) change the portion on line 31 :
      current_version = "master"
-     previous_version = "1.13"
-     before_previous_version = "1.12"
+     previous_version = "1.15"
+     before_previous_version = "1.14"
 
 
 2. If you want to change the branch to be run for the Segment Routing tests :
@@ -20,19 +20,19 @@
   1) go to the FabricJenkinsfileTrigger
   2) change the variable values on line 32:
      current_version = "master"
-     previous_version = "1.13"
-     before_previous_version = "1.12"
+     previous_version = "1.15"
+     before_previous_version = "1.14"
   3) If you want certain branch to be run on different machine then change
      a) line 155 - 157:
         testcases[ "SR" ][ "nodeName" ][ <node you want> ] 0: Fabric2, 1: Fabric3, 2: Fabric4
      b) Then, go to dependencies/JenkinsCommonFuncs.groovy
         change def fabricOn( branch ) on line 86.
-        Currently, master, 1.13 and 1.12 run on Fabric4, 2 and 3 respectively.
-     c) Make sure to change the URLs on Wiki as well. If 1.12 runs on Fabric2 instead of Fabric3, then you
+        Currently, master, 1.15 and 1.14 run on Fabric4, 2 and 3 respectively.
+     c) Make sure to change the URLs on Wiki as well. If 1.14 runs on Fabric2 instead of Fabric3, then you
         have to update the URL from
-          https://jenkins.onosproject.org/view/QA/job/postjob-Fabric3/lastSuccessfulBuild/artifact/SRBridging_onos-1.12_20-builds_graph.jpg
+          https://jenkins.onosproject.org/view/QA/job/postjob-Fabric3/lastSuccessfulBuild/artifact/SRBridging_onos-1.14_20-builds_graph.jpg
           to
-          https://jenkins.onosproject.org/view/QA/job/postjob-Fabric2/lastSuccessfulBuild/artifact/SRBridging_onos-1.12_20-builds_graph.jpg
+          https://jenkins.onosproject.org/view/QA/job/postjob-Fabric2/lastSuccessfulBuild/artifact/SRBridging_onos-1.14_20-builds_graph.jpg
 
 
 3. If you want to upload additional logs for the Segment Routing tests:
diff --git a/TestON/JenkinsFile/SRHAJenkinsFile b/TestON/JenkinsFile/SRHAJenkinsFile
index 83fa007..b13290f 100644
--- a/TestON/JenkinsFile/SRHAJenkinsFile
+++ b/TestON/JenkinsFile/SRHAJenkinsFile
@@ -36,7 +36,7 @@
 jobName = env.JOB_NAME
 
 // read the TestON.property depends on which branch it is running.
-// ( currently master on Fabric4, 1.13 on Fabric2 and 1.12 on Fabric3 )
+// ( currently master on Fabric4, 1.15 on Fabric2 and 1.14 on Fabric3 )
 def prop = null
 prop = funcs.getProperties()
 SRHA = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SRHA" ]
diff --git a/TestON/JenkinsFile/SRJenkinsFile b/TestON/JenkinsFile/SRJenkinsFile
index c562640..30fba24 100644
--- a/TestON/JenkinsFile/SRJenkinsFile
+++ b/TestON/JenkinsFile/SRJenkinsFile
@@ -36,7 +36,7 @@
 funcs.additionalInitForSR( jobName )
 
 // read the TestON.property depends on which branch it is running.
-// ( currently master on Fabric4, 1.13 on Fabric2 and 1.12 on Fabric3 )
+// ( currently master on Fabric4, 1.15 on Fabric2 and 1.14 on Fabric3 )
 def prop = null
 prop = funcs.getProperties()
 SR = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SR" ]
diff --git a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
index 5ba4055..f2e8bc9 100644
--- a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
+++ b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
@@ -29,8 +29,8 @@
 // set the versions of the onos
 fileRelated.init()
 current_version = "master"
-previous_version = "1.14"
-before_previous_version = "1.13"
+previous_version = "1.15"
+before_previous_version = "1.14"
 
 // init trend graphs to be on VM.
 funcs.initializeTrend( "VM" );
diff --git a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
index c205778..0a37eac 100644
--- a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
+++ b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
@@ -83,7 +83,7 @@
 
 def additionalInitForSR( branch ){
     // additional setup for SegmentRouting tests to determine the machine depends on the branch it is running.
-    // branch : branch of the onos. ( master, 1.12, 1.13... )
+    // branch : branch of the onos. ( master, 1.15, 1.14... )
 
     testMachine = ( ( new StringBuilder( testMachine ) ).insert( testMachine.size() - 1, fabricOn( branch ) ) ).
             toString()
@@ -98,12 +98,13 @@
 
 def fabricOn( branch ){
     // gets the fabric machines with the branch of onos.
-    // branch : master, 1.12, 1.13...
+    // branch : master, 1.15, 1.14...
     // branch.reverse().take(4).reverse() will get last 4 characters of the string.
     switch ( branch.reverse().take( 4 ).reverse() ){
         case "ster": return "4"
-        case "1.13": return "2"
+        case "1.15": return "2"
         case "1.14": return "3"
+        case "1.13": return "2"
         case "1.12": return "3"
         default: return "4"
     }
@@ -293,7 +294,7 @@
 def postLogs( testName, prefix ){
     // posting logs of the onos jobs specifically SR tests
     // testName : name of the test
-    // prefix : branch prefix ( master, 1.12, 1.13 ... )
+    // prefix : branch prefix ( master, 1.15, 1.14 ... )
 
     resultURL = ""
     if ( testType == "SR" ){
@@ -462,7 +463,7 @@
     // stat_file : file name with full path for Rscript for the stat graph
     // pie_file : file name with full path for Rscript for the pie graph
     // type : type of the test ( USECASE, FUNC, HA )
-    // branch : branch of the test ( master, onos-1.12, onos-1.13 )
+    // branch : branch of the test ( master, onos-1.15, onos-1.14 )
     // testListPart : list of the test to be included
     // save_path : path that will save the graphs to
     // pieTestListPart : list of the test for pie graph
@@ -581,10 +582,14 @@
 
 def testBranchWithPrefix( branch ){
     // get TestON branch with the prefix ( "onos-" )
-    if ( branch == "1.13" )
+    if ( branch == "1.12" )
         return "onos-1.13"
-    else if ( branch == "1.12" )
+    else if ( branch == "1.13" )
         return "onos-1.13"
+    else if ( branch == "1.14" )
+        return "onos-1.14"
+    else if ( branch == "1.15" )
+        return "onos-1.14"
     else
         return "master"
 }
diff --git a/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy b/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy
index eaadd7e..1f9df18 100644
--- a/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy
+++ b/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy
@@ -26,7 +26,7 @@
 
 def getAllTheTests( wikiPrefix ){
     // This contains the dictionary of the test and the category of them
-    // wikiPrefix : master, 1.13, 1.12 ...
+    // wikiPrefix : master, 1.15, 1.14 ...
 
     // category: it will be used to distinguish which category to be run on which days ( basic,extra_A, extra_B ... )
     // day: it will be used to display the schedule of the test to be run to the slack. It is empty in the first place but will be
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index dd60fb4..3841a76 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -58,6 +58,7 @@
         self.handle = None
         self.karafUser = None
         self.karafPass = None
+        self.karafPrompt = "sdn@root >"  # FIXME:  make configurable
         self.graph = Graph()
         super( OnosCliDriver, self ).__init__()
 
@@ -171,7 +172,7 @@
         try:
             if self.handle:
                 self.handle.sendline( "" )
-                i = self.handle.expect( [ "onos>", self.prompt, pexpect.TIMEOUT ],
+                i = self.handle.expect( [ self.karafPrompt, self.prompt, pexpect.TIMEOUT ],
                                         timeout=10 )
                 if i == 0:  # In ONOS CLI
                     self.handle.sendline( "logout" )
@@ -273,7 +274,7 @@
             # Check if we are already in the cli
             self.handle.sendline( "" )
             x = self.handle.expect( [
-                self.prompt, "onos>" ], commandlineTimeout )
+                self.prompt, self.karafPrompt ], commandlineTimeout )
             if x == 1:
                 main.log.info( "ONOS cli is already running" )
                 return main.TRUE
@@ -286,26 +287,27 @@
                 startCliCommand = "onos "
             self.handle.sendline( startCliCommand + str( ONOSIp ) )
             i = self.handle.expect( [
-                "onos>",
+                self.karafPrompt,
                 pexpect.TIMEOUT ], onosStartTimeout )
 
             if i == 0:
                 main.log.info( str( ONOSIp ) + " CLI Started successfully" )
-                if karafTimeout:
+                if karafTimeout:  # FIXME: This doesn't look right
                     self.handle.sendline(
                         "config:property-set -p org.apache.karaf.shell\
                                  sshIdleTimeout " +
                         karafTimeout )
                     self.handle.expect( self.prompt )
                     self.handle.sendline( startCliCommand + str( ONOSIp ) )
-                    self.handle.expect( "onos>" )
+                    self.handle.expect( self.karafPrompt )
+                main.log.debug( self.handle.before )
                 return main.TRUE
             else:
                 # If failed, send ctrl+c to process and try again
                 main.log.info( "Starting CLI failed. Retrying..." )
                 self.handle.send( "\x03" )
                 self.handle.sendline( startCliCommand + str( ONOSIp ) )
-                i = self.handle.expect( [ "onos>", pexpect.TIMEOUT ],
+                i = self.handle.expect( [ self.karafPrompt, pexpect.TIMEOUT ],
                                         timeout=30 )
                 if i == 0:
                     main.log.info( str( ONOSIp ) + " CLI Started " +
@@ -317,7 +319,7 @@
                             karafTimeout )
                         self.handle.expect( self.prompt )
                         self.handle.sendline( startCliCommand + str( ONOSIp ) )
-                        self.handle.expect( "onos>" )
+                        self.handle.expect( self.karafPrompt )
                     return main.TRUE
                 else:
                     main.log.error( "Connection to CLI " +
@@ -356,7 +358,7 @@
         try:
             self.handle.sendline( "" )
             x = self.handle.expect( [
-                self.prompt, "onos>" ], commandlineTimeout )
+                self.prompt, self.karafPrompt ], commandlineTimeout )
 
             if x == 1:
                 main.log.info( "ONOS cli is already running" )
@@ -365,26 +367,27 @@
             # Wait for onos start ( onos-wait-for-start ) and enter onos cli
             self.handle.sendline( "/opt/onos/bin/onos" )
             i = self.handle.expect( [
-                "onos>",
+                self.karafPrompt,
                 pexpect.TIMEOUT ], onosStartTimeout )
 
             if i == 0:
                 main.log.info( self.name + " CLI Started successfully" )
-                if karafTimeout:
+                if karafTimeout:  # FIXME: This doesn't look right
                     self.handle.sendline(
                         "config:property-set -p org.apache.karaf.shell\
                                  sshIdleTimeout " +
                         karafTimeout )
                     self.handle.expect( self.prompt )
                     self.handle.sendline( "/opt/onos/bin/onos" )
-                    self.handle.expect( "onos>" )
+                    self.handle.expect( self.karafPrompt )
+                main.log.debug( self.handle.before )
                 return main.TRUE
             else:
                 # If failed, send ctrl+c to process and try again
                 main.log.info( "Starting CLI failed. Retrying..." )
                 self.handle.send( "\x03" )
                 self.handle.sendline( "/opt/onos/bin/onos" )
-                i = self.handle.expect( [ "onos>", pexpect.TIMEOUT ],
+                i = self.handle.expect( [ self.karafPrompt, pexpect.TIMEOUT ],
                                         timeout=30 )
                 if i == 0:
                     main.log.info( self.name + " CLI Started " +
@@ -396,7 +399,7 @@
                             karafTimeout )
                         self.handle.expect( self.prompt )
                         self.handle.sendline( "/opt/onos/bin/onos" )
-                        self.handle.expect( "onos>" )
+                        self.handle.expect( self.karafPrompt )
                     return main.TRUE
                 else:
                     main.log.error( "Connection to CLI " +
@@ -431,7 +434,7 @@
 
             self.handle.sendline( "log:log " + lvlStr + " " + cmdStr )
             self.handle.expect( "log:log" )
-            self.handle.expect( "onos>" )
+            self.handle.expect( self.karafPrompt )
 
             response = self.handle.before
             if re.search( "Error", response ):
@@ -472,7 +475,7 @@
         try:
             # Try to reconnect if disconnected from cli
             self.handle.sendline( "" )
-            i = self.handle.expect( [ "onos>", self.prompt, pexpect.TIMEOUT ] )
+            i = self.handle.expect( [ self.karafPrompt, self.prompt, pexpect.TIMEOUT ] )
             response = self.handle.before
             if i == 1:
                 main.log.error( self.name + ": onos cli session closed. " )
@@ -493,7 +496,7 @@
                 main.log.warn( "Timeout when testing cli responsiveness" )
                 main.log.debug( self.handle.before )
                 self.handle.send( "\x03" )  # Send ctrl-c to clear previous output
-                self.handle.expect( "onos>" )
+                self.handle.expect( self.karafPrompt )
 
             response += self.handle.before
             if debug:
@@ -503,7 +506,7 @@
             main.log.error( self.name + ": ONOS timeout" )
             main.log.debug( self.handle.before )
             self.handle.send( "\x03" )
-            self.handle.expect( "onos>" )
+            self.handle.expect( self.karafPrompt )
             return None
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -519,7 +522,7 @@
             else:
                 main.cleanAndExit()
 
-    def sendline( self, cmdStr, showResponse=False, debug=False, timeout=10, noExit=False ):
+    def sendline( self, cmdStr, showResponse=False, debug=False, timeout=10, noExit=False, relaxedRegex=True ):
         """
         A wrapper around pexpect's sendline/expect. Will return all the output from a given command
 
@@ -533,6 +536,7 @@
                   before a timeout.
         noExit - Defaults to False. If True, will not exit TestON in the event of a
                  closed channel, but instead return None
+        relaxedRegex - Defaults to True. If there is a pipe in the command send, will only try to match the last part of the piped command.
 
         Warning: There are no sanity checking to commands sent using this method.
 
@@ -545,7 +549,7 @@
                 logStr = "\"Sending CLI command: '" + cmdStr + "'\""
                 self.log( logStr, noExit=noExit )
             self.handle.sendline( cmdStr )
-            self.handle.expect( "onos>", timeout )
+            self.handle.expect( self.karafPrompt, timeout )
             response = self.handle.before
             main.log.info( "Command '" + str( cmdStr ) + "' sent to "
                            + self.name + "." )
@@ -553,13 +557,26 @@
                 main.log.debug( self.name + ": Raw output" )
                 main.log.debug( self.name + ": " + repr( response ) )
 
+            # Remove control codes from karaf 4.2.1
+            karafEscape = re.compile( r"('(0|1)~\'|\r\r\r\n\x1b\[A\x1b\[79Cx|\x1b(>|=)|\x1b\[90m~)" )
+            response = karafEscape.sub( '', response )
+            if debug:
+                main.log.debug( self.name + ": karafEscape output" )
+                main.log.debug( self.name + ": " + repr( response ) )
             # Remove ANSI color control strings from output
-            ansiEscape = re.compile( r'\x1b[^m]*m' )
+            ansiEscape = re.compile( r'((\x9b|\x1b\[)[0-?]*[ -/]*[@-~])' )
             response = ansiEscape.sub( '', response )
             if debug:
                 main.log.debug( self.name + ": ansiEscape output" )
                 main.log.debug( self.name + ": " + repr( response ) )
 
+            # Remove ANSI color control strings from output
+            backspaceEscape = re.compile( r'((..\x08\x08)|(.|\s)\x08)' )
+            response = backspaceEscape.sub( '', response )
+            if debug:
+                main.log.debug( self.name + ": backspaceEscape output" )
+                main.log.debug( self.name + ": " + repr( response ) )
+
             # Remove extra return chars that get added
             response = re.sub(  r"\s\r", "", response )
             if debug:
@@ -574,7 +591,15 @@
                 main.log.debug( self.name + ": " + repr( response ) )
 
             # parse for just the output, remove the cmd from response
-            output = response.split( cmdStr.strip(), 1 )
+            if relaxedRegex:
+                # This was added because karaf 4.2 is stripping some characters from the command echo
+                endStr = cmdStr.split( '|' )[-1]
+                output = response.split( endStr.strip(), 1 )
+            else:
+                output = response.split( endStr.strip(), 1 )
+                if len( output ) < 2:
+                    main.log.warn( "Relaxing regex match to last 5 characters of the sent command" )
+                    output = response.split( endStr.strip()[-5:], 1 )
             if output:
                 if debug:
                     main.log.debug( self.name + ": split output" )
@@ -590,7 +615,7 @@
             if debug:
                 main.log.debug( self.handle.before )
             self.handle.send( "\x03" )
-            self.handle.expect( "onos>" )
+            self.handle.expect( self.karafPrompt )
             return None
         except IndexError:
             main.log.exception( self.name + ": Object not as expected" )
@@ -613,6 +638,46 @@
             else:
                 main.cleanAndExit()
 
+    def lineCount( self, cmdStr, showResponse=False, debug=False, timeout=10, noExit=False, relaxedRegex=True ):
+        """
+        A wrapper around sendline(). Will return the number of lines returned or None on error
+
+        Required Arguments:
+        cmdStr - String to send to the pexpect session
+
+        Optional Arguments:
+        showResponse - Defaults to False. If True will log the response.
+        debug - Defaults to False. If True, will enable debug logging.
+        timeout - Defaults to 10. Amount of time in seconds for a command to return
+                  before a timeout.
+        noExit - Defaults to False. If True, will not exit TestON in the event of a
+                 closed channel, but instead return None
+        relaxedRegex - Defaults to True. If there is a pipe in the command send, will only try to match the last part of the piped command.
+
+        Warning: There are no sanity checking to commands sent using this method.
+
+        """
+        try:
+            numLines = self.sendline( cmdStr, showResponse, debug, timeout, noExit, relaxedRegex )
+            parsed = re.search( "(\d+)\s+(\d+)", numLines )
+            if not parsed:
+                main.log.error( "Warning, output of karaf's wc may have changed" )
+                return None
+            return parsed.group( 1 )
+        except IndexError:
+            main.log.exception( self.name + ": Object not as expected" )
+            main.log.debug( "response: {}".format( repr( response ) ) )
+            return None
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
+            return None
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            if noExit:
+                return None
+            else:
+                main.cleanAndExit()
+
     # IMPORTANT NOTE:
     # For all cli commands, naming convention should match
     # the cli command changing 'a:b' with 'aB'.
@@ -2895,7 +2960,7 @@
             else:
                 cmdStr = "flows any " + str( deviceId ) + " | " +\
                          "grep 'state=ADDED' | wc -l"
-            handle = self.sendline( cmdStr )
+            handle = self.lineCount( cmdStr )
             assert handle is not None, "Error in sendline"
             assert "Command not found:" not in handle, handle
             return handle
@@ -2924,7 +2989,7 @@
             else:
                 cmdStr = "groups any " + str( deviceId ) + " | " +\
                          "grep 'state=ADDED' | wc -l"
-            handle = self.sendline( cmdStr )
+            handle = self.lineCount( cmdStr )
             assert handle is not None, "Error in sendline"
             assert "Command not found:" not in handle, handle
             return handle
@@ -3437,7 +3502,7 @@
         try:
             dpid = str( dpid )
             cmdStr = "onos:ports -e " + dpid + " | wc -l"
-            output = self.sendline( cmdStr )
+            output = self.lineCount( cmdStr )
             assert output is not None, "Error in sendline"
             assert "Command not found:" not in output, output
             if re.search( "No such device", output ):
@@ -3465,7 +3530,7 @@
         try:
             dpid = str( dpid )
             cmdStr = "onos:links " + dpid + " | grep ACTIVE | wc -l"
-            output = self.sendline( cmdStr )
+            output = self.lineCount( cmdStr )
             assert output is not None, "Error in sendline"
             assert "Command not found:" not in output, output
             if re.search( "No such device", output ):
@@ -5171,7 +5236,7 @@
         """
         try:
             self.handle.sendline( "log:set %s %s" % ( level, app ) )
-            self.handle.expect( "onos>" )
+            self.handle.expect( self.karafPrompt )
 
             response = self.handle.before
             if re.search( "Error", response ):
@@ -5340,7 +5405,7 @@
                 num = self.sendline( cmd )
                 return num
             elif mode == 'total':
-                totalLines = self.sendline( "cat /opt/onos/log/karaf.log | wc -l" )
+                totalLines = self.lineCount( "cat /opt/onos/log/karaf.log | wc -l" )
                 return int( totalLines )
             else:
                 main.log.error( self.name + " unsupported mode" )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 80c682d..2b17d66 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -2830,17 +2830,19 @@
                 self.handle.sendline( "echo Return code: $?" )
                 self.handle.expect( "\$\?" )
                 self.handle.expect( self.prompt )
-                main.log.debug( self.handle.before + self.handle.before )
                 match = re.search( "Return code: (\d+)", self.handle.before )
                 if match:
                     exitCode = int( match.group( 1 ) )
                 else:
                     # Didn't match pattern
                     main.log.error( "Could not parse exit code of atomix-install" )
+                    main.log.debug( self.handle.before + self.handle.before )
                     return main.FALSE
                 if exitCode == 0:
                     return main.TRUE
                 else:
+                    main.log.error( "Unsuccessful exit code of atomix-install" )
+                    main.log.debug( self.handle.before + self.handle.before )
                     return main.FALSE
             elif i == 4:
                 # timeout
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index fbd6bd8..81b33b2 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -63,7 +63,7 @@
                 '@' +
                 self.ip_address +
                 ' -o ServerAliveInterval=120 -o TCPKeepAlive=yes',
-                env={ "TERM": "xterm-mono" },
+                env={ "TERM": "vt100" },
                 maxread=1000000 )
         else:
             self.handle = pexpect.spawn(
@@ -72,7 +72,7 @@
                 '@' +
                 self.ip_address +
                 ' -o ServerAliveInterval=120 -o TCPKeepAlive=yes',
-                env={ "TERM": "xterm-mono" },
+                env={ "TERM": "vt100" },
                 maxread=1000000,
                 timeout=60 )
 
@@ -375,7 +375,7 @@
                                 uName +
                                 '@' +
                                 ipAddress,
-                                env={ "TERM": "xterm-mono" },
+                                env={ "TERM": "vt100" },
                                 maxread=1000000,
                                 timeout=60 )
 
diff --git a/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py b/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py
index 85ad546..277e098 100644
--- a/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py
+++ b/TestON/tests/HA/HAcontinuousStopNodes/HAcontinuousStopNodes.py
@@ -224,7 +224,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
index 417bc39..e3daf8e 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
@@ -360,7 +360,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
diff --git a/TestON/tests/HA/HAkillNodes/HAkillNodes.py b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
index 45852af..560b785 100644
--- a/TestON/tests/HA/HAkillNodes/HAkillNodes.py
+++ b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
@@ -216,7 +216,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
diff --git a/TestON/tests/HA/HApowerFailure/HApowerFailure.py b/TestON/tests/HA/HApowerFailure/HApowerFailure.py
index e8fbe61..85801e0 100644
--- a/TestON/tests/HA/HApowerFailure/HApowerFailure.py
+++ b/TestON/tests/HA/HApowerFailure/HApowerFailure.py
@@ -222,7 +222,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
diff --git a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index 4fbdb01..af383f1 100644
--- a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -439,7 +439,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
 
         if not topoResult:
             main.cleanAndExit()
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.py b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
index e112f9f..998f29c 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
@@ -215,7 +215,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
diff --git a/TestON/tests/HA/HAupgrade/HAupgrade.py b/TestON/tests/HA/HAupgrade/HAupgrade.py
index 9f1d307..f71cf79 100644
--- a/TestON/tests/HA/HAupgrade/HAupgrade.py
+++ b/TestON/tests/HA/HAupgrade/HAupgrade.py
@@ -215,7 +215,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
diff --git a/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.py b/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.py
index 3101324..db5e503 100644
--- a/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.py
+++ b/TestON/tests/HA/HAupgradeRollback/HAupgradeRollback.py
@@ -215,7 +215,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
@@ -287,7 +287,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
diff --git a/TestON/tests/HA/dependencies/HA.py b/TestON/tests/HA/dependencies/HA.py
index 88d122d..4342f96 100644
--- a/TestON/tests/HA/dependencies/HA.py
+++ b/TestON/tests/HA/dependencies/HA.py
@@ -266,7 +266,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
@@ -2716,7 +2716,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
@@ -2805,7 +2805,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
 
@@ -3392,7 +3392,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
 
         if not topoResult:
             main.cleanAndExit()
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
index d536106..fe4ea90 100644
--- a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
@@ -279,7 +279,7 @@
             if main.params[ 'CASE2100' ][ 'RESTchkFlow' ] == 'main.TRUE':
                 resp = main.Cluster.active( 0 ).REST.checkFlowsState()
             else:
-                handle = main.Cluster.active( 0 ).CLI.flows( state=" |grep PEND|wc -l", jsonFormat=False )
+                handle = main.Cluster.active( 0 ).CLI.lineCount( "flows |grep PEND|wc -l", timeout=60 )
                 main.log.info( "handle returns PENDING flows: " + handle )
                 if handle == "0":
                     resp = main.TRUE
@@ -351,7 +351,7 @@
             if main.params[ 'CASE3100' ][ 'RESTchkFlow' ] == 'main.TRUE':
                 resp = main.Cluster.active( 0 ).REST.checkFlowsState()
             else:
-                handle = main.Cluster.active( 0 ).CLI.flows( state=" |grep PEND|wc -l", jsonFormat=False )
+                handle = main.Cluster.active( 0 ).CLI.lineCount( "flows |grep PEND|wc -l", timeout=60 )
                 main.log.info( "handle returns PENDING flows: " + handle )
                 if handle == "0":
                     resp = main.TRUE
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index d9c350c..0b32c5a 100644
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -897,7 +897,7 @@
             for ctrl in main.Cluster.runningNodes:
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )
             main.log.error( "Failed to kill ONOS, stopping test" )
             main.cleanAndExit()
 
diff --git a/TestON/tests/dependencies/ONOSSetup.py b/TestON/tests/dependencies/ONOSSetup.py
index a601569..6ea5361 100644
--- a/TestON/tests/dependencies/ONOSSetup.py
+++ b/TestON/tests/dependencies/ONOSSetup.py
@@ -438,7 +438,7 @@
             for ctrl in main.Cluster.active():
                 main.log.debug( "{} components not ACTIVE: \n{}".format(
                     ctrl.name,
-                    ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
+                    ctrl.CLI.sendline( "onos:scr-list | grep -v ACTIVE" ) ) )  #FIXME: This output has changed a lot
             main.log.error( "Failed to start ONOS, stopping test" )
             main.cleanAndExit()
         return main.TRUE