ninjab3s has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21582 )


Change subject: enb: Set cipher and integrity via scenario file
......................................................................

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 chipher algorithms:
- 
4g:srsue-rftype@uhd+srsenb-rftype@uhd+mod-amarisoftenb-cipher@1+mod-amarisoftenb-cipher@0+mod-enb-nprb@6
- 
4g:srsue-rftype@uhd+srsenb-rftype@uhd+mod-srsenb-cipher@EEA1+mod-srsenb-cipher@EEA0+mod-enb-nprb@6

Change-Id: I595206b7d49016fb6d0aec175c828d9537c53886
---
M src/osmo_gsm_tester/core/schema.py
M src/osmo_gsm_tester/obj/bts.py
M src/osmo_gsm_tester/obj/enb.py
M src/osmo_gsm_tester/obj/ms.py
M src/osmo_gsm_tester/templates/amarisoft_enb.cfg.tmpl
M src/osmo_gsm_tester/templates/srsenb.conf.tmpl
M sysmocom/defaults.conf
A sysmocom/scenarios/mod-amarisoftenb-cipher@.conf
A sysmocom/scenarios/mod-amarisoftenb-integrity@.conf
A sysmocom/scenarios/mod-srsenb-cipher@.conf
A sysmocom/scenarios/mod-srsenb-integrity@.conf
11 files changed, 65 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester 
refs/changes/82/21582/1

diff --git a/src/osmo_gsm_tester/core/schema.py 
b/src/osmo_gsm_tester/core/schema.py
index d56d6ec..9d6bc11 100644
--- a/src/osmo_gsm_tester/core/schema.py
+++ b/src/osmo_gsm_tester/core/schema.py
@@ -105,11 +105,29 @@
         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 in ('EEA0', 'EEA1', 'EEA2'):
+        # srsENB
+        return True
+    if val in ('0', '1', '2'):
+        # Amarisoft eNB
+        return True
+    raise ValueError('Unknown 4G cipher value: %r' % val)
+
+def integrity_4g(val):
+    if val in ('EIA0', 'EIA1', 'EIA2'):
+        # srsENB
+        return True
+    if val in ('0', '1', '2',):
+        # Amarisoft eNB
+        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'):
         return True
@@ -165,7 +183,9 @@
 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 +209,8 @@
         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 +219,7 @@
         OSMO_TRX_CLOCK_REF: osmo_trx_clock_ref,
         LTE_TRANSMISSION_MODE: lte_transmission_mode,
         DURATION: duration,
+        INTEGRITY_4G: integrity_4g,
     }

 def add(dest, src):
diff --git a/src/osmo_gsm_tester/obj/bts.py b/src/osmo_gsm_tester/obj/bts.py
index 5b43642..2453fef 100644
--- a/src/osmo_gsm_tester/obj/bts.py
+++ b/src/osmo_gsm_tester/obj/bts.py
@@ -31,7 +31,7 @@
         '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,
diff --git a/src/osmo_gsm_tester/obj/enb.py b/src/osmo_gsm_tester/obj/enb.py
index cdf9505..ce4a8fb 100644
--- a/src/osmo_gsm_tester/obj/enb.py
+++ b/src/osmo_gsm_tester/obj/enb.py
@@ -44,6 +44,8 @@
         '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,
diff --git a/src/osmo_gsm_tester/obj/ms.py b/src/osmo_gsm_tester/obj/ms.py
index 7257769..3d0827d 100644
--- a/src/osmo_gsm_tester/obj/ms.py
+++ b/src/osmo_gsm_tester/obj/ms.py
@@ -31,7 +31,7 @@
         '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)
diff --git a/src/osmo_gsm_tester/templates/amarisoft_enb.cfg.tmpl 
b/src/osmo_gsm_tester/templates/amarisoft_enb.cfg.tmpl
index 4c7aa33..fb41fb1 100644
--- a/src/osmo_gsm_tester/templates/amarisoft_enb.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/amarisoft_enb.cfg.tmpl
@@ -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_algo)))}],
     /* RRC integrity algorithm preference. EIA0 is always the last. */
