This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17651 ) Change subject: iperf3: add config to adjust the duration of the iperf run ...................................................................... iperf3: add config to adjust the duration of the iperf run the time is passed as a string param and is then converted into seconds when literals "h" or "m" are found. So it would accept 2m and would convert it to 120s, for example. Example: +cfg-iperf3-time at 15+ Change-Id: Iff28816f83670751e9e91de31ec59b1b0ad8fc0d --- M example/defaults.conf A example/scenarios/cfg-iperf3-time at .conf M src/osmo_gsm_tester/iperf3.py M src/osmo_gsm_tester/resource.py M src/osmo_gsm_tester/schema.py M suites/4g/iperf3_dl.py M suites/4g/iperf3_ul.py 7 files changed, 34 insertions(+), 5 deletions(-) Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/example/defaults.conf b/example/defaults.conf index aa1e1dc..0b9136d 100644 --- a/example/defaults.conf +++ b/example/defaults.conf @@ -123,3 +123,6 @@ airplane_t_on_ms: -1 airplane_t_off_ms: -1 num_carriers: 1 + +iperf3cli: + time: 60 diff --git a/example/scenarios/cfg-iperf3-time at .conf b/example/scenarios/cfg-iperf3-time at .conf new file mode 100644 index 0000000..f46c59a --- /dev/null +++ b/example/scenarios/cfg-iperf3-time at .conf @@ -0,0 +1,3 @@ +config: + iperf3cli: + time: ${param1} diff --git a/src/osmo_gsm_tester/iperf3.py b/src/osmo_gsm_tester/iperf3.py index be4dd6f..7103193 100644 --- a/src/osmo_gsm_tester/iperf3.py +++ b/src/osmo_gsm_tester/iperf3.py @@ -20,7 +20,7 @@ import os import json -from . import log, util, process, pcap_recorder, run_node, remote +from . import log, util, config, process, pcap_recorder, run_node, remote def iperf3_result_to_json(file): with open(file) as f: @@ -154,8 +154,23 @@ locally = not self._run_node or self._run_node.is_local() return locally - def prepare_test_proc(self, downlink=False, netns=None, time_sec=10): - self.log('Starting iperf3-client connecting to %s:%d' % (self.server.addr(), self.server.port())) + def prepare_test_proc(self, downlink=False, netns=None, time_sec=None): + if time_sec is None: + values = config.get_defaults('iperf3cli') + config.overlay(values, self.suite_run.config().get('iperf3cli', {})) + time_sec_str = values.get('time', time_sec) + + # Convert duration to seconds + if isinstance(time_sec_str, str) and time_sec_str.endswith('h'): + time_sec = int(time_sec_str[:-1]) * 3600 + elif isinstance(time_sec_str, str) and time_sec_str.endswith('m'): + time_sec = int(time_sec_str[:-1]) * 60 + else: + time_sec = int(time_sec_str) + + assert(time_sec) + + self.log('Preparing iperf3-client connecting to %s:%d (time=%ds)' % (self.server.addr(), self.server.port(), time_sec)) self.log_copied = False self.run_dir = util.Dir(self.suite_run.get_test_run_dir().new_dir(self.name())) self.log_file = self.run_dir.new_file(IPerf3Client.LOGFILE) diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py index a13fd2d..3b6e341 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -127,6 +127,7 @@ 'config.epc.enable_pcap': schema.BOOL_STR, 'config.modem.enable_pcap': schema.BOOL_STR, 'config.amarisoft.license_server_addr': schema.IPV4, + 'config.iperf3cli.time': schema.DURATION, }, dict([('resources.%s' % key, val) for key, val in WANT_SCHEMA.items()]), dict([('modifiers.%s' % key, val) for key, val in WANT_SCHEMA.items()])) diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py index 7fe6689..85c5fd6 100644 --- a/src/osmo_gsm_tester/schema.py +++ b/src/osmo_gsm_tester/schema.py @@ -136,6 +136,11 @@ return raise ValueError('Unknown LTE RLC DRB Mode value: %r' % val) +def duration(val): + if val.isdecimal() or val.endswith('m') or val.endswith('h'): + return + raise ValueError('Invalid duration value: %r' % val) + INT = 'int' STR = 'str' UINT = 'uint' @@ -157,6 +162,7 @@ OSMO_TRX_CLOCK_REF = 'osmo_trx_clock_ref' LTE_TRANSMISSION_MODE = 'lte_transmission_mode' LTE_RLC_DRB_MODE = 'lte_rlc_drb_mode' +DURATION = 'duration' SCHEMA_TYPES = { INT: int, @@ -180,6 +186,7 @@ OSMO_TRX_CLOCK_REF: osmo_trx_clock_ref, LTE_TRANSMISSION_MODE: lte_transmission_mode, LTE_RLC_DRB_MODE: lte_rlc_drb_mode, + DURATION: duration, } def validate(config, schema): diff --git a/suites/4g/iperf3_dl.py b/suites/4g/iperf3_dl.py index 38a3891..88ae82d 100755 --- a/suites/4g/iperf3_dl.py +++ b/suites/4g/iperf3_dl.py @@ -32,7 +32,7 @@ ue.connect(enb) iperf3srv.start() -proc = iperf3cli.prepare_test_proc(True, ue.netns(), time_sec=60) +proc = iperf3cli.prepare_test_proc(True, ue.netns()) print('waiting for UE to attach...') wait(ue.is_connected, None) diff --git a/suites/4g/iperf3_ul.py b/suites/4g/iperf3_ul.py index f467696..597b50d 100755 --- a/suites/4g/iperf3_ul.py +++ b/suites/4g/iperf3_ul.py @@ -32,7 +32,7 @@ ue.connect(enb) iperf3srv.start() -proc = iperf3cli.prepare_test_proc(False, ue.netns(), time_sec=60) +proc = iperf3cli.prepare_test_proc(False, ue.netns()) print('waiting for UE to attach...') wait(ue.is_connected, None) -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17651 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Change-Id: Iff28816f83670751e9e91de31ec59b1b0ad8fc0d Gerrit-Change-Number: 17651 Gerrit-PatchSet: 10 Gerrit-Owner: srs_andre <andre at softwareradiosystems.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-Reviewer: srs_andre <andre at softwareradiosystems.com> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200401/22b385de/attachment.htm>