#NEWLINE# def process_reply( self , message ) : #NEWLINE# #INDENT# result = super ( Iperf3Executor , self ) . process_reply ( message ) #NEWLINE# if ( not result [ 'stdout' ] ) : #NEWLINE# #INDENT# raise base . ExecutorException ( result , 'Empty result from iperf' ) #NEWLINE# #UNINDENT# data = json . loads ( result [ 'stdout' ] ) #NEWLINE# result [ 'verbose' ] = yaml . safe_dump ( dict ( start = data [ 'start' ] , end = data [ 'end' ] ) , indent = 2 , default_flow_style = False ) #NEWLINE# if ( 'error' in data ) : #NEWLINE# #INDENT# raise base . ExecutorException ( result , data [ 'error' ] ) #NEWLINE# #UNINDENT# has_retransmits = False #NEWLINE# if ( ( len ( data [ 'intervals' ] ) > 0 ) and ( 'retransmits' in data [ 'intervals' ] [ 0 ] [ 'sum' ] ) ) : #NEWLINE# #INDENT# has_retransmits = True #NEWLINE# #UNINDENT# if self . test_definition . get ( 'udp' ) : #NEWLINE# #INDENT# sampler = ( lambda p : [ round ( p [ 'end' ] , 2 ) , p [ 'packets' ] ] ) #NEWLINE# meta = [ [ 'time' , 's' ] , [ 'packets' , 'pps' ] ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if has_retransmits : #NEWLINE# #INDENT# sampler = ( lambda p : [ round ( p [ 'end' ] , 2 ) , p [ 'bits_per_second' ] , p [ 'retransmits' ] ] ) #NEWLINE# meta = [ [ 'time' , 's' ] , [ 'bandwidth' , 'bit/s' ] , [ 'retransmits' , '' ] ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sampler = ( lambda p : [ round ( p [ 'end' ] , 2 ) , p [ 'bits_per_second' ] ] ) #NEWLINE# meta = [ [ 'time' , 's' ] , [ 'bandwidth' , 'bit/s' ] ] #NEWLINE# #UNINDENT# #UNINDENT# samples = [ ] #NEWLINE# for point in data [ 'intervals' ] : #NEWLINE# #INDENT# samples . append ( sampler ( samples [ 'sum' ] ) ) #NEWLINE# #UNINDENT# result [ 'samples' ] = samples #NEWLINE# result [ 'meta' ] = meta #NEWLINE# stats = result [ 'stats' ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if utils . copy_value_by_path ( data , 'end.sum.jitter_ms' , stats , 'jitter.avg' ) : #NEWLINE# #INDENT# utils . set_value_by_path ( stats , 'jitter.unit' , 'ms' ) #NEWLINE# #UNINDENT# if utils . copy_value_by_path ( data , 'end.sum.lost_percent' , stats , 'loss.avg' ) : #NEWLINE# #INDENT# utils . set_value_by_path ( stats , 'loss.unit' , '%' ) #NEWLINE# #UNINDENT# return result