From 22d20feb68933d02e004ca3885151a6438efb8ea Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Thu, 7 Nov 2019 11:50:06 +0100 Subject: [PATCH 01/14] Add a new testcase, add a new stats collector --- stats_collector.py | 198 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 153 insertions(+), 45 deletions(-) diff --git a/stats_collector.py b/stats_collector.py index ab51a0e..a41a2b0 100644 --- a/stats_collector.py +++ b/stats_collector.py @@ -63,6 +63,8 @@ import os from warp17_api import * import socket +import time +import os from rpc_impl import * from functools import partial @@ -76,6 +78,7 @@ from warp17_app_raw_pb2 import * from warp17_app_pb2 import * from warp17_server_pb2 import * +from warp17_app_http_pb2 import * from warp17_client_pb2 import * from warp17_test_case_pb2 import * from warp17_service_pb2 import * @@ -136,7 +139,7 @@ def add_config(self): b2b_port_add_intfs(pcfg, [(Ip(ip_version=IPV4, ip_v4=b2b_ipv4(port, i)), Ip(ip_version=IPV4, ip_v4=b2b_mask(port, i)), - b2b_count(port, i)) for i in range(0, n_ip)]) + b2b_count(port, i)) for i in range(0, 1)]) warp17_call('ConfigurePort', pcfg) cl_src_ips = b2b_sips(self.cl_port, self.l3_config[self.cl_port][1]) @@ -148,7 +151,7 @@ def add_config(self): tuc_sports=b2b_ports(self.l4_config[0]), tuc_dports=b2b_ports(self.l4_config[1]))) - uptime_delay = Delay(d_value=120) + uptime_delay = Delay(d_value=2) downtime_delay = Delay(d_value=0) self.ccfg = TestCase(tc_type=CLIENT, tc_eth_port=self.cl_port, tc_id=self.tc_id, @@ -177,19 +180,33 @@ def add_config(self): def run(self): self.add_config() self.start() - results = self.check_results() + status, stats, tstamps = self.check_results(20) self.stop() - return results + return status, stats, tstamps - def check_results(self): - results = {} + def check_results(self, times=1): + status = [] + stats = [] + tstamps = [] sleep(5) - for port in self.l3_config: - results[port] = warp17_call('GetTestStatus', - TestCaseArg(tca_eth_port=port, - tca_test_case_id=self.tc_id)) - - return results + while times >= 0: + status1 = {} + stats1 = {} + for port in self.l3_config: + status1[port] = warp17_call('GetTestStatus', + TestCaseArg(tca_eth_port=port, + tca_test_case_id=self.tc_id)) + stats1[port] = warp17_call('GetStatistics', + TestCaseArg(tca_eth_port=port, + tca_test_case_id=self.tc_id)) + tstamp1 = time.time() + status.append(status1) + stats.append(stats1) + tstamps.append(tstamp1) + time.sleep(1) + times -= 1 + + return status, stats, tstamps def stop(self): for port in self.l3_config: @@ -214,15 +231,16 @@ def passed(results): def search_mimimum_memory(pivot, R): """Binary search the minimum memory needed to run the test""" + localenv = env if R < precision: return print("Running warp17 on {}Mb memory".format(pivot)) not_started = False - env.set_value(env.MEMORY, pivot) + localenv.set_value(env.MEMORY, pivot) try: oarg = Warp17OutputArgs(out_file=log_file) - proc = warp17_start(env=env, exec_file=bin, output_args=oarg) + proc = warp17_start(env=localenv, exec_file=bin, output_args=oarg) except BaseException as E: print("Error occurred: {}".format(E)) @@ -231,31 +249,81 @@ def search_mimimum_memory(pivot, R): try: warp17_wait(env) - results = test.run() + status, stats, tstamps = test.run() except BaseException as E: print("Error occurred: {}".format(E)) not_started = True pass - warp17_stop(env, proc) + if warp17_stop(env, proc) != 0: + os.kill(proc) + time.sleep(1) if not not_started: - if test.passed(results): + if test.passed(status): message = "Success run with {}Mb memory\n".format(pivot) - result.write(message) + resultwriter.write(message) search_mimimum_memory(pivot - R / 2, R / 2) return message = "Failed run with {}Mb memory\n".format(pivot) - result.write(message) + resultwriter.write(message) search_mimimum_memory(pivot + R / 2, R / 2) return +def collect_stats(logwriter, localenv): + """Binary search the minimum memory needed to run the test""" + print("Running warp17 on {}".format(localenv)) + + try: + oarg = Warp17OutputArgs(out_file=log_file) + # pdb.set_trace() + proc = warp17_start(env=localenv, exec_file=bin, output_args=oarg) + + except BaseException as E: + print("Error occurred: {}".format(E)) + exit(-1) + + try: + warp17_wait(localenv) + + status, stats, tstamps = test.run() + + warp17_stop(localenv, proc) + i = 0 + + while i < len(stats): + stats1 = stats[i] + status1 = status[i] + tstamps1 = tstamps[i] + message = "timestamp: {} ".format(tstamps1) + + + for port in (test.cl_port, test.sr_port): + phystats = stats1[port].sr_phy_rate + statusstats = status1[port].tsr_stats + link_speed_bytes = float(phystats.pys_link_speed) * 1000 * 1000 / 8 + + tx_usage = min(float(phystats.pys_tx_bytes) * 100 / link_speed_bytes, 100.0) + rx_usage = min(float(phystats.pys_rx_bytes) * 100 / link_speed_bytes, 100.0) + message += "pys_rx_bytes {} ".format(rx_usage) + message += "pys_tx_bytes {} ".format(tx_usage) + message += "gs_estab {} ".format(statusstats.gs_estab) + message += "\n" + logwriter.write(message) + i += 1 + + except BaseException as E: + print("Error occurred: {}".format(E)) + # pass + + return def test_10m_sessions(): """Configures a test to run 10 million sessions""" + localenv = env test_10m = Test() - test_10m.add_l3(0, 167837697, 200) # 10.1.0.1 + test_10m.add_l3(0, 167837697, 200) # 10.1.0.1-10.1.0.200 test_10m.add_l3(1, 167772161, 1) # 10.0.0.1 test_10m.l4_config[0] = 50000 test_10m.l4_config[1] = 1 # not really needed @@ -263,35 +331,75 @@ def test_10m_sessions(): test_10m.cl_port = 0 test_10m.sr_port = 1 - test_10m.cl_test_criteria = TestCriteria(tc_crit_type=CL_ESTAB, - tc_cl_estab=10000000) + test_10m.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) - test_10m.app_ccfg = App(app_proto=RAW_CLIENT, - app_raw_client=RawClient(rc_req_plen=10, - rc_resp_plen=10)) - test_10m.app_scfg = App(app_proto=RAW_SERVER, - app_raw_server=RawServer(rs_req_plen=10, - rs_resp_plen=10)) + test_10m.app_ccfg = App(app_proto=HTTP_CLIENT, + app_http_client=HttpClient(hc_req_method=GET, + hc_req_object_name='/index.html', + hc_req_host_name='www.foobar.net', + hc_req_size=10485760))#10MB + test_10m.app_scfg = App(app_proto=HTTP_SERVER, + app_http_server=HttpServer(hs_resp_code=OK_200, + hs_resp_size=10485760)) start_memory = int(env.get_memory()) - env.set_value(env.TCB_POOL_SZ, 20000) - env.set_value(env.UCB_POOL_SZ, 0) + localenv.set_value(env.TCB_POOL_SZ, 95000) + localenv.set_value(env.UCB_POOL_SZ, 0) out_folder = "/tmp/10m-test-{}/".format(get_uniq_stamp()) - return test_10m, start_memory, out_folder - - -test, start_memory, out_folder = test_10m_sessions() # set your test here -res_file = "{}res.txt".format(out_folder) -log_file = "{}out.log".format(out_folder) -if not os.path.exists(out_folder): - os.mkdir(out_folder) -print "Logs and outputs in " + out_folder -result = open(res_file, "w") -result.write("Start binary search {}\n".format(datetime.today())) -precision = 1000 -search_mimimum_memory(start_memory / 2, start_memory / 2) -result.write("Finish\n") -result.close() + return test_10m, start_memory, out_folder, localenv + +def test_throughoput(): + """Configures a test to run 10 million sessions""" + localenv = env + test_thr = Test() + test_thr.add_l3(0, 167837697, 1) # 10.1.0.1 + test_thr.add_l3(1, 167772161, 10) # 10.0.0.1-10.0.0.10 + test_thr.l4_config[0] = 10 + test_thr.l4_config[1] = 50000 # not really needed + test_thr.proto = UDP + test_thr.cl_port = 0 + test_thr.sr_port = 1 + + test_thr.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) + + test_thr.app_ccfg = App(app_proto=RAW_CLIENT, + app_raw_client=RawClient(rc_req_plen=80000, + rc_resp_plen=0)) + test_thr.app_scfg = App(app_proto=RAW_SERVER, + app_raw_server=RawServer(rs_req_plen=80000, + rs_resp_plen=0)) + + start_memory = int(env.get_memory()) + + localenv.set_value(env.TCB_POOL_SZ, 0) + localenv.set_value(env.UCB_POOL_SZ, 95000) + + out_folder = "/tmp/throughoput-test-{}/".format(get_uniq_stamp()) + + return test_thr, start_memory, out_folder, localenv + +tests = [] +#tests.append(test_throughoput()) +tests.append(test_10m_sessions()) + +for test, start_memory, out_folder, localenv in tests: + # test, start_memory, out_folder = test_throughoput() # set your test here + res_file = "{}res.txt".format(out_folder) + log_file = "{}out.log".format(out_folder) + if not os.path.exists(out_folder): + os.mkdir(out_folder) + print "Logs and outputs in " + out_folder + resultwriter = open(res_file, "w") + resultwriter.write("Start binary search {}\n".format(datetime.today())) + for i in range (0, 10): + print "run {}".format(i) + resultwriter.write("Run {}\n".format(i)) + collect_stats(resultwriter, localenv) + resultwriter.write("Finish\n") + resultwriter.close() + From eca06f8b0cfefdc66674daa24059e19919b5d029 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Thu, 7 Nov 2019 13:57:20 +0100 Subject: [PATCH 02/14] Reformat stats output, add deconstructor, add "single test" init Default behaviour of our "Test class" init is to initialize server and client together, with this new function you'll be able to add just one test per time (you'll need to have 2 different tests if you want, for instance, to have 2 UDP client instead of client and server) --- stats_collector.py | 105 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 89 insertions(+), 16 deletions(-) diff --git a/stats_collector.py b/stats_collector.py index a41a2b0..ac7ada6 100644 --- a/stats_collector.py +++ b/stats_collector.py @@ -120,6 +120,10 @@ def __init__(self): self.l4_ccfg = L4Client() + self.init_delay = Delay(d_value=0) + self.uptime = Delay() + self.downtime = Delay(d_value=0) + self.ccfg = TestCase() self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, tc_srv_up=1) @@ -129,6 +133,71 @@ def __init__(self): self.sr_port = 1 self.tc_id = 0 + def __del__(self): + self.l3_config = None + self.l4_config = None + self.rate_ccfg = None + self.app_ccfg = None + + self.l4_ccfg = None + + self.init_delay = None + self.uptime = None + self.downtime = None + + self.ccfg = None + self.sr_test_criteria = None + + self.l4_scfg = None + self.scfg = None + self.cl_port = None + self.sr_port = None + self.tc_id = None + + def init_single(self, type, port, id): + self.__del__() + # l3_config = { + # port : [ + # def_gw, + # n_ip] + # } + self.l3_config = { + 0: [0, + 1], + 1: [0, + 1] + } + # self.l4_config = { + # port: n_ports + # } + self.l4_config = { + 0: 1, + 1: 1, + } + if type is TestCaseType(CLIENT): + self.rate_ccfg = RateClient(rc_open_rate=Rate(), + rc_close_rate=Rate(), + rc_send_rate=Rate()) + self.app_ccfg = App() + + self.l4_ccfg = L4Client() + + self.init_delay = Delay(d_value=0) + self.uptime = Delay() + self.downtime = Delay(d_value=0) + + self.ccfg = TestCase() + self.cl_port = port + if type is TestCaseType(SERVER): + self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, tc_srv_up=1) + + self.l4_scfg = L4Server() + self.scfg = TestCase() + self.sr_port = port + else: + raise BaseException("Wrong test type.") + self.tc_id = id + def add_l3(self, port, def_gw, n_ip): self.l3_config[port] = [def_gw, n_ip] @@ -151,8 +220,6 @@ def add_config(self): tuc_sports=b2b_ports(self.l4_config[0]), tuc_dports=b2b_ports(self.l4_config[1]))) - uptime_delay = Delay(d_value=2) - downtime_delay = Delay(d_value=0) self.ccfg = TestCase(tc_type=CLIENT, tc_eth_port=self.cl_port, tc_id=self.tc_id, tc_client=Client(cl_src_ips=cl_src_ips, @@ -160,8 +227,9 @@ def add_config(self): cl_l4=self.l4_ccfg, cl_rates=self.rate_ccfg), tc_app=self.app_ccfg, - tc_uptime=uptime_delay, - tc_downtime=downtime_delay, + tc_init_delay=self.init_delay, + tc_uptime=self.uptime, + tc_downtime=self.downtime, tc_criteria=self.cl_test_criteria) warp17_call('ConfigureTestCase', self.ccfg) @@ -188,7 +256,7 @@ def check_results(self, times=1): status = [] stats = [] tstamps = [] - sleep(5) + sleep(2) # wait for test to be fully running before start colleting stats while times >= 0: status1 = {} stats1 = {} @@ -277,7 +345,6 @@ def collect_stats(logwriter, localenv): try: oarg = Warp17OutputArgs(out_file=log_file) - # pdb.set_trace() proc = warp17_start(env=localenv, exec_file=bin, output_args=oarg) except BaseException as E: @@ -296,7 +363,7 @@ def collect_stats(logwriter, localenv): stats1 = stats[i] status1 = status[i] tstamps1 = tstamps[i] - message = "timestamp: {} ".format(tstamps1) + message = "timestamp={},".format(tstamps1) for port in (test.cl_port, test.sr_port): @@ -306,10 +373,11 @@ def collect_stats(logwriter, localenv): tx_usage = min(float(phystats.pys_tx_bytes) * 100 / link_speed_bytes, 100.0) rx_usage = min(float(phystats.pys_rx_bytes) * 100 / link_speed_bytes, 100.0) - message += "pys_rx_bytes {} ".format(rx_usage) - message += "pys_tx_bytes {} ".format(tx_usage) - message += "gs_estab {} ".format(statusstats.gs_estab) - message += "\n" + message += "port={},".format(port) + message += "rx_usage={},".format(rx_usage) + message += "tx_usage={},".format(tx_usage) + message += "gs_estab={},".format(statusstats.gs_estab) + message += "\n" logwriter.write(message) i += 1 @@ -369,10 +437,15 @@ def test_throughoput(): test_thr.app_ccfg = App(app_proto=RAW_CLIENT, app_raw_client=RawClient(rc_req_plen=80000, - rc_resp_plen=0)) + rc_resp_plen=80000)) test_thr.app_scfg = App(app_proto=RAW_SERVER, app_raw_server=RawServer(rs_req_plen=80000, - rs_resp_plen=0)) + rs_resp_plen=80000)) + + test_thr.tc_init_delay = Delay(d_value=0) + test_thr.tc_uptime = Delay(d_value=1) + test_thr.tc_downtime = Delay(d_value=0) + start_memory = int(env.get_memory()) @@ -384,9 +457,9 @@ def test_throughoput(): return test_thr, start_memory, out_folder, localenv tests = [] -#tests.append(test_throughoput()) -tests.append(test_10m_sessions()) - +tests.append(test_throughoput()) +# tests.append(test_10m_sessions()) +# TODO: bug when we try to set for test, start_memory, out_folder, localenv in tests: # test, start_memory, out_folder = test_throughoput() # set your test here res_file = "{}res.txt".format(out_folder) From 762fdaa78ba96eb26338c5e5859a1154b3312c71 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Thu, 7 Nov 2019 16:59:50 +0100 Subject: [PATCH 03/14] Add new way to configure multiple testcases --- stats_collector.py | 178 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 134 insertions(+), 44 deletions(-) diff --git a/stats_collector.py b/stats_collector.py index ac7ada6..08e525c 100644 --- a/stats_collector.py +++ b/stats_collector.py @@ -132,6 +132,7 @@ def __init__(self): self.cl_port = 0 self.sr_port = 1 self.tc_id = 0 + test_type = None def __del__(self): self.l3_config = None @@ -154,8 +155,7 @@ def __del__(self): self.sr_port = None self.tc_id = None - def init_single(self, type, port, id): - self.__del__() + def __init__(self, type, port, id): # l3_config = { # port : [ # def_gw, @@ -174,7 +174,7 @@ def init_single(self, type, port, id): 0: 1, 1: 1, } - if type is TestCaseType(CLIENT): + if type is TestCaseType.Value('CLIENT'): self.rate_ccfg = RateClient(rc_open_rate=Rate(), rc_close_rate=Rate(), rc_send_rate=Rate()) @@ -188,7 +188,7 @@ def init_single(self, type, port, id): self.ccfg = TestCase() self.cl_port = port - if type is TestCaseType(SERVER): + elif type is TestCaseType.Value('SERVER'): self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, tc_srv_up=1) self.l4_scfg = L4Server() @@ -197,6 +197,7 @@ def init_single(self, type, port, id): else: raise BaseException("Wrong test type.") self.tc_id = id + self.test_type = type def add_l3(self, port, def_gw, n_ip): self.l3_config[port] = [def_gw, n_ip] @@ -219,38 +220,43 @@ def add_config(self): l4c_tcp_udp=TcpUdpClient( tuc_sports=b2b_ports(self.l4_config[0]), tuc_dports=b2b_ports(self.l4_config[1]))) - - self.ccfg = TestCase(tc_type=CLIENT, tc_eth_port=self.cl_port, - tc_id=self.tc_id, - tc_client=Client(cl_src_ips=cl_src_ips, - cl_dst_ips=cl_dst_ips, - cl_l4=self.l4_ccfg, - cl_rates=self.rate_ccfg), - tc_app=self.app_ccfg, - tc_init_delay=self.init_delay, - tc_uptime=self.uptime, - tc_downtime=self.downtime, - tc_criteria=self.cl_test_criteria) - warp17_call('ConfigureTestCase', self.ccfg) + if self.test_type is TestCaseType.Value('CLIENT') or self.test_type \ + is None: + self.ccfg = TestCase(tc_type=CLIENT, tc_eth_port=self.cl_port, + tc_id=self.tc_id, + tc_client=Client(cl_src_ips=cl_src_ips, + cl_dst_ips=cl_dst_ips, + cl_l4=self.l4_ccfg, + cl_rates=self.rate_ccfg), + tc_app=self.app_ccfg, + tc_init_delay=self.init_delay, + tc_uptime=self.uptime, + tc_downtime=self.downtime, + tc_criteria=self.cl_test_criteria) + answer = warp17_call('ConfigureTestCase', self.ccfg) + + if answer.e_code is not 0: + raise BaseException("{} trying to configure testcase {}" + "".format(answer.e_code, self.ccfg)) self.l4_scfg = L4Server(l4s_proto=self.proto, l4s_tcp_udp=TcpUdpServer( tus_ports=b2b_ports(1))) srv_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) - self.scfg = TestCase(tc_type=SERVER, tc_eth_port=self.sr_port, - tc_id=self.tc_id, - tc_server=Server(srv_ips=srv_ips, - srv_l4=self.l4_scfg), - tc_app=self.app_scfg, - tc_criteria=self.sr_test_criteria) - warp17_call('ConfigureTestCase', self.scfg) - - def run(self): - self.add_config() - self.start() - status, stats, tstamps = self.check_results(20) - self.stop() - return status, stats, tstamps + + if self.test_type is TestCaseType.Value('SERVER') or self.test_type \ + is None: + self.scfg = TestCase(tc_type=SERVER, tc_eth_port=self.sr_port, + tc_id=self.tc_id, + tc_server=Server(srv_ips=srv_ips, + srv_l4=self.l4_scfg), + tc_app=self.app_scfg, + tc_criteria=self.sr_test_criteria) + answer = warp17_call('ConfigureTestCase', self.scfg) + + if answer.e_code is not 0: + raise BaseException("{} trying to configure testcase {}" + "".format(answer.e_code, self.scfg)) def check_results(self, times=1): status = [] @@ -296,7 +302,7 @@ def passed(results): return False return True - +# TODO: adapt this to the new test class def search_mimimum_memory(pivot, R): """Binary search the minimum memory needed to run the test""" localenv = env @@ -339,8 +345,7 @@ def search_mimimum_memory(pivot, R): search_mimimum_memory(pivot + R / 2, R / 2) return -def collect_stats(logwriter, localenv): - """Binary search the minimum memory needed to run the test""" +def collect_stats(logwriter, localenv, test_list): print("Running warp17 on {}".format(localenv)) try: @@ -354,7 +359,35 @@ def collect_stats(logwriter, localenv): try: warp17_wait(localenv) - status, stats, tstamps = test.run() + status = [] + stats = [] + tstamps = [] + # status, stats, tstamps = test_list.run() + # TODO fix the runner in order to have a common behaviour + for test in test_list: + test.add_config() + test.start() + for times in range(0, 10): + sleep(2) # wait for test to be fully running before start colleting stats + while times >= 0: + status1 = {} + stats1 = {} + for port in range(0, 1): + status1[port] = warp17_call('GetTestStatus', + TestCaseArg(tca_eth_port=port, + tca_test_case_id=0)) + stats1[port] = warp17_call('GetStatistics', + TestCaseArg(tca_eth_port=port, + tca_test_case_id=0)) + tstamp1 = time.time() + status.append(status1) + stats.append(stats1) + tstamps.append(tstamp1) + time.sleep(1) + times -= 1 + + for test in test_list: + test.stop() warp17_stop(localenv, proc) i = 0 @@ -366,7 +399,7 @@ def collect_stats(logwriter, localenv): message = "timestamp={},".format(tstamps1) - for port in (test.cl_port, test.sr_port): + for port in range(0, 1): phystats = stats1[port].sr_phy_rate statusstats = status1[port].tsr_stats link_speed_bytes = float(phystats.pys_link_speed) * 1000 * 1000 / 8 @@ -420,8 +453,8 @@ def test_10m_sessions(): return test_10m, start_memory, out_folder, localenv -def test_throughoput(): - """Configures a test to run 10 million sessions""" +def test_throughput(): + """Configures a test that fulfill the 100Gb/s nic""" localenv = env test_thr = Test() test_thr.add_l3(0, 167837697, 1) # 10.1.0.1 @@ -452,16 +485,73 @@ def test_throughoput(): localenv.set_value(env.TCB_POOL_SZ, 0) localenv.set_value(env.UCB_POOL_SZ, 95000) - out_folder = "/tmp/throughoput-test-{}/".format(get_uniq_stamp()) + out_folder = "/tmp/throughput-test-{}/".format(get_uniq_stamp()) return test_thr, start_memory, out_folder, localenv +def test_throughput2(): + """Configures a test that fulfill the 100Gb/s nic""" + localenv = env + + test_thr_cl1 = Test(type=TestCaseType.Value('CLIENT'), port=0, id=0) + test_thr_cl1.cl_port = 0 + test_thr_cl1.sr_port = 1 + test_thr_cl1.add_l3(test_thr_cl1.cl_port, 167837697, 1) # 10.1.0.1 + test_thr_cl1.add_l3(test_thr_cl1.sr_port, 167772161, 10) # 10.0.0.1-10.0.0.10 + test_thr_cl1.l4_config[test_thr_cl1.cl_port] = 10 + test_thr_cl1.l4_config[test_thr_cl1.sr_port] = 50000 # not really needed + test_thr_cl1.proto = UDP + + + test_thr_cl1.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) + + test_thr_cl1.app_ccfg = App(app_proto=RAW_CLIENT, + app_raw_client=RawClient(rc_req_plen=80000, + rc_resp_plen=80000)) + test_thr_cl1.tc_init_delay = Delay(d_value=0) + test_thr_cl1.tc_uptime = Delay(d_value=1) + test_thr_cl1.tc_downtime = Delay(d_value=0) + + test_thr_cl2 = Test(type=TestCaseType.Value('CLIENT'), + port=1, + id=0) + test_thr_cl2.cl_port = 1 + test_thr_cl2.sr_port = 0 + test_thr_cl2.add_l3(test_thr_cl2.cl_port, 167837697, 1) # 10.1.0.1 + test_thr_cl2.add_l3(test_thr_cl2.sr_port, 167772161, 10) # 10.0.0.1-10.0.0.10 + test_thr_cl2.l4_config[test_thr_cl2.cl_port] = 10 + test_thr_cl2.l4_config[test_thr_cl2.sr_port] = 50000 # not really needed + test_thr_cl2.proto = UDP + + + test_thr_cl2.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) + + test_thr_cl2.app_ccfg = App(app_proto=RAW_CLIENT, + app_raw_client=RawClient(rc_req_plen=80000, + rc_resp_plen=80000)) + + test_thr_cl2.tc_init_delay = Delay(d_value=0) + test_thr_cl2.tc_uptime = Delay(d_value=1) + test_thr_cl2.tc_downtime = Delay(d_value=0) + + + start_memory = int(env.get_memory()) + + # pdb.set_trace() + localenv.set_value(env.TCB_POOL_SZ, 0) + localenv.set_value(env.UCB_POOL_SZ, 95000) + + out_folder = "/tmp/throughput-test-{}/".format(get_uniq_stamp()) + + return [test_thr_cl1, test_thr_cl2], start_memory, out_folder, localenv + tests = [] -tests.append(test_throughoput()) +tests.append(test_throughput2()) # tests.append(test_10m_sessions()) -# TODO: bug when we try to set + for test, start_memory, out_folder, localenv in tests: - # test, start_memory, out_folder = test_throughoput() # set your test here res_file = "{}res.txt".format(out_folder) log_file = "{}out.log".format(out_folder) if not os.path.exists(out_folder): @@ -469,10 +559,10 @@ def test_throughoput(): print "Logs and outputs in " + out_folder resultwriter = open(res_file, "w") resultwriter.write("Start binary search {}\n".format(datetime.today())) - for i in range (0, 10): + for i in range (0, 1): print "run {}".format(i) resultwriter.write("Run {}\n".format(i)) - collect_stats(resultwriter, localenv) + collect_stats(resultwriter, localenv, test) resultwriter.write("Finish\n") resultwriter.close() From bc73bc7d241075237fbc2304511c93f15b1f8468 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Fri, 8 Nov 2019 10:32:31 +0100 Subject: [PATCH 04/14] Fix multiple constructor, Adapt old tests to the new class version [wip] --- stats_collector.py | 133 ++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 85 deletions(-) diff --git a/stats_collector.py b/stats_collector.py index 08e525c..9c02b75 100644 --- a/stats_collector.py +++ b/stats_collector.py @@ -94,68 +94,7 @@ class Test(): - def __init__(self): - # l3_config = { - # port : [ - # def_gw, - # n_ip] - # } - self.l3_config = { - 0: [0, - 1], - 1: [0, - 1] - } - # self.l4_config = { - # port: n_ports - # } - self.l4_config = { - 0: 1, - 1: 1, - } - self.rate_ccfg = RateClient(rc_open_rate=Rate(), - rc_close_rate=Rate(), - rc_send_rate=Rate()) - self.app_ccfg = App() - - self.l4_ccfg = L4Client() - - self.init_delay = Delay(d_value=0) - self.uptime = Delay() - self.downtime = Delay(d_value=0) - - self.ccfg = TestCase() - self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, tc_srv_up=1) - - self.l4_scfg = L4Server() - self.scfg = TestCase() - self.cl_port = 0 - self.sr_port = 1 - self.tc_id = 0 - test_type = None - - def __del__(self): - self.l3_config = None - self.l4_config = None - self.rate_ccfg = None - self.app_ccfg = None - - self.l4_ccfg = None - - self.init_delay = None - self.uptime = None - self.downtime = None - - self.ccfg = None - self.sr_test_criteria = None - - self.l4_scfg = None - self.scfg = None - self.cl_port = None - self.sr_port = None - self.tc_id = None - - def __init__(self, type, port, id): + def __init__(self, type=None, port=None, id=None): # l3_config = { # port : [ # def_gw, @@ -188,16 +127,39 @@ def __init__(self, type, port, id): self.ccfg = TestCase() self.cl_port = port + self.tc_id = id + self.test_type = type elif type is TestCaseType.Value('SERVER'): self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, tc_srv_up=1) self.l4_scfg = L4Server() self.scfg = TestCase() self.sr_port = port + self.tc_id = id + self.test_type = type + elif type is None and port is None and id is None: + self.rate_ccfg = RateClient(rc_open_rate=Rate(), + rc_close_rate=Rate(), + rc_send_rate=Rate()) + self.app_ccfg = App() + + self.l4_ccfg = L4Client() + + self.init_delay = Delay(d_value=0) + self.uptime = Delay() + self.downtime = Delay(d_value=0) + + self.ccfg = TestCase() + self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, tc_srv_up=1) + + self.l4_scfg = L4Server() + self.scfg = TestCase() + self.cl_port = 0 + self.sr_port = 1 + self.tc_id = 0 + self.test_type = None else: raise BaseException("Wrong test type.") - self.tc_id = id - self.test_type = type def add_l3(self, port, def_gw, n_ip): self.l3_config[port] = [def_gw, n_ip] @@ -359,6 +321,8 @@ def collect_stats(logwriter, localenv, test_list): try: warp17_wait(localenv) + n_samples = 10 + sample = 0 status = [] stats = [] tstamps = [] @@ -367,24 +331,24 @@ def collect_stats(logwriter, localenv, test_list): for test in test_list: test.add_config() test.start() - for times in range(0, 10): - sleep(2) # wait for test to be fully running before start colleting stats - while times >= 0: - status1 = {} - stats1 = {} - for port in range(0, 1): - status1[port] = warp17_call('GetTestStatus', - TestCaseArg(tca_eth_port=port, - tca_test_case_id=0)) - stats1[port] = warp17_call('GetStatistics', - TestCaseArg(tca_eth_port=port, - tca_test_case_id=0)) - tstamp1 = time.time() - status.append(status1) - stats.append(stats1) - tstamps.append(tstamp1) - time.sleep(1) - times -= 1 + + sleep(2) # wait for test to be fully running before start colleting stats + while sample <= n_samples: + status1 = {} + stats1 = {} + for port in range(0, 1): + status1[port] = warp17_call('GetTestStatus', + TestCaseArg(tca_eth_port=port, + tca_test_case_id=0)) + stats1[port] = warp17_call('GetStatistics', + TestCaseArg(tca_eth_port=port, + tca_test_case_id=0)) + tstamp1 = time.time() + status.append(status1) + stats.append(stats1) + tstamps.append(tstamp1) + time.sleep(1) + sample += 1 for test in test_list: test.stop() @@ -416,7 +380,6 @@ def collect_stats(logwriter, localenv, test_list): except BaseException as E: print("Error occurred: {}".format(E)) - # pass return @@ -451,7 +414,7 @@ def test_10m_sessions(): out_folder = "/tmp/10m-test-{}/".format(get_uniq_stamp()) - return test_10m, start_memory, out_folder, localenv + return [test_10m], start_memory, out_folder, localenv def test_throughput(): """Configures a test that fulfill the 100Gb/s nic""" @@ -558,7 +521,7 @@ def test_throughput2(): os.mkdir(out_folder) print "Logs and outputs in " + out_folder resultwriter = open(res_file, "w") - resultwriter.write("Start binary search {}\n".format(datetime.today())) + resultwriter.write("Stats collection:_{}\n".format(datetime.today())) for i in range (0, 1): print "run {}".format(i) resultwriter.write("Run {}\n".format(i)) From 0c2f8bf7c27e06af0b81f3b6ee8ef3f59b036d31 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Fri, 8 Nov 2019 13:53:15 +0100 Subject: [PATCH 05/14] Adapt old tests to the new class version, reworked the configurator fun --- stats_collector.py | 124 +++++++++++++++++++++++++++++++-------------- 1 file changed, 86 insertions(+), 38 deletions(-) diff --git a/stats_collector.py b/stats_collector.py index 9c02b75..3f0259c 100644 --- a/stats_collector.py +++ b/stats_collector.py @@ -64,7 +64,6 @@ from warp17_api import * import socket import time -import os from rpc_impl import * from functools import partial @@ -165,25 +164,23 @@ def add_l3(self, port, def_gw, n_ip): self.l3_config[port] = [def_gw, n_ip] def add_config(self): - for port in self.l3_config: - def_gw, n_ip = self.l3_config[port] - pcfg = b2b_port_add(port, def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) + # TODO: enable multiple server/client tests + if self.test_type is TestCaseType.Value('CLIENT'): + + def_gw, n_ip = self.l3_config[self.cl_port] + pcfg = b2b_port_add(self.cl_port, def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) b2b_port_add_intfs(pcfg, - [(Ip(ip_version=IPV4, ip_v4=b2b_ipv4(port, i)), - Ip(ip_version=IPV4, ip_v4=b2b_mask(port, i)), - b2b_count(port, i)) for i in range(0, 1)]) + [(Ip(ip_version=IPV4, ip_v4=b2b_ipv4(self.cl_port, i)), + Ip(ip_version=IPV4, ip_v4=b2b_mask(self.cl_port, i)), + b2b_count(self.cl_port, i)) for i in range(0, 1)]) warp17_call('ConfigurePort', pcfg) - cl_src_ips = b2b_sips(self.cl_port, self.l3_config[self.cl_port][1]) - cl_dst_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) - - # todo: enable multiple server/client tests - self.l4_ccfg = L4Client(l4c_proto=self.proto, - l4c_tcp_udp=TcpUdpClient( - tuc_sports=b2b_ports(self.l4_config[0]), - tuc_dports=b2b_ports(self.l4_config[1]))) - if self.test_type is TestCaseType.Value('CLIENT') or self.test_type \ - is None: + self.l4_ccfg = L4Client(l4c_proto=self.proto, + l4c_tcp_udp=TcpUdpClient( + tuc_sports=b2b_ports(self.l4_config[self.cl_port]), + tuc_dports=b2b_ports(self.l4_config[self.sr_port]))) + cl_src_ips = b2b_sips(self.cl_port, self.l3_config[self.cl_port][1]) + cl_dst_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) self.ccfg = TestCase(tc_type=CLIENT, tc_eth_port=self.cl_port, tc_id=self.tc_id, tc_client=Client(cl_src_ips=cl_src_ips, @@ -200,17 +197,70 @@ def add_config(self): if answer.e_code is not 0: raise BaseException("{} trying to configure testcase {}" "".format(answer.e_code, self.ccfg)) + elif self.test_type is TestCaseType.Value('SERVER'): - self.l4_scfg = L4Server(l4s_proto=self.proto, - l4s_tcp_udp=TcpUdpServer( - tus_ports=b2b_ports(1))) - srv_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) + def_gw, n_ip = self.l3_config[self.sr_port] + pcfg = b2b_port_add(self.sr_port, def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) + b2b_port_add_intfs(pcfg, + [(Ip(ip_version=IPV4, ip_v4=b2b_ipv4(self.sr_port, i)), + Ip(ip_version=IPV4, ip_v4=b2b_mask(self.sr_port, i)), + b2b_count(self.sr_port, i)) for i in range(0, 1)]) + warp17_call('ConfigurePort', pcfg) + self.l4_scfg = L4Server(l4s_proto=self.proto, + l4s_tcp_udp=TcpUdpServer( + tus_ports=b2b_ports(1))) + srv_src_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) + self.scfg = TestCase(tc_type=SERVER, tc_eth_port=self.sr_port, + tc_id=self.tc_id, + tc_server=Server(srv_ips=srv_src_ips, + srv_l4=self.l4_scfg), + tc_app=self.app_scfg, + tc_criteria=self.sr_test_criteria) + answer = warp17_call('ConfigureTestCase', self.scfg) + + if answer.e_code is not 0: + raise BaseException("{} trying to configure testcase {}" + "".format(answer.e_code, self.scfg)) + elif self.test_type is None: + + for port in self.l3_config: + def_gw, n_ip = self.l3_config[port] + pcfg = b2b_port_add(port, def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) + b2b_port_add_intfs(pcfg, + [(Ip(ip_version=IPV4, ip_v4=b2b_ipv4(port, i)), + Ip(ip_version=IPV4, ip_v4=b2b_mask(port, i)), + b2b_count(port, i)) for i in range(0, 1)]) + warp17_call('ConfigurePort', pcfg) + + self.l4_ccfg = L4Client(l4c_proto=self.proto, + l4c_tcp_udp=TcpUdpClient( + tuc_sports=b2b_ports(self.l4_config[self.cl_port]), + tuc_dports=b2b_ports(self.l4_config[self.sr_port]))) + cl_src_ips = b2b_sips(self.cl_port, self.l3_config[self.cl_port][1]) + cl_dst_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) + self.ccfg = TestCase(tc_type=CLIENT, tc_eth_port=self.cl_port, + tc_id=self.tc_id, + tc_client=Client(cl_src_ips=cl_src_ips, + cl_dst_ips=cl_dst_ips, + cl_l4=self.l4_ccfg, + cl_rates=self.rate_ccfg), + tc_app=self.app_ccfg, + tc_init_delay=self.init_delay, + tc_uptime=self.uptime, + tc_downtime=self.downtime, + tc_criteria=self.cl_test_criteria) + answer = warp17_call('ConfigureTestCase', self.ccfg) + if answer.e_code is not 0: + raise BaseException("{} trying to configure testcase {}" + "".format(answer.e_code, self.ccfg)) - if self.test_type is TestCaseType.Value('SERVER') or self.test_type \ - is None: + self.l4_scfg = L4Server(l4s_proto=self.proto, + l4s_tcp_udp=TcpUdpServer( + tus_ports=b2b_ports(self.l4_config[self.sr_port]))) + srv_src_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) self.scfg = TestCase(tc_type=SERVER, tc_eth_port=self.sr_port, tc_id=self.tc_id, - tc_server=Server(srv_ips=srv_ips, + tc_server=Server(srv_ips=srv_src_ips, srv_l4=self.l4_scfg), tc_app=self.app_scfg, tc_criteria=self.sr_test_criteria) @@ -220,6 +270,8 @@ def add_config(self): raise BaseException("{} trying to configure testcase {}" "".format(answer.e_code, self.scfg)) + else: + raise BaseException("test type is invalid") def check_results(self, times=1): status = [] stats = [] @@ -251,8 +303,6 @@ def stop(self): def start(self): for port in self.l3_config: warp17_call('PortStart', PortArg(pa_eth_port=port)) - # wait for the test to start running - sleep(2) @staticmethod def passed(results): @@ -326,8 +376,7 @@ def collect_stats(logwriter, localenv, test_list): status = [] stats = [] tstamps = [] - # status, stats, tstamps = test_list.run() - # TODO fix the runner in order to have a common behaviour + for test in test_list: test.add_config() test.start() @@ -336,14 +385,14 @@ def collect_stats(logwriter, localenv, test_list): while sample <= n_samples: status1 = {} stats1 = {} - for port in range(0, 1): + for port in (0, 1): status1[port] = warp17_call('GetTestStatus', TestCaseArg(tca_eth_port=port, tca_test_case_id=0)) stats1[port] = warp17_call('GetStatistics', TestCaseArg(tca_eth_port=port, tca_test_case_id=0)) - tstamp1 = time.time() + tstamp1 = time.time() status.append(status1) stats.append(stats1) tstamps.append(tstamp1) @@ -363,7 +412,7 @@ def collect_stats(logwriter, localenv, test_list): message = "timestamp={},".format(tstamps1) - for port in range(0, 1): + for port in (0, 1): phystats = stats1[port].sr_phy_rate statusstats = status1[port].tsr_stats link_speed_bytes = float(phystats.pys_link_speed) * 1000 * 1000 / 8 @@ -450,7 +499,7 @@ def test_throughput(): out_folder = "/tmp/throughput-test-{}/".format(get_uniq_stamp()) - return test_thr, start_memory, out_folder, localenv + return [test_thr], start_memory, out_folder, localenv def test_throughput2(): """Configures a test that fulfill the 100Gb/s nic""" @@ -493,16 +542,15 @@ def test_throughput2(): test_thr_cl2.app_ccfg = App(app_proto=RAW_CLIENT, app_raw_client=RawClient(rc_req_plen=80000, - rc_resp_plen=80000)) + rc_resp_plen=0)) - test_thr_cl2.tc_init_delay = Delay(d_value=0) - test_thr_cl2.tc_uptime = Delay(d_value=1) - test_thr_cl2.tc_downtime = Delay(d_value=0) + test_thr_cl2.init_delay = Delay(d_value=0) + test_thr_cl2.uptime = Delay(d_value=1) + test_thr_cl2.downtime = Delay(d_value=0) start_memory = int(env.get_memory()) - # pdb.set_trace() localenv.set_value(env.TCB_POOL_SZ, 0) localenv.set_value(env.UCB_POOL_SZ, 95000) @@ -511,7 +559,7 @@ def test_throughput2(): return [test_thr_cl1, test_thr_cl2], start_memory, out_folder, localenv tests = [] -tests.append(test_throughput2()) +tests.append(test_throughput()) # tests.append(test_10m_sessions()) for test, start_memory, out_folder, localenv in tests: From 0d9a31249f1c9c5f179bf7ac3680c1549133968c Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Mon, 11 Nov 2019 11:14:33 +0100 Subject: [PATCH 06/14] Print only 2 decimal ciphers in the usage percentage, add some checks --- stats_collector.py | 52 +++++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/stats_collector.py b/stats_collector.py index 3f0259c..5c6c4a8 100644 --- a/stats_collector.py +++ b/stats_collector.py @@ -258,6 +258,7 @@ def add_config(self): l4s_tcp_udp=TcpUdpServer( tus_ports=b2b_ports(self.l4_config[self.sr_port]))) srv_src_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) + assert(cl_dst_ips == srv_src_ips) self.scfg = TestCase(tc_type=SERVER, tc_eth_port=self.sr_port, tc_id=self.tc_id, tc_server=Server(srv_ips=srv_src_ips, @@ -272,7 +273,8 @@ def add_config(self): else: raise BaseException("test type is invalid") - def check_results(self, times=1): + + def collect_results(self, times=1): status = [] stats = [] tstamps = [] @@ -298,11 +300,28 @@ def check_results(self, times=1): def stop(self): for port in self.l3_config: - warp17_call('PortStop', PortArg(pa_eth_port=port)) + answer = warp17_call('PortStop', PortArg(pa_eth_port=port)) + if answer.e_code is not 0: + raise BaseException("{} trying to start testcases on port {}" + "".format(answer.e_code, port)) + + # DEBUG function that tries to get the testcase and prints it + # ATTENTION: use it only after you configured the testcases + def check_test(self): + for port in self.l3_config: + answer = warp17_call('GetTestCase', TestCaseArg( + tca_eth_port=port, tca_test_case_id=0)) + if answer.tcr_error.e_code is not 0: + raise BaseException("{} trying to start testcases on port {}" + "".format(answer.tcr_error.e_code, port)) + print(answer.tcr_cfg) def start(self): for port in self.l3_config: - warp17_call('PortStart', PortArg(pa_eth_port=port)) + answer = warp17_call('PortStart', PortArg(pa_eth_port=port)) + if answer.e_code is not 0: + raise BaseException("{} trying to start testcases on port {}" + "".format(answer.e_code, port)) @staticmethod def passed(results): @@ -314,6 +333,7 @@ def passed(results): return False return True + # TODO: adapt this to the new test class def search_mimimum_memory(pivot, R): """Binary search the minimum memory needed to run the test""" @@ -379,9 +399,10 @@ def collect_stats(logwriter, localenv, test_list): for test in test_list: test.add_config() + # test.check_test() # use to debug only test.start() - sleep(2) # wait for test to be fully running before start colleting stats + sleep(2) # wait for test to be fully running while sample <= n_samples: status1 = {} stats1 = {} @@ -396,7 +417,7 @@ def collect_stats(logwriter, localenv, test_list): status.append(status1) stats.append(stats1) tstamps.append(tstamp1) - time.sleep(1) + time.sleep(0.5) sample += 1 for test in test_list: @@ -420,8 +441,8 @@ def collect_stats(logwriter, localenv, test_list): tx_usage = min(float(phystats.pys_tx_bytes) * 100 / link_speed_bytes, 100.0) rx_usage = min(float(phystats.pys_rx_bytes) * 100 / link_speed_bytes, 100.0) message += "port={},".format(port) - message += "rx_usage={},".format(rx_usage) - message += "tx_usage={},".format(tx_usage) + message += "rx_usage={:.2f},".format(rx_usage) + message += "tx_usage={:.2f},".format(tx_usage) message += "gs_estab={},".format(statusstats.gs_estab) message += "\n" logwriter.write(message) @@ -469,13 +490,13 @@ def test_throughput(): """Configures a test that fulfill the 100Gb/s nic""" localenv = env test_thr = Test() - test_thr.add_l3(0, 167837697, 1) # 10.1.0.1 - test_thr.add_l3(1, 167772161, 10) # 10.0.0.1-10.0.0.10 - test_thr.l4_config[0] = 10 - test_thr.l4_config[1] = 50000 # not really needed - test_thr.proto = UDP test_thr.cl_port = 0 test_thr.sr_port = 1 + test_thr.add_l3(test_thr.cl_port, 167837697, 1) # 10.1.0.1 + test_thr.add_l3(test_thr.sr_port, 167772161, 10) # 10.0.0.1-10.0.0.10 + test_thr.l4_config[test_thr.cl_port] = 10 + test_thr.l4_config[test_thr.sr_port] = 50000 # not really needed + test_thr.proto = UDP test_thr.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, tc_cl_estab=120) @@ -560,7 +581,7 @@ def test_throughput2(): tests = [] tests.append(test_throughput()) -# tests.append(test_10m_sessions()) +#tests.append(test_10m_sessions()) for test, start_memory, out_folder, localenv in tests: res_file = "{}res.txt".format(out_folder) @@ -570,10 +591,11 @@ def test_throughput2(): print "Logs and outputs in " + out_folder resultwriter = open(res_file, "w") resultwriter.write("Stats collection:_{}\n".format(datetime.today())) - for i in range (0, 1): + running_times = 10 + for i in range (0, running_times): print "run {}".format(i) resultwriter.write("Run {}\n".format(i)) collect_stats(resultwriter, localenv, test) resultwriter.write("Finish\n") resultwriter.close() - + sleep(20) # waiting between each warp17 restart From bbd49c5b995b18a597acd6516abe8ddf74aeba35 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Tue, 12 Nov 2019 13:07:48 +0100 Subject: [PATCH 07/14] Enhance output, refactor --- stats_collector.py | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/stats_collector.py b/stats_collector.py index 5c6c4a8..bd2b1b8 100644 --- a/stats_collector.py +++ b/stats_collector.py @@ -337,7 +337,7 @@ def passed(results): # TODO: adapt this to the new test class def search_mimimum_memory(pivot, R): """Binary search the minimum memory needed to run the test""" - localenv = env + localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) if R < precision: return print("Running warp17 on {}Mb memory".format(pivot)) @@ -391,18 +391,18 @@ def collect_stats(logwriter, localenv, test_list): try: warp17_wait(localenv) - n_samples = 10 + n_samples = 20 sample = 0 status = [] stats = [] tstamps = [] - for test in test_list: test.add_config() # test.check_test() # use to debug only test.start() sleep(2) # wait for test to be fully running + init_tstamp = time.time() while sample <= n_samples: status1 = {} stats1 = {} @@ -413,10 +413,10 @@ def collect_stats(logwriter, localenv, test_list): stats1[port] = warp17_call('GetStatistics', TestCaseArg(tca_eth_port=port, tca_test_case_id=0)) - tstamp1 = time.time() + tstamp_diff = time.time() - init_tstamp status.append(status1) stats.append(stats1) - tstamps.append(tstamp1) + tstamps.append(tstamp_diff) time.sleep(0.5) sample += 1 @@ -430,9 +430,7 @@ def collect_stats(logwriter, localenv, test_list): stats1 = stats[i] status1 = status[i] tstamps1 = tstamps[i] - message = "timestamp={},".format(tstamps1) - - + message = "timestamp={:.2f},".format(tstamps1) for port in (0, 1): phystats = stats1[port].sr_phy_rate statusstats = status1[port].tsr_stats @@ -450,20 +448,21 @@ def collect_stats(logwriter, localenv, test_list): except BaseException as E: print("Error occurred: {}".format(E)) + warp17_stop(localenv, proc) return def test_10m_sessions(): """Configures a test to run 10 million sessions""" - localenv = env + localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) test_10m = Test() - test_10m.add_l3(0, 167837697, 200) # 10.1.0.1-10.1.0.200 - test_10m.add_l3(1, 167772161, 1) # 10.0.0.1 - test_10m.l4_config[0] = 50000 - test_10m.l4_config[1] = 1 # not really needed - test_10m.proto = TCP test_10m.cl_port = 0 test_10m.sr_port = 1 + test_10m.add_l3(test_10m.cl_port, 167837697, 20) # 10.1.0.1-10.1.0.20 + test_10m.add_l3(test_10m.sr_port, 167772161, 1) # 10.0.0.1 + test_10m.l4_config[test_10m.cl_port] = 50000 + test_10m.l4_config[test_10m.sr_port] = 10 # not really needed + test_10m.proto = TCP test_10m.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, tc_cl_estab=120) @@ -488,7 +487,7 @@ def test_10m_sessions(): def test_throughput(): """Configures a test that fulfill the 100Gb/s nic""" - localenv = env + localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) test_thr = Test() test_thr.cl_port = 0 test_thr.sr_port = 1 @@ -524,7 +523,7 @@ def test_throughput(): def test_throughput2(): """Configures a test that fulfill the 100Gb/s nic""" - localenv = env + localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) test_thr_cl1 = Test(type=TestCaseType.Value('CLIENT'), port=0, id=0) test_thr_cl1.cl_port = 0 @@ -581,7 +580,7 @@ def test_throughput2(): tests = [] tests.append(test_throughput()) -#tests.append(test_10m_sessions()) +tests.append(test_10m_sessions()) for test, start_memory, out_folder, localenv in tests: res_file = "{}res.txt".format(out_folder) From c681660b20f881dbf21fe9fe59a93e68db2dd5cf Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Wed, 13 Nov 2019 10:11:53 +0100 Subject: [PATCH 08/14] Add new 40m http test --- stats_collector.py | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/stats_collector.py b/stats_collector.py index bd2b1b8..f1ddf5c 100644 --- a/stats_collector.py +++ b/stats_collector.py @@ -377,6 +377,7 @@ def search_mimimum_memory(pivot, R): search_mimimum_memory(pivot + R / 2, R / 2) return + def collect_stats(logwriter, localenv, test_list): print("Running warp17 on {}".format(localenv)) @@ -401,7 +402,8 @@ def collect_stats(logwriter, localenv, test_list): # test.check_test() # use to debug only test.start() - sleep(2) # wait for test to be fully running + sleep(15) # wait for test to be fully running + # (http tests take a lot of time) init_tstamp = time.time() while sample <= n_samples: status1 = {} @@ -452,6 +454,7 @@ def collect_stats(logwriter, localenv, test_list): return + def test_10m_sessions(): """Configures a test to run 10 million sessions""" localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) @@ -485,6 +488,42 @@ def test_10m_sessions(): return [test_10m], start_memory, out_folder, localenv + +def test_40m_http_sessions(): + """Configures a test to run 10 million sessions""" + localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) + test_40m = Test() + test_40m.cl_port = 0 + test_40m.sr_port = 1 + test_40m.add_l3(test_40m.cl_port, 167837697, 20) # 10.1.0.1-10.1.0.20 + test_40m.add_l3(test_40m.sr_port, 167772161, 4) # 10.0.0.1 + test_40m.l4_config[test_40m.cl_port] = 50000 + test_40m.l4_config[test_40m.sr_port] = 10 # not really needed + test_40m.proto = TCP + + test_40m.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) + + test_40m.app_ccfg = App(app_proto=HTTP_CLIENT, + app_http_client=HttpClient(hc_req_method=GET, + hc_req_object_name='/index.html', + hc_req_host_name='www.foobar.net', + hc_req_size=204800)) + #20kb + test_40m.app_scfg = App(app_proto=HTTP_SERVER, + app_http_server=HttpServer(hs_resp_code=OK_200, + hs_resp_size=204800)) + + start_memory = int(env.get_memory()) + + localenv.set_value(env.TCB_POOL_SZ, 95000) + localenv.set_value(env.UCB_POOL_SZ, 0) + + out_folder = "/tmp/40m-http-test-{}/".format(get_uniq_stamp()) + + return [test_40m], start_memory, out_folder, localenv + + def test_throughput(): """Configures a test that fulfill the 100Gb/s nic""" localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) @@ -521,6 +560,7 @@ def test_throughput(): return [test_thr], start_memory, out_folder, localenv + def test_throughput2(): """Configures a test that fulfill the 100Gb/s nic""" localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) @@ -580,7 +620,7 @@ def test_throughput2(): tests = [] tests.append(test_throughput()) -tests.append(test_10m_sessions()) +tests.append(test_40m_http_sessions()) for test, start_memory, out_folder, localenv in tests: res_file = "{}res.txt".format(out_folder) From 773f5b01e01553eee77be3a5f54c0c4774f66357 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Thu, 14 Nov 2019 10:37:33 +0100 Subject: [PATCH 09/14] Add a single direction udp test --- stats_collector.py | 53 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/stats_collector.py b/stats_collector.py index f1ddf5c..7a1e229 100644 --- a/stats_collector.py +++ b/stats_collector.py @@ -455,7 +455,7 @@ def collect_stats(logwriter, localenv, test_list): return -def test_10m_sessions(): +def test_http_throughput(): """Configures a test to run 10 million sessions""" localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) test_10m = Test() @@ -496,8 +496,8 @@ def test_40m_http_sessions(): test_40m.cl_port = 0 test_40m.sr_port = 1 test_40m.add_l3(test_40m.cl_port, 167837697, 20) # 10.1.0.1-10.1.0.20 - test_40m.add_l3(test_40m.sr_port, 167772161, 4) # 10.0.0.1 - test_40m.l4_config[test_40m.cl_port] = 50000 + test_40m.add_l3(test_40m.sr_port, 167772161, 5) # 10.0.0.1-10.0.0.5 + test_40m.l4_config[test_40m.cl_port] = 45000 test_40m.l4_config[test_40m.sr_port] = 10 # not really needed test_40m.proto = TCP @@ -508,15 +508,14 @@ def test_40m_http_sessions(): app_http_client=HttpClient(hc_req_method=GET, hc_req_object_name='/index.html', hc_req_host_name='www.foobar.net', - hc_req_size=204800)) - #20kb + hc_req_size=67108864)) test_40m.app_scfg = App(app_proto=HTTP_SERVER, app_http_server=HttpServer(hs_resp_code=OK_200, - hs_resp_size=204800)) + hs_resp_size=67108864)) start_memory = int(env.get_memory()) - localenv.set_value(env.TCB_POOL_SZ, 95000) + localenv.set_value(env.TCB_POOL_SZ, 98000) localenv.set_value(env.UCB_POOL_SZ, 0) out_folder = "/tmp/40m-http-test-{}/".format(get_uniq_stamp()) @@ -524,8 +523,7 @@ def test_40m_http_sessions(): return [test_40m], start_memory, out_folder, localenv -def test_throughput(): - """Configures a test that fulfill the 100Gb/s nic""" +def test_udp_throughput(): localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) test_thr = Test() test_thr.cl_port = 0 @@ -554,7 +552,39 @@ def test_throughput(): start_memory = int(env.get_memory()) localenv.set_value(env.TCB_POOL_SZ, 0) - localenv.set_value(env.UCB_POOL_SZ, 95000) + localenv.set_value(env.UCB_POOL_SZ, 98000) + + out_folder = "/tmp/throughput-test-{}/".format(get_uniq_stamp()) + + return [test_thr], start_memory, out_folder, localenv + + +def test_single_udp_throughput(): + """Configures a test that fulfill the 100Gb/s nic monodirectional""" + localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) + test_thr = Test() + test_thr.cl_port = 0 + test_thr.sr_port = 1 + test_thr.add_l3(test_thr.cl_port, 167837697, 1) # 10.1.0.1 + test_thr.add_l3(test_thr.sr_port, 167772161, 15) # 10.0.0.1-10.0.0.15 + test_thr.l4_config[test_thr.cl_port] = 15 + test_thr.l4_config[test_thr.sr_port] = 50000 # not really needed + test_thr.proto = UDP + + test_thr.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) + + test_thr.app_ccfg = App(app_proto=RAW_CLIENT, + app_raw_client=RawClient(rc_req_plen=32768, + rc_resp_plen=0)) + test_thr.app_scfg = App(app_proto=RAW_SERVER, + app_raw_server=RawServer(rs_req_plen=0, + rs_resp_plen=0)) + + start_memory = int(env.get_memory()) + + localenv.set_value(env.TCB_POOL_SZ, 0) + localenv.set_value(env.UCB_POOL_SZ, 98000) out_folder = "/tmp/throughput-test-{}/".format(get_uniq_stamp()) @@ -619,7 +649,7 @@ def test_throughput2(): return [test_thr_cl1, test_thr_cl2], start_memory, out_folder, localenv tests = [] -tests.append(test_throughput()) +tests.append(test_single_udp_throughput()) tests.append(test_40m_http_sessions()) for test, start_memory, out_folder, localenv in tests: @@ -634,6 +664,7 @@ def test_throughput2(): for i in range (0, running_times): print "run {}".format(i) resultwriter.write("Run {}\n".format(i)) + resultwriter.flush() collect_stats(resultwriter, localenv, test) resultwriter.write("Finish\n") resultwriter.close() From 6d5a3d3f94fe93a5e9565f2ac788347bf8c4c709 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Fri, 15 Nov 2019 11:29:03 +0100 Subject: [PATCH 10/14] Moving stats collector to python folder --- stats_collector.py => python/stats_collector.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename stats_collector.py => python/stats_collector.py (100%) diff --git a/stats_collector.py b/python/stats_collector.py similarity index 100% rename from stats_collector.py rename to python/stats_collector.py From fb7f8691c32643db38e8352e6bf3df1683d16312 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Thu, 21 Nov 2019 10:48:18 +0100 Subject: [PATCH 11/14] Add 2 new tests, support MTU option --- python/stats_collector.py | 93 ++++++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 20 deletions(-) diff --git a/python/stats_collector.py b/python/stats_collector.py index 7a1e229..0008975 100644 --- a/python/stats_collector.py +++ b/python/stats_collector.py @@ -128,6 +128,7 @@ def __init__(self, type=None, port=None, id=None): self.cl_port = port self.tc_id = id self.test_type = type + self.mtu = 1500 # Redundant elif type is TestCaseType.Value('SERVER'): self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, tc_srv_up=1) @@ -136,6 +137,7 @@ def __init__(self, type=None, port=None, id=None): self.sr_port = port self.tc_id = id self.test_type = type + self.mtu = 1500 elif type is None and port is None and id is None: self.rate_ccfg = RateClient(rc_open_rate=Rate(), rc_close_rate=Rate(), @@ -157,6 +159,7 @@ def __init__(self, type=None, port=None, id=None): self.sr_port = 1 self.tc_id = 0 self.test_type = None + self.mtu = 1500 else: raise BaseException("Wrong test type.") @@ -231,7 +234,16 @@ def add_config(self): Ip(ip_version=IPV4, ip_v4=b2b_mask(port, i)), b2b_count(port, i)) for i in range(0, 1)]) warp17_call('ConfigurePort', pcfg) - + + if self.mtu is not 1500: # 1500 is the default MTU + port_options = PortOptions(po_mtu=self.mtu) + answer = warp17_call('SetPortOptions', + PortOptionsArg(poa_port=PortArg(pa_eth_port=port), + poa_opts=port_options)) + if answer.e_code is not 0: + raise BaseException("{} trying to configure testcase {}" + "".format(answer.e_code, self.ccfg)) + self.l4_ccfg = L4Client(l4c_proto=self.proto, l4c_tcp_udp=TcpUdpClient( tuc_sports=b2b_ports(self.l4_config[self.cl_port]), @@ -474,32 +486,69 @@ def test_http_throughput(): app_http_client=HttpClient(hc_req_method=GET, hc_req_object_name='/index.html', hc_req_host_name='www.foobar.net', - hc_req_size=10485760))#10MB + hc_req_size=45056)) #44k test_10m.app_scfg = App(app_proto=HTTP_SERVER, app_http_server=HttpServer(hs_resp_code=OK_200, - hs_resp_size=10485760)) + hs_resp_size=45056)) start_memory = int(env.get_memory()) localenv.set_value(env.TCB_POOL_SZ, 95000) localenv.set_value(env.UCB_POOL_SZ, 0) - out_folder = "/tmp/10m-test-{}/".format(get_uniq_stamp()) + out_folder = "/tmp/{}-test-{}/".format(test_http_throughput.__name__, + get_uniq_stamp()) return [test_10m], start_memory, out_folder, localenv -def test_40m_http_sessions(): - """Configures a test to run 10 million sessions""" +def test_400k_http_sessions(): + """Configures a test to run 400k sessions""" + localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) + test_40m = Test() + test_40m.cl_port = 0 + test_40m.sr_port = 1 + test_40m.add_l3(test_40m.cl_port, 167837697, 1) # 10.1.0.1-10.1.0.20 + test_40m.add_l3(test_40m.sr_port, 167772161, 1) # 10.0.0.1-10.0.0.5 + test_40m.l4_config[test_40m.cl_port] = 4000 + test_40m.l4_config[test_40m.sr_port] = 100 # not really needed + test_40m.proto = TCP + test_40m.mtu = 9192 + + test_40m.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) + + test_40m.app_ccfg = App(app_proto=HTTP_CLIENT, + app_http_client=HttpClient(hc_req_method=GET, + hc_req_object_name='/index.html', + hc_req_host_name='www.foobar.net', + hc_req_size=45056)) # 44k + test_40m.app_scfg = App(app_proto=HTTP_SERVER, + app_http_server=HttpServer(hs_resp_code=OK_200, + hs_resp_size=45056)) + + start_memory = int(env.get_memory()) + + localenv.set_value(env.TCB_POOL_SZ, 98000) + localenv.set_value(env.UCB_POOL_SZ, 0) + + out_folder = "/tmp/{}-test-{}/".format(test_400k_http_sessions.__name__, + get_uniq_stamp()) + + return [test_40m], start_memory, out_folder, localenv + +def test_800k_http_sessions(): + """Configures a test to run 800k sessions""" localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) test_40m = Test() test_40m.cl_port = 0 test_40m.sr_port = 1 - test_40m.add_l3(test_40m.cl_port, 167837697, 20) # 10.1.0.1-10.1.0.20 - test_40m.add_l3(test_40m.sr_port, 167772161, 5) # 10.0.0.1-10.0.0.5 - test_40m.l4_config[test_40m.cl_port] = 45000 - test_40m.l4_config[test_40m.sr_port] = 10 # not really needed + test_40m.add_l3(test_40m.cl_port, 167837697, 1) # 10.1.0.1-10.1.0.20 + test_40m.add_l3(test_40m.sr_port, 167772161, 1) # 10.0.0.1-10.0.0.5 + test_40m.l4_config[test_40m.cl_port] = 4000 + test_40m.l4_config[test_40m.sr_port] = 200 # not really needed test_40m.proto = TCP + test_40m.mtu = 9192 test_40m.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, tc_cl_estab=120) @@ -508,17 +557,18 @@ def test_40m_http_sessions(): app_http_client=HttpClient(hc_req_method=GET, hc_req_object_name='/index.html', hc_req_host_name='www.foobar.net', - hc_req_size=67108864)) + hc_req_size=45056)) # 44k test_40m.app_scfg = App(app_proto=HTTP_SERVER, app_http_server=HttpServer(hs_resp_code=OK_200, - hs_resp_size=67108864)) + hs_resp_size=45056)) start_memory = int(env.get_memory()) localenv.set_value(env.TCB_POOL_SZ, 98000) localenv.set_value(env.UCB_POOL_SZ, 0) - out_folder = "/tmp/40m-http-test-{}/".format(get_uniq_stamp()) + out_folder = "/tmp/{}-test-{}/".format(test_800k_http_sessions.__name__, + get_uniq_stamp()) return [test_40m], start_memory, out_folder, localenv @@ -554,7 +604,8 @@ def test_udp_throughput(): localenv.set_value(env.TCB_POOL_SZ, 0) localenv.set_value(env.UCB_POOL_SZ, 98000) - out_folder = "/tmp/throughput-test-{}/".format(get_uniq_stamp()) + out_folder = "/tmp/{}-test-{}/".format(test_udp_throughput.__name__, + get_uniq_stamp()) return [test_thr], start_memory, out_folder, localenv @@ -586,7 +637,8 @@ def test_single_udp_throughput(): localenv.set_value(env.TCB_POOL_SZ, 0) localenv.set_value(env.UCB_POOL_SZ, 98000) - out_folder = "/tmp/throughput-test-{}/".format(get_uniq_stamp()) + out_folder = "/tmp/{}-test-{}/".format( + test_single_udp_throughput.__name__, get_uniq_stamp()) return [test_thr], start_memory, out_folder, localenv @@ -644,13 +696,14 @@ def test_throughput2(): localenv.set_value(env.TCB_POOL_SZ, 0) localenv.set_value(env.UCB_POOL_SZ, 95000) - out_folder = "/tmp/throughput-test-{}/".format(get_uniq_stamp()) + out_folder = "/tmp/{}-test-{}/".format(test_throughput2.__name__, + get_uniq_stamp()) return [test_thr_cl1, test_thr_cl2], start_memory, out_folder, localenv -tests = [] -tests.append(test_single_udp_throughput()) -tests.append(test_40m_http_sessions()) +tests = [] # here you can append the tests you want to run (in sequence) +tests.append(test_400k_http_sessions()) +tests.append(test_800k_http_sessions()) for test, start_memory, out_folder, localenv in tests: res_file = "{}res.txt".format(out_folder) @@ -668,4 +721,4 @@ def test_throughput2(): collect_stats(resultwriter, localenv, test) resultwriter.write("Finish\n") resultwriter.close() - sleep(20) # waiting between each warp17 restart + sleep(20) # waiting between each warp17 restart From a00027196740dfeffe627baa4995227047960a8c Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Thu, 21 Nov 2019 15:17:12 +0100 Subject: [PATCH 12/14] Updating ini files Update config files, introduce socket-mem 2019-11-21 09:47:55,674 - TestPerf - INFO - Test test_01_4M_tcp_sess_setup_rate 2019-11-21 09:49:19,388 - TestPerf - INFO - Average Rate 8765645 2019-11-21 09:49:19,389 - TestPerf - INFO - Test test_02_8M_tcp_sess_setup_rate 2019-11-21 09:51:49,498 - TestPerf - INFO - Average Rate 8576509 2019-11-21 09:51:49,498 - TestPerf - INFO - Test test_03_10M_tcp_sess_setup_rate 2019-11-21 09:54:53,255 - TestPerf - INFO - Average Rate 8536844 2019-11-21 09:54:53,256 - TestPerf - INFO - Test test_04_4M_tcp_sess_data_10b_setup_rate 2019-11-21 09:56:28,755 - TestPerf - INFO - Average Rate 3649090 2019-11-21 09:56:28,755 - TestPerf - INFO - Test test_05_4M_tcp_sess_data_1024b_setup_rate 2019-11-21 09:58:02,809 - TestPerf - INFO - Average Rate 2907782 2019-11-21 09:58:02,810 - TestPerf - INFO - Test test_06_4M_tcp_sess_data_1300b_setup_rate 2019-11-21 09:59:38,275 - TestPerf - INFO - Average Rate 3817552 2019-11-21 09:59:38,275 - TestPerf - INFO - Test test_07_4M_udp_sess_data_10b_setup_rate 2019-11-21 10:00:59,143 - TestPerf - INFO - Average Rate 11352735 2019-11-21 10:00:59,143 - TestPerf - INFO - Test test_08_4M_http_sess_data_10b_setup_rate 2019-11-21 10:02:33,004 - TestPerf - INFO - Average Rate 3357083 2019-11-21 10:02:33,004 - TestPerf - INFO - Test test_09_4M_udp_mcast_flows_data_10b_setup_rate 2019-11-21 10:03:55,600 - TestPerf - INFO - Average Rate 21894579 2019-11-21 10:03:55,600 - TestPerf - INFO - Test test_10_timestamp_4M_tcp_sess_setup_rate 2019-11-21 10:05:26,933 - TestPerf - INFO - Average Rate 7681492 2019-11-21 10:05:26,934 - TestPerf - INFO - Test test_11_timestamp_4M_udp_sess_data_10b_setup_rate 2019-11-21 10:06:50,991 - TestPerf - INFO - Average Rate 10767120 2019-11-21 10:06:50,991 - TestPerf - INFO - Test test_12_recent_timestamp_4M_tcp_sess_setup_rate 2019-11-21 10:08:22,313 - TestPerf - INFO - Average Rate 7681031 2019-11-21 10:08:22,313 - TestPerf - INFO - Test test_13_recent_timestamp_4M_udp_sess_data_10b_setup_rate 2019-11-21 10:09:46,368 - TestPerf - INFO - Average Rate 10754733 2019-11-21 10:09:46,369 - TestPerf - INFO - Test test_14_timestamp_raw_4M_tcp_sess_data_1024b_setup_rate 2019-11-21 10:11:21,721 - TestPerf - INFO - Average Rate 3198651 2019-11-21 10:11:21,721 - TestPerf - INFO - Test test_15_timestamp_raw_4M_udp_sess_data_1024b_setup_rate 2019-11-21 10:12:38,191 - TestPerf - INFO - Average Rate 12987489 2019-11-21 10:12:38,191 - TestPerf - INFO - Test test_16_recent_timestamp_raw_4M_tcp_sess_data_1024b_setup_rate 2019-11-21 10:14:13,349 - TestPerf - INFO - Average Rate 3247600 2019-11-21 10:14:13,349 - TestPerf - INFO - Test test_17_recent_timestamp_raw_4M_udp_sess_data_1024b_setup_rate 2019-11-21 10:15:29,815 - TestPerf - INFO - Average Rate 13008807 --- python/warp17_api.py | 17 +++++++++++++++-- ut/ini/jspg3.ini | 26 +++++++++++++------------- ut/ini/vmxOne.ini | 39 ++++++++++++++++++++------------------- ut/ini/vmxOne_1G.ini | 2 +- 4 files changed, 49 insertions(+), 35 deletions(-) diff --git a/python/warp17_api.py b/python/warp17_api.py index 8dc2d28..9011612 100644 --- a/python/warp17_api.py +++ b/python/warp17_api.py @@ -90,6 +90,7 @@ class Warp17Env(): NCHAN = 'nchan' NO_HUGE = 'no-huge' MEMORY = 'memory' + SOCKET_MEM = 'socket-mem' PORTS = 'ports' QMAP_DEFAULT = 'qmap-default' QMAP = 'qmap' @@ -153,7 +154,19 @@ def get_nohuge(self): return False def get_memory(self): - return int(self.get_value(Warp17Env.MEMORY, mandatory=True)) + retvalue = None + + if self.get_value(Warp17Env.MEMORY, mandatory=False) is not None: + retvalue = ('-m ' + str( + int(self.get_value(Warp17Env.MEMORY, mandatory=False))) + ' ') + elif self.get_value(Warp17Env.SOCKET_MEM, mandatory=False) is not None: + retvalue = ('--socket-mem ' + str( + self.get_value(Warp17Env.SOCKET_MEM, mandatory=False)) + ' ') + + if retvalue is None: + raise Warp17Exception("Memory configuration missing.") + else: + return retvalue def get_ports(self): return self.get_value(Warp17Env.PORTS, mandatory=False) @@ -220,7 +233,7 @@ def get_exec_args(self): args += '-n ' + str(self.get_nchan()) + ' ' if self.get_nohuge(): args += '--no-huge ' - args += '-m ' + str(self.get_memory()) + ' ' + args += self.get_memory() ports = self.get_ports() if ports is not None: args += ' '.join(['-w ' + port for port in string.split(self.get_ports())]) + ' ' diff --git a/ut/ini/jspg3.ini b/ut/ini/jspg3.ini index a76ac51..d7400ba 100644 --- a/ut/ini/jspg3.ini +++ b/ut/ini/jspg3.ini @@ -56,29 +56,29 @@ [DEFAULT] # Mask of cores to be assigned to DPDK -coremask=0xFF3FCFF3FF +coremask = 0xFF3FCFF3FF # Number of memory channels to use -nchan=4 -# Hugepages memory to be used (in MB) -memory=32768 +nchan = 4 +# Hugepages memory to be used (in MB) per socket +socket-mem = 49152,49152 # TCB pool size (by default 10M TCBs) -tcb-pool-sz=22528 -ucb-pool-sz=22528 +tcb-pool-sz = 22528 +ucb-pool-sz = 22528 # List of ports to be used. These must be already added to the DPDK driver. -ports=0000:02:00.0 0000:82:00.0 +ports = 0000:03:00.0 0000:83:00.0 # Default qmap # qmap-default=max-c -[0000:02:00.0] +[0000:03:00.0] # Uncomment qmap-default from DEFAULT if the default should be used -qmap=0x003FC003FC +qmap = 0x003FC003FC -[0000:82:00.0] +[0000:83:00.0] # Uncomment qmap-default from DEFAULT if the default should be used -qmap=0xFF000FF000 +qmap = 0xFF000FF000 # The unit test section is required only when running tests. The expected # values and setup rates should be defined below. @@ -103,9 +103,9 @@ udp-mcast-data-setup-rate = 21000000 http-data-setup-rate = 3300000 -timestamp-tcp-rate = 7500000 +timestamp-tcp-rate = 7500000 timestamp-udp-rate = 10000000 -timestamp-tcp-data-rate = 2800000 +timestamp-tcp-data-rate = 3000000 timestamp-udp-data-rate = 12500000 diff --git a/ut/ini/vmxOne.ini b/ut/ini/vmxOne.ini index a5ff742..761ed8e 100644 --- a/ut/ini/vmxOne.ini +++ b/ut/ini/vmxOne.ini @@ -56,30 +56,31 @@ [DEFAULT] # Mask of cores to be assigned to DPDK -coremask=0x00FF00FF03 +coremask = 0x00FF00FF03 # Number of memory channels to use -nchan=4 +nchan = 4 # Hugepages memory to be used (in MB) -memory=32768 +socket-mem = 49152,49152 # TCB pool size (by default 10M TCBs) -tcb-pool-sz=22528 +tcb-pool-sz = 49000 +ucb-pool-sz = 49000 # List of ports to be used. These must be already added to the DPDK driver. -ports=0000:81:00.0 0000:82:00.0 +ports = 0000:81:00.1 0000:82:00.0 # Default qmap -qmap-default=max-c +qmap-default = max-c -[0000:81:00.0] +[0000:81:00.1] # This is here for reference as the default qmap will be used # Comment out qmap-default from DEFAULT if this one should be used -qmap=0x42 +qmap = 0xff00 [0000:82:00.0] # This is here for reference as the default qmap will be used # Comment out qmap-default from DEFAULT if this one should be used -qmap=0x42 +qmap = 0xff000000 # The unit test section is required only when running tests. The expected # values and setup rates should be defined below. @@ -97,18 +98,18 @@ skip-big-data = 0 # Uncomment if need to allow failed sessions (e.g., on 1G ports) # allowed-failed-sessions = 42 -tcp-setup-rate = 3900000 -tcp-data-setup-rate = 1800000 -tcp-data-setup-rate-1024 = 1700000 +tcp-setup-rate = 4400000 +tcp-data-setup-rate = 1800000 +tcp-data-setup-rate-1024 = 1700000 -udp-data-setup-rate = 5600000 -udp-mcast-data-setup-rate = 9690000 +udp-data-setup-rate = 7000000 +udp-mcast-data-setup-rate = 10000000 -http-data-setup-rate = 1570000 +http-data-setup-rate = 1570000 -timestamp-tcp-rate = 3500000 -timestamp-udp-rate = 5400000 +timestamp-tcp-rate = 4000000 +timestamp-udp-rate = 6000000 -timestamp-tcp-data-rate = 1640000 -timestamp-udp-data-rate = 4300000 +timestamp-tcp-data-rate = 1640000 +timestamp-udp-data-rate = 4900000 diff --git a/ut/ini/vmxOne_1G.ini b/ut/ini/vmxOne_1G.ini index defb6bf..a7997bd 100644 --- a/ut/ini/vmxOne_1G.ini +++ b/ut/ini/vmxOne_1G.ini @@ -62,7 +62,7 @@ coremask = 0x00FF00FF03 # Number of memory channels to use nchan = 4 # Hugepages memory to be used (in MB) -memory = 32768 +memory = 98304 # TCB pool size (by default 10M TCBs) tcb-pool-sz = 22528 From 682de36c1bb3fca427dfc55dbb4f1278c38a7e54 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Thu, 21 Nov 2019 16:06:14 +0100 Subject: [PATCH 13/14] Adapt memory collection --- python/stats_collector.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/stats_collector.py b/python/stats_collector.py index 0008975..1539a67 100644 --- a/python/stats_collector.py +++ b/python/stats_collector.py @@ -491,7 +491,7 @@ def test_http_throughput(): app_http_server=HttpServer(hs_resp_code=OK_200, hs_resp_size=45056)) - start_memory = int(env.get_memory()) + start_memory = env.get_memory() localenv.set_value(env.TCB_POOL_SZ, 95000) localenv.set_value(env.UCB_POOL_SZ, 0) @@ -527,7 +527,7 @@ def test_400k_http_sessions(): app_http_server=HttpServer(hs_resp_code=OK_200, hs_resp_size=45056)) - start_memory = int(env.get_memory()) + start_memory = env.get_memory() localenv.set_value(env.TCB_POOL_SZ, 98000) localenv.set_value(env.UCB_POOL_SZ, 0) @@ -562,7 +562,7 @@ def test_800k_http_sessions(): app_http_server=HttpServer(hs_resp_code=OK_200, hs_resp_size=45056)) - start_memory = int(env.get_memory()) + start_memory = env.get_memory() localenv.set_value(env.TCB_POOL_SZ, 98000) localenv.set_value(env.UCB_POOL_SZ, 0) @@ -599,7 +599,7 @@ def test_udp_throughput(): test_thr.tc_downtime = Delay(d_value=0) - start_memory = int(env.get_memory()) + start_memory = env.get_memory() localenv.set_value(env.TCB_POOL_SZ, 0) localenv.set_value(env.UCB_POOL_SZ, 98000) @@ -632,7 +632,7 @@ def test_single_udp_throughput(): app_raw_server=RawServer(rs_req_plen=0, rs_resp_plen=0)) - start_memory = int(env.get_memory()) + start_memory = env.get_memory() localenv.set_value(env.TCB_POOL_SZ, 0) localenv.set_value(env.UCB_POOL_SZ, 98000) @@ -691,7 +691,7 @@ def test_throughput2(): test_thr_cl2.downtime = Delay(d_value=0) - start_memory = int(env.get_memory()) + start_memory = env.get_memory() localenv.set_value(env.TCB_POOL_SZ, 0) localenv.set_value(env.UCB_POOL_SZ, 95000) From 9d4bbb96cbd5ee43d203acf464b0b07fb4bd6ac4 Mon Sep 17 00:00:00 2001 From: Matteo Triggiani Date: Tue, 3 Dec 2019 16:30:04 +0100 Subject: [PATCH 14/14] Add support to TCP window fixing and custom test number --- python/stats_collector.py | 371 ++++++++++++++++++++++++++------------ 1 file changed, 259 insertions(+), 112 deletions(-) diff --git a/python/stats_collector.py b/python/stats_collector.py index 1539a67..ff24c23 100644 --- a/python/stats_collector.py +++ b/python/stats_collector.py @@ -1,5 +1,4 @@ #!/usr/bin/env python2 - # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER # @@ -60,9 +59,7 @@ # **************************************************************************** # Include files # **************************************************************************** -import os from warp17_api import * -import socket import time from rpc_impl import * @@ -112,6 +109,8 @@ def __init__(self, type=None, port=None, id=None): 0: 1, 1: 1, } + self.tcpwin = None + self.mtu = 1500 if type is TestCaseType.Value('CLIENT'): self.rate_ccfg = RateClient(rc_open_rate=Rate(), rc_close_rate=Rate(), @@ -128,17 +127,16 @@ def __init__(self, type=None, port=None, id=None): self.cl_port = port self.tc_id = id self.test_type = type - self.mtu = 1500 # Redundant elif type is TestCaseType.Value('SERVER'): - self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, tc_srv_up=1) + self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, + tc_srv_up=1) self.l4_scfg = L4Server() self.scfg = TestCase() self.sr_port = port self.tc_id = id self.test_type = type - self.mtu = 1500 - elif type is None and port is None and id is None: + elif type is None and port is None: self.rate_ccfg = RateClient(rc_open_rate=Rate(), rc_close_rate=Rate(), rc_send_rate=Rate()) @@ -151,15 +149,15 @@ def __init__(self, type=None, port=None, id=None): self.downtime = Delay(d_value=0) self.ccfg = TestCase() - self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, tc_srv_up=1) + self.sr_test_criteria = TestCriteria(tc_crit_type=SRV_UP, + tc_srv_up=1) self.l4_scfg = L4Server() self.scfg = TestCase() self.cl_port = 0 self.sr_port = 1 - self.tc_id = 0 + self.tc_id = 0 if id is None else id self.test_type = None - self.mtu = 1500 else: raise BaseException("Wrong test type.") @@ -171,17 +169,23 @@ def add_config(self): if self.test_type is TestCaseType.Value('CLIENT'): def_gw, n_ip = self.l3_config[self.cl_port] - pcfg = b2b_port_add(self.cl_port, def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) + pcfg = b2b_port_add(self.cl_port, + def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) b2b_port_add_intfs(pcfg, - [(Ip(ip_version=IPV4, ip_v4=b2b_ipv4(self.cl_port, i)), - Ip(ip_version=IPV4, ip_v4=b2b_mask(self.cl_port, i)), - b2b_count(self.cl_port, i)) for i in range(0, 1)]) + [(Ip(ip_version=IPV4, + ip_v4=b2b_ipv4(self.cl_port, i)), + Ip(ip_version=IPV4, + ip_v4=b2b_mask(self.cl_port, i)), + b2b_count(self.cl_port, i)) for i in + range(0, 1)]) warp17_call('ConfigurePort', pcfg) self.l4_ccfg = L4Client(l4c_proto=self.proto, l4c_tcp_udp=TcpUdpClient( - tuc_sports=b2b_ports(self.l4_config[self.cl_port]), - tuc_dports=b2b_ports(self.l4_config[self.sr_port]))) + tuc_sports=b2b_ports( + self.l4_config[self.cl_port]), + tuc_dports=b2b_ports( + self.l4_config[self.sr_port]))) cl_src_ips = b2b_sips(self.cl_port, self.l3_config[self.cl_port][1]) cl_dst_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) self.ccfg = TestCase(tc_type=CLIENT, tc_eth_port=self.cl_port, @@ -194,7 +198,8 @@ def add_config(self): tc_init_delay=self.init_delay, tc_uptime=self.uptime, tc_downtime=self.downtime, - tc_criteria=self.cl_test_criteria) + tc_criteria=self.cl_test_criteria, + tc_async=True) answer = warp17_call('ConfigureTestCase', self.ccfg) if answer.e_code is not 0: @@ -203,22 +208,28 @@ def add_config(self): elif self.test_type is TestCaseType.Value('SERVER'): def_gw, n_ip = self.l3_config[self.sr_port] - pcfg = b2b_port_add(self.sr_port, def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) + pcfg = b2b_port_add(self.sr_port, + def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) b2b_port_add_intfs(pcfg, - [(Ip(ip_version=IPV4, ip_v4=b2b_ipv4(self.sr_port, i)), - Ip(ip_version=IPV4, ip_v4=b2b_mask(self.sr_port, i)), - b2b_count(self.sr_port, i)) for i in range(0, 1)]) + [(Ip(ip_version=IPV4, + ip_v4=b2b_ipv4(self.sr_port, i)), + Ip(ip_version=IPV4, + ip_v4=b2b_mask(self.sr_port, i)), + b2b_count(self.sr_port, i)) for i in + range(0, 1)]) warp17_call('ConfigurePort', pcfg) self.l4_scfg = L4Server(l4s_proto=self.proto, l4s_tcp_udp=TcpUdpServer( tus_ports=b2b_ports(1))) - srv_src_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) + srv_src_ips = b2b_sips(self.sr_port, + self.l3_config[self.sr_port][1]) self.scfg = TestCase(tc_type=SERVER, tc_eth_port=self.sr_port, tc_id=self.tc_id, tc_server=Server(srv_ips=srv_src_ips, srv_l4=self.l4_scfg), tc_app=self.app_scfg, - tc_criteria=self.sr_test_criteria) + tc_criteria=self.sr_test_criteria, + tc_async=True) answer = warp17_call('ConfigureTestCase', self.scfg) if answer.e_code is not 0: @@ -228,26 +239,32 @@ def add_config(self): for port in self.l3_config: def_gw, n_ip = self.l3_config[port] - pcfg = b2b_port_add(port, def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) + pcfg = b2b_port_add(port, + def_gw=Ip(ip_version=IPV4, ip_v4=def_gw)) b2b_port_add_intfs(pcfg, - [(Ip(ip_version=IPV4, ip_v4=b2b_ipv4(port, i)), - Ip(ip_version=IPV4, ip_v4=b2b_mask(port, i)), + [(Ip(ip_version=IPV4, + ip_v4=b2b_ipv4(port, i)), + Ip(ip_version=IPV4, + ip_v4=b2b_mask(port, i)), b2b_count(port, i)) for i in range(0, 1)]) warp17_call('ConfigurePort', pcfg) - if self.mtu is not 1500: # 1500 is the default MTU + if self.mtu is not 1500: # 1500 is the default MTU port_options = PortOptions(po_mtu=self.mtu) answer = warp17_call('SetPortOptions', - PortOptionsArg(poa_port=PortArg(pa_eth_port=port), - poa_opts=port_options)) + PortOptionsArg( + poa_port=PortArg(pa_eth_port=port), + poa_opts=port_options)) if answer.e_code is not 0: raise BaseException("{} trying to configure testcase {}" "".format(answer.e_code, self.ccfg)) self.l4_ccfg = L4Client(l4c_proto=self.proto, l4c_tcp_udp=TcpUdpClient( - tuc_sports=b2b_ports(self.l4_config[self.cl_port]), - tuc_dports=b2b_ports(self.l4_config[self.sr_port]))) + tuc_sports=b2b_ports( + self.l4_config[self.cl_port]), + tuc_dports=b2b_ports( + self.l4_config[self.sr_port]))) cl_src_ips = b2b_sips(self.cl_port, self.l3_config[self.cl_port][1]) cl_dst_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) self.ccfg = TestCase(tc_type=CLIENT, tc_eth_port=self.cl_port, @@ -260,17 +277,35 @@ def add_config(self): tc_init_delay=self.init_delay, tc_uptime=self.uptime, tc_downtime=self.downtime, - tc_criteria=self.cl_test_criteria) + tc_criteria=self.cl_test_criteria, + tc_async=True) answer = warp17_call('ConfigureTestCase', self.ccfg) + if answer.e_code is not 0: - raise BaseException("{} trying to configure testcase {}" + raise BaseException("{} error trying to configure testcase {}" "".format(answer.e_code, self.ccfg)) + if self.tcpwin is not None: + time.sleep(1) + sockopt_arg = TcpSockoptArg( + toa_tc_arg=TestCaseArg(tca_eth_port=self.cl_port, + tca_test_case_id=self.tc_id), + toa_opts=TcpSockopt( + to_win_size=self.tcpwin)) + answer = warp17_call('SetTcpSockopt', sockopt_arg) + + if answer.e_code is not 0: + raise BaseException( + '{} error configuring tcp option {}'.format( + answer.e_code, sockopt_arg)) + self.l4_scfg = L4Server(l4s_proto=self.proto, l4s_tcp_udp=TcpUdpServer( - tus_ports=b2b_ports(self.l4_config[self.sr_port]))) - srv_src_ips = b2b_sips(self.sr_port, self.l3_config[self.sr_port][1]) - assert(cl_dst_ips == srv_src_ips) + tus_ports=b2b_ports( + self.l4_config[self.sr_port]))) + srv_src_ips = b2b_sips(self.sr_port, + self.l3_config[self.sr_port][1]) + assert (cl_dst_ips == srv_src_ips) self.scfg = TestCase(tc_type=SERVER, tc_eth_port=self.sr_port, tc_id=self.tc_id, tc_server=Server(srv_ips=srv_src_ips, @@ -283,6 +318,20 @@ def add_config(self): raise BaseException("{} trying to configure testcase {}" "".format(answer.e_code, self.scfg)) + if self.tcpwin is not None: + time.sleep(1) + sockopt_arg = TcpSockoptArg( + toa_tc_arg=TestCaseArg(tca_eth_port=self.sr_port, + tca_test_case_id=self.tc_id), + toa_opts=TcpSockopt( + to_win_size=self.tcpwin)) + answer = warp17_call('SetTcpSockopt', sockopt_arg) + + if answer.e_code is not 0: raise BaseException( + '{} error configuring tcp option {}'.format(answer.e_code, + sockopt_arg)) + + else: raise BaseException("test type is invalid") @@ -290,14 +339,14 @@ def collect_results(self, times=1): status = [] stats = [] tstamps = [] - sleep(2) # wait for test to be fully running before start colleting stats + sleep(2) # wait for test to be fully running before start colleting stats while times >= 0: status1 = {} stats1 = {} for port in self.l3_config: status1[port] = warp17_call('GetTestStatus', - TestCaseArg(tca_eth_port=port, - tca_test_case_id=self.tc_id)) + TestCaseArg(tca_eth_port=port, + tca_test_case_id=self.tc_id)) stats1[port] = warp17_call('GetStatistics', TestCaseArg(tca_eth_port=port, tca_test_case_id=self.tc_id)) @@ -473,10 +522,10 @@ def test_http_throughput(): test_10m = Test() test_10m.cl_port = 0 test_10m.sr_port = 1 - test_10m.add_l3(test_10m.cl_port, 167837697, 20) # 10.1.0.1-10.1.0.20 - test_10m.add_l3(test_10m.sr_port, 167772161, 1) # 10.0.0.1 - test_10m.l4_config[test_10m.cl_port] = 50000 - test_10m.l4_config[test_10m.sr_port] = 10 # not really needed + test_10m.add_l3(test_10m.cl_port, 167837697, 2) + test_10m.add_l3(test_10m.sr_port, 167772161, 1) + test_10m.l4_config[test_10m.cl_port] = 200 + test_10m.l4_config[test_10m.sr_port] = 50000 test_10m.proto = TCP test_10m.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, @@ -486,10 +535,10 @@ def test_http_throughput(): app_http_client=HttpClient(hc_req_method=GET, hc_req_object_name='/index.html', hc_req_host_name='www.foobar.net', - hc_req_size=45056)) #44k + hc_req_size=512)) test_10m.app_scfg = App(app_proto=HTTP_SERVER, app_http_server=HttpServer(hs_resp_code=OK_200, - hs_resp_size=45056)) + hs_resp_size=512)) start_memory = env.get_memory() @@ -502,109 +551,208 @@ def test_http_throughput(): return [test_10m], start_memory, out_folder, localenv -def test_400k_http_sessions(): - """Configures a test to run 400k sessions""" +def test_udp_throughput(): localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) - test_40m = Test() - test_40m.cl_port = 0 - test_40m.sr_port = 1 - test_40m.add_l3(test_40m.cl_port, 167837697, 1) # 10.1.0.1-10.1.0.20 - test_40m.add_l3(test_40m.sr_port, 167772161, 1) # 10.0.0.1-10.0.0.5 - test_40m.l4_config[test_40m.cl_port] = 4000 - test_40m.l4_config[test_40m.sr_port] = 100 # not really needed - test_40m.proto = TCP - test_40m.mtu = 9192 - - test_40m.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + test_thr = Test(id=0) + test_thr.cl_port = 0 + test_thr.sr_port = 1 + test_thr.add_l3(test_thr.cl_port, 167837697, 1) # 10.1.0.1 + test_thr.add_l3(test_thr.sr_port, 167772161, 10) # 10.0.0.1-10.0.0.10 + test_thr.l4_config[test_thr.cl_port] = 10 + test_thr.l4_config[test_thr.sr_port] = 50000 # not really needed + test_thr.proto = UDP + + test_thr.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, tc_cl_estab=120) - test_40m.app_ccfg = App(app_proto=HTTP_CLIENT, - app_http_client=HttpClient(hc_req_method=GET, - hc_req_object_name='/index.html', - hc_req_host_name='www.foobar.net', - hc_req_size=45056)) # 44k - test_40m.app_scfg = App(app_proto=HTTP_SERVER, - app_http_server=HttpServer(hs_resp_code=OK_200, - hs_resp_size=45056)) + test_thr.app_ccfg = App(app_proto=RAW_CLIENT, + app_raw_client=RawClient(rc_req_plen=1324, + rc_resp_plen=1324)) + test_thr.app_scfg = App(app_proto=RAW_SERVER, + app_raw_server=RawServer(rs_req_plen=1324, + rs_resp_plen=1324)) + + test_thr.tc_init_delay = Delay(d_value=0) + test_thr.tc_uptime = Delay(d_value=1) + test_thr.tc_downtime = Delay(d_value=0) + + test_thr2 = Test(id=1) + test_thr2.cl_port = 1 + test_thr2.sr_port = 0 + test_thr2.add_l3(test_thr2.cl_port, 167837697, 1) # 10.1.0.1 + test_thr2.add_l3(test_thr2.sr_port, 167772161, 10) # 10.0.0.1-10.0.0.10 + test_thr2.l4_config[test_thr2.cl_port] = 10 + test_thr2.l4_config[test_thr2.sr_port] = 50000 # not really needed + test_thr2.proto = UDP + + test_thr2.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) + + test_thr2.app_ccfg = App(app_proto=RAW_CLIENT, + app_raw_client=RawClient(rc_req_plen=1324, + rc_resp_plen=1324)) + test_thr2.app_scfg = App(app_proto=RAW_SERVER, + app_raw_server=RawServer(rs_req_plen=1324, + rs_resp_plen=1324)) + + test_thr2.tc_init_delay = Delay(d_value=0) + test_thr2.tc_uptime = Delay(d_value=1) + test_thr2.tc_downtime = Delay(d_value=0) + + start_memory = env.get_memory() + + localenv.set_value(env.TCB_POOL_SZ, 0) + localenv.set_value(env.UCB_POOL_SZ, 98000) + + out_folder = "/tmp/{}-test-{}/".format(test_udp_throughput.__name__, + get_uniq_stamp()) + + return [test_thr, test_thr2], start_memory, out_folder, localenv + + +def test_tcp_throughput(): + localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) + test_thr = Test() + test_thr.cl_port = 0 + test_thr.sr_port = 1 + test_thr.add_l3(test_thr.cl_port, 167837697, 4) # 10.1.0.1 + test_thr.add_l3(test_thr.sr_port, 167772161, 1) # 10.0.0.1-10.0.0.10 + test_thr.l4_config[test_thr.cl_port] = 200 + test_thr.l4_config[test_thr.sr_port] = 50000 # not really needed + test_thr.proto = TCP + + test_thr.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) + + test_thr.app_ccfg = App(app_proto=RAW_CLIENT, + app_raw_client=RawClient(rc_req_plen=512, + rc_resp_plen=512)) + test_thr.app_scfg = App(app_proto=RAW_SERVER, + app_raw_server=RawServer(rs_req_plen=512, + rs_resp_plen=512)) + + test_thr.tc_init_delay = Delay(d_value=0) + test_thr.tc_uptime = Delay(d_value=1) + test_thr.tc_downtime = Delay(d_value=0) start_memory = env.get_memory() localenv.set_value(env.TCB_POOL_SZ, 98000) localenv.set_value(env.UCB_POOL_SZ, 0) - out_folder = "/tmp/{}-test-{}/".format(test_400k_http_sessions.__name__, + out_folder = "/tmp/{}-test-{}/".format(test_tcp_throughput.__name__, get_uniq_stamp()) - return [test_40m], start_memory, out_folder, localenv + return [test_thr], start_memory, out_folder, localenv + -def test_800k_http_sessions(): - """Configures a test to run 800k sessions""" +def test_tcp2_throughput(): localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) - test_40m = Test() - test_40m.cl_port = 0 - test_40m.sr_port = 1 - test_40m.add_l3(test_40m.cl_port, 167837697, 1) # 10.1.0.1-10.1.0.20 - test_40m.add_l3(test_40m.sr_port, 167772161, 1) # 10.0.0.1-10.0.0.5 - test_40m.l4_config[test_40m.cl_port] = 4000 - test_40m.l4_config[test_40m.sr_port] = 200 # not really needed - test_40m.proto = TCP - test_40m.mtu = 9192 - - test_40m.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + test_thr = Test() + test_thr.cl_port = 0 + test_thr.sr_port = 1 + test_thr.add_l3(test_thr.cl_port, 167837697, 4) # 10.1.0.1 + test_thr.add_l3(test_thr.sr_port, 167772161, 1) # 10.0.0.1-10.0.0.10 + test_thr.l4_config[test_thr.cl_port] = 200 + test_thr.l4_config[test_thr.sr_port] = 50000 # not really needed + test_thr.proto = TCP + + test_thr.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, tc_cl_estab=120) - test_40m.app_ccfg = App(app_proto=HTTP_CLIENT, - app_http_client=HttpClient(hc_req_method=GET, - hc_req_object_name='/index.html', - hc_req_host_name='www.foobar.net', - hc_req_size=45056)) # 44k - test_40m.app_scfg = App(app_proto=HTTP_SERVER, - app_http_server=HttpServer(hs_resp_code=OK_200, - hs_resp_size=45056)) + test_thr.app_ccfg = App(app_proto=RAW_CLIENT, + app_raw_client=RawClient(rc_req_plen=1024, + rc_resp_plen=1024)) + test_thr.app_scfg = App(app_proto=RAW_SERVER, + app_raw_server=RawServer(rs_req_plen=1024, + rs_resp_plen=1024)) + + test_thr.tc_init_delay = Delay(d_value=0) + test_thr.tc_uptime = Delay(d_value=1) + test_thr.tc_downtime = Delay(d_value=0) start_memory = env.get_memory() localenv.set_value(env.TCB_POOL_SZ, 98000) localenv.set_value(env.UCB_POOL_SZ, 0) - out_folder = "/tmp/{}-test-{}/".format(test_800k_http_sessions.__name__, + out_folder = "/tmp/{}-test-{}/".format(test_tcp2_throughput.__name__, get_uniq_stamp()) - return [test_40m], start_memory, out_folder, localenv + return [test_thr], start_memory, out_folder, localenv -def test_udp_throughput(): +def test_tcp3_throughput(): localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) test_thr = Test() test_thr.cl_port = 0 test_thr.sr_port = 1 - test_thr.add_l3(test_thr.cl_port, 167837697, 1) # 10.1.0.1 - test_thr.add_l3(test_thr.sr_port, 167772161, 10) # 10.0.0.1-10.0.0.10 - test_thr.l4_config[test_thr.cl_port] = 10 + test_thr.add_l3(test_thr.cl_port, 167837697, 4) # 10.1.0.1 + test_thr.add_l3(test_thr.sr_port, 167772161, 1) # 10.0.0.1-10.0.0.10 + test_thr.l4_config[test_thr.cl_port] = 200 test_thr.l4_config[test_thr.sr_port] = 50000 # not really needed - test_thr.proto = UDP + test_thr.proto = TCP + test_thr.mtu = 2854 + test_thr.tcpwin = 2560 test_thr.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, tc_cl_estab=120) test_thr.app_ccfg = App(app_proto=RAW_CLIENT, - app_raw_client=RawClient(rc_req_plen=80000, - rc_resp_plen=80000)) + app_raw_client=RawClient(rc_req_plen=2560, + rc_resp_plen=2560)) test_thr.app_scfg = App(app_proto=RAW_SERVER, - app_raw_server=RawServer(rs_req_plen=80000, - rs_resp_plen=80000)) + app_raw_server=RawServer(rs_req_plen=2560, + rs_resp_plen=2560)) test_thr.tc_init_delay = Delay(d_value=0) test_thr.tc_uptime = Delay(d_value=1) test_thr.tc_downtime = Delay(d_value=0) + start_memory = env.get_memory() + + localenv.set_value(env.TCB_POOL_SZ, 98000) + localenv.set_value(env.UCB_POOL_SZ, 0) + + out_folder = "/tmp/{}-test-{}/".format(test_tcp3_throughput.__name__, + get_uniq_stamp()) + + return [test_thr], start_memory, out_folder, localenv + + +def test_tcp4_throughput(): + localenv = Warp17Env('ut/ini/{}.ini'.format(socket.gethostname())) + test_thr = Test() + test_thr.cl_port = 0 + test_thr.sr_port = 1 + test_thr.add_l3(test_thr.cl_port, 167837697, 4) # 10.1.0.1 + test_thr.add_l3(test_thr.sr_port, 167772161, 1) # 10.0.0.1-10.0.0.10 + test_thr.l4_config[test_thr.cl_port] = 200 + test_thr.l4_config[test_thr.sr_port] = 50000 # not really needed + test_thr.proto = TCP + test_thr.mtu = 5414 + test_thr.tcpwin = 5120 + + test_thr.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, + tc_cl_estab=120) + + test_thr.app_ccfg = App(app_proto=RAW_CLIENT, + app_raw_client=RawClient(rc_req_plen=5120, + rc_resp_plen=5120)) + test_thr.app_scfg = App(app_proto=RAW_SERVER, + app_raw_server=RawServer(rs_req_plen=5120, + rs_resp_plen=5120)) + + test_thr.tc_init_delay = Delay(d_value=0) + test_thr.tc_uptime = Delay(d_value=1) + test_thr.tc_downtime = Delay(d_value=0) start_memory = env.get_memory() - localenv.set_value(env.TCB_POOL_SZ, 0) - localenv.set_value(env.UCB_POOL_SZ, 98000) + localenv.set_value(env.TCB_POOL_SZ, 98000) + localenv.set_value(env.UCB_POOL_SZ, 0) - out_folder = "/tmp/{}-test-{}/".format(test_udp_throughput.__name__, + out_folder = "/tmp/{}-test-{}/".format(test_tcp4_throughput.__name__, get_uniq_stamp()) return [test_thr], start_memory, out_folder, localenv @@ -656,7 +804,6 @@ def test_throughput2(): test_thr_cl1.l4_config[test_thr_cl1.sr_port] = 50000 # not really needed test_thr_cl1.proto = UDP - test_thr_cl1.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, tc_cl_estab=120) @@ -668,8 +815,8 @@ def test_throughput2(): test_thr_cl1.tc_downtime = Delay(d_value=0) test_thr_cl2 = Test(type=TestCaseType.Value('CLIENT'), - port=1, - id=0) + port=1, + id=0) test_thr_cl2.cl_port = 1 test_thr_cl2.sr_port = 0 test_thr_cl2.add_l3(test_thr_cl2.cl_port, 167837697, 1) # 10.1.0.1 @@ -678,7 +825,6 @@ def test_throughput2(): test_thr_cl2.l4_config[test_thr_cl2.sr_port] = 50000 # not really needed test_thr_cl2.proto = UDP - test_thr_cl2.cl_test_criteria = TestCriteria(tc_crit_type=RUN_TIME, tc_cl_estab=120) @@ -690,7 +836,6 @@ def test_throughput2(): test_thr_cl2.uptime = Delay(d_value=1) test_thr_cl2.downtime = Delay(d_value=0) - start_memory = env.get_memory() localenv.set_value(env.TCB_POOL_SZ, 0) @@ -701,9 +846,11 @@ def test_throughput2(): return [test_thr_cl1, test_thr_cl2], start_memory, out_folder, localenv -tests = [] # here you can append the tests you want to run (in sequence) -tests.append(test_400k_http_sessions()) -tests.append(test_800k_http_sessions()) + +tests = [] # here you can append the tests you want to run (in sequence) +# tests.append(test_http_throughput()) +tests.append(test_tcp4_throughput()) +tests.append(test_udp_throughput()) for test, start_memory, out_folder, localenv in tests: res_file = "{}res.txt".format(out_folder) @@ -714,7 +861,7 @@ def test_throughput2(): resultwriter = open(res_file, "w") resultwriter.write("Stats collection:_{}\n".format(datetime.today())) running_times = 10 - for i in range (0, running_times): + for i in range(0, running_times): print "run {}".format(i) resultwriter.write("Run {}\n".format(i)) resultwriter.flush()