aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--example/defaults.conf5
-rw-r--r--example/scenarios/cfg-srs-enable-pcap.conf7
-rw-r--r--src/osmo_gsm_tester/resource.py6
-rw-r--r--src/osmo_gsm_tester/srs_enb.py36
-rw-r--r--src/osmo_gsm_tester/srs_epc.py28
-rw-r--r--src/osmo_gsm_tester/srs_ue.py22
-rw-r--r--src/osmo_gsm_tester/templates/srsenb.conf.tmpl2
-rw-r--r--src/osmo_gsm_tester/templates/srsepc.conf.tmpl2
-rw-r--r--src/osmo_gsm_tester/templates/srsue.conf.tmpl2
9 files changed, 77 insertions, 33 deletions
diff --git a/example/defaults.conf b/example/defaults.conf
index 9b92ad0..60539c8 100644
--- a/example/defaults.conf
+++ b/example/defaults.conf
@@ -97,9 +97,14 @@ srsepc:
mcc: 901
mnc: 70
rlc_drb_mode: UM
+ enable_pcap: false
srsenb:
mcc: 901
mnc: 70
num_prb: 100
transmission_mode: 1
+ enable_pcap: false
+
+srsue:
+ enable_pcap: false
diff --git a/example/scenarios/cfg-srs-enable-pcap.conf b/example/scenarios/cfg-srs-enable-pcap.conf
new file mode 100644
index 0000000..6927b80
--- /dev/null
+++ b/example/scenarios/cfg-srs-enable-pcap.conf
@@ -0,0 +1,7 @@
+config:
+ epc:
+ enable_pcap: true
+ enb:
+ enable_pcap: true
+ modem:
+ enable_pcap: true
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index cdf0596..8a93ea4 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -116,7 +116,11 @@ WANT_SCHEMA = util.dict_add(
CONF_SCHEMA = util.dict_add(
{ 'defaults.timeout': schema.STR,
'config.bsc.net.codec_list[]': schema.CODEC,
- 'config.epc.rlc_drb_mode': schema.LTE_RLC_DRB_MODE, },
+ 'config.enb.enable_pcap': schema.BOOL_STR,
+ 'config.epc.rlc_drb_mode': schema.LTE_RLC_DRB_MODE,
+ 'config.epc.enable_pcap': schema.BOOL_STR,
+ 'config.modem.enable_pcap': schema.BOOL_STR,
+ },
dict([('resources.%s' % key, val) for key, val in WANT_SCHEMA.items()]),
dict([('modifiers.%s' % key, val) for key, val in WANT_SCHEMA.items()]))
diff --git a/src/osmo_gsm_tester/srs_enb.py b/src/osmo_gsm_tester/srs_enb.py
index 716217e..14e2db4 100644
--- a/src/osmo_gsm_tester/srs_enb.py
+++ b/src/osmo_gsm_tester/srs_enb.py
@@ -53,6 +53,7 @@ class srsENB(log.Origin):
CFGFILE_RR = 'srsenb_rr.conf'
CFGFILE_DRB = 'srsenb_drb.conf'
LOGFILE = 'srsenb.log'
+ PCAPFILE = 'srsenb.pcap'
def __init__(self, suite_run, conf):
super().__init__(log.C_RUN, 'srsenb')
@@ -68,6 +69,8 @@ class srsENB(log.Origin):
self.config_sib_file = None
self.config_rr_file = None
self.config_drb_file = None
+ self.log_file = None
+ self.pcap_file = None
self.process = None
self.rem_host = None
self.remote_config_file = None
@@ -75,8 +78,10 @@ class srsENB(log.Origin):
self.remote_config_rr_file = None
self.remote_config_drb_file = None
self.remote_log_file = None
+ self.remote_pcap_file = None
self._num_prb = 0
self._txmode = 0
+ self.enable_pcap = False
self.suite_run = suite_run
self.remote_user = conf.get('remote_user', None)
if not rf_type_valid(conf.get('rf_dev_type', None)):
@@ -92,6 +97,11 @@ class srsENB(log.Origin):
self.rem_host.scpfrom('scp-back-log', self.remote_log_file, self.log_file)
except Exception as e:
self.log(repr(e))
+ if self.enable_pcap:
+ try:
+ self.rem_host.scpfrom('scp-back-pcap', self.remote_pcap_file, self.pcap_file)
+ except Exception as e:
+ self.log(repr(e))
def setup_runs_locally(self):
return self.remote_user is None
@@ -124,10 +134,11 @@ class srsENB(log.Origin):
self.remote_config_rr_file = remote_run_dir.child(srsENB.CFGFILE_RR)
self.remote_config_drb_file = remote_run_dir.child(srsENB.CFGFILE_DRB)
self.remote_log_file = remote_run_dir.child(srsENB.LOGFILE)
+ self.remote_pcap_file = remote_run_dir.child(srsENB.PCAPFILE)
self.rem_host.recreate_remote_dir(self.remote_inst)
self.rem_host.scp('scp-inst-to-remote', str(self.inst), remote_prefix_dir)
- self.rem_host.create_remote_dir(remote_run_dir)
+ self.rem_host.recreate_remote_dir(remote_run_dir)
self.rem_host.scp('scp-cfg-to-remote', self.config_file, self.remote_config_file)
self.rem_host.scp('scp-cfg-sib-to-remote', self.config_sib_file, self.remote_config_sib_file)
self.rem_host.scp('scp-cfg-rr-to-remote', self.config_rr_file, self.remote_config_rr_file)
@@ -141,7 +152,8 @@ class srsENB(log.Origin):
'--enb_files.drb_config=' + self.remote_config_drb_file,
'--expert.nof_phy_threads=1',
'--expert.rrc_inactivity_timer=1500',
- '--log.filename=' + self.remote_log_file)
+ '--log.filename=' + self.remote_log_file,
+ '--pcap.filename=' + self.remote_pcap_file)
self.process = self.rem_host.RemoteProcessFixIgnoreSIGHUP(srsENB.BINFILE, util.Dir(srsENB.REMOTE_DIR), args, remote_env=remote_env)
self.suite_run.remember_to_stop(self.process)
@@ -166,7 +178,8 @@ class srsENB(log.Origin):
'--enb_files.drb_config=' + os.path.abspath(self.config_drb_file),
'--expert.nof_phy_threads=1',
'--expert.rrc_inactivity_timer=1500',
- '--log.filename=' + self.log_file)
+ '--log.filename=' + self.log_file,
+ '--pcap.filename=' + self.pcap_file)
self.process = process.Process(self.name(), self.run_dir, args, env=env)
self.suite_run.remember_to_stop(self.process)
@@ -176,10 +189,14 @@ class srsENB(log.Origin):
self.dbg(config_file=path)
values = dict(enb=config.get_defaults('srsenb'))
- config.overlay(values, self.suite_run.config())
+ config.overlay(values, dict(enb=self.suite_run.config().get('enb', {})))
config.overlay(values, dict(enb=self._conf))
config.overlay(values, dict(enb={ 'mme_addr': self.epc.addr() }))
+ # Convert parsed boolean string to Python boolean:
+ self.enable_pcap = util.str2bool(values['enb'].get('enable_pcap', 'false'))
+ config.overlay(values, dict(enb={'enable_pcap': self.enable_pcap}))
+
self._num_prb = int(values['enb'].get('num_prb', None))
assert self._num_prb
self._txmode = int(values['enb'].get('transmission_mode', None))
@@ -205,11 +222,12 @@ class srsENB(log.Origin):
f.write(r)
def configure(self):
- self.config_file = self.run_dir.new_file(srsENB.CFGFILE)
- self.config_sib_file = self.run_dir.new_file(srsENB.CFGFILE_SIB)
- self.config_rr_file = self.run_dir.new_file(srsENB.CFGFILE_RR)
- self.config_drb_file = self.run_dir.new_file(srsENB.CFGFILE_DRB)
- self.log_file = self.run_dir.new_file(srsENB.LOGFILE)
+ self.config_file = self.run_dir.child(srsENB.CFGFILE)
+ self.config_sib_file = self.run_dir.child(srsENB.CFGFILE_SIB)
+ self.config_rr_file = self.run_dir.child(srsENB.CFGFILE_RR)
+ self.config_drb_file = self.run_dir.child(srsENB.CFGFILE_DRB)
+ self.log_file = self.run_dir.child(srsENB.LOGFILE)
+ self.pcap_file = self.run_dir.child(srsENB.PCAPFILE)
self.gen_conf_file(self.config_file, srsENB.CFGFILE)
self.gen_conf_file(self.config_sib_file, srsENB.CFGFILE_SIB)
diff --git a/src/osmo_gsm_tester/srs_epc.py b/src/osmo_gsm_tester/srs_epc.py
index 705c7c7..0d020bc 100644
--- a/src/osmo_gsm_tester/srs_epc.py
+++ b/src/osmo_gsm_tester/srs_epc.py
@@ -53,6 +53,7 @@ class srsEPC(log.Origin):
self.remote_db_file = None
self.remote_log_file = None
self.remote_pcap_file = None
+ self.enable_pcap = False
self.subscriber_list = []
self.suite_run = suite_run
self._run_node = run_node
@@ -67,10 +68,11 @@ class srsEPC(log.Origin):
self.rem_host.scpfrom('scp-back-log', self.remote_log_file, self.log_file)
except Exception as e:
self.log(repr(e))
- try:
- self.rem_host.scpfrom('scp-back-pcap', self.remote_pcap_file, self.pcap_file)
- except Exception as e:
- self.log(repr(e))
+ if self.enable_pcap:
+ try:
+ self.rem_host.scpfrom('scp-back-pcap', self.remote_pcap_file, self.pcap_file)
+ except Exception as e:
+ self.log(repr(e))
def start(self):
self.log('Starting srsepc')
@@ -100,7 +102,7 @@ class srsEPC(log.Origin):
self.rem_host.recreate_remote_dir(remote_inst)
self.rem_host.scp('scp-inst-to-remote', str(self.inst), remote_prefix_dir)
- self.rem_host.create_remote_dir(remote_run_dir)
+ self.rem_host.recreate_remote_dir(remote_run_dir)
self.rem_host.scp('scp-cfg-to-remote', self.config_file, self.remote_config_file)
self.rem_host.scp('scp-db-to-remote', self.db_file, self.remote_db_file)
@@ -116,7 +118,6 @@ class srsEPC(log.Origin):
args = (remote_binary, self.remote_config_file,
'--hss.db_file=' + self.remote_db_file,
'--log.filename=' + self.remote_log_file,
- '--pcap.enable=true',
'--pcap.filename=' + self.remote_pcap_file)
self.process = self.rem_host.RemoteProcess(srsEPC.BINFILE, args)
@@ -147,7 +148,6 @@ class srsEPC(log.Origin):
args = (binary, os.path.abspath(self.config_file),
'--hss.db_file=' + self.db_file,
'--log.filename=' + self.log_file,
- '--pcap.enable=true',
'--pcap.filename=' + self.pcap_file)
self.process = process.Process(self.name(), self.run_dir, args, env=env)
@@ -155,16 +155,20 @@ class srsEPC(log.Origin):
self.process.launch()
def configure(self):
- self.config_file = self.run_dir.new_file(srsEPC.CFGFILE)
- self.db_file = self.run_dir.new_file(srsEPC.DBFILE)
- self.log_file = self.run_dir.new_file(srsEPC.LOGFILE)
- self.pcap_file = self.run_dir.new_file(srsEPC.PCAPFILE)
+ self.config_file = self.run_dir.child(srsEPC.CFGFILE)
+ self.db_file = self.run_dir.child(srsEPC.DBFILE)
+ self.log_file = self.run_dir.child(srsEPC.LOGFILE)
+ self.pcap_file = self.run_dir.child(srsEPC.PCAPFILE)
self.dbg(config_file=self.config_file, db_file=self.db_file)
values = dict(epc=config.get_defaults('srsepc'))
- config.overlay(values, self.suite_run.config())
+ config.overlay(values, dict(epc=self.suite_run.config().get('epc', {})))
config.overlay(values, dict(epc={'run_addr': self.addr()}))
+ # Convert parsed boolean string to Python boolean:
+ self.enable_pcap = util.str2bool(values['epc'].get('enable_pcap', 'false'))
+ config.overlay(values, dict(epc={'enable_pcap': self.enable_pcap}))
+
# Set qci for each subscriber:
rlc_drb_mode = values['epc'].get('rlc_drb_mode', None)
assert rlc_drb_mode is not None
diff --git a/src/osmo_gsm_tester/srs_ue.py b/src/osmo_gsm_tester/srs_ue.py
index 9743848..f725587 100644
--- a/src/osmo_gsm_tester/srs_ue.py
+++ b/src/osmo_gsm_tester/srs_ue.py
@@ -73,6 +73,7 @@ class srsUE(MS):
self.remote_log_file = None
self.remote_pcap_file = None
self.remote_metrics_file = None
+ self.enable_pcap = False
self.suite_run = suite_run
self.remote_user = conf.get('remote_user', None)
if not rf_type_valid(conf.get('rf_dev_type', None)):
@@ -94,10 +95,11 @@ class srsUE(MS):
self.rem_host.scpfrom('scp-back-log', self.remote_log_file, self.log_file)
except Exception as e:
self.log(repr(e))
- try:
- self.rem_host.scpfrom('scp-back-pcap', self.remote_pcap_file, self.pcap_file)
- except Exception as e:
- self.log(repr(e))
+ if self.enable_pcap:
+ try:
+ self.rem_host.scpfrom('scp-back-pcap', self.remote_pcap_file, self.pcap_file)
+ except Exception as e:
+ self.log(repr(e))
def setup_runs_locally(self):
return self.remote_user is None
@@ -137,7 +139,7 @@ class srsUE(MS):
self.rem_host.recreate_remote_dir(remote_inst)
self.rem_host.scp('scp-inst-to-remote', str(self.inst), remote_prefix_dir)
- self.rem_host.create_remote_dir(remote_run_dir)
+ self.rem_host.recreate_remote_dir(remote_run_dir)
self.rem_host.scp('scp-cfg-to-remote', self.config_file, self.remote_config_file)
remote_lib = remote_inst.child('lib')
@@ -206,17 +208,21 @@ class srsUE(MS):
self.process.launch()
def configure(self):
- self.config_file = self.run_dir.new_file(srsUE.CFGFILE)
+ self.config_file = self.run_dir.child(srsUE.CFGFILE)
self.log_file = self.run_dir.child(srsUE.LOGFILE)
- self.pcap_file = self.run_dir.new_file(srsUE.PCAPFILE)
+ self.pcap_file = self.run_dir.child(srsUE.PCAPFILE)
self.metrics_file = self.run_dir.child(srsUE.METRICSFILE)
self.dbg(config_file=self.config_file)
values = dict(ue=config.get_defaults('srsue'))
- config.overlay(values, self.suite_run.config())
+ config.overlay(values, dict(ue=self.suite_run.config().get('modem', {})))
config.overlay(values, dict(ue=self._conf))
config.overlay(values, dict(ue=dict(num_antennas = self.enb.num_ports())))
+ # Convert parsed boolean string to Python boolean:
+ self.enable_pcap = util.str2bool(values['ue'].get('enable_pcap', 'false'))
+ config.overlay(values, dict(ue={'enable_pcap': self.enable_pcap}))
+
# We need to set some specific variables programatically here to match IP addresses:
if self._conf.get('rf_dev_type') == 'zmq':
base_srate = num_prb2base_srate(self.enb.num_prb())
diff --git a/src/osmo_gsm_tester/templates/srsenb.conf.tmpl b/src/osmo_gsm_tester/templates/srsenb.conf.tmpl
index dccade5..d28d255 100644
--- a/src/osmo_gsm_tester/templates/srsenb.conf.tmpl
+++ b/src/osmo_gsm_tester/templates/srsenb.conf.tmpl
@@ -98,7 +98,7 @@ device_args = ${enb.rf_dev_args}
# filename: File path to use for packet captures
#####################################################################
[pcap]
-enable = false
+enable = ${'true' if enb.enable_pcap else 'false'}
filename = /tmp/enb.pcap
#####################################################################
diff --git a/src/osmo_gsm_tester/templates/srsepc.conf.tmpl b/src/osmo_gsm_tester/templates/srsepc.conf.tmpl
index 8acd22f..cb03967 100644
--- a/src/osmo_gsm_tester/templates/srsepc.conf.tmpl
+++ b/src/osmo_gsm_tester/templates/srsepc.conf.tmpl
@@ -71,7 +71,7 @@ max_paging_queue = 100
#
####################################################################
[pcap]
-enable = false
+enable = ${'true' if epc.enable_pcap else 'false'}
filename = /tmp/epc.pcap
####################################################################
diff --git a/src/osmo_gsm_tester/templates/srsue.conf.tmpl b/src/osmo_gsm_tester/templates/srsue.conf.tmpl
index f7dee03..4a4828e 100644
--- a/src/osmo_gsm_tester/templates/srsue.conf.tmpl
+++ b/src/osmo_gsm_tester/templates/srsue.conf.tmpl
@@ -71,7 +71,7 @@ device_args = ${ue.rf_dev_args}
# nas_filename: File path to use for NAS packet captures
#####################################################################
[pcap]
-enable = true
+enable = ${'true' if ue.enable_pcap else 'false'}
filename = /tmp/ue.pcap
nas_enable = false
nas_filename = /tmp/nas.pcap