summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-09-01 14:07:40 (UTC)
committerPau Espin Pedrol <pespin@sysmocom.de>2017-09-01 16:03:09 (UTC)
commit80c6d83a0069f5dbb1f354b5b823f76aeabadf56 (patch)
treeb606d5fadc67a3dc519b5b7aa5f0be63e788ffc3
parent14da504868be17ae6544dc251a15417c969a5bf0 (diff)
Introduce OsmoPcuSysmo class and integrate it with Sysmobts and Sgsn
At this point configuration towards the Sgsn is not configured correctly, but Inegration between osmo-bts-sysmo and osmo-pcu works correctly. Change-Id: I05d4ebca118a115e69cc6687b191b5a56f37bc80
-rw-r--r--src/osmo_gsm_tester/bts_sysmo.py22
-rw-r--r--src/osmo_gsm_tester/osmo_sgsn.py3
-rw-r--r--src/osmo_gsm_tester/pcu_sysmo.py129
-rw-r--r--src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl29
-rw-r--r--src/osmo_gsm_tester/templates/osmo-bts-sysmo.cfg.tmpl1
-rw-r--r--src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl29
-rw-r--r--src/osmo_gsm_tester/templates/osmo-pcu-sysmo.cfg.tmpl12
7 files changed, 220 insertions, 5 deletions
diff --git a/src/osmo_gsm_tester/bts_sysmo.py b/src/osmo_gsm_tester/bts_sysmo.py
index f37f88b..ef186fa 100644
--- a/src/osmo_gsm_tester/bts_sysmo.py
+++ b/src/osmo_gsm_tester/bts_sysmo.py
@@ -19,18 +19,20 @@
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
remote_env = None
remote_dir = 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'
@@ -40,6 +42,7 @@ class SysmoBts(log.Origin):
self.conf = conf
self.remote_env = {}
self.remote_user = 'root'
+ self._pcu = pcu_sysmo.OsmoPcuSysmo(self.suite_run, self, self.conf)
def start(self):
if self.bsc is None:
@@ -107,9 +110,15 @@ class SysmoBts(log.Origin):
log.ctx(proc)
raise log.Error('Exited in error')
+ def pcu(self):
+ 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')
@@ -122,7 +131,7 @@ class SysmoBts(log.Origin):
config.overlay(values, {
'osmo_bts_sysmo': {
'oml_remote_ip': self.bsc.addr(),
- 'pcu_socket_path': os.path.join(SysmoBts.REMOTE_DIR, 'pcu_bts')
+ 'pcu_socket_path': self.pcu_socket_path()
}
})
config.overlay(values, { 'osmo_bts_sysmo': self.conf })
@@ -138,10 +147,17 @@ class SysmoBts(log.Origin):
values = config.get_defaults('bsc_bts')
config.overlay(values, config.get_defaults('osmo_bts_sysmo'))
config.overlay(values, self.conf)
+
+ sgsn_addr = '127.0.0.1' if self.sgsn is None else self.sgsn.addr()
+ config.overlay(values, dict(sgsn_ip_addr=sgsn_addr))
+
self.dbg(conf=values)
return values
def set_bsc(self, bsc):
self.bsc = bsc
+ def set_sgsn(self, sgsn):
+ self.sgsn = sgsn
+
# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/src/osmo_gsm_tester/osmo_sgsn.py b/src/osmo_gsm_tester/osmo_sgsn.py
index 6d7f77f..70aa86c 100644
--- a/src/osmo_gsm_tester/osmo_sgsn.py
+++ b/src/osmo_gsm_tester/osmo_sgsn.py
@@ -86,4 +86,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/pcu_sysmo.py b/src/osmo_gsm_tester/pcu_sysmo.py
new file mode 100644
index 0000000..13af226
--- /dev/null
+++ b/src/osmo_gsm_tester/pcu_sysmo.py
@@ -0,0 +1,129 @@
+# osmo_gsm_tester: specifics for running a osmo-pcu for sysmoBTS
+#
+# Copyright (C) 2016-2017 by sysmocom - s.f.m.c. GmbH
+#
+# Author: Pau Espin Pedrol <pespin@sysmocom.de>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import pprint
+from . import log, config, util, template, process
+
+class OsmoPcuSysmo(log.Origin):
+ suite_run = None
+ bsc = None
+ run_dir = None
+ inst = None
+ remote_inst = None
+ remote_env = None
+ remote_dir = None
+ sysmobts = None
+
+ REMOTE_DIR = '/osmo-gsm-tester-pcu'
+ PCU_SYSMO_BIN = 'osmo-pcu'
+ PCU_SYSMO_CFG = 'osmo-pcu-sysmo.cfg'
+
+ def __init__(self, suite_run, sysmobts, conf):
+ super().__init__(log.C_RUN, self.PCU_SYSMO_BIN)
+ self.suite_run = suite_run
+ self.sysmobts = sysmobts
+ self.conf = conf
+ self.remote_env = {}
+ self.remote_user = 'root'
+
+ def start(self):
+ # TODO: self.log('Waiting for osmo-bts to start up...')
+ # event_loop.wait(self, self.trx.trx_ready)
+ self.run_dir = util.Dir(self.suite_run.get_test_run_dir().new_dir(self.name()))
+ self.configure()
+
+ self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmo-pcu-sysmo')))
+ lib = self.inst.child('lib')
+ if not os.path.isdir(lib):
+ raise log.Error('No lib/ in', self.inst)
+ if not self.inst.isfile('bin', OsmoPcuSysmo.PCU_SYSMO_BIN):
+ raise log.Error('No osmo-pcu-sysmo binary in', self.inst)
+
+ self.remote_dir = util.Dir(OsmoPcuSysmo.REMOTE_DIR)
+ self.remote_inst = util.Dir(self.remote_dir.child(os.path.basename(str(self.inst))))
+
+ self.run_remote('rm-remote-dir', ('test', '!', '-d', OsmoPcuSysmo.REMOTE_DIR, '||', 'rm', '-rf', OsmoPcuSysmo.REMOTE_DIR))
+ self.run_remote('mk-remote-dir', ('mkdir', '-p', OsmoPcuSysmo.REMOTE_DIR))
+ self.run_local('scp-inst-to-sysmobts',
+ ('scp', '-r', str(self.inst), '%s@%s:%s' % (self.remote_user, self.sysmobts.remote_addr(), str(self.remote_inst))))
+
+ remote_run_dir = self.remote_dir.child(OsmoPcuSysmo.PCU_SYSMO_BIN)
+ self.run_remote('mk-remote-run-dir', ('mkdir', '-p', remote_run_dir))
+
+ remote_config_file = self.remote_dir.child(OsmoPcuSysmo.PCU_SYSMO_CFG)
+ self.run_local('scp-cfg-to-sysmobts',
+ ('scp', '-r', self.config_file, '%s@%s:%s' % (self.remote_user, self.sysmobts.remote_addr(), remote_config_file)))
+
+ remote_lib = self.remote_inst.child('lib')
+ remote_binary = self.remote_inst.child('bin', OsmoPcuSysmo.PCU_SYSMO_BIN)
+ self.launch_remote(OsmoPcuSysmo.PCU_SYSMO_BIN,
+ ('LD_LIBRARY_PATH=%s' % remote_lib,
+ remote_binary, '-c', remote_config_file, '-r', '1',
+ '-i', self.sysmobts.bsc.addr()),
+ remote_cwd=remote_run_dir)
+
+ def _process_remote(self, name, popen_args, remote_cwd=None):
+ run_dir = self.run_dir.new_dir(name)
+ return process.RemoteProcess(name, run_dir, self.remote_user, self.sysmobts.remote_addr(), remote_cwd,
+ popen_args)
+
+ def run_remote(self, name, popen_args, remote_cwd=None):
+ proc = self._process_remote(name, popen_args, remote_cwd)
+ proc.launch()
+ proc.wait()
+ if proc.result != 0:
+ log.ctx(proc)
+ raise log.Error('Exited in error')
+
+ def launch_remote(self, name, popen_args, remote_cwd=None):
+ proc = self._process_remote(name, popen_args, remote_cwd)
+ self.suite_run.remember_to_stop(proc)
+ proc.launch()
+
+ def run_local(self, name, popen_args):
+ run_dir = self.run_dir.new_dir(name)
+ proc = process.Process(name, run_dir, popen_args)
+ proc.launch()
+ proc.wait()
+ if proc.result != 0:
+ log.ctx(proc)
+ raise log.Error('Exited in error')
+
+ def configure(self):
+ self.config_file = self.run_dir.new_file(OsmoPcuSysmo.PCU_SYSMO_CFG)
+ self.dbg(config_file=self.config_file)
+
+ values = { 'osmo_pcu_sysmo': config.get_defaults('osmo_pcu_sysmo') }
+ config.overlay(values, self.suite_run.config())
+ config.overlay(values, {
+ 'osmo_pcu_sysmo': {
+ 'pcu_socket_path': self.sysmobts.pcu_socket_path()
+ }
+ })
+ config.overlay(values, { 'osmo_pcu_sysmo': self.conf })
+
+ self.dbg('OSMO-PCU-SYSMO CONFIG:\n' + pprint.pformat(values))
+
+ with open(self.config_file, 'w') as f:
+ r = template.render(OsmoPcuSysmo.PCU_SYSMO_CFG, values)
+ self.dbg(r)
+ f.write(r)
+
+# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
index 57ab8a3..1e00392 100644
--- a/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/osmo-bsc.cfg.tmpl
@@ -56,7 +56,34 @@ network
rach max transmission 7
ip.access unit_id ${bts.ipa_unit_id} 0
oml ip.access stream_id ${bts.stream_id} 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 ${bts.sgsn_ip_addr}
+ no force-combined-si
% for trx in bts.trx_list:
trx ${loop.index}
rf_locked 0
diff --git a/src/osmo_gsm_tester/templates/osmo-bts-sysmo.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-bts-sysmo.cfg.tmpl
index 69f7ac1..6cc2a86 100644
--- a/src/osmo_gsm_tester/templates/osmo-bts-sysmo.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/osmo-bts-sysmo.cfg.tmpl
@@ -9,6 +9,7 @@ log stderr
logging level rll debug
logging level rr debug
logging level rsl debug
+ logging level pcu info
!
phy 0
instance 0
diff --git a/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl
index d2927f9..625f693 100644
--- a/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/osmo-nitb.cfg.tmpl
@@ -49,7 +49,34 @@ network
rach max transmission 7
ip.access unit_id ${bts.ipa_unit_id} 0
oml ip.access stream_id ${bts.stream_id} 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 ${bts.sgsn_ip_addr}
+ no force-combined-si
% for trx in bts.trx_list:
trx ${loop.index}
rf_locked 0
diff --git a/src/osmo_gsm_tester/templates/osmo-pcu-sysmo.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-pcu-sysmo.cfg.tmpl
new file mode 100644
index 0000000..632bc27
--- /dev/null
+++ b/src/osmo_gsm_tester/templates/osmo-pcu-sysmo.cfg.tmpl
@@ -0,0 +1,12 @@
+log stderr
+ logging color 1
+ logging print extended-timestamp 1
+ logging print category 1
+ logging level all debug
+pcu
+ pcu-socket ${osmo_pcu_sysmo.pcu_socket_path}
+ flow-control-interval 10
+ cs 2
+ alloc-algorithm dynamic
+ alpha 0
+ gamma 0