srsLTE: Support configuring different RF backends

Before this patch, only virtual RF through ZeroMQ was supported.
This patch allows configuring srsUE and srsENB to use a real SDR with
UHD/SoapySDR backend connected through a physical RF network, while
still keeping compatibility to run on virtual RF ZeroMQ network, based
on the resources used (controlled by scenarios). For instance, one can
first run a suite through the phyisical RF (using 2 UHD-controlled SDRs)
and afterwards with ZeroMQ using the following default-suites.conf:

- 4g:srsenb-rftype-uhd+srsue-rftype-uhd
- 4g:srsenb-rftype-zmq+srsue-rftype-zmq

Change-Id: I7dbbe328f4c0225fe74e878bb2da13fe39ccf049
diff --git a/src/osmo_gsm_tester/srs_ue.py b/src/osmo_gsm_tester/srs_ue.py
index c68c726..4a99ad9 100644
--- a/src/osmo_gsm_tester/srs_ue.py
+++ b/src/osmo_gsm_tester/srs_ue.py
@@ -24,6 +24,9 @@
 from .run_node import RunNode
 from .ms import MS
 
+def rf_type_valid(rf_type_str):
+    return rf_type_str in ('zmq', 'UHD', 'soapy', 'bladeRF')
+
 class srsUE(MS):
 
     REMOTE_DIR = '/osmo-gsm-tester-srsue'
@@ -54,6 +57,8 @@
         else:
           self.base_srate=23.04e6
         self.remote_user = conf.get('remote_user', None)
+        if not rf_type_valid(conf.get('rf_dev_type', None)):
+            raise log.Error('Invalid rf_dev_type=%s' % conf.get('rf_dev_type', None))
 
     def cleanup(self):
         if self.process is None:
@@ -122,8 +127,6 @@
 
         #'strace', '-ff',
         args = (remote_binary, self.remote_config_file,
-                '--rf.device_name=zmq',
-                '--rf.device_args="tx_port=tcp://'+ self.addr() +':2001,rx_port=tcp://'+ self.enb.addr() +':2000,id=ue,base_srate='+ str(self.base_srate) + '"',
                 '--phy.nof_phy_threads=1',
                 '--gw.netns=' + self.netns(),
                 '--log.filename=' + 'stdout', #self.remote_log_file,
@@ -157,8 +160,6 @@
         util.setcap_netsys_admin(binary, self.run_dir.new_dir('setcap_netsys_admin'))
 
         args = (binary, os.path.abspath(self.config_file),
-                '--rf.device_name=zmq',
-                '--rf.device_args="tx_port=tcp://'+ self.addr() +':2001,rx_port=tcp://'+ self.enb.addr() +':2000,id=ue,base_srate='+ str(self.base_srate) + '"',
                 '--phy.nof_phy_threads=1',
                 '--gw.netns=' + self.netns(),
                 '--log.filename=' + self.log_file,
@@ -180,6 +181,10 @@
         config.overlay(values, self.suite_run.config())
         config.overlay(values, dict(ue=self._conf))
 
+        # We need to set some specific variables programatically here to match IP addresses:
+        if self._conf.get('rf_dev_type') == 'zmq':
+            config.overlay(values, dict(ue=dict(rf_dev_args='tx_port=tcp://'+ self.addr() +':2001,rx_port=tcp://'+ self.enb.addr() +':2000,id=ue,base_srate='+ str(self.base_srate))))
+
         self.dbg('SRSUE CONFIG:\n' + pprint.pformat(values))
 
         with open(self.config_file, 'w') as f: