def plr_plt_scenario(): testbed = BasicTestbed(host_ip=HOST_IP) sites_to_check = ["https://www.nasa.gov"] plr_levels = list(numpy.unique(list(numpy.geomspace((1*pow(10, -7)), (1*pow(10,2)), num=20)) + list(numpy.geomspace((1*pow(10,-7)), (1*pow(10,2)), num=10)))) plain_scenario = PlainScenario(name="Plain", testbed=testbed, benchmarks=[]) vpn_scenario = OpenVPNScenario(name="OpenVPN", testbed=testbed, benchmarks=[]) pepsal_scenario = PEPsalScenario(name="PEPSal", testbed=testbed, benchmarks=[], terminal=True, gateway=False) distributed_pepsal_scenario = PEPsalScenario(name="Distributed PEPsal",terminal=True, gateway=True, testbed=testbed,benchmarks=[]) qpep_scenario = QPEPScenario(name="QPEP", testbed=testbed, benchmarks=[]) scenarios = [plain_scenario, pepsal_scenario, distributed_pepsal_scenario, qpep_scenario, vpn_scenario] for scenario in scenarios: benchmarks = [SitespeedBenchmark(hosts=sites_to_check, scenario=scenario, iterations=1, sub_iterations=int(os.getenv("PLR_PLT_ITERATIONS")))] if scenario.name == os.getenv("SCENARIO_NAME"): logger.debug("Running PLR PLT scenario" + str(scenario.name)) plr_scenario_results = {} for plr_level in plr_levels[int(os.getenv("PLR_MIN_INDEX")):int(os.getenv("PLR_MAX_INDEX"))]: plr_string = numpy.format_float_positional(plr_level, precision=7, trim='-') plr_scenario_results[str(plr_string)]=[] for j in range(0, int(os.getenv("PLR_META_ITERATIONS"))): scenario.benchmarks = copy.deepcopy(benchmarks) scenario.deploy_scenario() scenario.testbed.set_plr_percentage(plr_string, st_out=False, gw_out=True) logger.debug("Running PLR PLT for " + str(scenario.name) + " at " + str(plr_string) + " batch " + str(j) +" of " + str(os.getenv("PLR_META_ITERATIONS"))) scenario.run_benchmarks(deployed=True) for benchmark in scenario.benchmarks: plr_scenario_results[str(plr_string)].append(benchmark.results) logger.debug("Interim PLR/PLT Results (PLR: " + str(plr_string) + " meta_iteration: " + str(j) + "/" + str(int(os.getenv("PLR_META_ITERATIONS"))) + " Scenario: " + str(scenario.name) +"): " + str(plr_scenario_results) + "\n") print("Final PLR PLT results for " + str(scenario.name)) print("***********************************************") print(plr_scenario_results) print('\n*********************************************') logger.success("PLR/PLT test complete")
def plt_test_scenario(testbed=None): if testbed is None: testbed = BasicTestbed(host_ip=HOST_IP) benchmarks = [SitespeedBenchmark(hosts=['https://www.sina.com.cn'])] plain_scenario = PlainScenario(name="Plain", testbed=testbed, benchmarks=copy.deepcopy(benchmarks)) vpn_scenario = OpenVPNScenario(name="OpenVPN", testbed=testbed, benchmarks=copy.deepcopy(benchmarks)) pepsal_scenario = PEPsalScenario(name="PEPSal", testbed=testbed, benchmarks=copy.deepcopy(benchmarks), terminal=True, gateway=False) distributed_pepsal_scenario = PEPsalScenario( name="Distributed PEPsal ", terminal=True, gateway=True, testbed=testbed, benchmarks=copy.deepcopy(benchmarks)) qpep_scenario = QPEPScenario(name="QPEP", testbed=testbed, benchmarks=copy.deepcopy(benchmarks)) #scenarios = [plain_scenario, pepsal_scenario, distributed_pepsal_scenario, qpep_scenario, vpn_scenario] scenarios = [distributed_pepsal_scenario] for scenario in scenarios: logger.debug("Running PLT test scenario " + str(scenario.name)) scenario.deploy_scenario() scenario.run_benchmarks(deployed=True) for benchmark in scenario.benchmarks: print("Results for PLT " + str(scenario.name)) print(benchmark.results)
def plt_test_scenario(testbed=None): if testbed is None: testbed = RealWorldTestbed() alexa_top_20 = [ "https://www.google.com", "https://www.youtube.com", "https://www.tmall.com", "https://www.facebook.com", "https://www.baidu.com", "https://www.qq.com", "https://www.sohu.com", "https://www.taobao.com", "https://www.360.cn", "https://www.jd.com", "https://www.yahoo.com", "https://www.amazon.com", "https://www.wikipedia.org", "https://www.weibo.com", "https://www.sina.com.cn", "https://www.reddit.com", "https://www.live.com", "https://www.netflix.com", "https://www.okezone.com", "https://www.vk.com" ] with open(str(os.getenv("TESTBED_FILE"))) as file: testbed_name = file.readlines()[0] plain_scenario = PlainScenario(name="plain", testbed=testbed, benchmarks=[]) vpn_scenario = OpenVPNScenario(name="ovpn", testbed=testbed, benchmarks=[]) pepsal_scenario = PEPsalScenario(name="pepsal", testbed=testbed, benchmarks=[], terminal=True, gateway=False) distributed_pepsal_scenario = PEPsalScenario(name="dist_pepsal", terminal=True, gateway=True, testbed=testbed, benchmarks=[]) qpep_scenario = QPEPScenario(name="qpep", testbed=testbed, benchmarks=[]) scenarios = [ plain_scenario, pepsal_scenario, distributed_pepsal_scenario, qpep_scenario, vpn_scenario ] for scenario in scenarios: scenario.benchmarks = [ SitespeedBenchmark( hosts=alexa_top_20[int(os.getenv("ALEXA_MIN") ):int(os.getenv("ALEXA_MAX"))], scenario=scenario, iterations=int(os.getenv("PLT_ITERATIONS")), sub_iterations=int(os.getenv("PLT_SUB_ITERATIONS"))) ] logger.debug("Running PLT test scenario " + str(scenario.name)) scenario.deploy_scenario() scenario.run_benchmarks(deployed=True) for benchmark in scenario.benchmarks: print("Results for PLT " + str(scenario.name)) print(benchmark.results) benchmark.save_results_to_db(str(scenario.name), testbed_name) for scenario in scenarios: if scenario.name == os.getenv("SCENARIO_NAME"): scenario.print_results()
def congestion_window_test_scenario(): testbed = BasicTestbed(host_ip=HOST_IP) benchmarks = [ SitespeedBenchmark(hosts=["https://www.bbc.co.uk"], iterations=3) ] qpep_congestion_scenario = QPEPCongestionScenario( name='QPEP Congestion Window Test', testbed=testbed, benchmarks=benchmarks) qpep_congestion_scenario.deploy_scenario() scenario_results = [] for i in range(1, 50): qpep_congestion_scenario.deploy_scenario(testbed_up=True, congestion_window=i) qpep_congestion_scenario.benchmarks = copy.deepcopy(benchmarks) qpep_congestion_scenario.run_benchmarks(deployed=True) for benchmark in qpep_congestion_scenario.benchmarks: print("Results for Congestion Window Test " + str(i)) print(benchmark.results) scenario_results.extend(benchmark.results) print("Current overall results: ", scenario_results) print("Congestion Test DECIMATION DONE", scenario_results)
def attenuation_test_plt_scenario(): testbed = BasicTestbed(host_ip=HOST_IP) attenuation_levels = [i * 0.5 for i in range(0, 11)] benchmarks = [ SitespeedBenchmark(hosts=["https://www.bbc.co.uk"], iterations=5) ] # test with pepsal vs qpep vs plain # NB - due to the networking requirements of PEPsal, a special testbed launch order is required in attenuation_test_pepsal_scenario to allow access to web content qpep_scenario = QPEPScenario(name="QPEP Attenuation ", testbed=testbed, benchmarks=copy.deepcopy(benchmarks)) plain_scenario = PlainScenario(name="Plain Attenuation ", testbed=testbed, benchmarks=copy.deepcopy(benchmarks)) vpn_scenario = OpenVPNScenario(name="OpenVPN", testbed=testbed, benchmarks=copy.deepcopy(benchmarks)) scenarios = [plain_scenario, qpep_scenario, vpn_scenario] for scenario in scenarios: scenario_results = [] scenario_errors = [] for attenuation_level in attenuation_levels: scenario.deploy_scenario() scenario.benchmarks = copy.deepcopy(benchmarks) logger.debug("Running attenuation scenario test for attenuation=" + str(attenuation_level)) scenario.testbed.set_downlink_attenuation(attenuation_level) scenario.testbed.run_attenuation_scenario() scenario.testbed.connect_terminal_workstation() scenario.run_benchmarks(deployed=True) for benchmark in scenario.benchmarks: if len(benchmark.results) > 0: scenario_results.append(mean(benchmark.results)) scenario_errors.append(benchmark.errors) print(scenario.name, "Results: ") print(" PLT: ", scenario_results) print(" ERR: ", scenario_errors) logger.success("Attenuation PLT Test Complete")
def attenuation_test_pepsal_scenario(): testbed = BasicTestbed(host_ip=HOST_IP) attenuation_levels = [i * 0.5 for i in range(6, 11)] benchmarks = [ SitespeedBenchmark(hosts=["https://www.bbc.co.uk"], iterations=5) ] pepsal_scenario = PEPsalScenario(name="PEPsal Attenuation ", testbed=testbed, benchmarks=copy.deepcopy(benchmarks)) distributed_pepsal_scenario = PEPsalScenario( name="Distributed Attenuation ", gateway=True, testbed=testbed, benchmarks=copy.deepcopy(benchmarks)) scenarios = [pepsal_scenario, distributed_pepsal_scenario] for scenario in scenarios: scenario_results = [] scenario_errors = [] for attenuation_level in attenuation_levels: testbed.start_testbed() testbed.connect_terminal_workstation() testbed.set_downlink_attenuation( attenuation_value=attenuation_level) testbed.run_attenuation_scenario() scenario.deploy_scenario(testbed_up=True) scenario.benchmarks = copy.deepcopy(benchmarks) scenario.run_benchmarks(deployed=True) for benchmark in scenario.benchmarks: if len(benchmark.results) > 0: scenario_results.append(mean(benchmark.results)) scenario_errors.append(benchmark.errors) logger.debug("Current results: " + str(scenario_results)) logger.debug("Current errors: " + str(scenario_errors)) testbed.stop_testbed() time.sleep(1) print(scenario.name, " Results: ") print(" PLT: ", scenario_results) print(" ERR: ", scenario_errors)