-    integ_algo_pref: [2, 1],
+    integ_algo_pref: [${', '.join(list(dict.fromkeys(enb.integrity_algo)))}],

     /* (in ms) send RRC connection release after this time of network
        inactivity */
diff --git a/src/osmo_gsm_tester/templates/srsenb.conf.tmpl 
b/src/osmo_gsm_tester/templates/srsenb.conf.tmpl
index 5df432b..3bcb9ac 100644
--- a/src/osmo_gsm_tester/templates/srsenb.conf.tmpl
+++ b/src/osmo_gsm_tester/templates/srsenb.conf.tmpl
@@ -282,5 +282,5 @@
 #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)))}
+eia_pref_list = ${', '.join(list(dict.fromkeys(enb.integrity_list)))}
diff --git a/sysmocom/defaults.conf b/sysmocom/defaults.conf
index 7704857..c0ebf30 100644
--- a/sysmocom/defaults.conf
+++ b/sysmocom/defaults.conf
@@ -153,6 +153,14 @@
   tx_gain: 80
   rx_gain: 40
   log_all_level: warning
+  cipher_4g:
+    - EEA0
+    - EEA2
+    - EEA1
+  integrity_4g:
+    - EIA2
+    - EIA1
+    - EIA0
   cell_list:
    - dl_rfemu:
        type: srsenb_stdin
@@ -165,6 +173,10 @@
   tx_gain: 89
   rx_gain: 60
   rf_dev_sync: none
+  cipher_4g: []
+  integrity_4g:
+    - 2
+    - 1
   log_options: 
all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,s1ap.level=debug,s1ap.max_size=1,x2ap.level=debug,x2ap.max_size=1,rrc.level=debug,rrc.max_size=1

 srsue:
diff --git a/sysmocom/scenarios/mod-amarisoftenb-cipher@.conf 
b/sysmocom/scenarios/mod-amarisoftenb-cipher@.conf
new file mode 100644
index 0000000..38a8002
--- /dev/null
+++ b/sysmocom/scenarios/mod-amarisoftenb-cipher@.conf
@@ -0,0 +1,5 @@
+modifiers:
+  enb:
+    - type: amarisoftenb
+      cipher_list:
+        - ${param1}
diff --git a/sysmocom/scenarios/mod-amarisoftenb-integrity@.conf 
b/sysmocom/scenarios/mod-amarisoftenb-integrity@.conf
new file mode 100644
index 0000000..ce58fbd
--- /dev/null
+++ b/sysmocom/scenarios/mod-amarisoftenb-integrity@.conf
@@ -0,0 +1,5 @@
+modifiers:
+  enb:
+    - type: amarisoftenb
+      integrity_list:
+        - ${param1}
diff --git a/sysmocom/scenarios/mod-srsenb-cipher@.conf 
b/sysmocom/scenarios/mod-srsenb-cipher@.conf
new file mode 100644
index 0000000..36c798e
--- /dev/null
+++ b/sysmocom/scenarios/mod-srsenb-cipher@.conf
@@ -0,0 +1,5 @@
+modifiers:
+  enb:
+    - type: srsenb
+      cipher_list:
+        - ${param1}
diff --git a/sysmocom/scenarios/mod-srsenb-integrity@.conf 
b/sysmocom/scenarios/mod-srsenb-integrity@.conf
new file mode 100644
index 0000000..013399e
--- /dev/null
+++ b/sysmocom/scenarios/mod-srsenb-integrity@.conf
@@ -0,0 +1,5 @@
+modifiers:
+  enb:
+    - type: srsenb
+      integrity_list:
+        - ${param1}

--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/21582
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I595206b7d49016fb6d0aec175c828d9537c53886
Gerrit-Change-Number: 21582
Gerrit-PatchSet: 1
Gerrit-Owner: ninjab3s <nils.fuer...@softwareradiosystems.com>
Gerrit-MessageType: newchange

Reply via email to