def cloudlab_config(cca,
                    end_time,
                    queue_size=1024,
                    btlbw=10,
                    rtt=40,
                    kind='iperf'):
    config = {}
    config['server'] = dict(HOST_SERVER._asdict())
    config['client'] = dict(HOST_CLIENT._asdict())
    config['experiments'] = {}

    num_flows = [1]
    # cca alone experiments
    for num_cca_flows in num_flows:
        experiment_name = '{}{}-{}bw-{}rtt-{}q'.format(cca, num_cca_flows,
                                                       btlbw, rtt, queue_size)
        experiment = {'btlbw': btlbw, 'queue_size': queue_size}
        experiment['flows'] = [{
            'ccalg': cca,
            'start_time': 0,
            'end_time': end_time,
            'rtt': rtt,
            'kind': kind
        } for _ in range(num_cca_flows)]
        config['experiments'][experiment_name] = experiment
    return config
def ccalg_predict_config(btlbw,
                         rtts,
                         end_time,
                         queue_sizes,
                         exp_name_suffix=None,
                         ccalgs=None,
                         loss=None):
    config = {}
    config['server'] = HOST_SERVER._asdict()
    config['client'] = HOST_CLIENT._asdict()
    config['experiments'] = {}

    if ccalgs is None:
        ccalgs = ['bbr', 'cubic', 'reno']
    if loss is None:
        loss = [None]
    for rtt in rtts:
        for queue_size in queue_sizes:
            for ccalg in ccalgs:
                for loss_rate in loss:
                    if exp_name_suffix is None:
                        experiment_name = '{}-{}bw-{}rtt-{}q'.format(
                            ccalg, btlbw, rtt, int(queue_size))
                    else:
                        experiment_name = '{}-{}bw-{}rtt-{}q-{}'.format(
                            ccalg, btlbw, rtt, int(queue_size),
                            exp_name_suffix)

                    if loss_rate is not None:
                        experiment_name = '{}-{}bw-{}rtt-{}q-{}loss-{}'.format(
                            ccalg, btlbw, rtt, int(queue_size),
                            float(loss_rate), exp_name_suffix)
                        experiment = {
                            'btlbw': btlbw,
                            'queue_size': int(queue_size),
                            'loss_rate': float(loss_rate)
                        }
                    else:
                        experiment = {
                            'btlbw': btlbw,
                            'queue_size': int(queue_size)
                        }
                    flows = [{
                        'ccalg': ccalg,
                        'start_time': 0,
                        'end_time': end_time,
                        'rtt': int(rtt)
                    }]
                    experiment['flows'] = flows
                    config['experiments'][experiment_name] = experiment
    return config