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
This commit is contained in:
Philipp Maier 2018-08-07 15:41:45 +02:00
parent ed0c9ab4dc
commit a415a225cf
1 changed files with 10 additions and 2 deletions

View File

@ -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))