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

## rrul test specification

include("netperf_definitions.inc")
DESCRIPTION="Realtime Response Under Load - Best Effort, configurable no of flows"
DEFAULTS={'PLOT': "all_scaled"}

STREAMS_UP=get_test_parameter('upload_streams')
STREAMS_DOWN=get_test_parameter('download_streams')


DATA_SETS = o([
    ('TCP upload BE',
     {'command': find_netperf("TCP_STREAM", LENGTH, HOST, marking="CS0,CS0"),
      'delay': DELAY,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',
      'duplicates': STREAMS_UP}),
    ('TCP upload avg',
     {'apply_to': [glob("TCP upload*", exclude=["TCP upload sum"])],
       'units': 'Mbits/s',
       'runner': 'average',}),
    ('TCP upload sum',
     {'apply_to': [glob("TCP upload*", exclude=["TCP upload avg"])],
       'units': 'Mbits/s',
       'runner': 'sum',}),

    ('TCP download BE',
     {'command': find_netperf("TCP_MAERTS", LENGTH, HOST, marking="CS0,CS0"),
      'delay': DELAY,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',
      'duplicates': STREAMS_DOWN}),
    ('TCP download avg',
     {'apply_to': [glob("TCP download*", exclude=["TCP download sum"])],
       'units': 'Mbits/s',
       'runner': 'average',}),
    ('TCP download sum',
     {'apply_to': [glob("TCP download*", exclude=["TCP download avg"])],
       'units': 'Mbits/s',
       'runner': 'sum',}),
    ('TCP totals',
     {'apply_to': [glob("TCP*", exclude=["TCP download avg", "TCP download sum", "TCP upload avg", "TCP upload sum"])],
       'units': 'Mbits/s',
       'runner': 'sum',}),

    ('Ping (ms) UDP BE',
     {'command': find_netperf("UDP_RR", TOTAL_LENGTH, HOST, marking="CS0,CS0"),
      'data_transform': 'rr_to_ms',
      'units': 'ms',
      'runner': 'netperf_demo',}),
    ('Ping (ms) ICMP',
     {'command': find_ping(IP_VERSION, STEP_SIZE, TOTAL_LENGTH, HOST),
      'units': 'ms',
      'runner': 'ping',}),
    ('Ping (ms) avg',
     {'apply_to': [glob("Ping (ms)*")],
       'units': 'ms',
       'runner': 'average',}),
    ])

PLOTS = o([
    ('download',
     {'description': 'Download bandwidth plot',
      'type': 'timeseries',
      'legend_title': 'TCP download',
      'series': [{'data': glob('TCP download BE*'),
                  'label': 'BE'},
                 {'data': 'TCP download avg',
                  'label': 'Avg',
                  'smoothing': 10,
                  'color': 'black',
                  'linewidth': 2}]}),

    ('download_scaled',
     {'description': 'Download bandwidth w/axes scaled to remove outliers',
      'parent': 'download',
      'scaling': (5,95)}),

    ('upload',
     {'description': 'Upload bandwidth plot',
      'type': 'timeseries',
      'legend_title': 'TCP upload',
      'series': [{'data': glob('TCP upload BE*'),
                  'label': 'BE'},
                 {'data': 'TCP upload avg',
                  'label': 'Avg',
                  'smoothing': 10,
                  'color': 'black',
                  'linewidth': 2}]}),

    ('upload_scaled',
     {'description': 'Upload bandwidth w/axes scaled to remove outliers',
      'parent': 'upload',
      'scaling': (5,95)}),

    ('ping',
     {'description': 'Ping plot',
      'type': 'timeseries',
      'legend_title': 'Ping (ms)',
      'axis_labels': ['Latency (ms)'],
      'series': [{'data': 'Ping (ms) UDP BE',
                  'label': 'UDP BE1'},
                 {'data': 'Ping (ms) ICMP',
                  'label': 'ICMP'},
                 {'data': 'Ping (ms) avg',
                  'label': 'Avg',
                  'smoothing': 10,
                  'color': 'black',
                  'linewidth': 2}]}),

    ('ping_scaled',
     {'description': 'Ping w/axes scaled to remove outliers',
      'parent': 'ping',
      'scaling': (5,95)}),

    ('ping_cdf',
     {'description': 'Ping CDF plot',
      'type': 'cdf',
      'axis_labels': ['Latency (ms)'],
      'parent': 'ping',
      'cutoff': (DELAY,DELAY)}),

    ('icmp_cdf',
     {'description': 'ICMP CDF plot',
      'type': 'cdf',
      'axis_labels': ['Latency (ms)'],
      'series': [{'data': 'Ping (ms) ICMP',
                  'label': 'Ping (ms)'},
                 ],
      'cutoff': (DELAY,DELAY)}),

    ('icmp_combine',
     {'description': 'Combined ICMP ping plot',
      'parent': 'icmp_cdf',
      'type': 'timeseries_combine',
      'group_by': 'groups_points',
      'cutoff': None}),

    ('totals_bandwidth',
     {'description': 'Total bandwidth',
      'type': 'timeseries',
      'series': [{'data': 'TCP download sum',
                  'label': 'Download',
                  'smoothing': 10},
                 {'data': 'TCP upload sum',
                  'label': 'Upload',
                  'smoothing': 10}]}),
    ('totals',
     {'description': 'Total bandwidth and average ping plot',
      'type': 'timeseries',
      'dual_axes': True,
      'axis_labels': [None, 'Latency (ms)'],
      'series': [{'data': 'TCP download sum',
                  'label': 'Download',
                  'smoothing': 10},
                 {'data': 'TCP upload sum',
                  'label': 'Upload',
                  'smoothing': 10},
                 {'data': 'Ping (ms) avg',
                  'label': 'Ping (ms)',
                  'smoothing': 10,
                  'axis': 2}]}),
    ('totals_scaled',
     {'description': 'Total bandwidth and average ping plot (scaled)',
      'parent': 'totals',
      'scaling': (5,95)}),

    ('totals_combine',
     {'description': 'Combined total bandwidth and average ping plot',
      'parent': 'totals',
      'type': 'timeseries_combine',
      'group_by': 'groups_points'}),

    ('all_scaled',
     {'description': 'Download, upload, ping (scaled versions)',
      'type': 'meta',
      'subplots': ('download_scaled', 'upload_scaled', 'ping_scaled')}),

    ('all',
     {'description': 'Download, upload, ping (unscaled versions)',
      'type': 'meta',
      'subplots': ('download', 'upload', 'ping')}),

    ('box_download',
     {'description': 'Download bandwidth box plot',
      'parent': 'download',
      'type': 'box'}),

    ('box_upload',
     {'description': 'Upload bandwidth box plot',
      'parent': 'upload',
      'type': 'box'}),

    ('box_ping',
     {'description': 'Ping box plot',
      'parent': 'ping',
      'type': 'box'}),

    ('box_totals',
     {'description': 'Box plot of totals',
      'parent': 'totals',
      'type': 'box',}),

    ('bar_totals',
     {'description': 'Box plot of totals',
      'parent': 'totals',
      'type': 'bar',}),

    ('box_combine',
     {'description': 'Box plot of averages of several data files.',
      'type': 'box_combine',
      'dual_axes': True,
      'axis_labels': ['Mean TCP goodput (Mbit/s)', 'Mean induced latency (ms)'],
      'cutoff': (DELAY,DELAY),
      'series': [{'data': 'TCP download sum',
                  'label': 'Download',
                  'combine_mode': 'meta:MEAN_VALUE'},
                 {'data': 'TCP upload sum',
                  'label': 'Upload',
                  'combine_mode': 'meta:MEAN_VALUE'},
                 {'data': 'Ping (ms) avg',
                  'label': 'Induced latency (ms)',
                  'combine_mode': 'mean_span',
                  'axis': 2}]}),

    ('bar_combine',
     {'description': 'Bar plot of averages of several data files.',
      'type': 'bar_combine',
      'dual_axes': True,
      'axis_labels': ['Mean TCP goodput (Mbit/s)', 'Mean induced latency (ms)'],
      'cutoff': (DELAY,DELAY),
      'series': [{'data': 'TCP download sum',
                  'label': 'Download',
                  'combine_mode': 'meta:MEAN_VALUE'},
                 {'data': 'TCP upload sum',
                  'label': 'Upload',
                  'combine_mode': 'meta:MEAN_VALUE'},
                 {'data': 'Ping (ms) avg',
                  'label': 'Induced latency (ms)',
                  'combine_mode': 'mean_span',
                  'axis': 2}]}),

    ('qq_icmp',
     {'description': 'Q-Q plot of ICMP pings',
      'type': 'qq',
      'series': [{'data': 'Ping (ms) ICMP',
                  'label': 'Latency (ms)'},
                 ]}),

    ('qq_download',
     {'description': 'Q-Q plot of total download bandwidth',
      'type': 'qq',
      'series': [{'data': 'TCP download sum',
                  'label': 'Download (Mbps)'},
                 ]}),

    ('qq_upload',
     {'description': 'Q-Q plot of total upload bandwidth',
      'type': 'qq',
      'series': [{'data': 'TCP upload sum',
                  'label': 'Upload (Mbps)'},
                 ]}),
    ('ellipsis',
     {'description': 'Ellipsis plot',
      'type': 'ellipsis',
      'series': [{'data': 'Ping (ms) avg',
                   'label': 'Latency (avg)'},
                   {'data': 'TCP upload sum',
                  'label': 'Upload (Mbps)'},
                   ]}),
    ('ellipsis_down',
     {'description': 'Ellipsis plot',
      'type': 'ellipsis',
      'series': [ {'data': 'Ping (ms) avg',
                   'label': 'Latency (avg)'},
                   {'data': 'TCP download sum',
                   'label': 'Download (Mbps)'},
                   ]}),
    ('ellipsis_sum',
     {'description': 'Ellipsis plot',
      'type': 'ellipsis',
      'series': [{'data': 'Ping (ms) avg',
                   'label': 'Latency (avg)'},
                 {'data': 'TCP totals',
                  'label': 'Throughput (Mbps)'}
                    ]}),
    ('ellipsis_combine',
     {'description': 'Ellipsis plot of averages of several data files.',
      'type': 'ellipsis_combine',
      'axis_labels': ['Mean induced latency (ms)', 'Mean TCP goodput (Mbit/s)'],
      'series': [{'data': 'Ping (ms) avg',
                  'label': 'Induced latency (ms)',
                  'combine_mode': 'mean_span',
                  'axis': 2},
                  {'data': 'TCP upload sum',
                  'label': 'Upload',
                  'combine_mode': 'meta:MEAN_VALUE'},
                 ]}),
    ('ellipsis_combine_both',
     {'description': 'Ellipsis plot of averages of several data files -- upload *and* download plotted.',
      'type': 'ellipsis_combine',
      'axis_labels': ['Mean induced latency (ms)', 'Mean TCP goodput (Mbit/s)'],
      'series': [{'data': 'Ping (ms) avg',
                  'label': 'Induced latency (ms)',
                  'combine_mode': 'mean_span',
                  'axis': 2},
                  {'data': 'TCP upload sum',
                  'label': 'Upload',
                  'combine_mode': 'meta:MEAN_VALUE'},
                  {'data': 'TCP download sum',
                  'label': 'Download',
                  'combine_mode': 'meta:MEAN_VALUE'},
                 ]}),
    ('cdf_combine',
     {'description': 'CDF plot of averages of several data files.',
      'type': 'cdf_combine',
      'group_by': 'groups_concat',
      'axis_labels': ['Mean induced latency (ms)'],
      'cutoff': (DELAY,DELAY),
      'series': [{'data': 'Ping (ms) avg',
                  'label': 'Induced latency (ms)',
                  'combine_mode': 'span',}
                 ]}),

    ])

include("common.inc")
