summaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester/bts_octphy.py
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-12-14 19:01:25 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2017-12-14 19:18:57 +0100
commit4b475be9d8d531fd1d95d658f37b06709fa57848 (patch)
treed0d49c20132082ae4238e60d01aedda87cd64e0f /src/osmo_gsm_tester/bts_octphy.py
parentc9817a50ff8d4138f9659a4e6e146f9843662af1 (diff)
cosmetic: bts_octphy: Sort members according to scope
Diffstat (limited to 'src/osmo_gsm_tester/bts_octphy.py')
-rw-r--r--src/osmo_gsm_tester/bts_octphy.py64
1 files changed, 37 insertions, 27 deletions
diff --git a/src/osmo_gsm_tester/bts_octphy.py b/src/osmo_gsm_tester/bts_octphy.py
index fd8d078..f5fa90b 100644
--- a/src/osmo_gsm_tester/bts_octphy.py
+++ b/src/osmo_gsm_tester/bts_octphy.py
@@ -23,6 +23,10 @@ import tempfile
from . import log, config, util, template, process, event_loop, pcu_osmo, bts_osmo
class OsmoBtsOctphy(bts_osmo.OsmoBtsMainUnit):
+
+##############
+# PROTECTED
+##############
run_dir = None
inst = None
env = None
@@ -36,33 +40,6 @@ class OsmoBtsOctphy(bts_osmo.OsmoBtsMainUnit):
self.env = {}
self.values = {}
- def start(self):
- if self.bsc is None:
- raise RuntimeError('BTS needs to be added to a BSC or NITB before it can be started')
- self.suite_run.poll()
-
- self.log('Starting to connect to', self.bsc)
- 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-bts')))
- btsoct_path = self.inst.child('bin', OsmoBtsOctphy.BIN_BTS_OCTPHY)
- lib = self.inst.child('lib')
- if not os.path.isdir(lib):
- raise RuntimeError('No lib/ in %r' % self.inst)
-
- # setting capabilities will later disable use of LD_LIBRARY_PATH from ELF loader -> modify RPATH instead.
- self.log('Setting RPATH for', OsmoBtsOctphy.BIN_BTS_OCTPHY)
- util.change_elf_rpath(btsoct_path, util.prepend_library_path(lib), self.run_dir.new_dir('patchelf'))
- # osmo-bty-octphy requires CAP_NET_RAW to open AF_PACKET socket:
- self.log('Applying CAP_NET_RAW capability to', OsmoBtsOctphy.BIN_BTS_OCTPHY)
- util.setcap_net_raw(btsoct_path, self.run_dir.new_dir('setcap_net_raw'))
-
- self.proc_bts = self.launch_process(OsmoBtsOctphy.BIN_BTS_OCTPHY, '-r', '1',
- '-c', os.path.abspath(self.config_file),
- '-i', self.bsc.addr(), '-t', str(self.num_trx()))
- self.suite_run.poll()
-
def launch_process(self, binary_name, *args):
binary = os.path.abspath(self.inst.child('bin', binary_name))
run_dir = self.run_dir.new_dir(binary_name)
@@ -131,6 +108,9 @@ class OsmoBtsOctphy(bts_osmo.OsmoBtsMainUnit):
self.dbg(r)
f.write(r)
+########################
+# PUBLIC - INTERNAL API
+########################
def conf_for_bsc(self):
values = config.get_defaults('bsc_bts')
config.overlay(values, config.get_defaults('osmo_bts_octphy'))
@@ -150,4 +130,34 @@ class OsmoBtsOctphy(bts_osmo.OsmoBtsMainUnit):
self.dbg(conf=values)
return values
+###################
+# PUBLIC (test API included)
+###################
+ def start(self):
+ if self.bsc is None:
+ raise RuntimeError('BTS needs to be added to a BSC or NITB before it can be started')
+ self.suite_run.poll()
+
+ self.log('Starting to connect to', self.bsc)
+ 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-bts')))
+ btsoct_path = self.inst.child('bin', OsmoBtsOctphy.BIN_BTS_OCTPHY)
+ lib = self.inst.child('lib')
+ if not os.path.isdir(lib):
+ raise RuntimeError('No lib/ in %r' % self.inst)
+
+ # setting capabilities will later disable use of LD_LIBRARY_PATH from ELF loader -> modify RPATH instead.
+ self.log('Setting RPATH for', OsmoBtsOctphy.BIN_BTS_OCTPHY)
+ util.change_elf_rpath(btsoct_path, util.prepend_library_path(lib), self.run_dir.new_dir('patchelf'))
+ # osmo-bty-octphy requires CAP_NET_RAW to open AF_PACKET socket:
+ self.log('Applying CAP_NET_RAW capability to', OsmoBtsOctphy.BIN_BTS_OCTPHY)
+ util.setcap_net_raw(btsoct_path, self.run_dir.new_dir('setcap_net_raw'))
+
+ self.proc_bts = self.launch_process(OsmoBtsOctphy.BIN_BTS_OCTPHY, '-r', '1',
+ '-c', os.path.abspath(self.config_file),
+ '-i', self.bsc.addr(), '-t', str(self.num_trx()))
+ self.suite_run.poll()
+
# vim: expandtab tabstop=4 shiftwidth=4