+10
-3
@@ -480,19 +480,26 @@ class Mininet( object ):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _parsePingFull( pingOutput ):
|
def _parsePingFull( pingOutput ):
|
||||||
"Parse ping output and return all data."
|
"Parse ping output and return all data."
|
||||||
|
errorTuple = (1, 0, 0, 0, 0, 0)
|
||||||
# Check for downed link
|
# Check for downed link
|
||||||
if 'connect: Network is unreachable' in pingOutput:
|
r = r'[uU]nreachable'
|
||||||
return (1, 0)
|
m = re.search( r, pingOutput )
|
||||||
|
if m is not None:
|
||||||
|
return errorTuple
|
||||||
r = r'(\d+) packets transmitted, (\d+) received'
|
r = r'(\d+) packets transmitted, (\d+) 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' %
|
||||||
pingOutput )
|
pingOutput )
|
||||||
return (1, 0, 0, 0, 0, 0)
|
return errorTuple
|
||||||
sent, received = int( m.group( 1 ) ), int( m.group( 2 ) )
|
sent, received = int( m.group( 1 ) ), int( m.group( 2 ) )
|
||||||
r = r'rtt min/avg/max/mdev = '
|
r = r'rtt min/avg/max/mdev = '
|
||||||
r += r'(\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+) ms'
|
r += r'(\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+)/(\d+\.\d+) ms'
|
||||||
m = re.search( r, pingOutput )
|
m = re.search( r, pingOutput )
|
||||||
|
if m is None:
|
||||||
|
error( '*** Error: could not parse ping output: %s\n' %
|
||||||
|
pingOutput )
|
||||||
|
return errorTuple
|
||||||
rttmin = float( m.group( 1 ) )
|
rttmin = float( m.group( 1 ) )
|
||||||
rttavg = float( m.group( 2 ) )
|
rttavg = float( m.group( 2 ) )
|
||||||
rttmax = float( m.group( 3 ) )
|
rttmax = float( m.group( 3 ) )
|
||||||
|
|||||||
Reference in New Issue
Block a user