diff --git a/example/resources.conf b/example/resources.conf index e8b1695c..d503a488 100644 --- a/example/resources.conf +++ b/example/resources.conf @@ -14,6 +14,7 @@ bts: ipa_unit_id: 1 addr: 10.42.42.114 band: GSM-1800 + direct_pcu: true ciphers: [a5_0, a5_1, a5_3] - label: Ettus B200 diff --git a/selftest/conf/resources.conf b/selftest/conf/resources.conf index b1867370..9e4e0159 100644 --- a/selftest/conf/resources.conf +++ b/selftest/conf/resources.conf @@ -13,6 +13,7 @@ bts: ipa_unit_id: 1 addr: 10.42.42.114 band: GSM-1800 + direct_pcu: true ciphers: - 'a5_0' - 'a5_1' diff --git a/selftest/resource_test.ok b/selftest/resource_test.ok index 09c276a5..650a8bcc 100644 --- a/selftest/resource_test.ok +++ b/selftest/resource_test.ok @@ -46,10 +46,11 @@ cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/s {'_hash': 'dc9ce027a257da087f31a5bc1ee6b4abd2637369', 'arfcn': '548', 'band': 'GSM-1900'}], - 'bts': [{'_hash': '377ac78d5404b826d40c84efd04b4a9fd4e62b7e', + 'bts': [{'_hash': 'd2aa7c1124943de352351b650ca0c751784da6b6', 'addr': '10.42.42.114', 'band': 'GSM-1800', 'ciphers': ['a5_0', 'a5_1'], + 'direct_pcu': 'True', 'ipa_unit_id': '1', 'label': 'sysmoBTS 1002', 'type': 'osmo-bts-sysmo'}, @@ -118,12 +119,13 @@ cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/s arfcn: '514' band: GSM-1800 --- testowner: Reserving 2 x bts (candidates: 3) ---- testowner: DBG: Picked - _hash: 377ac78d5404b826d40c84efd04b4a9fd4e62b7e +--- testowner: DBG: Picked - _hash: d2aa7c1124943de352351b650ca0c751784da6b6 addr: 10.42.42.114 band: GSM-1800 ciphers: - a5_0 - a5_1 + direct_pcu: 'True' ipa_unit_id: '1' label: sysmoBTS 1002 type: osmo-bts-sysmo @@ -170,13 +172,14 @@ arfcn: arfcn: '514' band: GSM-1800 bts: -- _hash: 377ac78d5404b826d40c84efd04b4a9fd4e62b7e +- _hash: d2aa7c1124943de352351b650ca0c751784da6b6 _reserved_by: testowner-123-1490837279 addr: 10.42.42.114 band: GSM-1800 ciphers: - a5_0 - a5_1 + direct_pcu: 'True' ipa_unit_id: '1' label: sysmoBTS 1002 type: osmo-bts-sysmo diff --git a/selftest/template_test.ok b/selftest/template_test.ok index dcfacc20..bae21d2c 100644 --- a/selftest/template_test.ok +++ b/selftest/template_test.ok @@ -50,7 +50,34 @@ network rach max transmission 7 ip.access unit_id val_bts.unit_id_bts0 0 oml ip.access stream_id val_bts.stream_id_bts0 line 0 - gprs mode none + gprs mode gprs + gprs routing area 0 + gprs network-control-order nc1 + gprs cell bvci 1800 + gprs cell timer blocking-timer 3 + gprs cell timer blocking-retries 3 + gprs cell timer unblocking-retries 3 + gprs cell timer reset-timer 3 + gprs cell timer reset-retries 3 + gprs cell timer suspend-timer 10 + gprs cell timer suspend-retries 3 + gprs cell timer resume-timer 10 + gprs cell timer resume-retries 3 + gprs cell timer capability-update-timer 10 + gprs cell timer capability-update-retries 3 + gprs nsei 1800 + gprs ns timer tns-block 3 + gprs ns timer tns-block-retries 3 + gprs ns timer tns-reset 3 + gprs ns timer tns-reset-retries 3 + gprs ns timer tns-test 30 + gprs ns timer tns-alive 3 + gprs ns timer tns-alive-retries 10 + gprs nsvc 0 nsvci 1800 + gprs nsvc 0 local udp port 23020 + gprs nsvc 0 remote udp port 23000 + gprs nsvc 0 remote ip val_bts.sgsn_ip_addr_bts0 + no force-combined-si trx 0 rf_locked 0 arfcn val_trx_arfcn_trx0 @@ -94,7 +121,34 @@ network rach max transmission 7 ip.access unit_id val_bts.unit_id_bts1 0 oml ip.access stream_id val_bts.stream_id_bts1 line 0 - gprs mode none + gprs mode gprs + gprs routing area 0 + gprs network-control-order nc1 + gprs cell bvci 1800 + gprs cell timer blocking-timer 3 + gprs cell timer blocking-retries 3 + gprs cell timer unblocking-retries 3 + gprs cell timer reset-timer 3 + gprs cell timer reset-retries 3 + gprs cell timer suspend-timer 10 + gprs cell timer suspend-retries 3 + gprs cell timer resume-timer 10 + gprs cell timer resume-retries 3 + gprs cell timer capability-update-timer 10 + gprs cell timer capability-update-retries 3 + gprs nsei 1800 + gprs ns timer tns-block 3 + gprs ns timer tns-block-retries 3 + gprs ns timer tns-reset 3 + gprs ns timer tns-reset-retries 3 + gprs ns timer tns-test 30 + gprs ns timer tns-alive 3 + gprs ns timer tns-alive-retries 10 + gprs nsvc 0 nsvci 1800 + gprs nsvc 0 local udp port 23020 + gprs nsvc 0 remote udp port 23000 + gprs nsvc 0 remote ip val_bts.sgsn_ip_addr_bts1 + no force-combined-si trx 0 rf_locked 0 arfcn val_trx_arfcn_trx0 diff --git a/selftest/template_test.py b/selftest/template_test.py index 0c836325..314dd8d5 100755 --- a/selftest/template_test.py +++ b/selftest/template_test.py @@ -26,6 +26,7 @@ mock_bts = { 'base_station_id_code': 'val_bts.base_station_id_code', 'ipa_unit_id': 'val_bts.unit_id', 'stream_id': 'val_bts.stream_id', + 'sgsn': (dict(ip_address=dict(addr='val_bts.sgsn_ip_addr'))), 'trx_list': ( dict(arfcn='val_trx_arfcn_trx0', nominal_power='val_trx_nominal_power_trx0', diff --git a/src/osmo_gsm_tester/bts_sysmo.py b/src/osmo_gsm_tester/bts_sysmo.py index 1a7b1399..812a2474 100644 --- a/src/osmo_gsm_tester/bts_sysmo.py +++ b/src/osmo_gsm_tester/bts_sysmo.py @@ -19,11 +19,12 @@ import os import pprint -from . import log, config, util, template, process +from . import log, config, util, template, process, pcu_sysmo class SysmoBts(log.Origin): suite_run = None bsc = None + sgsn = None run_dir = None inst = None remote_inst = None @@ -32,8 +33,9 @@ class SysmoBts(log.Origin): lac = None cellid = None proc_bts = None + _pcu = None - REMOTE_DIR = '/osmo-gsm-tester' + REMOTE_DIR = '/osmo-gsm-tester-bts' BTS_SYSMO_BIN = 'osmo-bts-sysmo' BTS_SYSMO_CFG = 'osmo-bts-sysmo.cfg' @@ -77,15 +79,22 @@ class SysmoBts(log.Origin): remote_lib = self.remote_inst.child('lib') remote_binary = self.remote_inst.child('bin', 'osmo-bts-sysmo') - self.proc_bts = self.launch_remote('osmo-bts-sysmo', - ('LD_LIBRARY_PATH=%s' % remote_lib, - remote_binary, '-c', remote_config_file, '-r', '1', - '-i', self.bsc.addr()), - remote_cwd=remote_run_dir) + + args = ('LD_LIBRARY_PATH=%s' % remote_lib, + remote_binary, '-c', remote_config_file, '-r', '1', + '-i', self.bsc.addr()) + + if self._direct_pcu_enabled(): + args += ('-M',) + + self.proc_bts = self.launch_remote('osmo-bts-sysmo', args, remote_cwd=remote_run_dir) def cleanup(self): pass + def _direct_pcu_enabled(self): + return util.str2bool(self.conf.get('direct_pcu')) + def pcu_socket_path(self): return os.path.join(SysmoBts.REMOTE_DIR, 'pcu_bts') @@ -117,9 +126,17 @@ class SysmoBts(log.Origin): log.ctx(proc) raise log.Error('Exited in error') + def pcu(self): + if self._pcu is None: + self._pcu = pcu_sysmo.OsmoPcuSysmo(self.suite_run, self, self.conf) + return self._pcu + def remote_addr(self): return self.conf.get('addr') + def pcu_socket_path(self): + return os.path.join(SysmoBts.REMOTE_DIR, 'pcu_bts') + def configure(self): if self.bsc is None: raise RuntimeError('BTS needs to be added to a BSC or NITB before it can be configured') @@ -152,6 +169,10 @@ class SysmoBts(log.Origin): if self.cellid is not None: config.overlay(values, { 'cell_identity': self.cellid }) config.overlay(values, self.conf) + + sgsn_conf = {} if self.sgsn is None else self.sgsn.conf_for_client() + config.overlay(values, sgsn_conf) + self.dbg(conf=values) return values @@ -163,6 +184,9 @@ class SysmoBts(log.Origin): def set_bsc(self, bsc): self.bsc = bsc + def set_sgsn(self, sgsn): + self.sgsn = sgsn + def set_lac(self, lac): self.lac = lac diff --git a/src/osmo_gsm_tester/osmo_sgsn.py b/src/osmo_gsm_tester/osmo_sgsn.py index 7a9c5ff6..86591860 100644 --- a/src/osmo_gsm_tester/osmo_sgsn.py +++ b/src/osmo_gsm_tester/osmo_sgsn.py @@ -91,4 +91,7 @@ class OsmoSgsn(log.Origin): def running(self): return not self.process.terminated() + def bts_add(self, bts): + bts.set_sgsn(self) + # vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py index 8412d6a7..604a9e9b 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -55,6 +55,7 @@ RESOURCES_SCHEMA = { 'bts[].band': schema.BAND, 'bts[].trx_remote_ip': schema.IPV4, 'bts[].launch_trx': schema.BOOL_STR, + 'bts[].direct_pcu': schema.BOOL_STR, 'bts[].ciphers[]': schema.CIPHER, 'bts[].trx_list[].hw_addr': schema.HWADDR, 'bts[].trx_list[].net_device': schema.STR, diff --git a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl index 18b3761b..2466f9fd 100644 --- a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl +++ b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl @@ -59,7 +59,38 @@ network rach max transmission 7 ip.access unit_id ${bts.ipa_unit_id} 0 oml ip.access stream_id ${bts.stream_id} line 0 +% if bts.get('sgsn', False): + gprs mode gprs + gprs routing area 0 + gprs network-control-order nc1 + gprs cell bvci 1800 + gprs cell timer blocking-timer 3 + gprs cell timer blocking-retries 3 + gprs cell timer unblocking-retries 3 + gprs cell timer reset-timer 3 + gprs cell timer reset-retries 3 + gprs cell timer suspend-timer 10 + gprs cell timer suspend-retries 3 + gprs cell timer resume-timer 10 + gprs cell timer resume-retries 3 + gprs cell timer capability-update-timer 10 + gprs cell timer capability-update-retries 3 + gprs nsei 1800 + gprs ns timer tns-block 3 + gprs ns timer tns-block-retries 3 + gprs ns timer tns-reset 3 + gprs ns timer tns-reset-retries 3 + gprs ns timer tns-test 30 + gprs ns timer tns-alive 3 + gprs ns timer tns-alive-retries 10 + gprs nsvc 0 nsvci 1800 + gprs nsvc 0 local udp port 23020 + gprs nsvc 0 remote udp port 23000 + gprs nsvc 0 remote ip ${bts.sgsn.ip_address.addr} + no force-combined-si +% else: gprs mode none +% endif % for trx in bts.trx_list: trx ${loop.index} rf_locked 0 diff --git a/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl index 803a3750..211b4ccc 100644 --- a/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl +++ b/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl @@ -49,7 +49,38 @@ network rach max transmission 7 ip.access unit_id ${bts.ipa_unit_id} 0 oml ip.access stream_id ${bts.stream_id} line 0 +% if bts.get('sgsn', False): + gprs mode gprs + gprs routing area 0 + gprs network-control-order nc1 + gprs cell bvci 1800 + gprs cell timer blocking-timer 3 + gprs cell timer blocking-retries 3 + gprs cell timer unblocking-retries 3 + gprs cell timer reset-timer 3 + gprs cell timer reset-retries 3 + gprs cell timer suspend-timer 10 + gprs cell timer suspend-retries 3 + gprs cell timer resume-timer 10 + gprs cell timer resume-retries 3 + gprs cell timer capability-update-timer 10 + gprs cell timer capability-update-retries 3 + gprs nsei 1800 + gprs ns timer tns-block 3 + gprs ns timer tns-block-retries 3 + gprs ns timer tns-reset 3 + gprs ns timer tns-reset-retries 3 + gprs ns timer tns-test 30 + gprs ns timer tns-alive 3 + gprs ns timer tns-alive-retries 10 + gprs nsvc 0 nsvci 1800 + gprs nsvc 0 local udp port 23020 + gprs nsvc 0 remote udp port 23000 + gprs nsvc 0 remote ip ${bts.sgsn.ip_address.addr} + no force-combined-si +% else: gprs mode none +% endif % for trx in bts.trx_list: trx ${loop.index} rf_locked 0