import argparse
from moonlight_analytics import MoonlightTester
import asyncio
import sys


if __name__ == '__main__':
    tester = MoonlightTester()
    time = sys.argv[2] if len(sys.argv) > 2 else 10
    if sys.argv[1] == "router":
        asyncio.get_event_loop().run_until_complete(tester.nightly_router_iperf(time=time))
    elif sys.argv[1] == "pi":
        asyncio.get_event_loop().run_until_complete(tester.nightly_pi_iperf(time=time))
    elif sys.argv[1] == "speedtest":
        asyncio.get_event_loop().run_until_complete(tester.nightly_pi_speedtest())
    elif sys.argv[1] == "start_iperf":
        asyncio.get_event_loop().run_until_complete(tester.start_iperf_servers())
    elif sys.argv[1] == "cleanup_iperf":
        asyncio.get_event_loop().run_until_complete(tester.cleanup_iperf_servers())