Attention is currently required from: laforge.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/38195?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by laforge, Verified+1 by Jenkins Builder
Change subject: filesystem: pass total_len to construct of when encoding file contents
......................................................................
filesystem: pass total_len to construct of when encoding file contents
In our construct models we frequently use a context parameter "total_len",
we also pass this parameter to construct when we decode files, but we
do not pass it when we generate files. This is a problem, because when
total_len is used in the construct model, this parameter must be known
also when decoding the file.
Let's make sure that the total_len is properly determined and and passed
to construct (via pyosmocom)
Related: OS#5714
Change-Id: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b
---
M pySim/filesystem.py
M pySim/runtime.py
2 files changed, 71 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/95/38195/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38195?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: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b
Gerrit-Change-Number: 38195
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Attention is currently required from: laforge.
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38195?usp=email )
Change subject: filesystem: pass total_len to construct of when encoding file contents
......................................................................
Patch Set 2:
(4 comments)
File pySim/filesystem.py:
https://gerrit.osmocom.org/c/pysim/+/38195/comment/590b1234_be0b47ef?usp=em… :
PS1, Line 182: '
> unrelated cosmetic change. […]
Done
https://gerrit.osmocom.org/c/pysim/+/38195/comment/b190bb7d_3d5269df?usp=em… :
PS1, Line 747: if total_len is not None:
> this could deserve some documentation (doc-string or comment). […]
In case the size is not specified, the default value of the parameter in the constructor should ensure size is present. Unless the constructor is called explicitly with size = None, there should be no problem. In any case, lets put a check to be 100% sure.
https://gerrit.osmocom.org/c/pysim/+/38195/comment/dc4c591c_8901a3cc?usp=em… :
PS1, Line 1043: __get_rec_len
> why do we have double-underscores here but single-underscore for _get_size() above? Also: please ad […]
I thought I could re-use _get_size() in TransRecEf, that is why _get_size only has one underscore.
https://gerrit.osmocom.org/c/pysim/+/38195/comment/e04af2b8_86fc99d6?usp=em… :
PS1, Line 1266: return b2h(filter_dict(build_construct(self._construct, abstract_data, self._get_size(total_len))))
> Did you test that? I think a _get_rec_len() would actually be required here. […]
I see, we can not use _get_size here. As far as I understand now I would have to use the rec_len as an alternative value.
I wonder how to test this. As it seems TransRecEF registers the command set from TransparentEF, so I only get the normal update_binary commands.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38195?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b
Gerrit-Change-Number: 38195
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 18 Sep 2024 10:12:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Attention is currently required from: laforge.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/38117?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Verified-1 by Jenkins Builder
Change subject: ts_51_011: replace encoding of EF.MSISDN with construct model
......................................................................
ts_51_011: replace encoding of EF.MSISDN with construct model
The encoding of EF.MSISDN is currently done with enc_msisdn and
dec_msisdn from utils.py. Let's replace this with a construct
based model, similar to the one we already use with EF.ADN
Related: OS#5714
Change-Id: I647f5c63f7f87902a86c0c5d8e92fdc7f4350a5a
---
M pySim/ts_51_011.py
M tests/pySim-trace_test/pySim-trace_test_gsmtap.pcapng.ok
2 files changed, 20 insertions(+), 15 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/17/38117/5
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38117?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: I647f5c63f7f87902a86c0c5d8e92fdc7f4350a5a
Gerrit-Change-Number: 38117
Gerrit-PatchSet: 5
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Attention is currently required from: laforge.
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38117?usp=email )
Change subject: ts_51_011: replace encoding of EF.MSISDN with construct model
......................................................................
Patch Set 5:
(1 comment)
Patchset:
PS1:
> We can try that, but before we must resolve some issues with construct. […]
I wonder how the compatibility layer should be implemented. What I could think of is a function that we define a method inside the file object definition (similar to the _encode_record_hex() function). This method would recognize if there is an old format pass and transform it.
The encode_record_hex in filesystem.py would then check if the method exists and call it to transform the abstract_data to the recent format. Then things would continue normally.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38117?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I647f5c63f7f87902a86c0c5d8e92fdc7f4350a5a
Gerrit-Change-Number: 38117
Gerrit-PatchSet: 5
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 18 Sep 2024 10:12:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
dexter has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38196?usp=email )
Change subject: filesystem, cosmetic: remove excess whitespace
......................................................................
filesystem, cosmetic: remove excess whitespace
Change-Id: I902670590ae75a5d197616ae37d8268a60125121
---
M pySim/filesystem.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 43a72f2..c55bcbe 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -179,7 +179,7 @@
"""Return a dict of {'identifier': self} tuples.
Args:
- alias : Add an alias with given name to 'self'
+ alias : Add an alias with given name to 'self'
flags : Specify which selectables to return 'FIDS' and/or 'NAMES';
If not specified, all selectables will be returned.
Returns:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38196?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I902670590ae75a5d197616ae37d8268a60125121
Gerrit-Change-Number: 38196
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/38196?usp=email )
Change subject: filesystem, cosmetic: remove excess whitespace
......................................................................
filesystem, cosmetic: remove excess whitespace
Change-Id: I902670590ae75a5d197616ae37d8268a60125121
---
M pySim/filesystem.py
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/96/38196/1
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 43a72f2..c55bcbe 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -179,7 +179,7 @@
"""Return a dict of {'identifier': self} tuples.
Args:
- alias : Add an alias with given name to 'self'
+ alias : Add an alias with given name to 'self'
flags : Specify which selectables to return 'FIDS' and/or 'NAMES';
If not specified, all selectables will be returned.
Returns:
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38196?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: I902670590ae75a5d197616ae37d8268a60125121
Gerrit-Change-Number: 38196
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Attention is currently required from: dexter.
laforge has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/38195?usp=email )
Change subject: filesystem: pass total_len to construct of when encoding file contents
......................................................................
Patch Set 1: Code-Review-1
(4 comments)
File pySim/filesystem.py:
https://gerrit.osmocom.org/c/pysim/+/38195/comment/de34e383_98a0ce51?usp=em… :
PS1, Line 182: '
unrelated cosmetic change. Not critical, but in case you are doing another version of this patch anyway, this should be removed.
https://gerrit.osmocom.org/c/pysim/+/38195/comment/336e860e_8ae0f3e4?usp=em… :
PS1, Line 747: if total_len is not None:
this could deserve some documentation (doc-string or comment). For somebody not super familiar with every bit of the code (I guess everyone ecxcept me and now you) the functionality will not be obvious. You could also do it like this
```
if total_len is not None: # caller has provided the on-card size
...
elif self.size[1] is not None: # use the recommended size
...
elif self.size[0] is not None: # use the minimum size
```
btw: I'm not entirely sure if self.size could be None, at whcih point self.size[1] or [0] would cause an exception.
https://gerrit.osmocom.org/c/pysim/+/38195/comment/839cddea_3246df69?usp=em… :
PS1, Line 1043: __get_rec_len
why do we have double-underscores here but single-underscore for _get_size() above? Also: please add comments/documentation like for _get_size, as I requested above.
https://gerrit.osmocom.org/c/pysim/+/38195/comment/c4c2b572_564fe968?usp=em… :
PS1, Line 1266: return b2h(filter_dict(build_construct(self._construct, abstract_data, self._get_size(total_len))))
Did you test that? I think a _get_rec_len() would actually be required here. Calling _get_size() of the parent class (TransparentEF) will return the total file size, ad not the size of an individual record.
The TransRecEf.encode_record_{hex,bin} should only include a single record. The TransRecEF._encode_bin() below then iterates over all records.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38195?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b
Gerrit-Change-Number: 38195
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 17 Sep 2024 18:25:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38193?usp=email )
Change subject: runtime: add new API functions to get the record len and file size
......................................................................
runtime: add new API functions to get the record len and file size
We have an API function to get the number of records, let's now also
add API functions to get the record length and the overall size of
the currently selected file.
Related: OS#5714
Change-Id: Ica7811c04161d8098b40c7219ed6b939df716cfd
---
M pySim/runtime.py
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/pySim/runtime.py b/pySim/runtime.py
index b903ccb..898008e 100644
--- a/pySim/runtime.py
+++ b/pySim/runtime.py
@@ -211,6 +211,12 @@
def selected_file_num_of_rec(self) -> Optional[int]:
return self.selected_file_fcp['file_descriptor'].get('num_of_rec')
+ def selected_file_record_len(self) -> Optional[int]:
+ return self.selected_file_fcp['file_descriptor'].get('record_len')
+
+ def selected_file_size(self) -> Optional[int]:
+ return self.selected_file_fcp.get('file_size')
+
def get_cwd(self) -> CardDF:
"""Obtain the current working directory.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38193?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ica7811c04161d8098b40c7219ed6b939df716cfd
Gerrit-Change-Number: 38193
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>