aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-07-13 12:01:10 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-07-13 18:33:53 +0200
commit0f7f265114742ba2ca9e88c0dfb94ffe5537d72e (patch)
tree787ffb39355a21bb506884eed54b8f28d1e3092c /src/osmo_gsm_tester
parentf96d590703e6328c181414b8315f41a43e05e95f (diff)
4G: Add milenage support
Diffstat (limited to 'src/osmo_gsm_tester')
-rw-r--r--src/osmo_gsm_tester/core/schema.py6
-rw-r--r--src/osmo_gsm_tester/obj/epc_amarisoft.py5
-rw-r--r--src/osmo_gsm_tester/obj/epc_srs.py9
-rw-r--r--src/osmo_gsm_tester/obj/ms.py4
-rw-r--r--src/osmo_gsm_tester/obj/ms_amarisoft.py3
-rw-r--r--src/osmo_gsm_tester/obj/ms_srs.py3
-rw-r--r--src/osmo_gsm_tester/templates/amarisoft_ltemme.cfg.tmpl5
-rw-r--r--src/osmo_gsm_tester/templates/amarisoft_lteue.cfg.tmpl4
-rw-r--r--src/osmo_gsm_tester/templates/srsepc_user_db.csv.tmpl2
-rw-r--r--src/osmo_gsm_tester/templates/srsue.conf.tmpl4
10 files changed, 38 insertions, 7 deletions
diff --git a/src/osmo_gsm_tester/core/schema.py b/src/osmo_gsm_tester/core/schema.py
index 9a346cd..72c2738 100644
--- a/src/osmo_gsm_tester/core/schema.py
+++ b/src/osmo_gsm_tester/core/schema.py
@@ -28,6 +28,7 @@ IPV4_RE = re.compile('([0-9]{1,3}.){3}[0-9]{1,3}')
HWADDR_RE = re.compile('([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}')
IMSI_RE = re.compile('[0-9]{6,15}')
KI_RE = re.compile('[0-9a-fA-F]{32}')
+OPC_RE = re.compile('[0-9a-fA-F]{32}')
MSISDN_RE = re.compile('[0-9]{1,15}')
def match_re(name, regex, val):
@@ -60,6 +61,9 @@ def imsi(val):
def ki(val):
return match_re('KI', KI_RE, val)
+def opc(val):
+ return match_re('OPC', OPC_RE, val)
+
def msisdn(val):
return match_re('MSISDN', MSISDN_RE, val)
@@ -157,6 +161,7 @@ IPV4 = 'ipv4'
HWADDR = 'hwaddr'
IMSI = 'imsi'
KI = 'ki'
+OPC = 'opc'
MSISDN = 'msisdn'
AUTH_ALGO = 'auth_algo'
TIMES='times'
@@ -180,6 +185,7 @@ SCHEMA_TYPES = {
HWADDR: hwaddr,
IMSI: imsi,
KI: ki,
+ OPC: opc,
MSISDN: msisdn,
AUTH_ALGO: auth_algo,
TIMES: times,
diff --git a/src/osmo_gsm_tester/obj/epc_amarisoft.py b/src/osmo_gsm_tester/obj/epc_amarisoft.py
index 40216f7..3e91b5c 100644
--- a/src/osmo_gsm_tester/obj/epc_amarisoft.py
+++ b/src/osmo_gsm_tester/obj/epc_amarisoft.py
@@ -177,8 +177,11 @@ class AmarisoftEPC(epc.EPC):
if algo_str != util.OSMO_AUTH_ALGO_NONE and not modem.ki():
raise log.Error("Auth algo %r selected but no KI specified" % algo_str)
+ if algo_str == 'milenage' and not modem.opc():
+ raise log.Error("Auth algo milenage selected but no OPC specified")
+
subscriber_id = len(self.subscriber_list) # list index
- self.subscriber_list.append({'id': subscriber_id, 'imsi': modem.imsi(), 'msisdn': msisdn, 'auth_algo': algo_str, 'ki': modem.ki(), 'opc': None, 'apn_ipaddr': modem.apn_ipaddr()})
+ self.subscriber_list.append({'id': subscriber_id, 'imsi': modem.imsi(), 'msisdn': msisdn, 'auth_algo': algo_str, 'ki': modem.ki(), 'opc': modem.opc(), 'apn_ipaddr': modem.apn_ipaddr()})
self.log('Add subscriber', msisdn=msisdn, imsi=modem.imsi(), subscriber_id=subscriber_id,
algo_str=algo_str)
diff --git a/src/osmo_gsm_tester/obj/epc_srs.py b/src/osmo_gsm_tester/obj/epc_srs.py
index 9c4b004..44e06a5 100644
--- a/src/osmo_gsm_tester/obj/epc_srs.py
+++ b/src/osmo_gsm_tester/obj/epc_srs.py
@@ -190,8 +190,15 @@ class srsEPC(epc.EPC):
if algo_str != util.OSMO_AUTH_ALGO_NONE and not modem.ki():
raise log.Error("Auth algo %r selected but no KI specified" % algo_str)
+ if algo_str == 'milenage':
+ if not modem.opc():
+ raise log.Error("Auth algo milenage selected but no OPC specified")
+ # srsepc's used_db uses token 'mil' for milenage:
+ algo_str = 'mil'
+
+ opc = (modem.opc() or '')
subscriber_id = len(self.subscriber_list) # list index
- self.subscriber_list.append({'id': subscriber_id, 'imsi': modem.imsi(), 'msisdn': msisdn, 'auth_algo': algo_str, 'ki': modem.ki(), 'opc': None, 'apn_ipaddr': modem.apn_ipaddr()})
+ self.subscriber_list.append({'id': subscriber_id, 'imsi': modem.imsi(), 'msisdn': msisdn, 'auth_algo': algo_str, 'ki': modem.ki(), 'opc': opc, 'apn_ipaddr': modem.apn_ipaddr()})
self.log('Add subscriber', msisdn=msisdn, imsi=modem.imsi(), subscriber_id=subscriber_id,
algo_str=algo_str)
diff --git a/src/osmo_gsm_tester/obj/ms.py b/src/osmo_gsm_tester/obj/ms.py
index b39d3ee..3e75719 100644
--- a/src/osmo_gsm_tester/obj/ms.py
+++ b/src/osmo_gsm_tester/obj/ms.py
@@ -28,6 +28,7 @@ def on_register_schemas():
'path': schema.STR,
'imsi': schema.IMSI,
'ki': schema.KI,
+ 'opc': schema.OPC,
'auth_algo': schema.AUTH_ALGO,
'apn_ipaddr': schema.IPV4,
'ciphers[]': schema.CIPHER,
@@ -100,6 +101,9 @@ class MS(log.Origin, metaclass=ABCMeta):
def ki(self):
return self._conf.get('ki')
+ def opc(self):
+ return self._conf.get('opc', None)
+
def apn_ipaddr(self):
return self._conf.get('apn_ipaddr', 'dynamic')
diff --git a/src/osmo_gsm_tester/obj/ms_amarisoft.py b/src/osmo_gsm_tester/obj/ms_amarisoft.py
index 565786b..7af6283 100644
--- a/src/osmo_gsm_tester/obj/ms_amarisoft.py
+++ b/src/osmo_gsm_tester/obj/ms_amarisoft.py
@@ -231,7 +231,8 @@ class AmarisoftUE(MS):
config.overlay(values, dict(ue=self.testenv.suite().config().get('modem', {})))
config.overlay(values, dict(ue=self._conf))
config.overlay(values, dict(ue=dict(addr = self.addr(),
- num_antennas = self.enb.num_ports())))
+ num_antennas = self.enb.num_ports(),
+ opc = self.opc())))
logfile = self.log_file if self._run_node.is_local() else self.remote_log_file
ifupfile = self.ifup_file if self._run_node.is_local() else self.remote_ifup_file
diff --git a/src/osmo_gsm_tester/obj/ms_srs.py b/src/osmo_gsm_tester/obj/ms_srs.py
index 96623a2..124b113 100644
--- a/src/osmo_gsm_tester/obj/ms_srs.py
+++ b/src/osmo_gsm_tester/obj/ms_srs.py
@@ -246,7 +246,8 @@ class srsUE(MS, srslte_common):
values = dict(ue=config.get_defaults('srsue'))
config.overlay(values, dict(ue=self.testenv.suite().config().get('modem', {})))
config.overlay(values, dict(ue=self._conf))
- config.overlay(values, dict(ue=dict(num_antennas = self.enb.num_ports())))
+ config.overlay(values, dict(ue=dict(num_antennas = self.enb.num_ports(),
+ opc = self.opc())))
metricsfile = self.metrics_file if self._run_node.is_local() else self.remote_metrics_file
logfile = self.log_file if self._run_node.is_local() else self.remote_log_file
diff --git a/src/osmo_gsm_tester/templates/amarisoft_ltemme.cfg.tmpl b/src/osmo_gsm_tester/templates/amarisoft_ltemme.cfg.tmpl
index 5fcc74a..fb3ec98 100644
--- a/src/osmo_gsm_tester/templates/amarisoft_ltemme.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/amarisoft_ltemme.cfg.tmpl
@@ -154,10 +154,13 @@
amf: 0x9001, /* Authentication Management Field */
sqn: "000000000000", /* Sequence Number */
K: "${sub.ki}", /* Anritsu Test USIM */
+% if sub.opc:
+ opc: "${sub.opc}",
+% endif
/* if true, allow several UEs to have the same IMSI (useful
with test SIM cards). They are distinguished with their
IMEI. default = false. */
- multi_sim: true,
+ multi_sim: false,
},
%endfor
/* Add new entries for each IMSI/K */
diff --git a/src/osmo_gsm_tester/templates/amarisoft_lteue.cfg.tmpl b/src/osmo_gsm_tester/templates/amarisoft_lteue.cfg.tmpl
index 720c0ba..d6ba32d 100644
--- a/src/osmo_gsm_tester/templates/amarisoft_lteue.cfg.tmpl
+++ b/src/osmo_gsm_tester/templates/amarisoft_lteue.cfg.tmpl
@@ -48,8 +48,12 @@
ue_category: 4,
/* USIM data */
+ sim_algo: "${sub.auth_algo}", /* USIM authentication algorithm: xor, milenage or tuak */
imsi: "${ue.imsi}",
K: "${ue.ki}",
+% if ue.opc is not None:
+ opc: "${ue.opc}",
+% endif
/* If enabled, will try to use external SIM card using libpcsclite */
//external_sim: true,
diff --git a/src/osmo_gsm_tester/templates/srsepc_user_db.csv.tmpl b/src/osmo_gsm_tester/templates/srsepc_user_db.csv.tmpl
index 5b970bf..250b261 100644
--- a/src/osmo_gsm_tester/templates/srsepc_user_db.csv.tmpl
+++ b/src/osmo_gsm_tester/templates/srsepc_user_db.csv.tmpl
@@ -20,5 +20,5 @@
#ue2,mil,001010123456780,00112233445566778899aabbccddeeff,opc,63bfa50ee6523365ff14c1f45f88737d,8000,000000001234,7,dynamic
#ue1,xor,001010123456789,00112233445566778899aabbccddeeff,opc,63bfa50ee6523365ff14c1f45f88737d,9001,000000001255,7,dynamic
%for sub in epc.hss.subscribers:
-ogt${sub.id},${sub.auth_algo},${sub.imsi},${sub.ki},opc,63bfa50ee6523365ff14c1f45f88737d,8000,000000001234,${sub.qci},${sub.apn_ipaddr}
+ogt${sub.id},${sub.auth_algo},${sub.imsi},${sub.ki},opc,${sub.opc},8000,000000001234,${sub.qci},${sub.apn_ipaddr}
%endfor
diff --git a/src/osmo_gsm_tester/templates/srsue.conf.tmpl b/src/osmo_gsm_tester/templates/srsue.conf.tmpl
index a75be23..3a43f17 100644
--- a/src/osmo_gsm_tester/templates/srsue.conf.tmpl
+++ b/src/osmo_gsm_tester/templates/srsue.conf.tmpl
@@ -126,7 +126,9 @@ file_max_size = -1
[usim]
mode = soft
algo = ${ue.auth_algo}
-#opc = 63BFA50EE6523365FF14C1F45F88737D
+% if ue.opc is not None:
+opc = ${ue.opc}
+% endif
k = ${ue.ki}
imsi = ${ue.imsi}
imei = 353490069873319