Attention is currently required from: neels.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/39741?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: [1/7] personalization: refactor: drop ClassVarMeta use
......................................................................
[1/7] personalization: refactor: drop ClassVarMeta use
Drop the ClassVarMeta/metaclass/ABCMeta stuff -- it doesn't seem to
serve any purpose that is not similarly achieved with plain python
inheritance.
Upcoming patches will use normal inheritance a lot more.
Note that most use of the ClassVarMeta was in the SdKey subclasses, and
that these currently don't actually work. See the fix in patch
I07dfc378705eba1318e9e8652796cbde106c6a52 .
Related: SYS#6768
Change-Id: I60ea8fd11fb438ec90ddb08b17b658cbb789c051
---
M pySim/esim/saip/personalization.py
1 file changed, 128 insertions(+), 84 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/41/39741/4
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39741?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I60ea8fd11fb438ec90ddb08b17b658cbb789c051
Gerrit-Change-Number: 39741
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Attention is currently required from: neels.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/39748?usp=email
to look at the new patch set (#3).
Change subject: pylint: personalization.py: fix E1135: permitted_len unsupported-membership-test
......................................................................
pylint: personalization.py: fix E1135: permitted_len unsupported-membership-test
pre-empt this from coming up in patch
I60ea8fd11fb438ec90ddb08b17b658cbb789c051:
E1135: Value 'self.permitted_len' doesn't support membership test (unsupported-membership-test) pickermitted_len
Change-Id: I0343f8dbbffefb4237a1cb4dd40b576f16111073
---
M pySim/esim/saip/personalization.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/48/39748/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39748?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I0343f8dbbffefb4237a1cb4dd40b576f16111073
Gerrit-Change-Number: 39748
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Attention is currently required from: neels.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/39741?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: [1/7] personalization: refactor: drop ClassVarMeta use
......................................................................
[1/7] personalization: refactor: drop ClassVarMeta use
Drop the ClassVarMeta/metaclass/ABCMeta stuff -- it doesn't seem to
serve any purpose that is not similarly achieved with plain python
inheritance.
Upcoming patches will use normal inheritance a lot more.
Note that most use of the ClassVarMeta was in the SdKey subclasses, and
that these currently don't actually work. See the fix in patch
I07dfc378705eba1318e9e8652796cbde106c6a52 .
Related: SYS#6768
Change-Id: I60ea8fd11fb438ec90ddb08b17b658cbb789c051
---
M pySim/esim/saip/personalization.py
1 file changed, 117 insertions(+), 76 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/41/39741/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39741?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I60ea8fd11fb438ec90ddb08b17b658cbb789c051
Gerrit-Change-Number: 39741
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
neels has uploaded a new patch set (#2). ( https://gerrit.osmocom.org/c/pysim/+/39748?usp=email )
Change subject: pylint: fix E1135: permitted_len unsupported-membership-test
......................................................................
pylint: fix E1135: permitted_len unsupported-membership-test
pre-empt this from coming up in patch
I60ea8fd11fb438ec90ddb08b17b658cbb789c051:
E1135: Value 'self.permitted_len' doesn't support membership test (unsupported-membership-test) pickermitted_len
Change-Id: I0343f8dbbffefb4237a1cb4dd40b576f16111073
---
M pySim/esim/saip/personalization.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/48/39748/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39748?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I0343f8dbbffefb4237a1cb4dd40b576f16111073
Gerrit-Change-Number: 39748
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: Jenkins Builder
Attention is currently required from: neels.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/39741?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: [1/7] personalization: refactor: drop ClassVarMeta use
......................................................................
[1/7] personalization: refactor: drop ClassVarMeta use
Drop the ClassVarMeta/metaclass/ABCMeta stuff -- it doesn't seem to
serve any purpose that is not similarly achieved with plain python
inheritance.
Upcoming patches will use normal inheritance a lot more.
Note that most use of the ClassVarMeta was in the SdKey subclasses, and
that these currently don't actually work. See the fix in patch
I07dfc378705eba1318e9e8652796cbde106c6a52 .
Related: SYS#6768
Change-Id: I60ea8fd11fb438ec90ddb08b17b658cbb789c051
---
M pySim/esim/saip/personalization.py
1 file changed, 104 insertions(+), 67 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/41/39741/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39741?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I60ea8fd11fb438ec90ddb08b17b658cbb789c051
Gerrit-Change-Number: 39741
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Attention is currently required from: neels.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/39742?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: [2/7] personalization: refactor ConfigurableParameter, Iccid, Imsi
......................................................................
[2/7] personalization: refactor ConfigurableParameter, Iccid, Imsi
Main points/rationales of the refactoring, details below:
1) common validation implementation
2) offer classmethods
The new features are optional, and will be heavily used by batch
personalization patches coming soon.
Implement Iccid and Imsi to use the new way, with a common abstract
DecimalParam implementation.
So far leave the other parameter classes working as they always did, to
follow suit in subsequent commits.
Details:
1) common validation implementation:
There are very common validation steps in the various parameter
implementations. It is more convenient and much more readable to
implement those once and set simple validation parameters per subclass.
So there now is a validate_val() classmethod, which subclasses can use
as-is to apply the validation parameters -- or subclasses can override
their cls.validate_val() for specialized validation.
(Those subclasses that this patch doesn't touch still override the
self.validate() instance method. Hence they still work as before this
patch, but don't use the new common features yet.)
2) offer stateless classmethods:
It is useful for...
- batch processing of multiple profiles (in upcoming patches) and
- user input validation
to be able to have classmethods that do what self.validate() and
self.apply() do, but do not modify any self.* members.
So far the paradigm was to create a class instance to keep state about
the value. This remains available, but in addition we make available the
paradigm of a singleton that is stateless (the classmethods).
Using self.validate() and self.apply() still work the same as before
this patch, i.e. via self.input_value and self.value -- but in addition,
there are now classmethods that don't touch self.* members.
Related: SYS#6768
Change-Id: I6522be4c463e34897ca9bff2309b3706a88b3ce8
---
M pySim/esim/saip/personalization.py
1 file changed, 177 insertions(+), 34 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/42/39742/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39742?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I6522be4c463e34897ca9bff2309b3706a88b3ce8
Gerrit-Change-Number: 39742
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/39747?usp=email )
Change subject: [7/7] personalization: refactor SdKey
......................................................................
[7/7] personalization: refactor SdKey
Refactor SdKey (and subclasses) to the new ConfigurableParameter
implementation style, keeping the same implementation.
But duly note that this implementation does not work!
It correctly patches pe.decoded[], but that gets overridden by
ProfileElementSD._pre_encode().
For a fix, see I07dfc378705eba1318e9e8652796cbde106c6a52.
Change-Id: I427ea851bfa28b2b045e70a19a9e35d361f0d393
---
M pySim/esim/saip/personalization.py
1 file changed, 13 insertions(+), 20 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/47/39747/1
diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py
index c591c7d..6567520 100644
--- a/pySim/esim/saip/personalization.py
+++ b/pySim/esim/saip/personalization.py
@@ -196,44 +196,37 @@
val = super().validate_val(val)
return bytes(val)
-class SdKey(ConfigurableParameter):
+class SdKey(BinaryParam):
"""Configurable Security Domain (SD) Key. Value is presented as bytes."""
- # these will be set by derived classes
+ # these will be set by subclasses
key_type = None
key_id = None
kvn = None
key_usage_qual = None
- permitted_len = None
- def validate(self):
- if not isinstance(self.input_value, (io.BytesIO, bytes, bytearray)):
- raise ValueError('Value must be of bytes-like type')
- if self.permitted_len:
- if len(self.input_value) not in self.permitted_len:
- raise ValueError('Value length must be %s' % self.permitted_len)
- self.value = self.input_value
-
- def _apply_sd(self, pe: ProfileElement):
+ @classmethod
+ def _apply_sd(cls, pe: ProfileElement, value):
assert pe.type == 'securityDomain'
for key in pe.decoded['keyList']:
- if key['keyIdentifier'][0] == self.key_id and key['keyVersionNumber'][0] == self.kvn:
+ if key['keyIdentifier'][0] == cls.key_id and key['keyVersionNumber'][0] == cls.kvn:
assert len(key['keyComponents']) == 1
- key['keyComponents'][0]['keyData'] = self.value
+ key['keyComponents'][0]['keyData'] = value
return
# Could not find matching key to patch, create a new one
key = {
- 'keyUsageQualifier': bytes([self.key_usage_qual]),
- 'keyIdentifier': bytes([self.key_id]),
- 'keyVersionNumber': bytes([self.kvn]),
+ 'keyUsageQualifier': bytes([cls.key_usage_qual]),
+ 'keyIdentifier': bytes([cls.key_id]),
+ 'keyVersionNumber': bytes([cls.kvn]),
'keyComponents': [
- { 'keyType': bytes([self.key_type]), 'keyData': self.value },
+ { 'keyType': bytes([cls.key_type]), 'keyData': value },
]
}
pe.decoded['keyList'].append(key)
- def apply(self, pes: ProfileElementSequence):
+ @classmethod
+ def apply_val(cls, pes: ProfileElementSequence, value):
for pe in pes.get_pes_for_type('securityDomain'):
- self._apply_sd(pe)
+ cls._apply_sd(pe, value)
class SdKeyScp80_01(SdKey):
kvn = 0x01
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/39747?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I427ea851bfa28b2b045e70a19a9e35d361f0d393
Gerrit-Change-Number: 39747
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>