Skip to content

Commit

Permalink
Merge pull request #117 from phate999/master
Browse files Browse the repository at this point in the history
Updated MSS UI
  • Loading branch information
phate999 committed Mar 15, 2024
2 parents 6c19459 + f4645f4 commit 49c507e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 26 deletions.
43 changes: 25 additions & 18 deletions Mobile_Site_Survey/Mobile_Site_Survey.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ def loop(self):
pretty_lat = '{:.6f}'.format(float(self.lat))
pretty_lon = '{:.6f}'.format(float(self.long))
title = f' ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n' \
f' ┣┅ {pretty_timestamp}{pretty_lat}, {pretty_lon} \n' \
f' ┃\n'
f' ┣┅➤ {pretty_timestamp}{pretty_lat}, {pretty_lon} \n'
self.results = title + self.results
cp.put('config/routing/policies', routing_policies)
cp.put('config/routing/tables', routing_tables)
Expand Down Expand Up @@ -487,8 +486,9 @@ def ping(host, iface):
def run_tests(sim):
"""Main testing function - multithreaded by Dispatcher"""
download, upload, latency = 0.0, 0.0, 0.0
bytes_sent, bytes_received, packet_loss_percent = 0, 0, 0
bytes_sent, bytes_received, total_mb_used, packet_loss_percent = 0, 0, 0, 0
share = ''
server = None
source_ip = None
ookla = None
logs = []
Expand Down Expand Up @@ -547,6 +547,9 @@ def run_tests(sim):
if wan_type == 'mdm':
diagnostics = cp.get(f'status/wan/devices/{sim}/diagnostics')
carrier = diagnostics.get('CARRID')
homecarrier = diagnostics.get('HOMECARRID')
if homecarrier != carrier:
carrier = f'{carrier}/{homecarrier}'
iccid = diagnostics.get('ICCID')
product = diagnostics.get('PRD')
elif wan_type == 'wwan':
Expand Down Expand Up @@ -612,18 +615,20 @@ def run_tests(sim):
cp.log(f'Speedtest Complete on {product} {carrier}.')

# Format results
if not download:
download = 0.0
download = round(ookla.results.download / 1000 / 1000, 2)
if not upload:
upload = 0.0
upload = round(ookla.results.upload / 1000 / 1000, 2)
latency = round(ookla.results.ping)
bytes_sent = ookla.results.bytes_sent or 0
bytes_received = ookla.results.bytes_received or 0
share = ookla.results.share()
try:
download = round(ookla.results.download / 1000 / 1000, 2)
upload = round(ookla.results.upload / 1000 / 1000, 2)
latency = round(ookla.results.ping)
bytes_sent = ookla.results.bytes_sent
bytes_received = ookla.results.bytes_received
server = ookla.results.server["host"]
share = ookla.results.share()
except Exception as e:
cp.logger.exception(f'Exception formatting Ookla results: {e}')

