diff options
author | Jeff Lane <jeffrey.lane@canonical.com> | 2016-03-03 15:33:30 -0500 |
---|---|---|
committer | Jeff Lane <jeffrey.lane@canonical.com> | 2016-03-03 15:33:30 -0500 |
commit | 7c11800c3476da53cc3712b8bde172d56f9128a2 (patch) | |
tree | 28a441286f1aa81f9ef89600b4ad761555dabc17 | |
parent | 6716ddee365184bca79a9914eb0a80652c3d9c3c (diff) |
p-p-c/bin/network: Added a runtime component so you can now test for DATASIZE GB (default of 1) OR RUNTIME seconds. p-p-c/jobs/ethernet.txt.in: Modified the multi_nic jobs to run for 15 minutes rather than 200GB, which can add up to 2 hours per port, or 8 hours on a quad port or longer.
-rwxr-xr-x | bin/network | 47 | ||||
-rw-r--r-- | jobs/ethernet.txt.in | 4 |
2 files changed, 35 insertions, 16 deletions
diff --git a/bin/network b/bin/network index 06d106e..7b5f8f6 100755 --- a/bin/network +++ b/bin/network @@ -56,7 +56,8 @@ class IPerfPerformanceTest(object): cpu_load_fail_threshold, iperf3, protocol="tcp", - data_size="1"): + data_size="1", + run_time=None): self.iface = Interface(interface) self.target = target @@ -65,6 +66,7 @@ class IPerfPerformanceTest(object): self.cpu_load_fail_threshold = cpu_load_fail_threshold self.iperf3 = iperf3 self.data_size = data_size + self.run_time = run_time def run(self): # if max_speed is 0, assume it's wifi and move on @@ -79,23 +81,28 @@ class IPerfPerformanceTest(object): logging.error("Check your device configuration and try again") return 1 + # Set the correct binary to run + if (self.iperf3): + self.executable = "iperf3 -V" + else: + self.executable = "iperf" + + # If we set run_time, use that instead to build the command. + if self.run_time is not None: + cmd = "{} -c {} -t {} -i 1 -f m".format( + self.executable, self.target, self.run_time) + else: # Because we can vary the data size, we need to vary the timeout as # well. It takes an estimated 15 minutes to send 1GB over 10Mb/s. # 802.11b is 11 Mb/s. So we'll assume 1.2x15 minutes or 18 minutes # or 1080 seconds per Gigabit. This will allow for a long period of # time without timeout to catch devices that slow down, and also not # prematurely end iperf on low-bandwidth devices. + self.timeout = 1080*int(self.data_size) + cmd = "timeout {} {} -c {} -n {}G -i 1 -f -m".format( + self.timeout, self.executable, self.target, self.data_size) - self.timeout = 1080*int(self.data_size) - - if (self.iperf3): - cmd = "timeout {} iperf3 -c {} -n {}G -i 1 -f m -V".format( - self.timeout, self.target, self.data_size) - else: - cmd = "timeout {} iperf -c {} -n {}G -i 1 -f m".format( - self.timeout, self.target, self.data_size) - - logging.debug(cmd) + logging.debug("Executing command {}".format(cmd)) logging.info("Starting iperf against {}, this could take a while...". format(self.target)) try: @@ -375,6 +382,8 @@ def run_test(args, test_target): args.iperf3) if args.datasize: iperf_benchmark.data_size = args.datasize + if args.runtime: + iperf_benchmark.run_time = args.runtime run_num = 0 while not error_number and run_num < args.num_runs: error_number = iperf_benchmark.run() @@ -549,6 +558,8 @@ TEST_TARGET_IPERF = iperf-server.example.com 'info', help=("Gather network info")) # Sub test options + action = test_parser.add_mutually_exclusive_group() + test_parser.add_argument( '-i', '--interface', type=str, required=True) test_parser.add_argument( @@ -558,11 +569,19 @@ TEST_TARGET_IPERF = iperf-server.example.com test_parser.add_argument( '-3', '--iperf3', default=False, action="store_true") test_parser.add_argument('--target', type=str) - test_parser.add_argument( + action.add_argument( '--datasize', type=str, default="1", - help=("Amount of data to send. For iperf tests this will direct " - "iperf to send DATASIZE GB of data to the target.")) + help=("CANNOT BE USED WITH --runtime. Amount of data to send. For " + "iperf tests this will direct iperf to send DATASIZE GB of " + "data to the target.")) + action.add_argument( + '--runtime', type=int, + default=60, + help=("CANNOT BE USED WITH --datasize. Send data for *runtime* " + "seconds. For iperf tests, this will send data for the amount " + "of time indicated, rather than until a certain file size is " + "reached.")) test_parser.add_argument( '--config', type=str, default="/etc/checkbox.d/network.cfg", diff --git a/jobs/ethernet.txt.in b/jobs/ethernet.txt.in index 5632504..776cc16 100644 --- a/jobs/ethernet.txt.in +++ b/jobs/ethernet.txt.in @@ -57,7 +57,7 @@ requires: package.name == 'nmap' user: root environ: TEST_TARGET_IPERF -command: network test -i {interface} -t iperf --fail-threshold 80 --datasize 200 --num_runs 4 +command: network test -i {interface} -t iperf --fail-threshold 80 --runtime 900 --num_runs 4 _description: This test uses iperf to ensure network devices pass data at an acceptable minimum percentage of advertized speed. @@ -77,7 +77,7 @@ requires: package.name == 'nmap' user: root environ: TEST_TARGET_IPERF -command: network test -i {interface} -t iperf --iperf3 --fail-threshold 80 --cpu-load-fail-threshold 90 --datasize 200 --num_runs 4 +command: network test -i {interface} -t iperf --iperf3 --fail-threshold 80 --cpu-load-fail-threshold 90 --runtime 900 --num_runs 4 _description: This test uses iperf3 to ensure network devices pass data at an acceptable minimum percentage of advertized speed. |