[PATCH] osmo-gsm-tester[master]: OsmoPcuSysmo: Integrate with Sysmobts and OsmoSgsn

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Dec 5 11:46:25 UTC 2017


Hello Neels Hofmeyr, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/5006

to look at the new patch set (#3).

OsmoPcuSysmo: Integrate  with Sysmobts and OsmoSgsn

Change-Id: I01485c5d74e5fe62d0ffea9eb1fad29041426eef
---
M example/resources.conf
M selftest/conf/resources.conf
M selftest/resource_test.ok
M selftest/template_test.ok
M selftest/template_test.py
M src/osmo_gsm_tester/bts_sysmo.py
M src/osmo_gsm_tester/osmo_sgsn.py
M src/osmo_gsm_tester/resource.py
M src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
M src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl
10 files changed, 162 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/06/5006/3

diff --git a/example/resources.conf b/example/resources.conf
index e8b1695..d503a48 100644
--- a/example/resources.conf
+++ b/example/resources.conf
@@ -14,6 +14,7 @@
   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 b186737..9e4e015 100644
--- a/selftest/conf/resources.conf
+++ b/selftest/conf/resources.conf
@@ -13,6 +13,7 @@
   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 09c276a..650a8bc 100644
--- a/selftest/resource_test.ok
+++ b/selftest/resource_test.ok
@@ -46,10 +46,11 @@
            {'_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 @@
   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: '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 dcfacc2..70aa2b9 100644
--- a/selftest/template_test.ok
+++ b/selftest/template_test.ok
@@ -50,7 +50,34 @@
   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 23000
+  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 @@
   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 23000
+  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 0c83632..314dd8d 100755
--- a/selftest/template_test.py
+++ b/selftest/template_test.py
@@ -26,6 +26,7 @@
     '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 1a7b139..812a247 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 @@
     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,14 +79,21 @@
 
         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,8 +126,16 @@
             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:
@@ -152,6 +169,10 @@
         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 @@
     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 7a9c5ff..8659186 100644
--- a/src/osmo_gsm_tester/osmo_sgsn.py
+++ b/src/osmo_gsm_tester/osmo_sgsn.py
@@ -91,4 +91,7 @@
     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 8412d6a..604a9e9 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -55,6 +55,7 @@
         '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 18b3761..2466f9f 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 @@
   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 803a375..419d185 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 @@
   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

-- 
To view, visit https://gerrit.osmocom.org/5006
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I01485c5d74e5fe62d0ffea9eb1fad29041426eef
Gerrit-PatchSet: 3
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list