Handle ping output for paused hosts

This commit is contained in:
Brandon Heller
2010-03-13 21:44:11 -08:00
parent 07aad11081
commit 3fac5a43d7
+4 -1
View File
@@ -383,12 +383,15 @@ class Mininet( object ):
@staticmethod
def _parsePing( pingOutput ):
"Parse ping output and return packets sent, received."
# Check for downed link
if 'connect: Network is unreachable' in pingOutput:
return (1, 0)
r = r'(\d+) packets transmitted, (\d+) received'
m = re.search( r, pingOutput )
if m == None:
error( '*** Error: could not parse ping output: %s\n' %
pingOutput )
exit( 1 )
return (1, 0)
sent, received = int( m.group( 1 ) ), int( m.group( 2 ) )
return sent, received