Adds logging for modem reconnections.

This commit is contained in:
Lukas Prause
2022-11-14 13:28:20 +01:00
parent c568e03ca8
commit 69e6284550

View File

@@ -603,7 +603,6 @@ class Client:
sleep(2)
print_message("done...")
def ping(self):
c = "ping {} -I {} -i {} -c {}".format(
self.config["server"],
@@ -769,6 +768,12 @@ class Client:
print_message("Use ws filter: {}".format(ws_filter))
for n in range(1, self.config["number_of_measurements"] + 1):
if not is_modem_connected():
background_write_to_file(
filepath="{}{}_reconnect.log".format(
self.config["folder"], self.config["prefix"]
),
content='{}"'.format(datetime.timestamp(datetime.now())),
)
reconnect_modem()
print_message(
"{} of {}".format(n, self.config["number_of_measurements"])
@@ -813,12 +818,26 @@ class Client:
iperf_return = 0
while not is_measurement_done or iperf_return != 0:
if iperf_return != 0:
background_write_to_file(
filepath="{}{}_reconnect.log".format(
self.config["folder"], self.config["prefix"]
),
content='{}"'.format(datetime.timestamp(datetime.now())),
)
reconnect_modem()
try:
try:
iperf_return = subprocess.call(iperf_command, timeout=float(time) + TIMEOUT_OFFSET)
iperf_return = subprocess.call(
iperf_command, timeout=float(time) + TIMEOUT_OFFSET
)
except:
print_message("iPerf timed out...")
background_write_to_file(
filepath="{}{}_reconnect.log".format(
self.config["folder"], self.config["prefix"]
),
content='{}"'.format(datetime.timestamp(datetime.now())),
)
reconnect_modem()
except KeyboardInterrupt:
exit()
@@ -838,6 +857,12 @@ class Client:
print_message("tcp probe is now enabled")
for n in range(1, self.config["number_of_measurements"] + 1):
if not is_modem_connected():
background_write_to_file(
filepath="{}{}_reconnect.log".format(
self.config["folder"], self.config["prefix"]
),
content='{}"'.format(datetime.timestamp(datetime.now())),
)
reconnect_modem()
print_message(
"{} of {}".format(n, self.config["number_of_measurements"])
@@ -881,12 +906,26 @@ class Client:
iperf_return = 0
while not is_measurement_done or iperf_return != 0:
if iperf_return != 0:
background_write_to_file(
filepath="{}{}_reconnect.log".format(
self.config["folder"], self.config["prefix"]
),
content='{}"'.format(datetime.timestamp(datetime.now())),
)
reconnect_modem()
try:
try:
iperf_return = subprocess.call(iperf_command, timeout=float(time) + TIMEOUT_OFFSET)
iperf_return = subprocess.call(
iperf_command, timeout=float(time) + TIMEOUT_OFFSET
)
except:
print_message("iPerf timed out...")
background_write_to_file(
filepath="{}{}_reconnect.log".format(
self.config["folder"], self.config["prefix"]
),
content='{}"'.format(datetime.timestamp(datetime.now())),
)
reconnect_modem()
except KeyboardInterrupt:
exit()