laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/pysim/+/35244?usp=email )

Change subject: euicc: Fix encoding of {enable,disable,delete}_profile
......................................................................

euicc: Fix encoding of {enable,disable,delete}_profile

The encoding was missing a "CHOICE" container and missed the
fact that the refreshFlag presence is mandatory for enable+disable.

Change-Id: I12e2b16b2c1b4b01dfad0d1fb485399827f25ddc
---
M pySim/euicc.py
1 file changed, 27 insertions(+), 17 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/pySim/euicc.py b/pySim/euicc.py
index c89d364..c74ca66 100644
--- a/pySim/euicc.py
+++ b/pySim/euicc.py
@@ -206,12 +206,14 @@
     pass

 # SGP.22 Section 5.7.16:: EnableProfile
-class RefreshFlag(BER_TLV_IE, tag=0x88): # FIXME
+class RefreshFlag(BER_TLV_IE, tag=0x81): # FIXME
     _construct = Int8ub # FIXME
 class EnableResult(BER_TLV_IE, tag=0x80):
     _construct = Enum(Int8ub, ok=0, iccidOrAidNotFound=1, 
profileNotInDisabledState=2,
                       disallowedByPolicy=3, wrongProfileReenabling=4, 
catBusy=5, undefinedError=127)
-class EnableProfileReq(BER_TLV_IE, tag=0xbf31, nested=[IsdpAid, Iccid, 
RefreshFlag]):
+class ProfileIdentifier(BER_TLV_IE, tag=0xa0, nested=[IsdpAid, Iccid]):
+    pass
+class EnableProfileReq(BER_TLV_IE, tag=0xbf31, nested=[ProfileIdentifier, 
RefreshFlag]):
     pass
 class EnableProfileResp(BER_TLV_IE, tag=0xbf31, nested=[EnableResult]):
     pass
@@ -220,7 +222,7 @@
 class DisableResult(BER_TLV_IE, tag=0x80):
     _construct = Enum(Int8ub, ok=0, iccidOrAidNotFound=1, 
profileNotInEnabledState=2,
                       disallowedByPolicy=3, catBusy=5, undefinedError=127)
-class DisableProfileReq(BER_TLV_IE, tag=0xbf32, nested=[IsdpAid, Iccid, 
RefreshFlag]):
+class DisableProfileReq(BER_TLV_IE, tag=0xbf32, nested=[ProfileIdentifier, 
RefreshFlag]):
     pass
 class DisableProfileResp(BER_TLV_IE, tag=0xbf32, nested=[DisableResult]):
     pass
@@ -229,7 +231,7 @@
 class DeleteResult(BER_TLV_IE, tag=0x80):
     _construct = Enum(Int8ub, ok=0, iccidOrAidNotFound=1, 
profileNotInDisabledState=2,
                       disallowedByPolicy=3, undefinedError=127)
-class DeleteProfileReq(BER_TLV_IE, tag=0xbf33, nested=[IsdpAid, Iccid]):
+class DeleteProfileReq(BER_TLV_IE, tag=0xbf33, nested=[ProfileIdentifier]):
     pass
 class DeleteProfileResp(BER_TLV_IE, tag=0xbf33, nested=[DeleteResult]):
     pass
@@ -404,13 +406,11 @@
         @cmd2.with_argparser(en_prof_parser)
         def do_enable_profile(self, opts):
             """Perform an ES10c EnableProfile function."""
-            ep_cmd_contents = []
             if opts.isdp_aid:
-                ep_cmd_contents.append(IsdpAid(decoded=opts.isdp_aid))
+                p_id = 
ProfileIdentifier(children=[IsdpAid(decoded=opts.isdp_aid)])
             if opts.iccid:
-                ep_cmd_contents.append(Iccid(decoded=opts.iccid))
-            if opts.refresh_required:
-                ep_cmd_contents.append(RefreshFlag())
+                p_id = ProfileIdentifier(children=[Iccid(decoded=opts.iccid)])
+            ep_cmd_contents = [p_id, 
RefreshFlag(decoded=opts.refresh_required)]
             ep_cmd = EnableProfileReq(children=ep_cmd_contents)
             ep = ADF_ISDR.store_data_tlv(self._cmd.lchan.scc, ep_cmd, 
EnableProfileResp)
             d = ep.to_dict()
@@ -425,13 +425,11 @@
         @cmd2.with_argparser(dis_prof_parser)
         def do_disable_profile(self, opts):
             """Perform an ES10c DisableProfile function."""
-            dp_cmd_contents = []
             if opts.isdp_aid:
-                dp_cmd_contents.append(IsdpAid(decoded=opts.isdp_aid))
+                p_id = 
ProfileIdentifier(children=[IsdpAid(decoded=opts.isdp_aid)])
             if opts.iccid:
-                dp_cmd_contents.append(Iccid(decoded=opts.iccid))
-            if opts.refresh_required:
-                dp_cmd_contents.append(RefreshFlag())
+                p_id = ProfileIdentifier(children=[Iccid(decoded=opts.iccid)])
+            dp_cmd_contents = [p_id, 
RefreshFlag(decoded=opts.refresh_required)]
             dp_cmd = DisableProfileReq(children=dp_cmd_contents)
             dp = ADF_ISDR.store_data_tlv(self._cmd.lchan.scc, dp_cmd, 
DisableProfileResp)
             d = dp.to_dict()
@@ -445,11 +443,11 @@
         @cmd2.with_argparser(del_prof_parser)
         def do_delete_profile(self, opts):
             """Perform an ES10c DeleteProfile function."""
-            dp_cmd_contents = []
             if opts.isdp_aid:
-                dp_cmd_contents.append(IsdpAid(decoded=opts.isdp_aid))
+                p_id = 
ProfileIdentifier(children=[IsdpAid(decoded=opts.isdp_aid)])
             if opts.iccid:
-                dp_cmd_contents.append(Iccid(decoded=opts.iccid))
+                p_id = ProfileIdentifier(children=[Iccid(decoded=opts.iccid)])
+            dp_cmd_contents = [p_id]
             dp_cmd = DeleteProfileReq(children=dp_cmd_contents)
             dp = ADF_ISDR.store_data_tlv(self._cmd.lchan.scc, dp_cmd, 
DeleteProfileResp)
             d = dp.to_dict()

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/35244?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I12e2b16b2c1b4b01dfad0d1fb485399827f25ddc
Gerrit-Change-Number: 35244
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-MessageType: merged

Reply via email to