aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-08-27 17:07:41 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-08-29 12:30:48 +0200
commit0d45504267ace476c4da88fcaa702d026e3ae88a (patch)
tree598b1d6a44c3f6be38d8da960474c5f0c4a7bff1
parenta9fdda85af89c758f96fbeaaf69f2db347b22fcd (diff)
osmo-bts-trx: Big refactor and cleanup of osmo-trx related code
* This commit is a preparation for future commits to add support for different osmo-trx devices and backends like osmo-trx-lms. * Drop deprecated osmo-trx-* cmd line params and use VTY cfg to set them. * As number of osmo-trx related osmo-gsm-tester attributes grow, group them togther in an "osmo_trx" dictionary. Change-Id: I77d29413c9e3b600b796627ba366f80c3281b7e1
-rw-r--r--example/defaults.conf5
-rw-r--r--example/resources.conf.prod9
-rw-r--r--example/resources.conf.rnd5
-rw-r--r--selftest/conf/resources.conf9
-rw-r--r--selftest/resource_test.ok26
-rw-r--r--selftest/suite_test.ok68
-rw-r--r--selftest/suite_test/resources.conf14
-rw-r--r--src/osmo_gsm_tester/bts_osmotrx.py105
-rw-r--r--src/osmo_gsm_tester/resource.py6
-rw-r--r--src/osmo_gsm_tester/schema.py7
-rw-r--r--src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl4
-rw-r--r--src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl25
12 files changed, 201 insertions, 82 deletions
diff --git a/example/defaults.conf b/example/defaults.conf
index 5bdf257..fc4c324 100644
--- a/example/defaults.conf
+++ b/example/defaults.conf
@@ -75,3 +75,8 @@ nanobts:
- {}
- phys_chan_config: TCH/F # nanobts only supports PDCH in TRX0.
- phys_chan_config: TCH/F
+
+osmo_trx:
+ type: uhd
+ launch_trx: true
+ clock_reference: internal
diff --git a/example/resources.conf.prod b/example/resources.conf.prod
index 31a737c..41ab009 100644
--- a/example/resources.conf.prod
+++ b/example/resources.conf.prod
@@ -24,16 +24,21 @@ bts:
ipa_unit_id: 6
addr: 10.42.42.50
band: GSM-1800
- launch_trx: true
ciphers: [a5_0, a5_1]
+ osmo_trx:
+ launch_trx: true
+ clock_reference: external
- label: sysmoCell 5000
type: osmo-bts-trx
ipa_unit_id: 7
addr: 10.42.42.51
band: GSM-1800
- trx_remote_ip: 10.42.42.112
ciphers: [a5_0, a5_1]
+ osmo_trx:
+ launch_trx: false
+ clock_reference: external
+ trx_ip: 10.42.42.112
- label: OCTBTS 3500
type: osmo-bts-octphy
diff --git a/example/resources.conf.rnd b/example/resources.conf.rnd
index 4e5c173..74b8e3e 100644
--- a/example/resources.conf.rnd
+++ b/example/resources.conf.rnd
@@ -24,7 +24,10 @@ bts:
ipa_unit_id: 6
addr: 10.42.42.50
band: GSM-1800
- launch_trx: true
+ osmo_trx:
+ type: uhd
+ launch_trx: true
+ clock_reference: external
ciphers: [a5_0, a5_1]
- label: NanoBTS-ONW-1900
diff --git a/selftest/conf/resources.conf b/selftest/conf/resources.conf
index 51f4abc..84d0ab9 100644
--- a/selftest/conf/resources.conf
+++ b/selftest/conf/resources.conf
@@ -23,7 +23,9 @@ bts:
ipa_unit_id: 6
addr: 10.42.42.50
band: GSM-1800
- launch_trx: true
+ osmo_trx:
+ launch_trx: true
+ clock_reference: external
ciphers:
- 'a5_0'
- 'a5_1'
@@ -33,7 +35,10 @@ bts:
ipa_unit_id: 7
addr: 10.42.42.51
band: GSM-1800
- trx_remote_ip: 10.42.42.112
+ osmo_trx:
+ launch_trx: false
+ clock_reference: external
+ trx_ip: 10.42.42.112
ciphers:
- 'a5_0'
- 'a5_1'
diff --git a/selftest/resource_test.ok b/selftest/resource_test.ok
index 3ec922b..08989a2 100644
--- a/selftest/resource_test.ok
+++ b/selftest/resource_test.ok
@@ -54,21 +54,23 @@ cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/s
'ipa_unit_id': '1',
'label': 'sysmoBTS 1002',
'type': 'osmo-bts-sysmo'},
- {'_hash': '6a9c9fbd364e1563a5b9f0826030a7888fd19575',
+ {'_hash': '2158317d5e0055070e7174c2498dedf53a2957e9',
'addr': '10.42.42.50',
'band': 'GSM-1800',
'ciphers': ['a5_0', 'a5_1'],
'ipa_unit_id': '6',
'label': 'Ettus B200',
- 'launch_trx': 'True',
+ 'osmo_trx': {'clock_reference': 'external', 'launch_trx': 'True'},
'type': 'osmo-bts-trx'},
- {'_hash': 'e50fd38e3bfe8039ac13bc315bc84f46110b7443',
+ {'_hash': 'f964ba5fe7a37b97ec3e0c4ef21c9231a19de45d',
'addr': '10.42.42.51',
'band': 'GSM-1800',
'ciphers': ['a5_0', 'a5_1'],
'ipa_unit_id': '7',
'label': 'sysmoCell 5000',
- 'trx_remote_ip': '10.42.42.112',
+ 'osmo_trx': {'clock_reference': 'external',
+ 'launch_trx': 'False',
+ 'trx_ip': '10.42.42.112'},
'type': 'osmo-bts-trx'}],
'ip_address': [{'_hash': 'fd103b22c7cf2480d609150e06f4bbd92ac78d8c',
'addr': '10.42.42.2'},
@@ -129,7 +131,7 @@ cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/s
ipa_unit_id: '1'
label: sysmoBTS 1002
type: osmo-bts-sysmo
-- _hash: 6a9c9fbd364e1563a5b9f0826030a7888fd19575
+- _hash: 2158317d5e0055070e7174c2498dedf53a2957e9
addr: 10.42.42.50
band: GSM-1800
ciphers:
@@ -137,7 +139,9 @@ cnf ResourcesPool: DBG: Found path state_dir as [PATH]/selftest/conf/test_work/s
- a5_1
ipa_unit_id: '6'
label: Ettus B200
- launch_trx: 'True'
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'True'
type: osmo-bts-trx
--- testowner: Reserving 1 x ip_address (candidates: 5)
--- testowner: DBG: Picked - _hash: fd103b22c7cf2480d609150e06f4bbd92ac78d8c
@@ -183,7 +187,7 @@ bts:
ipa_unit_id: '1'
label: sysmoBTS 1002
type: osmo-bts-sysmo
-- _hash: 6a9c9fbd364e1563a5b9f0826030a7888fd19575
+- _hash: 2158317d5e0055070e7174c2498dedf53a2957e9
_reserved_by: testowner-123-1490837279
addr: 10.42.42.50
band: GSM-1800
@@ -192,7 +196,9 @@ bts:
- a5_1
ipa_unit_id: '6'
label: Ettus B200
- launch_trx: 'True'
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'True'
type: osmo-bts-trx
ip_address:
- _hash: fd103b22c7cf2480d609150e06f4bbd92ac78d8c
@@ -240,15 +246,15 @@ resources(testowner)={'arfcn': [{'_hash': 'e620569450f8259b3f0212ec19c285dd07df0
'ipa_unit_id': '1',
'label': 'sysmoBTS 1002',
'type': 'osmo-bts-sysmo'},
- {'_hash': '6a9c9fbd364e1563a5b9f0826030a7888fd19575',
+ {'_hash': '2158317d5e0055070e7174c2498dedf53a2957e9',
'_reserved_by': 'testowner-123-1490837279',
'addr': '10.42.42.50',
'band': 'GSM-1800',
'ciphers': ['a5_0', 'a5_1'],
'ipa_unit_id': '6',
'label': 'Ettus B200',
- 'launch_trx': 'True',
'num_trx': 2,
+ 'osmo_trx': {'clock_reference': 'external', 'launch_trx': 'True'},
'type': 'osmo-bts-trx'}],
'ip_address': [{'_hash': 'fd103b22c7cf2480d609150e06f4bbd92ac78d8c',
'_reserved_by': 'testowner-123-1490837279',
diff --git a/selftest/suite_test.ok b/selftest/suite_test.ok
index b792b57..908f24f 100644
--- a/selftest/suite_test.ok
+++ b/selftest/suite_test.ok
@@ -37,28 +37,34 @@ tst {combining_scenarios='resources'}: DBG: {definition_conf={bts=[{'label': 'sy
tst test_suite: DBG: {combining='modifiers'}
tst {combining_scenarios='modifiers'}: DBG: {definition_conf={}} [test_suite↪{combining_scenarios='modifiers'}]
tst test_suite: Reserving 3 x bts (candidates: 6)
-tst test_suite: DBG: Picked - _hash: 076ff06a4b719e61779492d3fb99f42a6635bb72
+tst test_suite: DBG: Picked - _hash: a59640b8ba6a373552b24a6f9f65cadd2347bace
addr: 10.42.42.53
band: GSM-1800
ipa_unit_id: '7'
label: sysmoCell 5000
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'False'
+ trx_ip: 10.42.42.112
trx_list:
- max_power_red: '3'
nominal_power: '10'
- max_power_red: '0'
nominal_power: '12'
- trx_remote_ip: 10.42.42.112
type: osmo-bts-trx
-- _hash: 9eaa928b04ce04b19dbae972f9bfc3eea6f5e249
+- _hash: c2feabd082c36a1cdeccb9a5237dfff7dbadb009
addr: 10.42.42.53
band: GSM-1800
ipa_unit_id: '7'
label: sysmoCell 5000
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'False'
+ trx_ip: 10.42.42.112
trx_list:
- nominal_power: '10'
- max_power_red: '1'
nominal_power: '12'
- trx_remote_ip: 10.42.42.112
type: osmo-bts-trx
- _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
addr: 10.42.42.114
@@ -183,28 +189,34 @@ tst test_suite: DBG: {combining='modifiers'} [suite.py:[LINENR]]
tst {combining_scenarios='modifiers'}: DBG: {definition_conf={}} [test_suite↪{combining_scenarios='modifiers'}] [suite.py:[LINENR]]
tst {combining_scenarios='modifiers', scenario='foo'}: DBG: {conf={}, scenario='foo'} [test_suite↪{combining_scenarios='modifiers', scenario='foo'}] [suite.py:[LINENR]]
tst test_suite: Reserving 3 x bts (candidates: 6) [resource.py:[LINENR]]
-tst test_suite: DBG: Picked - _hash: 076ff06a4b719e61779492d3fb99f42a6635bb72
+tst test_suite: DBG: Picked - _hash: a59640b8ba6a373552b24a6f9f65cadd2347bace
addr: 10.42.42.53
band: GSM-1800
ipa_unit_id: '7'
label: sysmoCell 5000
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'False'
+ trx_ip: 10.42.42.112
trx_list:
- max_power_red: '3'
nominal_power: '10'
- max_power_red: '0'
nominal_power: '12'
- trx_remote_ip: 10.42.42.112
type: osmo-bts-trx
-- _hash: 9eaa928b04ce04b19dbae972f9bfc3eea6f5e249
+- _hash: c2feabd082c36a1cdeccb9a5237dfff7dbadb009
addr: 10.42.42.53
band: GSM-1800
ipa_unit_id: '7'
label: sysmoCell 5000
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'False'
+ trx_ip: 10.42.42.112
trx_list:
- nominal_power: '10'
- max_power_red: '1'
nominal_power: '12'
- trx_remote_ip: 10.42.42.112
type: osmo-bts-trx
- _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
addr: 10.42.42.114
@@ -264,28 +276,34 @@ tst test_suite: DBG: {combining='modifiers'} [suite.py:[LINENR]]
tst {combining_scenarios='modifiers'}: DBG: {definition_conf={}} [test_suite↪{combining_scenarios='modifiers'}] [suite.py:[LINENR]]
tst {combining_scenarios='modifiers', scenario='foo'}: DBG: {conf={}, scenario='foo'} [test_suite↪{combining_scenarios='modifiers', scenario='foo'}] [suite.py:[LINENR]]
tst test_suite: Reserving 3 x bts (candidates: 6) [resource.py:[LINENR]]
-tst test_suite: DBG: Picked - _hash: 076ff06a4b719e61779492d3fb99f42a6635bb72
+tst test_suite: DBG: Picked - _hash: a59640b8ba6a373552b24a6f9f65cadd2347bace
addr: 10.42.42.53
band: GSM-1800
ipa_unit_id: '7'
label: sysmoCell 5000
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'False'
+ trx_ip: 10.42.42.112
trx_list:
- max_power_red: '3'
nominal_power: '10'
- max_power_red: '0'
nominal_power: '12'
- trx_remote_ip: 10.42.42.112
type: osmo-bts-trx
-- _hash: 9eaa928b04ce04b19dbae972f9bfc3eea6f5e249
+- _hash: c2feabd082c36a1cdeccb9a5237dfff7dbadb009
addr: 10.42.42.53
band: GSM-1800
ipa_unit_id: '7'
label: sysmoCell 5000
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'False'
+ trx_ip: 10.42.42.112
trx_list:
- nominal_power: '10'
- max_power_red: '1'
nominal_power: '12'
- trx_remote_ip: 10.42.42.112
type: osmo-bts-trx
- _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
addr: 10.42.42.114
@@ -341,28 +359,34 @@ tst test_suite: DBG: {combining='modifiers'} [suite.py:[LINENR]]
tst {combining_scenarios='modifiers'}: DBG: {definition_conf={}} [test_suite↪{combining_scenarios='modifiers'}] [suite.py:[LINENR]]
tst {combining_scenarios='modifiers', scenario='foo'}: DBG: {conf={bts=[{'trx_list': [{'nominal_power': '20'}, {'nominal_power': '20'}]}, {'trx_list': [{'nominal_power': '20'}, {'nominal_power': '20'}]}, {'type': 'sysmo'}]}, scenario='foo'} [test_suite↪{combining_scenarios='modifiers', scenario='foo'}] [suite.py:[LINENR]]
tst test_suite: Reserving 3 x bts (candidates: 6) [resource.py:[LINENR]]
-tst test_suite: DBG: Picked - _hash: 076ff06a4b719e61779492d3fb99f42a6635bb72
+tst test_suite: DBG: Picked - _hash: a59640b8ba6a373552b24a6f9f65cadd2347bace
addr: 10.42.42.53
band: GSM-1800
ipa_unit_id: '7'
label: sysmoCell 5000
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'False'
+ trx_ip: 10.42.42.112
trx_list:
- max_power_red: '3'
nominal_power: '10'
- max_power_red: '0'
nominal_power: '12'
- trx_remote_ip: 10.42.42.112
type: osmo-bts-trx
-- _hash: 9eaa928b04ce04b19dbae972f9bfc3eea6f5e249
+- _hash: c2feabd082c36a1cdeccb9a5237dfff7dbadb009
addr: 10.42.42.53
band: GSM-1800
ipa_unit_id: '7'
label: sysmoCell 5000
+ osmo_trx:
+ clock_reference: external
+ launch_trx: 'False'
+ trx_ip: 10.42.42.112
trx_list:
- nominal_power: '10'
- max_power_red: '1'
nominal_power: '12'
- trx_remote_ip: 10.42.42.112
type: osmo-bts-trx
- _hash: 07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9
addr: 10.42.42.114
@@ -387,25 +411,29 @@ tst test_suite: DBG: Picked - _hash: 19c69e45aa090fb511446bd00797690aa82ff52f
label: m7802
path: /wavecom_1
[resource.py:[LINENR]]
-resources(test_suite)={'bts': [{'_hash': '076ff06a4b719e61779492d3fb99f42a6635bb72',
+resources(test_suite)={'bts': [{'_hash': 'a59640b8ba6a373552b24a6f9f65cadd2347bace',
'_reserved_by': 'test_suite-[ID_NUM]-[ID_NUM]',
'addr': '10.42.42.53',
'band': 'GSM-1800',
'ipa_unit_id': '7',
'label': 'sysmoCell 5000',
+ 'osmo_trx': {'clock_reference': 'external',
+ 'launch_trx': 'False',
+ 'trx_ip': '10.42.42.112'},
'trx_list': [{'max_power_red': '3', 'nominal_power': '20'},
{'max_power_red': '0', 'nominal_power': '20'}],
- 'trx_remote_ip': '10.42.42.112',
'type': 'osmo-bts-trx'},
- {'_hash': '9eaa928b04ce04b19dbae972f9bfc3eea6f5e249',
+ {'_hash': 'c2feabd082c36a1cdeccb9a5237dfff7dbadb009',
'_reserved_by': 'test_suite-[ID_NUM]-[ID_NUM]',
'addr': '10.42.42.53',
'band': 'GSM-1800',
'ipa_unit_id': '7',
'label': 'sysmoCell 5000',
+ 'osmo_trx': {'clock_reference': 'external',
+ 'launch_trx': 'False',
+ 'trx_ip': '10.42.42.112'},
'trx_list': [{'nominal_power': '20'},
{'max_power_red': '1', 'nominal_power': '20'}],
- 'trx_remote_ip': '10.42.42.112',
'type': 'osmo-bts-trx'},
{'_hash': '07d9c8aaa940b674efcbbabdd69f58a6ce4e94f9',
'_reserved_by': 'test_suite-[ID_NUM]-[ID_NUM]',
diff --git a/selftest/suite_test/resources.conf b/selftest/suite_test/resources.conf
index 440e55c..bd121cb 100644
--- a/selftest/suite_test/resources.conf
+++ b/selftest/suite_test/resources.conf
@@ -33,7 +33,9 @@ bts:
ipa_unit_id: 6
addr: 10.42.42.52
band: GSM-1800
- launch_trx: true
+ osmo_trx:
+ launch_trx: true
+ clock_reference: external
trx_list:
- nominal_power: 10
max_power_red: 2
@@ -44,7 +46,10 @@ bts:
ipa_unit_id: 7
addr: 10.42.42.53
band: GSM-1800
- trx_remote_ip: 10.42.42.112
+ osmo_trx:
+ launch_trx: false
+ clock_reference: external
+ trx_ip: 10.42.42.112
trx_list:
- nominal_power: 10
max_power_red: 3
@@ -56,7 +61,10 @@ bts:
ipa_unit_id: 7
addr: 10.42.42.53
band: GSM-1800
- trx_remote_ip: 10.42.42.112
+ osmo_trx:
+ launch_trx: false
+ clock_reference: external
+ trx_ip: 10.42.42.112
trx_list:
- nominal_power: 10
- nominal_power: 12
diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py
index 1584eb2..1c7349f 100644
--- a/src/osmo_gsm_tester/bts_osmotrx.py
+++ b/src/osmo_gsm_tester/bts_osmotrx.py
@@ -20,6 +20,7 @@
import os
import pprint
import tempfile
+from abc import ABCMeta, abstractmethod
from . import log, config, util, template, process, pcu_osmo, bts_osmo
from .event_loop import MainLoop
@@ -39,17 +40,15 @@ class OsmoBtsTrx(bts_osmo.OsmoBtsMainUnit):
self.inst = None
self.trx = None
self.env = {}
+ self.gen_conf = {}
def trx_remote_ip(self):
- conf_ip = self.conf.get('trx_remote_ip', None)
+ conf_ip = self.conf.get('osmo_trx', {}).get('trx_ip', None)
if conf_ip is not None:
return conf_ip
# if 'trx_remote_ip' is not configured, use same IP as BTS
return self.remote_addr()
- def launch_trx_enabled(self):
- return util.str2bool(self.conf.get('launch_trx'))
-
def launch_process(self, keepalive, binary_name, *args):
binary = os.path.abspath(self.inst.child('bin', binary_name))
run_dir = self.run_dir.new_dir(binary_name)
@@ -69,17 +68,22 @@ class OsmoBtsTrx(bts_osmo.OsmoBtsMainUnit):
self.dbg(config_file=self.config_file)
values = dict(osmo_bts_trx=config.get_defaults('osmo_bts_trx'))
+ config.overlay(values, dict(osmo_bts_trx=dict(osmo_trx=config.get_defaults('osmo_trx'))))
config.overlay(values, self.suite_run.config())
config.overlay(values, {
'osmo_bts_trx': {
'oml_remote_ip': self.bsc.addr(),
- 'trx_local_ip': self.remote_addr(),
- 'trx_remote_ip': self.trx_remote_ip(),
'pcu_socket_path': self.pcu_socket_path(),
+ 'osmo_trx': {
+ 'bts_ip': self.remote_addr(),
+ 'trx_ip': self.trx_remote_ip(),
+ 'channels': [{}] # TODO: implement channels for multiTRX
+ }
}
})
config.overlay(values, { 'osmo_bts_trx': self.conf })
+ self.gen_conf = values
self.dbg('OSMO-BTS-TRX CONFIG:\n' + pprint.pformat(values))
with open(self.config_file, 'w') as f:
@@ -87,6 +91,12 @@ class OsmoBtsTrx(bts_osmo.OsmoBtsMainUnit):
self.dbg(r)
f.write(r)
+ def launch_trx_enabled(self):
+ return util.str2bool(self.gen_conf['osmo_bts_trx'].get('osmo_trx', {}).get('launch_trx'))
+
+ def get_osmo_trx_type(self):
+ return self.gen_conf['osmo_bts_trx'].get('osmo_trx', {}).get('type')
+
########################
# PUBLIC - INTERNAL API
########################
@@ -95,6 +105,9 @@ class OsmoBtsTrx(bts_osmo.OsmoBtsMainUnit):
self.dbg(conf=values)
return values
+ def conf_for_osmotrx(self):
+ return dict(osmo_trx=self.gen_conf['osmo_bts_trx'].get('osmo_trx', {}))
+
###################
# PUBLIC (test API included)
###################
@@ -108,9 +121,9 @@ class OsmoBtsTrx(bts_osmo.OsmoBtsMainUnit):
self.configure()
if self.launch_trx_enabled():
- self.trx = OsmoTrx(self.suite_run, self.conf, self.trx_remote_ip(), self.remote_addr())
+ self.trx = OsmoTrx.get_instance_by_type(self.get_osmo_trx_type(), self.suite_run, self.conf_for_osmotrx())
self.trx.start(keepalive)
- self.log('Waiting for osmo-trx to start up...')
+ self.log('Waiting for %s to start up...' % self.trx.name())
MainLoop.wait(self, self.trx.trx_ready)
self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmo-bts')))
@@ -124,36 +137,42 @@ class OsmoBtsTrx(bts_osmo.OsmoBtsMainUnit):
'-i', self.bsc.addr())
self.suite_run.poll()
-class OsmoTrx(log.Origin):
- suite_run = None
- run_dir = None
- inst = None
- env = None
- proc_trx = None
+class OsmoTrx(log.Origin, metaclass=ABCMeta):
- BIN_TRX = 'osmo-trx-uhd'
CONF_OSMO_TRX = 'osmo-trx.cfg'
- def __init__(self, suite_run, conf, listen_ip, bts_ip):
- super().__init__(log.C_RUN, OsmoTrx.BIN_TRX)
+##############
+# PROTECTED
+##############
+ def __init__(self, suite_run, conf):
+ super().__init__(log.C_RUN, self.binary_name())
self.suite_run = suite_run
self.conf = conf
self.env = {}
- self.listen_ip = listen_ip
- self.bts_ip = bts_ip
+ self.listen_ip = conf.get('trx_ip')
+ self.bts_ip = conf.get('bts_ip')
+ self.run_dir = None
+ self.inst = None
+ self.proc_trx = None
+
+ @classmethod
+ def get_instance_by_type(cls, type, suite_run, conf):
+ KNOWN_OSMOTRX_TYPES = {
+ 'uhd': OsmoTrxUHD,
+ }
+ osmo_trx_class = KNOWN_OSMOTRX_TYPES.get(type)
+ return osmo_trx_class(suite_run, conf)
+
+ @abstractmethod
+ def binary_name(self):
+ 'Used by base class. Subclass can create different OsmoTRX implementations.'
+ pass
def configure(self):
self.config_file = self.run_dir.new_file(OsmoTrx.CONF_OSMO_TRX)
self.dbg(config_file=self.config_file)
- values = dict(osmo_bts_trx=config.get_defaults('osmo_trx'))
- config.overlay(values, self.suite_run.config())
- config.overlay(values, {
- 'osmo_trx': {
- 'bind_ip' : self.listen_ip,
- }
- })
- config.overlay(values, { 'osmo_trx': self.conf })
+ values = self.conf
self.dbg('OSMO-TRX CONFIG:\n' + pprint.pformat(values))
@@ -162,16 +181,6 @@ class OsmoTrx(log.Origin):
self.dbg(r)
f.write(r)
- def start(self, keepalive=False):
- 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-trx')))
- lib = self.inst.child('lib')
- self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
- self.proc_trx = self.launch_process(keepalive, OsmoTrx.BIN_TRX, '-x',
- '-j', self.listen_ip, '-i', self.bts_ip,
- '-C', os.path.abspath(self.config_file))
-
def launch_process(self, keepalive, binary_name, *args):
binary = os.path.abspath(self.inst.child('bin', binary_name))
run_dir = self.run_dir.new_dir(binary_name)
@@ -184,8 +193,30 @@ class OsmoTrx(log.Origin):
proc.launch()
return proc
+##############
+# PUBLIC (test API included)
+##############
+ def start(self, keepalive=False):
+ 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-trx')))
+ lib = self.inst.child('lib')
+ self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) }
+ self.proc_trx = self.launch_process(keepalive, self.binary_name(),
+ '-C', os.path.abspath(self.config_file))
+
def trx_ready(self):
if not self.proc_trx or not self.proc_trx.is_running:
return False
return '-- Transceiver active with' in (self.proc_trx.get_stdout() or '')
+
+class OsmoTrxUHD(OsmoTrx):
+ BIN_TRX = 'osmo-trx-uhd'
+
+ def __init__(self, suite_run, conf):
+ super().__init__(suite_run, conf)
+
+ def binary_name(self):
+ return OsmoTrxUHD.BIN_TRX
+
# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py
index 15f2711..9ca5665 100644
--- a/src/osmo_gsm_tester/resource.py
+++ b/src/osmo_gsm_tester/resource.py
@@ -54,8 +54,6 @@ RESOURCES_SCHEMA = {
'bts[].ipa_unit_id': schema.UINT,
'bts[].addr': schema.IPV4,
'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[].channel_allocator': schema.CHAN_ALLOCATOR,
@@ -70,6 +68,10 @@ RESOURCES_SCHEMA = {
'bts[].trx_list[].power_supply.type': schema.STR,
'bts[].trx_list[].power_supply.device': schema.STR,
'bts[].trx_list[].power_supply.port': schema.STR,
+ 'bts[].osmo_trx.launch_trx': schema.BOOL_STR,
+ 'bts[].osmo_trx.type': schema.STR,
+ 'bts[].osmo_trx.clock_reference': schema.OSMO_TRX_CLOCK_REF,
+ 'bts[].osmo_trx.trx_ip': schema.IPV4,
'arfcn[].arfcn': schema.INT,
'arfcn[].band': schema.BAND,
'modem[].label': schema.STR,
diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py
index 174c28f..12cfd7a 100644
--- a/src/osmo_gsm_tester/schema.py
+++ b/src/osmo_gsm_tester/schema.py
@@ -115,6 +115,11 @@ def codec(val):
return
raise ValueError('Unknown Codec value: %r' % val)
+def osmo_trx_clock_ref(val):
+ if val in ('internal', 'external', 'gspdo'):
+ return
+ raise ValueError('Unknown OsmoTRX clock reference value: %r' % val)
+
INT = 'int'
STR = 'str'
UINT = 'uint'
@@ -132,6 +137,7 @@ MODEM_FEATURE = 'modem_feature'
PHY_CHAN = 'chan'
CHAN_ALLOCATOR = 'chan_allocator'
CODEC = 'codec'
+OSMO_TRX_CLOCK_REF = 'osmo_trx_clock_ref'
SCHEMA_TYPES = {
INT: int,
@@ -151,6 +157,7 @@ SCHEMA_TYPES = {
PHY_CHAN: phy_channel_config,
CHAN_ALLOCATOR: channel_allocator,
CODEC: codec,
+ OSMO_TRX_CLOCK_REF: osmo_trx_clock_ref,
}
def validate(config, schema):
diff --git a/src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl
index d95ca6e..5dba323 100644
--- a/src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl
@@ -21,8 +21,8 @@ ctrl
bind ${osmo_bts_trx.addr}
!
phy 0
- osmotrx ip local ${osmo_bts_trx.trx_local_ip}
- osmotrx ip remote ${osmo_bts_trx.trx_remote_ip}
+ osmotrx ip local ${osmo_bts_trx.osmo_trx.bts_ip}
+ osmotrx ip remote ${osmo_bts_trx.osmo_trx.trx_ip}
instance 0
osmotrx rx-gain 25
osmotrx tx-attenuation oml
diff --git a/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl
index a197c59..2f6e830 100644
--- a/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl
@@ -1,15 +1,34 @@
!
-! OsmoHLR example configuration
+! OsmoTRX example configuration
!
log stderr
logging filter all 1
logging color 1
logging print category 1
logging timestamp 1
+ logging print file basename
logging print extended-timestamp 1
logging level all info
!
line vty
- bind ${osmo_trx.bind_ip}
+ bind ${osmo_trx.trx_ip}
ctrl
- bind ${osmo_trx.bind_ip}
+ bind ${osmo_trx.trx_ip}
+trx
+ bind-ip ${osmo_trx.trx_ip}
+ remote-ip ${osmo_trx.bts_ip}
+ base-port 5700
+ egprs disable
+ tx-sps 4
+ rx-sps 4
+ clock-ref ${osmo_trx.clock_reference}
+ rt-prio 18
+%for chan in osmo_trx.channels:
+ chan ${loop.index}
+% if chan.get('tx_path', False):
+ tx-path ${chan.tx_path}
+% endif
+% if chan.get('rx_path', False):
+ rx-path ${chan.rx_path}
+ %endif
+%endfor