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
This commit is contained in:
parent
a9fdda85af
commit
0d45504267
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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]',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue