#!/usr/bin/python
#
# Return participant-specific data for a run
#

import pscheduler
import random
import sys
import iperf3_utils
from iperf3_defaults import *

json = pscheduler.json_load(exit_on_error=True)
result = {}

try:
    participant = json['participant']
except KeyError:
    pscheduler.fail("Missing participant")

config = iperf3_utils.get_config()

# Nothing else interesting for sender
if participant == 0:    
    pass
# Receiver has to figure out what port it's going
# to listen on, client will need this to figure out
# where to connect
elif participant == 1:
    result["server_port"] = config["server_port"]
else:
    pscheduler.fail("Invalid participant number for this test")

pscheduler.succeed_json(result)
