laforge has submitted this change. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38204?usp=email )
Change subject: osmocom.utils: Make 'hexstr' type hashable
......................................................................
osmocom.utils: Make 'hexstr' type hashable
otherwise we couldn't use hexstr values as dict keys, for example
Change-Id: Ic9e1f8af1db436af5456fe5964133a144c9e066b
---
M src/osmocom/utils.py
1 file changed, 4 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/src/osmocom/utils.py b/src/osmocom/utils.py
index a218e1b..009eb04 100644
--- a/src/osmocom/utils.py
+++ b/src/osmocom/utils.py
@@ -41,6 +41,10 @@
# make sure comparison is done case-insensitive
return str(self) == other.lower()
+ def __hash__(self):
+ # having a custom __eq__ method will make the type unhashable by default, lets fix that
+ return hash(str(self))
+
def __getitem__(self, val) -> 'hexstr':
# make sure slicing a hexstr will return a hexstr
return hexstr(super().__getitem__(val))
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38204?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: Ic9e1f8af1db436af5456fe5964133a144c9e066b
Gerrit-Change-Number: 38204
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
laforge has posted comments on this change by laforge. ( https://gerrit.osmocom.org/c/python/pyosmocom/+/38205?usp=email )
Change subject: bump version to 0.0.4 for the recent hexstr improvements
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/python/pyosmocom/+/38205?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: I4bc48a5c3546bd8d170bc97f77a9ecf557f933ae
Gerrit-Change-Number: 38205
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Fri, 20 Sep 2024 14:39:02 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38231?usp=email )
Change subject: pySim-shell: recognize ADP pins longer than 8 digits as hexadecimal
......................................................................
pySim-shell: recognize ADP pins longer than 8 digits as hexadecimal
When a hexadecimal formatted ADM pin is retrieved via the
card_key_provider, it still requires the --pin-is-hex parameter so
that sanitize_pin_adm knows the correct format.
This unfortunately ruins the card_key_provider feature for all cards
that use hexadecimal pins, because the --pin-is-hex would also be
required in scripts, which makes a script either useable for cards
with hexadecimal ADM or for for cards with ASCII ADM.
To minimize the problem, let's recognize all ADM pins longer than 8
digits as hexadecimal in case --pin-is-hex is not set.
Related: OS#4348
Change-Id: Iad9398365d448946c499ce89e3cfb2c3af5d525e
---
M pySim-shell.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/pySim-shell.py b/pySim-shell.py
index d3f0d87..8c260aa 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -819,7 +819,7 @@
adm_type = opts.adm_type or 'ADM1'
# try to find an ADM-PIN if none is specified
result = card_key_provider_get_field(adm_type, key='ICCID', value=iccid)
- if opts.pin_is_hex:
+ if opts.pin_is_hex or (result and len(result) > 8):
pin_adm = sanitize_pin_adm(None, result)
else:
pin_adm = sanitize_pin_adm(result)
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38231?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: Iad9398365d448946c499ce89e3cfb2c3af5d525e
Gerrit-Change-Number: 38231
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Attention is currently required from: pespin.
fixeria has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38210?usp=email )
Change subject: s1gw: make number of eNBs configurable via module params
......................................................................
Patch Set 2:
(1 comment)
File s1gw/S1GW_Tests.ttcn:
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38210/comment/7413a2b1_9556… :
PS2, Line 226: vc_conns[i] := f_ConnHdlr_spawn(refers(f_TC_setup_multi), pars);
Oh, this is actually my TTCN-3 discovery of the month! Instead of doing `list := list & { item }` every time you want to add something, you can just reference items by index sequentially. And what's more important, it also works for template lists, for which you cannot do `list := list & { item }`.
> Sounds weird, given that you could have a lengthof(vc_conns)==4 and then do vc_conns[4543] = ...
It's a good question what happens in this case. I gave this code a try:
```
private type component dummy_CT { };
private type record of integer IntList;
testcase TC_record_of_test() runs on dummy_CT {
var IntList list;
list[0] := 42;
list[3] := 43;
log(list);
}
```
and this is what I got printed:
```
MTC@LEGION: { 42, <unbound>, <unbound>, 43 }
```
so you'll have thousands of unbound values in the middle if you do `vc_conns[4543]`.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38210?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia80b9118e66a5d6721b89d3ba068227d30dcc01f
Gerrit-Change-Number: 38210
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 20 Sep 2024 14:35:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>