summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-08-22 20:04:42 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-23 15:21:57 +0200
commitabc8fa5da1abf2805d59e07e27c0c4f3a8969bf0 (patch)
tree8328600c6416ecd44db0dabf89a17b6ae3d80b70
parentb33fe854427001449fe4f25c11e26b584f1ddee6 (diff)
hlr: fill auc_2g table when registering a subscriber
-rw-r--r--src/osmo_gsm_tester/osmo_hlr.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/osmo_gsm_tester/osmo_hlr.py b/src/osmo_gsm_tester/osmo_hlr.py
index 19241cc..fbcd43e 100644
--- a/src/osmo_gsm_tester/osmo_hlr.py
+++ b/src/osmo_gsm_tester/osmo_hlr.py
@@ -31,6 +31,10 @@ class OsmoHlr(log.Origin):
process = None
next_subscriber_id = 1
+ AUTH_ALGO_NONE = 0
+ AUTH_ALGO_XOR = 1
+ AUTH_ALGO_COMP128v1 = 2
+
def __init__(self, suite_run, ip_address):
super().__init__(log.C_RUN, 'osmo-hlr_%s' % ip_address.get('addr'))
self.suite_run = suite_run
@@ -113,16 +117,21 @@ class OsmoHlr(log.Origin):
f.write(sql)
self.run_sql_file(name, sql_file)
- def subscriber_add(self, modem, msisdn=None):
+ def subscriber_add(self, modem, msisdn=None, algo=None):
if msisdn is None:
msisdn = self.suite_run.resources_pool.next_msisdn(modem)
modem.set_msisdn(msisdn)
subscriber_id = self.next_subscriber_id
self.next_subscriber_id += 1
- self.log('Add subscriber', msisdn=msisdn, imsi=modem.imsi(), subscriber_id=subscriber_id)
+ if not algo:
+ algo = self.AUTH_ALGO_COMP128v1 if modem.ki() else self.AUTH_ALGO_NONE
+ self.log('Add subscriber', msisdn=msisdn, imsi=modem.imsi(), subscriber_id=subscriber_id, algo=algo)
self.run_sql('add_subscriber',
'insert into subscriber (id, imsi, msisdn) values (%r, %r, %r);'
% (subscriber_id, modem.imsi(), modem.msisdn))
+ self.run_sql('add_subscriber',
+ 'insert into auc_2g (subscriber_id, algo_id_2g, ki) values (%r, %r, %r);'
+ % (subscriber_id, algo, modem.ki()))
return subscriber_id
def conf_for_msc(self):