laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/41454?usp=email )
Change subject: pySim.esim.es8p: Support non-operational ProfileMetadata ......................................................................
pySim.esim.es8p: Support non-operational ProfileMetadata
If no profileClass is given, ProfileMetadata defaults to operational. Let's add the capability to also generate metadata for test or provisioning profiles.
Change-Id: Id55537ed03e2690c1fc9545bb3c49cfc76d8e331 --- M pySim/esim/es8p.py 1 file changed, 10 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/54/41454/1
diff --git a/pySim/esim/es8p.py b/pySim/esim/es8p.py index 9c76084..6926cae 100644 --- a/pySim/esim/es8p.py +++ b/pySim/esim/es8p.py @@ -76,10 +76,11 @@ class ProfileMetadata: """Representation of Profile metadata. Right now only the mandatory bits are supported, but in general this should follow the StoreMetadataRequest of SGP.22 5.5.3""" - def __init__(self, iccid_bin: bytes, spn: str, profile_name: str): + def __init__(self, iccid_bin: bytes, spn: str, profile_name: str, profile_class = 'operational'): self.iccid_bin = iccid_bin self.spn = spn self.profile_name = profile_name + self.profile_class = profile_class self.icon = None self.icon_type = None self.notifications = [] @@ -105,6 +106,14 @@ 'serviceProviderName': self.spn, 'profileName': self.profile_name, } + if self.profile_class == 'test': + smr['profileClass'] = 0 + elif self.profile_class == 'provisioning': + smr['profileClass'] = 1 + elif self.profile_class == 'operational': + smr['profileClass'] = 2 + else: + raise ValueError('Unsupported Profile Class %s' % self.profile_class) if self.icon: smr['icon'] = self.icon smr['iconType'] = self.icon_type