path: root/src/osmo_gsm_tester/osmo_nitb.py
diff options
authorPau Espin Pedrol <pespin@sysmocom.de>2017-08-24 16:57:17 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-24 17:09:11 +0200
commit713ce2cf869f9a3ad325ace03574af22b9ae321e (patch)
tree9c552eb3d2de211b0298f1cabdd5cdd30c1f44f8 /src/osmo_gsm_tester/osmo_nitb.py
parent387526aa99d526a1e36f8c72015b91011abbfc64 (diff)
Introduce auth_algo modem config attribute
Algorithm to use to generate response for the challenge during authentication time is hardcoded in the sim card and cannot be easily changed. Thus specify in the config of each modem the algorithm used by the SIM Card. This attribute is used add subscriber_add() time, when the IMSI, KI and algorithm to use in the MSC to authenticate a given subscriber is stored in the database. This way we can easily set up a specific algorithm for each SimCard/Modem, in case different SimCards are configured with different algorithms. This can be used to specificially test different algorithms too. For instance, let's imagine we have 2 simcards, one configured to use comp128v1 and another one with xor, and we create a test which ckecks that XOR is algo is working fine. We don't want to accidentally select the modem with comp128v1 in this case. Thus we can use this attribute to create a scenario file matching 'auth_algo: xor' to ensure always the correct modem is picked. Change-Id: Ifdf74630afeb05452994bbc9eb62a745a1d745ce
Diffstat (limited to 'src/osmo_gsm_tester/osmo_nitb.py')
1 files changed, 14 insertions, 4 deletions
diff --git a/src/osmo_gsm_tester/osmo_nitb.py b/src/osmo_gsm_tester/osmo_nitb.py
index be3b24b..8f91bbd 100644
--- a/src/osmo_gsm_tester/osmo_nitb.py
+++ b/src/osmo_gsm_tester/osmo_nitb.py
@@ -112,12 +112,24 @@ class OsmoNitb(log.Origin):
def mcc_mnc(self):
return (self.mcc(), self.mnc())
- 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)
+ if not algo:
+ alg_str = modem.auth_algo()
+ if not alg_str or alg_str == 'none':
+ algo = None
+ elif alg_str == 'comp128v1':
+ algo = 'comp128v1'
+ elif alg_str == 'xor':
+ algo = 'xor'
+ if algo is not None and not modem.ki():
+ raise log.Error("Auth algo %r selected and no KI specified" % algo)
self.log('Add subscriber', msisdn=msisdn, imsi=modem.imsi())
- OsmoNitbCtrl(self).subscriber_add(modem.imsi(), msisdn, modem.ki())
+ OsmoNitbCtrl(self).subscriber_add(modem.imsi(), msisdn, modem.ki(), algo)
def subscriber_delete(self, modem):
self.log('Delete subscriber', imsi=modem.imsi())
@@ -155,8 +167,6 @@ class OsmoNitbCtrl(log.Origin):
def subscriber_add(self, imsi, msisdn, ki=None, algo=None):
created = False
- if ki and not algo:
- algo = 'comp128v1'
if algo:
value = '%s,%s,%s,%s' % (imsi,msisdn,algo,ki)