debug_log(f'bytes_sent: {bytes_sent} bytes_received: {bytes_received}')
dispatcher.total_bytes[sim] += bytes_sent + bytes_received
total_mb_used = round(dispatcher.total_bytes[sim] / 1000 / 1000, 2)
except Exception as e:
msg = f'Exception running Ookla speedtest for {product} {carrier}: {e}'
log_all(msg, logs)
Expand All @@ -633,7 +638,7 @@ def run_tests(sim):
post_success = ''
if dispatcher.config["send_to_server"]:
try:
post_success = '5g-ready:❌'
post_success = '5g-ready:❌ '
scell0 = diagnostics.get("BAND_SCELL0")
scell1 = diagnostics.get("BAND_SCELL1")
scell2 = diagnostics.get("BAND_SCELL2")
Expand All @@ -650,7 +655,7 @@ def run_tests(sim):
serdis = diagnostics.get('mode')
band = diagnostics.get('channel')
rssi = diagnostics.get('signal_strength')
pci = ''
pci, cur_plmn, lac, tac = None, None, None, None
else:
cell_id = diagnostics.get('CELL_ID')
pci = diagnostics.get('PHY_CELL_ID')
Expand Down Expand Up @@ -718,7 +723,7 @@ def run_tests(sim):
try:
req = requests.post(url, headers=headers, json=payload)
if req.status_code < 300:
post_success = '5g-ready:✓️'
post_success = '5g-ready:✓️ '
break
except Exception as e:
cp.log(f'Exception in POST: {e}')
Expand Down Expand Up @@ -765,8 +770,10 @@ def run_tests(sim):
logs.append(f'{logstamp} Results: {text}')
cp.log(f'Results: {text}')
# cp.put('config/system/desc', text[:1000])
pretty_results = f' ┣┅┅┅ ☏{carrier}{latency}ms ⇄ {packet_loss_percent}% loss ({tx-rx} of {tx}) {post_success}\n' \
f' ┗┅┅┅ ↓{download}Mbps ↑{upload}Mbps ⛗{round(dispatcher.total_bytes[sim] / 1000 / 1000)}MB used.'
pretty_results = f' ┣┅┅┅ ☏{carrier} {cur_plmn}{packet_loss_percent}% loss ({tx-rx} of {tx})\n' \
f' ┣┅┅┅ ↓{download}Mbps ↑{upload}Mbps ⏱{latency}ms\n' \
f' ┣┅┅┅ ⛁ {server}\n' \
f' ┗┅┅┅ {post_success}{total_mb_used}MB used.'
log_all(pretty_results, logs)
except Exception as e:
msg = f'Exception formatting results: {e}'
Expand Down
2 changes: 1 addition & 1 deletion Mobile_Site_Survey/package.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ firmware_major = 7
firmware_minor = 24
version_major = 2
version_minor = 5
version_patch = 7
version_patch = 8
uuid = 98b31c39-f649-43f3-b9f4-276a5d8824bf
21 changes: 14 additions & 7 deletions Mobile_Site_Survey/readme.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Application Name
================
SNCF_MSS
Mobile Site Survey


Application Version
===================
2.5.3
2.5.8


External Requirements
Expand All @@ -16,7 +16,7 @@ External Requirements

Application Purpose
===================
This app is intended to perform rail testing of cellular networks but also works for testing stationary deployments.
This app is intended to perform drive testing of cellular networks but also works for testing stationary deployments.
It will run automatic tests collecting location (GPS), interface diagnostics (including cellular signal)

The app is configurable through a webUI running on port 8000. Use NCM Remote Connect to 127.0.0.1 port 8000 HTTP.
Expand All @@ -28,14 +28,18 @@ Or locally, forward the Primary LAN Zone to the Router Zone with the Default All

Survey Options:

* Enable Speedtests - Include Ookla TCP upload and download tests
* Speedtest Timer - Time between speedtests (in seconds)
* Run Distance based tests - The app will run tests when the router has moved the distance defined
* Distance Between Tests (meters) - Set the distance for automatic testing

* Enable Metrics - Gather cellular metrics
* Metrics Timer - Time between metrics (in seconds)
* Run Time based tests - The app will run tests at the time interval defined
* Time Between Tests (seconds) - Set the time interval for automatic testing

Both distance and timed tests can be enabled.
Note: New tests cannot start until all current interface tests complete.

* Test Ethernet and Wifi-as-WAN - Disabled only tests cellular modems
* Run Speedtests - Include Ookla TCP upload and download tests (if disabled, app will ping 8.8.8.8 to measure latency)
* Monitor Packet Loss Between Tests - Continuously ping 8.8.8.8 and track tx/rx, packet loss
* Write to .csv - Write test results to .csv file on router flash (Accessible via FTP server)
* Debug Logs - Additional debugging logs for application troubleshooting.

Expand Down Expand Up @@ -67,3 +71,6 @@ Changelog:
Added "version" to CSV filename, logs, and send-to-server payload.
Added fields "cur_plmn", "tac", and "lac" to CSV and send-to-server payload.
Added 5g-ready status indicator to results.

2.5.8:
Added MVNO support to carrier field to show HOMECARRID if different than CARRID

0 comments on commit 49c507e

Please sign in to comment.