enb: Set cipher and integrity via scenario file

This patch enables setting cipher and integrity algorithms
in Amarisoft eNB and srsENB via scenario files. If no
settings are defined following defaults are applied:
- Cipher algorithm: EEA0, EEA2, EEA1
- Integrity algorithm: EIA2, EIA1, EIA0

Example of setting cipher algorithms:
- 4g:srsue-rftype@uhd+srsenb-rftype@uhd+mod-enb-cipher@eea1+mod-enb-cipher@eea0+mod-enb-nprb@6

Change-Id: I595206b7d49016fb6d0aec175c828d9537c53886
This commit is contained in:
Nils Fürste 2020-12-03 14:14:31 +01:00 committed by Andre Puschmann
parent 215bec2f3c
commit a81801558e
10 changed files with 45 additions and 9 deletions

View File

@ -105,11 +105,22 @@ def times(val):
raise ValueError('Positive value >0 expected instead of %d' % n)
return True
def cipher(val):
def cipher_2g(val):
if val in ('a5_0', 'a5_1', 'a5_2', 'a5_3', 'a5_4', 'a5_5', 'a5_6', 'a5_7'):
return True
raise ValueError('Unknown Cipher value: %r' % val)
def cipher_4g(val):
if val.lower() in ('eea0', 'eea1', 'eea2'):
return True
raise ValueError('Unknown 4G cipher value: %r' % val)
def integrity_4g(val):
if val.lower() in ('eia0', 'eia1', 'eia2'):
# srsENB
return True
raise ValueError('Unknown 4G integrity value %r' % val)
def modem_feature(val):
if val in ('sms', 'gprs', 'voice', 'ussd', 'sim', '2g', '3g', '4g', 'dl_qam256', 'ul_qam64', 'qc_diag'):
return True
@ -165,7 +176,9 @@ OPC = 'opc'
MSISDN = 'msisdn'
AUTH_ALGO = 'auth_algo'
TIMES='times'
CIPHER = 'cipher'
CIPHER_2G = 'cipher_2g'
CIPHER_4G = 'cipher_4g'
INTEGRITY_4G = 'integrity_4g'
MODEM_FEATURE = 'modem_feature'
PHY_CHAN = 'chan'
CHAN_ALLOCATOR = 'chan_allocator'
@ -189,7 +202,8 @@ SCHEMA_TYPES = {
MSISDN: msisdn,
AUTH_ALGO: auth_algo,
TIMES: times,
CIPHER: cipher,
CIPHER_2G: cipher_2g,
CIPHER_4G: cipher_4g,
MODEM_FEATURE: modem_feature,
PHY_CHAN: phy_channel_config,
CHAN_ALLOCATOR: channel_allocator,
@ -198,6 +212,7 @@ SCHEMA_TYPES = {
OSMO_TRX_CLOCK_REF: osmo_trx_clock_ref,
LTE_TRANSMISSION_MODE: lte_transmission_mode,
DURATION: duration,
INTEGRITY_4G: integrity_4g,
}
def add(dest, src):

View File

@ -31,7 +31,7 @@ def on_register_schemas():
'addr': schema.IPV4,
'band': schema.BAND,
'direct_pcu': schema.BOOL_STR,
'ciphers[]': schema.CIPHER,
'ciphers[]': schema.CIPHER_2G,
'channel_allocator': schema.CHAN_ALLOCATOR,
'gprs_mode': schema.GPRS_MODE,
'emergency_calls_allowed': schema.BOOL_STR,

View File

@ -44,6 +44,8 @@ def on_register_schemas():
'enable_measurements': schema.BOOL_STR,
'enable_dl_awgn': schema.BOOL_STR,
'dl_awgn_snr': schema.INT,
'cipher_list[]': schema.CIPHER_4G,
'integrity_list[]': schema.INTEGRITY_4G,
'a1_report_type': schema.STR,
'a1_report_value': schema.INT,
'a1_hysteresis': schema.INT,

View File

@ -176,6 +176,10 @@ class AmarisoftENB(enb.eNodeB):
config.overlay(values, dict(enb={'enable_dl_awgn': util.str2bool(values['enb'].get('enable_dl_awgn', 'false'))}))
# Remove EEA0 from cipher list, if specified, as it's always assumed as default
cipher_list = values['enb'].get('cipher_list', None)
if "eea0" in cipher_list: cipher_list.remove("eea0")
# We need to set some specific variables programatically here to match IP addresses:
if self._conf.get('rf_dev_type') == 'zmq':
base_srate = self.num_prb2base_srate(self.num_prb())

View File

@ -31,7 +31,7 @@ def on_register_schemas():
'opc': schema.OPC,
'auth_algo': schema.AUTH_ALGO,
'apn_ipaddr': schema.IPV4,
'ciphers[]': schema.CIPHER,
'ciphers[]': schema.CIPHER_2G,
'features[]': schema.MODEM_FEATURE
}
schema.register_resource_schema('modem', resource_schema)

View File

@ -224,9 +224,9 @@
dpc_pucch_snr_target: 10,
/* RRC/UP ciphering algorithm preference. EEA0 is always the last. */
cipher_algo_pref: [],
cipher_algo_pref: [${', '.join(list(dict.fromkeys(enb.cipher_list))).split("eea")[1] if len(list(dict.fromkeys(enb.cipher_list))) > 0 else ''}],
/* RRC integrity algorithm preference. EIA0 is always the last. */
integ_algo_pref: [2, 1],
integ_algo_pref: [${', '.join(list(dict.fromkeys(enb.integrity_list))).split("eia")[1]}],
/* (in ms) send RRC connection release after this time of network
inactivity */

View File

@ -285,5 +285,5 @@ nof_prach_threads = 0
#link_failure_nof_err = 50
rrc_inactivity_timer = ${enb.inactivity_timer}
#max_prach_offset_us = 30
#eea_pref_list = EEA0, EEA2, EEA1
#eia_pref_list = EIA2, EIA1, EIA0
eea_pref_list = ${', '.join(list(dict.fromkeys(enb.cipher_list))).upper()}
eia_pref_list = ${', '.join(list(dict.fromkeys(enb.integrity_list))).upper()}

View File

@ -144,6 +144,13 @@ enb:
root_seq_idx: 205
scell_list: []
ncell_list: []
cipher_4g:
- eea0
- eea2
- eea1
integrity_4g:
- eia2
- eia1
srsenb:
num_prb: 100

View File

@ -0,0 +1,4 @@
modifiers:
enb:
- cipher_list:
- ${param1}

View File

@ -0,0 +1,4 @@
modifiers:
enb:
- integrity_list:
- ${param1}