More regex fixes for karaf cli
Change-Id: I31e18271daa41e5bb8298a22141cdb37fdc07656
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index d794112..7d790b6 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -558,7 +558,7 @@
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\[79C|\x1b(>|=)|\x1b\[90m~)" )
+ karafEscape = re.compile( r"('(0|1)~\'|\r\r\r\n\x1b\[A\x1b\[79C(x)?|\x1b(>|=)|\x1b\[90m~)" )
response = karafEscape.sub( '', response )
if debug:
main.log.debug( self.name + ": karafEscape output" )
@@ -595,6 +595,9 @@
# 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 )
+ 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 )
else:
output = response.split( endStr.strip(), 1 )
if len( output ) < 2: