From a415a225cfcf0ec05e0979547fdb3e22a3b99bfe Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Tue, 7 Aug 2018 15:41:45 +0200 Subject: [PATCH] sysmo_usimsjs1: Also recognize algo by its number The test 04_algo.sh suggests that an algorithm should also be identified by its number (this is the old way). Since we upgraded the commandline interface to accept the names of the algorithms the support for the old way that used numbers had been removed. However, we should stay compatible with the old method to keep legacy scripts of customers working. - Check if the given parameter that references tha algorithem is a number. If yes, us it, otherwise lookup the number by the given string name. Change-Id: Ib41e4870d05820b6967f648eeeba416113bbc120 Related: OS#3376 --- sysmo_usimsjs1.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sysmo_usimsjs1.py b/sysmo_usimsjs1.py index 789a052..d569b72 100644 --- a/sysmo_usimsjs1.py +++ b/sysmo_usimsjs1.py @@ -292,8 +292,16 @@ def sysmo_usim_show_auth_params(sim): # Program new authentication parameters def sysmo_usim_write_auth_params(sim, algo_2g_str, algo_3g_str): - algo_2g = sysmo_usim_str_to_algo(algo_2g_str) - algo_3g = sysmo_usim_str_to_algo(algo_3g_str) + + if algo_2g_str.isdigit(): + algo_2g = int(algo_2g_str) + else: + algo_2g = sysmo_usim_str_to_algo(algo_2g_str) + + if algo_3g_str.isdigit(): + algo_3g = int(algo_2g_str) + else: + algo_3g = sysmo_usim_str_to_algo(algo_3g_str) print " * New algorithm setting:" print " 2G: %d=%s" % (algo_2g, sysmo_usim_algo_to_str(algo_2g))