Merge pull request #685 from maufl/fix-ping-parse-regex

Fix regex for ping result parsing, supporting optional 'packets' word in ping output
This commit is contained in:
lantz
2017-01-06 14:53:42 -08:00
committed by GitHub
+1 -1
View File
@@ -633,7 +633,7 @@ class Mininet( object ):
# Check for downed link # Check for downed link
if 'connect: Network is unreachable' in pingOutput: if 'connect: Network is unreachable' in pingOutput:
return 1, 0 return 1, 0
r = r'(\d+) packets transmitted, (\d+) received' r = r'(\d+) packets transmitted, (\d+)( packets)? received'
m = re.search( r, pingOutput ) m = re.search( r, pingOutput )
if m is None: if m is None:
error( '*** Error: could not parse ping output: %s\n' % error( '*** Error: could not parse ping output: %s\n' %