Commit a6211143 authored by Kirill Smelkov's avatar Kirill Smelkov

promise/plugin/check_rx_saturated: Don't hardcode "all rx antennas" as a set of what to check

Currently check_rx_saturated checks saturation on all rx antennas. This
works well for ORS, which has only one SDR board, but won't work for
multiRU case where we will need to check RX for saturation for each
Radio Unit separately.

-> As a preparatory step adjust check_rx_saturated to take list of which
RX antennas to check for saturation.

For now this change is accompanied by the following change in
ors-amarisoft SR to keep it working as before:

    --- a/software/ors-amarisoft/instance-enb.jinja2.cfg
    +++ b/software/ors-amarisoft/instance-enb.jinja2.cfg
    @@ -699,6 +699,7 @@ config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
     <= macro.promise
     promise = check_rx_saturated
     config-testing = {{ slapparameter_dict.get("testing", False) }}
    +config-rf-rx-chan-list = {{ list(range(0, int(slapparameter_dict.get('n_antenna_ul', default_n_antenna_ul)))) }}
     config-amarisoft-stats-log = ${amarisoft-stats-template:log-output}
     config-stats-period = {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
     config-max-rx-sample-db = {{ slapparameter_dict.get("max_rx_sample_db", 0) }}

(posted in slapos!1459)

/cc @lu.xu, @xavier_thompson, @Daetalus
/reviewed-by @jhuge
/partly-reviewed-by @tomo
/reviewed-on !126
parent 60d1bc2c
Pipeline #30888 passed with stage
in 0 seconds
from .util import get_json_log_data_interval
from .util import JSONPromise
import json
from zope.interface import implementer
from slapos.grid.promise import interface
......@@ -13,6 +14,7 @@ class RunPromise(JSONPromise):
self.testing = self.getConfig('testing') == "True"
self.amarisoft_stats_log = self.getConfig('amarisoft-stats-log')
self.stats_period = int(self.getConfig('stats-period'))
self.rx_chan_list = json.loads(self.getConfig('rf-rx-chan-list')) # which rx channels to check
self.max_rx_sample_db = float(self.getConfig('max-rx-sample-db'))
def sense(self):
......@@ -23,7 +25,7 @@ class RunPromise(JSONPromise):
saturated = False
for rx_antenna_list in map(lambda x: x['samples']['rx'], data_list):
rx_list = map(lambda x: float(x['max']), rx_antenna_list)
rx_list = map(lambda x: float(x['max']), [rx_antenna_list[i] for i in self.rx_chan_list])
if not max_rx_list:
max_rx_list = list(rx_list)
for i, rx in enumerate(rx_list):
......
......@@ -44,9 +44,9 @@ class TestCheckRXSaturated(TestPromisePluginMixin):
f.write("""{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {"samples": {"rx": [{"max": %f}, {"max": %f}]}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {"samples": {"rx": [{"max": %f}, {"max": %f}]}}}
{"time": "%s", "log_level": "INFO", "message": "Samples stats", "data": {"samples": {"rx": [{"max": %f}, {"max": %f}]}}}""" % (
(datetime.now() - timedelta(seconds=25)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], -5.0, -6.0,
(datetime.now() - timedelta(seconds=15)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], -2.0, -3.0,
(datetime.now() - timedelta(seconds=5)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], -9.0, -7.0,
(datetime.now() - timedelta(seconds=25)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], +99, -6.0,
(datetime.now() - timedelta(seconds=15)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], +99, -3.0,
(datetime.now() - timedelta(seconds=5)).strftime("%Y-%m-%d %H:%M:%S,%f")[:-3], +99, -7.0,
))
def writePromise(self, **kw):
......@@ -59,6 +59,7 @@ class TestCheckRXSaturated(TestPromisePluginMixin):
'amarisoft-stats-log': self.amarisoft_stats_log,
'stats-period': 10,
'max-rx-sample-db': 0.0,
'rf-rx-chan-list': '[1]',
})
self.configureLauncher()
self.launcher.run()
......@@ -68,6 +69,7 @@ class TestCheckRXSaturated(TestPromisePluginMixin):
'amarisoft-stats-log': self.amarisoft_stats_log,
'stats-period': 10,
'max-rx-sample-db': -3.0,
'rf-rx-chan-list': '[1]',
})
self.configureLauncher()
with self.assertRaises(PromiseError):
......
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