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

## rrul test specification

include("netperf_definitions.inc")
DESCRIPTION="RTT Fair Realtime Response Under Load"
DEFAULTS={'PLOT': "all_scaled",
          'HOSTS': []}

# This makes sure that five hosts are specified on the command line, and if not
# fills up the HOSTS list with input from the DEFAULTS above
# (repeating them if necessary).
min_host_count(5)

DATA_SETS = o([
    ('TCP upload BE0 %s' % HOSTS[0],
     {'command': find_netperf("TCP_STREAM", LENGTH, HOSTS[0], marking="CS0,CS0"),
      'delay': DELAY,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',}),
    ('TCP upload BE1 %s' % HOSTS[1],
     {'command': find_netperf("TCP_STREAM", LENGTH, HOSTS[1], marking="CS0,CS0"),
      'delay': DELAY,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',}),
    ('TCP upload BE2 %s' % HOSTS[2],
     {'command': find_netperf("TCP_STREAM", LENGTH, HOSTS[2], marking="CS0,CS0"),
      'delay': DELAY,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',}),
    ('TCP upload BE3 %s' % HOSTS[3],
     {'command': find_netperf("TCP_STREAM", LENGTH, HOSTS[3], marking="CS0,CS0"),
       'delay': DELAY,
       'units': 'Mbits/s',
       'runner': 'netperf_demo',}),
    ('TCP upload BE4 %s' % HOSTS[4],
     {'command': find_netperf("TCP_STREAM", LENGTH, HOSTS[4], marking="CS0,CS0"),
       'delay': DELAY,
       'units': 'Mbits/s',
       'runner': 'netperf_demo',}),
    ('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',}),

    ('Ping (ms) ICMP0 %s' % HOSTS[0],
     {'command': find_ping(IP_VERSION, STEP_SIZE, TOTAL_LENGTH, HOSTS[0]),
      'units': 'ms',
      'runner': 'ping',}),
    ('Ping (ms) ICMP1 %s' % HOSTS[1],
     {'command': find_ping(IP_VERSION, STEP_SIZE, TOTAL_LENGTH, HOSTS[1]),
      'units': 'ms',
      'runner': 'ping',}),
    ('Ping (ms) ICMP2 %s' % HOSTS[2],
     {'command': find_ping(IP_VERSION, STEP_SIZE, TOTAL_LENGTH, HOSTS[2]),
      'units': 'ms',
      'runner': 'ping',}),
    ('Ping (ms) ICMP3 %s' % HOSTS[3],
     {'command': find_ping(IP_VERSION, STEP_SIZE, TOTAL_LENGTH, HOSTS[3]),
      'units': 'ms',
      'runner': 'ping',}),
    ('Ping (ms) ICMP4 %s' % HOSTS[4],
     {'command': find_ping(IP_VERSION, STEP_SIZE, TOTAL_LENGTH, HOSTS[4]),
      'units': 'ms',
      'runner': 'ping',}),
    ('Ping (ms) avg',
     {'apply_to': [glob("Ping (ms)*")],
       'units': 'ms',
       'runner': 'average',}),
    ])

PLOTS = o([
    ('upload',
     {'description': 'Upload bandwidth plot',
      'type': 'timeseries',
      'legend_title': 'TCP upload',
      'series': [{'data': 'TCP upload BE0 %s' % HOSTS[0],
                  'label': 'BE %s' % HOSTS[0],
                  'linewidth': 2.0},
                 {'data': 'TCP upload BE1 %s' % HOSTS[1],
                  'label': 'BE %s' % HOSTS[1]},
                 {'data': 'TCP upload BE2 %s' % HOSTS[2],
                  'label': 'BE %s' % HOSTS[2]},
                 {'data': 'TCP upload BE3 %s' % HOSTS[3],
                  'label': 'BE %s' % HOSTS[3]},
                 {'data': 'TCP upload BE4 %s' % HOSTS[4],
                  'label': 'BE %s' % HOSTS[4]},
                 {'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)',
      'series': [
                 {'data': 'Ping (ms) ICMP0 %s' % HOSTS[0],
                  'label': 'ICMP %s' % HOSTS[0] },
                 {'data': 'Ping (ms) ICMP1 %s' % HOSTS[1],
                  'label': 'ICMP %s' % HOSTS[1] },
                 {'data': 'Ping (ms) ICMP2 %s' % HOSTS[2],
                  'label': 'ICMP %s' % HOSTS[2] },
                 {'data': 'Ping (ms) ICMP3 %s' % HOSTS[3],
                  'label': 'ICMP %s' % HOSTS[3] },
                 {'data': 'Ping (ms) ICMP4 %s' % HOSTS[4],
                  'label': 'ICMP %s' % HOSTS[4] },
                 {'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',
      'parent': 'ping',
      'cutoff': (DELAY,DELAY)}),

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

    ('totals',
     {'description': 'Total bandwidth and average ping plot',
      'type': 'timeseries',
      'dual_axes': True,
      'series': [{'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)}),

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

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

    ('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',}),
    ])
