To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 4ecbba80 authored by Reto Da Forno's avatar Reto Da Forno
Browse files

radio config printing adjusted for linktests

parent b6aa50d0
......@@ -364,7 +364,7 @@ CREATE TABLE `tbl_serv_link_measurements` (
`test_fk` int(10) unsigned DEFAULT NULL,
`platform_fk` int(10) unsigned NOT NULL,
`begin` datetime NOT NULL,
`radio_cfg` enum('', 'fsk_868','lora_868') COLLATE utf8_bin,
`radio_cfg` text COLLATE utf8_bin,
`links` mediumblob,
`links_html` longtext COLLATE utf8_bin,
PRIMARY KEY (`serv_link_measurements_key`),
......
......@@ -1112,6 +1112,7 @@ def evaluate_linkmeasurement(testid, cur):
# Load the results
resultsfile_html = os.path.join(tempdir, "linktest_map.html")
resultsfile_data = os.path.join(tempdir, "linktest_data.pkl")
resultsfile_cfg = os.path.join(tempdir, "linktest_config.json")
if not os.path.isfile(resultsfile_html) or not os.path.isfile(resultsfile_data):
msg = "Linktest results file %s or %s not found." % (resultsfile_html, resultsfile_data)
logger.error(msg)
......@@ -1123,10 +1124,14 @@ def evaluate_linkmeasurement(testid, cur):
resultsdata = None
with open(resultsfile_data, 'rb') as f:
resultsdata = f.read()
resultsconfig = ""
if os.path.isfile(resultsfile_cfg):
with open(resultsfile_cfg, 'r') as f:
resultsconfig = f.read()
# Store results in DB
logger.debug("Storing XML file in DB...")
cur.execute("DELETE FROM `tbl_serv_link_measurements` WHERE `test_fk`=%s" % str(testid))
cur.execute("INSERT INTO `tbl_serv_link_measurements` (`test_fk`, `platform_fk`, `begin`, `radio_cfg`, `links`, `links_html`) VALUES (%s, %s, %s, %s, %s, %s)", (str(testid), platform_fk, teststarttime, '', resultsdata, resultshtml))
cur.execute("INSERT INTO `tbl_serv_link_measurements` (`test_fk`, `platform_fk`, `begin`, `radio_cfg`, `links`, `links_html`) VALUES (%s, %s, %s, %s, %s, %s)", (str(testid), platform_fk, teststarttime, resultsconfig, resultsdata, resultshtml))
return errors
### END evaluate_linkmeasurement()
......
......@@ -267,24 +267,33 @@ def evalSerialLog():
radio_cfg_str = ""
if "coderate" in radioConfig:
# DPP2 LoRa platform
modulation = "FSK"
if radioConfig['modulation'] == 1:
modulation = "LoRa"
radio_cfg_str = 'Radio: SX1262, frequency: %.3fMHz, TX power: %ddBm, modulation: %s, datarate: %dkbps, bandwidth: %dkHz, coderate: %d' % (radioConfig['frequency'] / 1000000.0, radioConfig['txPower'], modulation, radioConfig['datarate'] / 1000.0, radioConfig['bandwidth'] / 1000.0, radioConfig['coderate'])
radioConfig['modulation'] = "LoRa"
radioConfig['datarate'] = "SF7"
radioConfig['bandwidth'] = 125000
else:
radioConfig['modulation'] = "FSK"
radioConfig['datarate'] = "%dkbps" % (radioConfig['datarate'] / 1000.0)
radio_cfg_str = 'Radio: SX1262, frequency: %.3fMHz, TX power: %ddBm, modulation: %s, datarate: %s, bandwidth: %dkHz, coding rate: %d' % (radioConfig['frequency'] / 1000000.0, radioConfig['txPower'], radioConfig['modulation'], radioConfig['datarate'], radioConfig['bandwidth'] / 1000.0, radioConfig['coderate'])
elif "radio" in radioConfig:
radio_cfg_str = 'Radio: %s, frequency: %.3fMHz, TX power: %ddBm, modulation: %s, datarate: %dkbps, bandwidth: %dkHz' % (radioConfig['radio'], radioConfig['frequency'] / 1000000.0, radioConfig['txPower'], str(radioConfig['modulation']), radioConfig['datarate'] / 1000.0, radioConfig['bandwidth'] / 1000.0)
radioConfig['datarate'] = "%dkbps" % (radioConfig['datarate'] / 1000.0)
radio_cfg_str = 'Radio: %s, frequency: %.3fMHz, TX power: %ddBm, modulation: %s, datarate: %s, bandwidth: %dkHz' % (radioConfig['radio'], radioConfig['frequency'] / 1000000.0, radioConfig['txPower'], str(radioConfig['modulation']), radioConfig['datarate'], radioConfig['bandwidth'] / 1000.0)
if "nrf5" in radioConfig['radio'].lower():
crc_error_html = "n/a" # no CRC data available
htmlPath = '{}/linktest_map.html'.format(outputdir)
os.makedirs(os.path.split(htmlPath)[0], exist_ok=True)
with open(htmlPath,"w") as fp:
with open(htmlPath, "w") as fp:
fp.write(html_template.format(
pathloss_html=pathloss_html,
prr_html=prr_html,
crc_error_html=crc_error_html,
config=radio_cfg_str))
configPath = '{}/linktest_config.json'.format(outputdir)
with open(configPath, "w") as fp:
json.dump(radioConfig, fp)
if __name__ == "__main__":
evalSerialLog()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment