-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1498dbc
commit 3f9536a
Showing
2 changed files
with
88 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,9 @@ | |
- as a consequence -b doesn't force -u | ||
""" | ||
|
||
__author__ = "Grzegorz Latuszek" | ||
__copyright__ = "Copyright (C) 2019-2023, Nokia" | ||
__email__ = "[email protected]" | ||
__author__ = "Grzegorz Latuszek, Marcin Usielski" | ||
__copyright__ = "Copyright (C) 2019-2024, Nokia" | ||
__email__ = "[email protected], [email protected]" | ||
|
||
|
||
import re | ||
|
@@ -94,6 +94,7 @@ def __init__( | |
self._got_server_report_hdr = False | ||
self._got_server_report = False | ||
self._stopping_server = False | ||
self._output_parsed = False | ||
|
||
def __str__(self): | ||
str_base_value = super(Iperf2, self).__str__() | ||
|
@@ -625,6 +626,70 @@ def _parse_too_early_ctrl_c(self, line): | |
self.break_cmd() # send Ctrl-C once more | ||
raise ParsingDone | ||
|
||
# iperf version 2.0.12 (25 June 2018) pthreads | ||
_re_version = re.compile(r"iperf\S*(\s+version)?\s+(?P<VERSION>\d.*\S)\s*$") | ||
|
||
def has_any_result(self) -> bool: | ||
""" | ||
Checks if any result was already set by command. | ||
:return: True if current_ret has collected any data. Otherwise False. | ||
""" | ||
|
||
if not self._output_parsed: | ||
if '--version' in self.options: | ||
was_version = any(self._regex_helper.search_compiled(Iperf2._re_version, line) for line in self.current_ret["INFO"]) | ||
if was_version: | ||
self._output_parsed = True | ||
return was_version | ||
else: | ||
self._output_parsed = True # we don't exepect any specific data for this instance. | ||
return super(Iperf2, self).has_any_result() | ||
|
||
|
||
COMMAND_OUTPUT_version = """xyz@debian:~$ iperf --version | ||
iperf version 2.0.5 (08 Jul 2010) pthreads | ||
xyz@debian:~$""" | ||
|
||
COMMAND_KWARGS_version = {"options": "--version"} | ||
|
||
COMMAND_RESULT_version = { | ||
"CONNECTIONS": {}, | ||
"INFO": [ | ||
"iperf version 2.0.5 (08 Jul 2010) pthreads" | ||
], | ||
} | ||
|
||
COMMAND_OUTPUT_version_bla = """xyz@debian:~$ iperf --version | ||
Last login: Thu Nov 14 16:35:41 2024 from 127.0.0.1 | ||
xyz@debian:~$ | ||
xyz@debian:~$echo DETECTING PROMPT | ||
DETECTING PROMPT | ||
xyz@debian:~$ | ||
xyz@debian:~$echo DETECTING PROMPT | ||
DETECTING PROMPT | ||
xyz@debian:~$ | ||
xyz@debian:~$iperf --version | ||
iperf version 2.0.12 (25 June 2018) pthreads | ||
xyz@debian:~$""" | ||
|
||
COMMAND_KWARGS_version_bla = {"options": "--version"} | ||
|
||
COMMAND_RESULT_version_bla = { | ||
"CONNECTIONS": {}, | ||
"INFO": [ | ||
'Last login: Thu Nov 14 16:35:41 2024 from 127.0.0.1', | ||
'xyz@debian:~$', | ||
'xyz@debian:~$echo DETECTING PROMPT', | ||
'DETECTING PROMPT', | ||
'xyz@debian:~$', | ||
'xyz@debian:~$echo DETECTING PROMPT', | ||
'DETECTING PROMPT', | ||
'xyz@debian:~$', | ||
'xyz@debian:~$iperf --version', | ||
'iperf version 2.0.12 (25 June 2018) pthreads', | ||
], | ||
} | ||
|
||
COMMAND_OUTPUT_basic_client = """ | ||
xyz@debian:~$ iperf -c 10.1.1.1 -i 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,9 @@ | |
- Added several new stats: Retr and Cwnd for TCP; Total Datagrams for UDP. | ||
""" | ||
|
||
__author__ = "Kacper Kozik" | ||
__copyright__ = "Copyright (C) 2023, Nokia" | ||
__email__ = "[email protected]" | ||
__author__ = "Kacper Kozik, Marcin Usielski" | ||
__copyright__ = "Copyright (C) 2023-2024, Nokia" | ||
__email__ = "[email protected], [email protected]" | ||
|
||
|
||
import re | ||
|
@@ -2849,3 +2849,20 @@ def _convert_jitter(self, input_dict): | |
'INFO': ['Server listening on 5001', | ||
'Accepted connection from 127.0.0.1, port 39914', | ||
'Server listening on 5001']} | ||
|
||
COMMAND_OUTPUT_version = """xyz@debian:~$ iperf3 --version | ||
iperf 3.12 (cJSON 1.7.15) | ||
Linux ute-image12 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64 | ||
Optional features available: CPU affinity setting, IPv6 flow label, SCTP, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing, authentication, bind to device, support IPv4 don't fragment | ||
xyz@debian:~$""" | ||
|
||
COMMAND_KWARGS_version = {"options": "--version"} | ||
|
||
COMMAND_RESULT_version = { | ||
"CONNECTIONS": {}, | ||
"INFO": [ | ||
"iperf 3.12 (cJSON 1.7.15)", | ||
"Linux ute-image12 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64", | ||
"Optional features available: CPU affinity setting, IPv6 flow label, SCTP, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing, authentication, bind to device, support IPv4 don't fragment", | ||
], | ||
} |