## -*- mode: python; coding: utf-8 -*-

DESCRIPTION="VoIP one-way stream test with competing TCP stream"
DEFAULTS={'PLOT': 'totals_loss'}
TOTAL_LENGTH=LENGTH+2*DELAY

VOIP_HOST=HOST
VOIP_LOCAL_BIND=LOCAL_BIND[0] if LOCAL_BIND else None
VOIP_CONTROL_HOST=CONTROL_HOST or HOST
VOIP_LENGTH=TOTAL_LENGTH
VOIP_CUTOFF=(DELAY,DELAY)
DATA_SETS=o()
PLOTS=o()
include("voip.inc")


DATA_SETS['TCP upload'] = {'command': find_netperf("TCP_STREAM", LENGTH, HOST),
                           'delay': DELAY,
                           'units': 'Mbits/s',
                           'runner': 'netperf_demo',}

PLOTS['bandwidth'] = {'description': 'TCP bandwidth plot',
      'type': 'timeseries',
      'series': [{'data': 'TCP upload',
                  'label': 'TCP upload'},]}
PLOTS['totals'] = {'description': 'TCP bandwidth with delay and jitter',
                   'type': 'meta',
                   'subplots': ('bandwidth', 'delay')}
PLOTS['totals_loss'] = {'description': 'TCP bandwidth with delay, jitter and loss',
                   'type': 'meta',
                   'subplots': ('bandwidth', 'voip_delay', 'voip_loss')}
PLOTS['box_combine'] = {'description': "Box combination plot",
                        'type': 'box_combine',
                        'cutoff': (DELAY,DELAY),
                        'dual_axes': True,
                        'axis_labels': ['Mean bandwidth (Mbps)', 'Mean induced delay (ms)'],
                        'series': [{'data': 'TCP upload',
                                    'label': 'TCP upload',
                                    'combine_mode': 'meta:MEAN_VALUE'},
                                    {'data': 'VoIP::delay',
                                     'label': 'Induced VoIP delay',
                                     'combine_mode': 'mean_span',
                                     'axis': 2}]}
PLOTS['bar_upload'] = {'description': "Bar combination plot",
                        'type': 'bar_combine',
                        'cutoff': (DELAY,DELAY),
                        'axis_labels': ['Mean goodput (Mbps)'],
                        'series': [{'data': 'TCP upload',
                                    'label': 'TCP upload',
                                    'combine_mode': 'meta:MEAN_VALUE'},
                                    ]}
PLOTS['cdf_combine'] = {'description': "CDF combination plot",
                        'type': 'cdf_combine',
                        'axis_labels': ['Induced one-way delay (ms)'],
                        'group_by': 'groups_concat',
                        'cutoff': (DELAY,DELAY),
                        'series': [{'data': 'VoIP::delay',
                                    'label': 'Induced VoIP delay',
                                    'markevery': 10,
                                    'combine_mode': 'span'}]}

PLOTS['bar_cdf'] = {'description': 'Bar and CDF combinations',
                    'type': 'meta',
                    'subplots': ('bar_upload', 'cdf_combine'),
                    'share_axis': False,
                    'orientation': 'horizontal'}

include("common.inc")
