laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/36960?usp=email )
Change subject: esim.saip: Implement ProfileElement.header_name for more PE types ......................................................................
esim.saip: Implement ProfileElement.header_name for more PE types
We now cover all PE types as of PE_Definitions-3.3.1.asn
Change-Id: I37951a0441fe53fce7a329066aebd973389cb743 --- M pySim/esim/saip/__init__.py 1 file changed, 27 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py index 3a71989..7301e81 100644 --- a/pySim/esim/saip/__init__.py +++ b/pySim/esim/saip/__init__.py @@ -137,6 +137,20 @@ """Class representing a Profile Element (PE) within a SAIP Profile.""" FILE_BEARING = ['mf', 'cd', 'telecom', 'usim', 'opt-usim', 'isim', 'opt-isim', 'phonebook', 'gsm-access', 'csim', 'opt-csim', 'eap', 'df-5gs', 'df-saip', 'df-snpn', 'df-5gprose', 'iot', 'opt-iot'] + # in their infinite wisdom the spec authors used inconsistent/irregular naming of PE type vs. hedaer field + # names, so we have to manually translate the exceptions here... + header_name_translation_dict = { + 'header': None, + 'genericFileManagement': 'gfm-header', + 'akaParameter': 'aka-header', + 'cdmaParameter': 'cdma-header', + # note how they couldn't even consistently captialize the 'header' suffix :( + 'application': 'app-Header', + 'pukCodes': 'puk-Header', + 'pinCodes': 'pin-Header', + 'securityDomain': 'sd-Header', + } + def __init__(self, decoded = None): self.decoded = decoded
@@ -173,6 +187,8 @@ # unneccessarry compliaction by inconsistent naming :( if self.type.startswith('opt-'): return self.type.replace('-','') + '-header' + if self.type in self.header_name_translation_dict: + return self.header_name_translation_dict[self.type] return self.type + '-header'
@property