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

## rrul test specification

include("netperf_definitions.inc")
DESCRIPTION="Realtime Response Under Load - Mixed v4/v6 compete"
DEFAULTS={'PLOT': "all_scaled"}

DATA_SETS = o([
    ('TCP upload BE',
     {'command': find_netperf("TCP_STREAM", LENGTH, HOST, marking="CS0,CS0", ip_version=4),
      'delay': DELAY+2,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',}),
    ('TCP upload BK',
     {'command': find_netperf("TCP_STREAM", LENGTH, HOST, marking="CS1,CS1", ip_version=4),
      'delay': DELAY+1,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',}),
    ('TCP upload 6BE',
     {'command': find_netperf("TCP_STREAM", LENGTH, HOST, marking="CS0,CS0", ip_version=6),
      'delay': DELAY+4,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',}),
    ('TCP upload 6BK',
     {'command': find_netperf("TCP_STREAM", LENGTH, HOST, marking="CS1,CS1", ip_version=6),
       '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',}),

    ('TCP download BK',
     {'command': find_netperf("TCP_MAERTS", LENGTH, HOST, marking="CS1,CS1", ip_version=4),
      'delay': DELAY,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',}),
    ('TCP download 6BK',
     {'command': find_netperf("TCP_MAERTS", LENGTH, HOST, marking="CS1,CS1", ip_version=6),
       'delay': DELAY,
       'units': 'Mbits/s',
       'runner': 'netperf_demo',}),
    ('TCP download BE',
     {'command': find_netperf("TCP_MAERTS", LENGTH, HOST, marking="CS0,CS0", ip_version=4),
      'delay': DELAY,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',}),
    ('TCP download 6BE',
     {'command': find_netperf("TCP_MAERTS", LENGTH, HOST, marking="CS0,CS0", ip_version=6),
      'delay': DELAY,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',}),
    ('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',}),

    ('Ping (ms) UDP 6EF',
     {'command': find_netperf("UDP_RR", TOTAL_LENGTH, HOST, marking="EF,EF", ip_version=6),
      'data_transform': 'rr_to_ms',
      'units': 'ms',
      'runner': 'netperf_demo',}),
    ('Ping (ms) UDP 6BK',
     {'command': find_netperf("UDP_RR", TOTAL_LENGTH, HOST, marking="CS1,CS1", ip_version=6),
      'data_transform': 'rr_to_ms',
      'units': 'ms',
      'runner': 'netperf_demo',}),
    ('Ping (ms) UDP BE',
     {'command': find_netperf("UDP_RR", TOTAL_LENGTH, HOST, ip_version=4),
      'data_transform': 'rr_to_ms',
      'units': 'ms',
      'runner': 'netperf_demo',}),
    ('Ping (ms) UDP 6BE',
     {'command': find_netperf("UDP_RR", TOTAL_LENGTH, HOST, ip_version=6),
      'data_transform': 'rr_to_ms',
      'units': 'ms',
      'runner': 'netperf_demo',}),
    ('Ping (ms) ICMP',
     {'command': find_ping(4, STEP_SIZE, TOTAL_LENGTH, HOST),
      'units': 'ms',
      'runner': 'ping',}),
    ('Ping (ms) ICMP6',
     {'command': find_ping(6, 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': 'TCP download BE',
                  'label': 'BE',
                  'linewidth': 2.0},
                 {'data': 'TCP download 6BE',
                  'label': '6BE'},
                 {'data': 'TCP download BK',
                  'label': 'BK'},
                 {'data': 'TCP download 6BK',
                  'label': '6BK'},
                 {'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': 'TCP upload BE',
                  'label': 'BE',
                  'linewidth': 2.0},
                 {'data': 'TCP upload 6BE',
                  'label': '6BE'},
                 {'data': 'TCP upload BK',
                  'label': 'BK'},
                 {'data': 'TCP upload 6BK',
                  'label': '6BK'},
                 {'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 6EF',
                  'label': 'UDP6 EF'},
                 {'data': 'Ping (ms) UDP 6BK',
                  'label': 'UDP6 BK'},
                 {'data': 'Ping (ms) UDP BE',
                  'label': 'UDP BE'},
                 {'data': 'Ping (ms) UDP 6BE',
                  'label': 'UDP6 BE'},
                 {'data': 'Ping (ms) ICMP',
                  'label': 'ICMP'},
                 {'data': 'Ping (ms) ICMP6',
                  'label': 'ICMP6'},
                 {'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)}),

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

    ('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 total bandwidth',
      'parent': 'totals',
      'type': 'box',}),

    ])
