From e519462d60cbaaa9920e8a737f55d166ee55c709 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 7 May 2018 13:36:58 +0200 Subject: bts: Pass defaults config name at construct time It will be needed later at construction time when resolving the num of trx. Change-Id: I2c6a46ead14010f714897ea178917327215823e7 --- src/osmo_gsm_tester/bts.py | 5 +++-- src/osmo_gsm_tester/bts_nanobts.py | 4 ++-- src/osmo_gsm_tester/bts_octphy.py | 4 ++-- src/osmo_gsm_tester/bts_osmo.py | 12 ++++++------ src/osmo_gsm_tester/bts_osmotrx.py | 4 ++-- src/osmo_gsm_tester/bts_sysmo.py | 4 ++-- 6 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/osmo_gsm_tester') diff --git a/src/osmo_gsm_tester/bts.py b/src/osmo_gsm_tester/bts.py index 02e5df7..fac4fd2 100644 --- a/src/osmo_gsm_tester/bts.py +++ b/src/osmo_gsm_tester/bts.py @@ -32,15 +32,16 @@ class Bts(log.Origin, metaclass=ABCMeta): rac = None cellid = None bvci = None + defaults_cfg_name = None ############## # PROTECTED ############## - def __init__(self, suite_run, conf, name): + def __init__(self, suite_run, conf, name, defaults_cfg_name): super().__init__(log.C_RUN, name) self.suite_run = suite_run self.conf = conf - + self.defaults_cfg_name = defaults_cfg_name ######################## # PUBLIC - INTERNAL API ######################## diff --git a/src/osmo_gsm_tester/bts_nanobts.py b/src/osmo_gsm_tester/bts_nanobts.py index a930442..d631f1c 100644 --- a/src/osmo_gsm_tester/bts_nanobts.py +++ b/src/osmo_gsm_tester/bts_nanobts.py @@ -36,7 +36,7 @@ class NanoBts(bts.Bts): def __init__(self, suite_run, conf): if conf.get('addr') is None: raise log.Error('No attribute addr provided in conf!') - super().__init__(suite_run, conf, 'nanobts_%s' % conf.get('addr')) + super().__init__(suite_run, conf, 'nanobts_%s' % conf.get('addr'), 'nanobts') def _configure(self): if self.bsc is None: @@ -56,7 +56,7 @@ class NanoBts(bts.Bts): ######################## def conf_for_bsc(self): - values = self.conf_for_bsc_osmo('nanobts') + values = self.conf_for_bsc_prepare() # Hack until we have proper ARFCN resource allocation support (OS#2230) band = values.get('band') trx_list = values.get('trx_list') diff --git a/src/osmo_gsm_tester/bts_octphy.py b/src/osmo_gsm_tester/bts_octphy.py index 70deba3..1c4b4a0 100644 --- a/src/osmo_gsm_tester/bts_octphy.py +++ b/src/osmo_gsm_tester/bts_octphy.py @@ -36,7 +36,7 @@ class OsmoBtsOctphy(bts_osmo.OsmoBtsMainUnit): CONF_BTS_OCTPHY = 'osmo-bts-octphy.cfg' def __init__(self, suite_run, conf): - super().__init__(suite_run, conf, OsmoBtsOctphy.BIN_BTS_OCTPHY) + super().__init__(suite_run, conf, OsmoBtsOctphy.BIN_BTS_OCTPHY, 'osmo_bts_octphy') self.env = {} self.values = {} @@ -112,7 +112,7 @@ class OsmoBtsOctphy(bts_osmo.OsmoBtsMainUnit): # PUBLIC - INTERNAL API ######################## def conf_for_bsc(self): - values = self.conf_for_bsc_osmo('osmo_bts_octphy') + values = self.conf_for_bsc_prepare() self.dbg(conf=values) return values diff --git a/src/osmo_gsm_tester/bts_osmo.py b/src/osmo_gsm_tester/bts_osmo.py index d0ba557..8629b9b 100644 --- a/src/osmo_gsm_tester/bts_osmo.py +++ b/src/osmo_gsm_tester/bts_osmo.py @@ -30,14 +30,14 @@ class OsmoBts(bts.Bts, metaclass=ABCMeta): ############## # PROTECTED ############## - def __init__(self, suite_run, conf, name): - super().__init__(suite_run, conf, name) + def __init__(self, suite_run, conf, name, defaults_cfg_name): + super().__init__(suite_run, conf, name, defaults_cfg_name) if len(self.pcu_socket_path().encode()) > 107: raise log.Error('Path for pcu socket is longer than max allowed len for unix socket path (107):', self.pcu_socket_path()) - def conf_for_bsc_osmo(self, bts_defaults_name): + def conf_for_bsc_prepare(self): values = config.get_defaults('bsc_bts') - config.overlay(values, config.get_defaults(bts_defaults_name)) + config.overlay(values, config.get_defaults(self.defaults_cfg_name)) if self.lac is not None: config.overlay(values, { 'location_area_code': self.lac }) if self.rac is not None: @@ -94,8 +94,8 @@ class OsmoBtsMainUnit(OsmoBts, metaclass=ABCMeta): ############## pcu_sk_tmp_dir = None - def __init__(self, suite_run, conf, name): - super().__init__(suite_run, conf, name) + def __init__(self, suite_run, conf, name, defaults_cfg_name): + super().__init__(suite_run, conf, name, defaults_cfg_name) ######################## # PUBLIC - INTERNAL API diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py index f1a9bdf..9f76194 100644 --- a/src/osmo_gsm_tester/bts_osmotrx.py +++ b/src/osmo_gsm_tester/bts_osmotrx.py @@ -38,7 +38,7 @@ class OsmoBtsTrx(bts_osmo.OsmoBtsMainUnit): CONF_BTS_TRX = 'osmo-bts-trx.cfg' def __init__(self, suite_run, conf): - super().__init__(suite_run, conf, OsmoBtsTrx.BIN_BTS_TRX) + super().__init__(suite_run, conf, OsmoBtsTrx.BIN_BTS_TRX, 'osmo_bts_trx') self.env = {} def trx_remote_ip(self): @@ -92,7 +92,7 @@ class OsmoBtsTrx(bts_osmo.OsmoBtsMainUnit): # PUBLIC - INTERNAL API ######################## def conf_for_bsc(self): - values = self.conf_for_bsc_osmo('osmo_bts_trx') + values = self.conf_for_bsc_prepare() self.dbg(conf=values) return values diff --git a/src/osmo_gsm_tester/bts_sysmo.py b/src/osmo_gsm_tester/bts_sysmo.py index c9978e5..d0f6ff3 100644 --- a/src/osmo_gsm_tester/bts_sysmo.py +++ b/src/osmo_gsm_tester/bts_sysmo.py @@ -35,7 +35,7 @@ class SysmoBts(bts_osmo.OsmoBts): BTS_SYSMO_CFG = 'osmo-bts-sysmo.cfg' def __init__(self, suite_run, conf): - super().__init__(suite_run, conf, SysmoBts.BTS_SYSMO_BIN) + super().__init__(suite_run, conf, SysmoBts.BTS_SYSMO_BIN, 'osmo_bts_sysmo') self.remote_user = 'root' def _direct_pcu_enabled(self): @@ -103,7 +103,7 @@ class SysmoBts(bts_osmo.OsmoBts): return os.path.join(SysmoBts.REMOTE_DIR, 'pcu_bts') def conf_for_bsc(self): - values = self.conf_for_bsc_osmo('osmo_bts_sysmo') + values = self.conf_for_bsc_prepare() self.dbg(conf=values) return values -- cgit v1.2.3