osmo-bsc: Parametrize codec-list VTY cfg

Change-Id: I1678aba43e8d399ecad192cbc416698373e3c0a0
This commit is contained in:
Pau Espin 2018-08-27 12:53:41 +02:00
parent c264d3df9d
commit 5dc245938b
10 changed files with 42 additions and 2 deletions

View File

@ -14,6 +14,8 @@ bsc:
short_name: osmo-gsm-tester-msc
long_name: osmo-gsm-tester-msc
encryption: a5_0
codec_list:
- hr3
msc:
net:

View File

@ -0,0 +1,5 @@
config:
bsc:
net:
codec_list:
- fr1

View File

@ -0,0 +1,5 @@
config:
bsc:
net:
codec_list:
- fr2

View File

@ -0,0 +1,5 @@
config:
bsc:
net:
codec_list:
- fr3

View File

@ -0,0 +1,5 @@
config:
bsc:
net:
codec_list:
- hr1

View File

@ -0,0 +1,5 @@
config:
bsc:
net:
codec_list:
- hr2

View File

@ -0,0 +1,5 @@
config:
bsc:
net:
codec_list:
- hr3

View File

@ -87,7 +87,8 @@ WANT_SCHEMA = util.dict_add(
RESOURCES_SCHEMA)
CONF_SCHEMA = util.dict_add(
{ 'defaults.timeout': schema.STR },
{ 'defaults.timeout': schema.STR,
'config.bsc.net.codec_list[]': schema.CODEC },
dict([('resources.%s' % key, val) for key, val in WANT_SCHEMA.items()]),
dict([('modifiers.%s' % key, val) for key, val in WANT_SCHEMA.items()]))

View File

@ -110,6 +110,11 @@ def channel_allocator(val):
return
raise ValueError('Unknown Channel Allocator Policy %r' % val)
def codec(val):
if val in ('hr1', 'hr2', 'hr3', 'fr1', 'fr2', 'fr3'):
return
raise ValueError('Unknown Codec value: %r' % val)
INT = 'int'
STR = 'str'
UINT = 'uint'
@ -126,6 +131,7 @@ CIPHER = 'cipher'
MODEM_FEATURE = 'modem_feature'
PHY_CHAN = 'chan'
CHAN_ALLOCATOR = 'chan_allocator'
CODEC = 'codec'
SCHEMA_TYPES = {
INT: int,
@ -144,6 +150,7 @@ SCHEMA_TYPES = {
MODEM_FEATURE: modem_feature,
PHY_CHAN: phy_channel_config,
CHAN_ALLOCATOR: channel_allocator,
CODEC: codec,
}
def validate(config, schema):

View File

@ -110,7 +110,7 @@ msc
mgw remote-port 2427
mgw local-ip ${bsc.ip_address.addr}
mgw endpoint-range 1 31
codec-list hr3
codec-list ${' '.join(bsc.net.codec_list)}
amr-config 12_2k forbidden
amr-config 10_2k forbidden
amr-config 7_95k forbidden