neels has uploaded this change for review.

View Change

personalization: set some typical parameter names

These names better match what humans expect to read, for example "PIN1"
instead of "Pin1".

(We still fall back to the __class__.__name__ if a subclass omits a
specific name, see the ConfigurableParameter init.)

Change-Id: I31f390d634e58c384589c50a33ca45d6f86d4e10
---
M pySim/esim/saip/personalization.py
1 file changed, 11 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/93/40093/1
diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py
index d09be46..a97706f 100644
--- a/pySim/esim/saip/personalization.py
+++ b/pySim/esim/saip/personalization.py
@@ -272,6 +272,7 @@
class Iccid(DecimalParam):
"""ICCID Parameter. Input: string of decimal digits.
If the string of digits is only 18 digits long, add a Luhn check digit."""
+ name = 'ICCID'
min_len = 18
max_len = 20

@@ -290,6 +291,8 @@
class Imsi(DecimalParam):
"""Configurable IMSI. Expects value to be a string of digits. Automatically sets the ACC to
the last digit of the IMSI."""
+
+ name = 'IMSI'
min_len = 6
max_len = 15

@@ -473,9 +476,11 @@
f" cannot find pukCode with keyReference={cls.keyReference}")

class Puk1(Puk):
+ name = 'PUK1'
keyReference = 0x01

class Puk2(Puk):
+ name = 'PUK2'
keyReference = 0x81

class Pin(DecimalHexParam):
@@ -505,9 +510,11 @@
+ f' {cls.get_name()} cannot find pinCode with keyReference={cls.keyReference}')

class Pin1(Pin):
+ name = 'PIN1'
keyReference = 0x01

class Pin2(Pin):
+ name = 'PIN2'
keyReference = 0x81

@classmethod
@@ -523,9 +530,11 @@
+ f' {cls.get_name()} cannot find pinCode with keyReference={cls.keyReference} in {naa=}')

class Adm1(Pin):
+ name = 'ADM1'
keyReference = 0x0A

class Adm2(Pin):
+ name = 'ADM2'
keyReference = 0x0B

class AlgoConfig(ConfigurableParameter):
@@ -561,8 +570,10 @@

class K(BinaryParam, AlgoConfig):
"""use validate_val() from BinaryParam, and apply_val() from AlgoConfig"""
+ name = 'K'
algo_config_key = 'key'
allow_len = int(128/8) # length in bytes (from BinaryParam)

class Opc(K):
+ name = 'OPc'
algo_config_key = 'opc'

To view, visit change 40093. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I31f390d634e58c384589c50a33ca45d6f86d4e10
Gerrit-Change-Number: 40093
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr@sysmocom.de>