<p>pespin <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17835">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">enb_srs.py: Pass filenames to main cfg file template instead of cmdline args<br><br>Change-Id: Ifec6a8a9c29b94634f6ac7ea50aae9b8e18ae3cb<br>---<br>M src/osmo_gsm_tester/obj/enb_srs.py<br>M src/osmo_gsm_tester/templates/srsenb.conf.tmpl<br>2 files changed, 56 insertions(+), 62 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo_gsm_tester/obj/enb_srs.py b/src/osmo_gsm_tester/obj/enb_srs.py</span><br><span>index 0860d19..9364375 100644</span><br><span>--- a/src/osmo_gsm_tester/obj/enb_srs.py</span><br><span>+++ b/src/osmo_gsm_tester/obj/enb_srs.py</span><br><span>@@ -115,41 +115,9 @@</span><br><span>         self.process.stdin_write('t\n')</span><br><span> </span><br><span>     def start_remotely(self):</span><br><span style="color: hsl(0, 100%, 40%);">-        self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('srslte')))</span><br><span style="color: hsl(0, 100%, 40%);">-        lib = self.inst.child('lib')</span><br><span style="color: hsl(0, 100%, 40%);">-        if not os.path.isdir(lib):</span><br><span style="color: hsl(0, 100%, 40%);">-            raise log.Error('No lib/ in', self.inst)</span><br><span style="color: hsl(0, 100%, 40%);">-        if not self.inst.isfile('bin', srsENB.BINFILE):</span><br><span style="color: hsl(0, 100%, 40%);">-            raise log.Error('No %s binary in' % srsENB.BINFILE, self.inst)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-        self.rem_host = remote.RemoteHost(self.run_dir, self.remote_user, self._addr)</span><br><span style="color: hsl(0, 100%, 40%);">-        remote_prefix_dir = util.Dir(srsENB.REMOTE_DIR)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.remote_inst = util.Dir(remote_prefix_dir.child(os.path.basename(str(self.inst))))</span><br><span style="color: hsl(0, 100%, 40%);">-        remote_run_dir = util.Dir(remote_prefix_dir.child(srsENB.BINFILE))</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-        self.remote_config_file = remote_run_dir.child(srsENB.CFGFILE)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.remote_config_sib_file = remote_run_dir.child(srsENB.CFGFILE_SIB)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.remote_config_rr_file = remote_run_dir.child(srsENB.CFGFILE_RR)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.remote_config_drb_file = remote_run_dir.child(srsENB.CFGFILE_DRB)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.remote_log_file = remote_run_dir.child(srsENB.LOGFILE)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.remote_pcap_file = remote_run_dir.child(srsENB.PCAPFILE)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-        self.rem_host.recreate_remote_dir(self.remote_inst)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.rem_host.scp('scp-inst-to-remote', str(self.inst), remote_prefix_dir)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.rem_host.recreate_remote_dir(remote_run_dir)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.rem_host.scp('scp-cfg-to-remote', self.config_file, self.remote_config_file)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.rem_host.scp('scp-cfg-sib-to-remote', self.config_sib_file, self.remote_config_sib_file)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.rem_host.scp('scp-cfg-rr-to-remote', self.config_rr_file, self.remote_config_rr_file)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.rem_host.scp('scp-cfg-drb-to-remote', self.config_drb_file, self.remote_config_drb_file)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>         remote_env = { 'LD_LIBRARY_PATH': self.remote_inst.child('lib') }</span><br><span>         remote_binary = self.remote_inst.child('bin', srsENB.BINFILE)</span><br><span style="color: hsl(0, 100%, 40%);">-        args = (remote_binary, self.remote_config_file,</span><br><span style="color: hsl(0, 100%, 40%);">-                '--enb_files.sib_config=' + self.remote_config_sib_file,</span><br><span style="color: hsl(0, 100%, 40%);">-                '--enb_files.rr_config=' + self.remote_config_rr_file,</span><br><span style="color: hsl(0, 100%, 40%);">-                '--enb_files.drb_config=' + self.remote_config_drb_file,</span><br><span style="color: hsl(0, 100%, 40%);">-                '--log.filename=' + self.remote_log_file,</span><br><span style="color: hsl(0, 100%, 40%);">-                '--pcap.filename=' + self.remote_pcap_file)</span><br><span style="color: hsl(120, 100%, 40%);">+        args = (remote_binary, self.remote_config_file)</span><br><span>         args += tuple(self._additional_args)</span><br><span> </span><br><span>         self.process = self.rem_host.RemoteProcess(srsENB.BINFILE, args, remote_env=remote_env)</span><br><span>@@ -157,24 +125,10 @@</span><br><span>         self.process.launch()</span><br><span> </span><br><span>     def start_locally(self):</span><br><span style="color: hsl(0, 100%, 40%);">-        inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('srslte')))</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-        binary = inst.child('bin', srsENB.BINFILE)</span><br><span style="color: hsl(0, 100%, 40%);">-        if not os.path.isfile(binary):</span><br><span style="color: hsl(0, 100%, 40%);">-            raise log.Error('Binary missing:', binary)</span><br><span style="color: hsl(0, 100%, 40%);">-        lib = inst.child('lib')</span><br><span style="color: hsl(0, 100%, 40%);">-        if not os.path.isdir(lib):</span><br><span style="color: hsl(0, 100%, 40%);">-            raise log.Error('No lib/ in', inst)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(120, 100%, 40%);">+        binary = self.inst.child('bin', srsENB.BINFILE)</span><br><span style="color: hsl(120, 100%, 40%);">+        lib = self.inst.child('lib')</span><br><span>         env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-        self.dbg(run_dir=self.run_dir, binary=binary, env=env)</span><br><span style="color: hsl(0, 100%, 40%);">-        args = (binary, os.path.abspath(self.config_file),</span><br><span style="color: hsl(0, 100%, 40%);">-                '--enb_files.sib_config=' + os.path.abspath(self.config_sib_file),</span><br><span style="color: hsl(0, 100%, 40%);">-                '--enb_files.rr_config=' + os.path.abspath(self.config_rr_file),</span><br><span style="color: hsl(0, 100%, 40%);">-                '--enb_files.drb_config=' + os.path.abspath(self.config_drb_file),</span><br><span style="color: hsl(0, 100%, 40%);">-                '--log.filename=' + self.log_file,</span><br><span style="color: hsl(0, 100%, 40%);">-                '--pcap.filename=' + self.pcap_file)</span><br><span style="color: hsl(120, 100%, 40%);">+        args = (binary, os.path.abspath(self.config_file))</span><br><span>         args += tuple(self._additional_args)</span><br><span> </span><br><span>         self.process = process.Process(self.name(), self.run_dir, args, env=env)</span><br><span>@@ -190,8 +144,46 @@</span><br><span>             f.write(r)</span><br><span> </span><br><span>     def configure(self):</span><br><span style="color: hsl(120, 100%, 40%);">+        self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('srslte')))</span><br><span style="color: hsl(120, 100%, 40%);">+        if not os.path.isdir(self.inst.child('lib')):</span><br><span style="color: hsl(120, 100%, 40%);">+            raise log.Error('No lib/ in', self.inst)</span><br><span style="color: hsl(120, 100%, 40%);">+        if not self.inst.isfile('bin', srsENB.BINFILE):</span><br><span style="color: hsl(120, 100%, 40%);">+            raise log.Error('No %s binary in' % srsENB.BINFILE, self.inst)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        self.config_file = self.run_dir.child(srsENB.CFGFILE)</span><br><span style="color: hsl(120, 100%, 40%);">+        self.config_sib_file = self.run_dir.child(srsENB.CFGFILE_SIB)</span><br><span style="color: hsl(120, 100%, 40%);">+        self.config_rr_file = self.run_dir.child(srsENB.CFGFILE_RR)</span><br><span style="color: hsl(120, 100%, 40%);">+        self.config_drb_file = self.run_dir.child(srsENB.CFGFILE_DRB)</span><br><span style="color: hsl(120, 100%, 40%);">+        self.log_file = self.run_dir.child(srsENB.LOGFILE)</span><br><span style="color: hsl(120, 100%, 40%);">+        self.pcap_file = self.run_dir.child(srsENB.PCAPFILE)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        if not self.setup_runs_locally():</span><br><span style="color: hsl(120, 100%, 40%);">+            self.rem_host = remote.RemoteHost(self.run_dir, self.remote_user, self._addr)</span><br><span style="color: hsl(120, 100%, 40%);">+            remote_prefix_dir = util.Dir(srsENB.REMOTE_DIR)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.remote_inst = util.Dir(remote_prefix_dir.child(os.path.basename(str(self.inst))))</span><br><span style="color: hsl(120, 100%, 40%);">+            remote_run_dir = util.Dir(remote_prefix_dir.child(srsENB.BINFILE))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+            self.remote_config_file = remote_run_dir.child(srsENB.CFGFILE)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.remote_config_sib_file = remote_run_dir.child(srsENB.CFGFILE_SIB)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.remote_config_rr_file = remote_run_dir.child(srsENB.CFGFILE_RR)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.remote_config_drb_file = remote_run_dir.child(srsENB.CFGFILE_DRB)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.remote_log_file = remote_run_dir.child(srsENB.LOGFILE)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.remote_pcap_file = remote_run_dir.child(srsENB.PCAPFILE)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>         values = super().configure(['srsenb'])</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+        sibfile = self.config_sib_file if self.setup_runs_locally() else self.remote_config_sib_file</span><br><span style="color: hsl(120, 100%, 40%);">+        rrfile = self.config_rr_file if self.setup_runs_locally() else self.remote_config_rr_file</span><br><span style="color: hsl(120, 100%, 40%);">+        drbfile = self.config_drb_file if self.setup_runs_locally() else self.remote_config_drb_file</span><br><span style="color: hsl(120, 100%, 40%);">+        logfile = self.log_file if self.setup_runs_locally() else self.remote_log_file</span><br><span style="color: hsl(120, 100%, 40%);">+        pcapfile = self.pcap_file if self.setup_runs_locally() else self.remote_pcap_file</span><br><span style="color: hsl(120, 100%, 40%);">+        config.overlay(values, dict(enb=dict(sib_filename=sibfile,</span><br><span style="color: hsl(120, 100%, 40%);">+                                             rr_filename=rrfile,</span><br><span style="color: hsl(120, 100%, 40%);">+                                             drb_filename=drbfile,</span><br><span style="color: hsl(120, 100%, 40%);">+                                             log_filename=logfile,</span><br><span style="color: hsl(120, 100%, 40%);">+                                             pcap_filename=pcapfile,</span><br><span style="color: hsl(120, 100%, 40%);">+                                             )))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>         # Convert parsed boolean string to Python boolean:</span><br><span>         self.enable_pcap = util.str2bool(values['enb'].get('enable_pcap', 'false'))</span><br><span>         config.overlay(values, dict(enb={'enable_pcap': self.enable_pcap}))</span><br><span>@@ -232,18 +224,20 @@</span><br><span> </span><br><span>                 config.overlay(values, dict(enb=dict(rf_dev_args=rf_dev_args)))</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-        self.config_file = self.run_dir.child(srsENB.CFGFILE)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.config_sib_file = self.run_dir.child(srsENB.CFGFILE_SIB)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.config_rr_file = self.run_dir.child(srsENB.CFGFILE_RR)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.config_drb_file = self.run_dir.child(srsENB.CFGFILE_DRB)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.log_file = self.run_dir.child(srsENB.LOGFILE)</span><br><span style="color: hsl(0, 100%, 40%);">-        self.pcap_file = self.run_dir.child(srsENB.PCAPFILE)</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>         self.gen_conf_file(self.config_file, srsENB.CFGFILE, values)</span><br><span>         self.gen_conf_file(self.config_sib_file, srsENB.CFGFILE_SIB, values)</span><br><span>         self.gen_conf_file(self.config_rr_file, srsENB.CFGFILE_RR, values)</span><br><span>         self.gen_conf_file(self.config_drb_file, srsENB.CFGFILE_DRB, values)</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+        if not self.setup_runs_locally():</span><br><span style="color: hsl(120, 100%, 40%);">+            self.rem_host.recreate_remote_dir(self.remote_inst)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.rem_host.scp('scp-inst-to-remote', str(self.inst), remote_prefix_dir)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.rem_host.recreate_remote_dir(remote_run_dir)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.rem_host.scp('scp-cfg-to-remote', self.config_file, self.remote_config_file)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.rem_host.scp('scp-cfg-sib-to-remote', self.config_sib_file, self.remote_config_sib_file)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.rem_host.scp('scp-cfg-rr-to-remote', self.config_rr_file, self.remote_config_rr_file)</span><br><span style="color: hsl(120, 100%, 40%);">+            self.rem_host.scp('scp-cfg-drb-to-remote', self.config_drb_file, self.remote_config_drb_file)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>     def ue_add(self, ue):</span><br><span>         if self.ue is not None:</span><br><span>             raise log.Error("More than one UE per ENB not yet supported (ZeroMQ)")</span><br><span>diff --git a/src/osmo_gsm_tester/templates/srsenb.conf.tmpl b/src/osmo_gsm_tester/templates/srsenb.conf.tmpl</span><br><span>index 954b63f..df12762 100644</span><br><span>--- a/src/osmo_gsm_tester/templates/srsenb.conf.tmpl</span><br><span>+++ b/src/osmo_gsm_tester/templates/srsenb.conf.tmpl</span><br><span>@@ -38,9 +38,9 @@</span><br><span> # drb_config:  DRB configuration file</span><br><span> #####################################################################</span><br><span> [enb_files]</span><br><span style="color: hsl(0, 100%, 40%);">-sib_config = sib.conf</span><br><span style="color: hsl(0, 100%, 40%);">-rr_config  = rr.conf</span><br><span style="color: hsl(0, 100%, 40%);">-drb_config = drb.conf</span><br><span style="color: hsl(120, 100%, 40%);">+sib_config = ${enb.sib_filename}</span><br><span style="color: hsl(120, 100%, 40%);">+rr_config  = ${enb.rr_filename}</span><br><span style="color: hsl(120, 100%, 40%);">+drb_config = ${enb.drb_filename}</span><br><span> </span><br><span> #####################################################################</span><br><span> # RF configuration</span><br><span>@@ -98,7 +98,7 @@</span><br><span> #####################################################################</span><br><span> [pcap]</span><br><span> enable = ${'true' if enb.enable_pcap else 'false'}</span><br><span style="color: hsl(0, 100%, 40%);">-filename = /tmp/enb.pcap</span><br><span style="color: hsl(120, 100%, 40%);">+filename = ${enb.pcap_filename}</span><br><span> </span><br><span> #####################################################################</span><br><span> # Log configuration</span><br><span>@@ -123,7 +123,7 @@</span><br><span> [log]</span><br><span> all_level = warning</span><br><span> all_hex_limit = 32</span><br><span style="color: hsl(0, 100%, 40%);">-filename = /tmp/enb.log</span><br><span style="color: hsl(120, 100%, 40%);">+filename = ${enb.log_filename}</span><br><span> file_max_size = -1</span><br><span> </span><br><span> [gui]</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17835">change 17835</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17835"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-gsm-tester </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ifec6a8a9c29b94634f6ac7ea50aae9b8e18ae3cb </div>
<div style="display:none"> Gerrit-Change-Number: 17835 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>