Attention is currently required from: fixeria, osmith.
laforge has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/docker-playground/+/41778?usp=email )
Change subject: ttcn3-bts-test: bpftrace: filter by executable name
......................................................................
Patch Set 2:
(1 comment)
File ttcn3-bts-test/bpftrace/ksys_write_delay.bt:
https://gerrit.osmocom.org/c/docker-playground/+/41778/comment/77401406_2a1… :
PS2, Line 28: kretprobe:ksys_write / comm == str($1) && @start[tid] /
> But in any case it's not going to wrap the same TID while the task holding that TID is in the middle […]
no, that would be a serious kernel bug then, breaking all kinds of assumptions
--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/41778?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I04c2e36806534a8ca650733bacf521ea57950692
Gerrit-Change-Number: 41778
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 15 Jan 2026 09:55:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria, osmith, pespin.
laforge has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/docker-playground/+/41846?usp=email )
Change subject: ttcn3-bts-test: add --no-warnings to bpftrace
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
> would be interesting what kind of warnings we're getting
nevermind. it shows an example. but that warning is printed so often that it becomes a problem in terms of space? Isn't that just printed once per test or once per testcase?
--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/41846?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I0e4c62f27f67d4b8601516ce5c1ebfa415331b4a
Gerrit-Change-Number: 41846
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 15 Jan 2026 09:54:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Attention is currently required from: pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41844?usp=email )
Change subject: logging: Improve systemd-journal log documentation
......................................................................
Patch Set 2:
(3 comments)
File common/chapters/logging.adoc:
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41844/comment/a486c37b_8432… :
PS2, Line 443: NOTE: systmed-journal logging target uses libsystemd, which implements _Native
```suggestion
NOTE: systemd-journal logging target uses libsystemd, which implements _Native
```
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41844/comment/fcfe0e43_cfbe… :
PS2, Line 449: socket `SO_SNDBUF` to 8MB, In Linux, the `SO_SNDBUF` value being set on the
```suggestion
socket `SO_SNDBUF` to 8MB. In Linux, the `SO_SNDBUF` value being set on the
```
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41844/comment/288d9365_7177… :
PS2, Line 453: sure sysctl `net.core.wmem_max` on your system is set to `4194304` (8MB) or
```suggestion
sure sysctl `net.core.wmem_max` on your system is set to `8388608` (8MB) or
```
--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41844?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Change-Id: I9a67b9b8c38868004a794164724cdffc5b86a044
Gerrit-Change-Number: 41844
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 15 Jan 2026 09:40:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41843?usp=email )
Change subject: logging: Improve file & stderr log documentation
......................................................................
Patch Set 2:
(2 comments)
File common/chapters/logging.adoc:
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41843/comment/a5cce0eb_0e84… :
PS2, Line 320: _blocking-io_ parameter. This I/O mode should not be used in any osmocom program
How about referring to the "blocking-io" section from the previous patch on details about why this should not be used except for debugging, instead of repeating it here?
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41843/comment/f99032a1_6f87… :
PS2, Line 322: block the thread for an un specified (potentially long or event infinite) amount
```suggestion
block the thread for an unspecified (potentially long or even infinite) amount
```
--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41843?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Change-Id: I90114f634ae0411e58d2f3da86d5a2e470b4d828
Gerrit-Change-Number: 41843
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 15 Jan 2026 09:37:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: daniel, fixeria, laforge, pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842?usp=email )
Change subject: logging: Improve GSMTAP log documentation
......................................................................
Patch Set 2:
(1 comment)
File common/chapters/logging.adoc:
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842/comment/b440329e_ce19… :
PS2, Line 242: the thread for an un specified (potentially long or event infinite)
> Comment removed by: osmith; Reason: better suggestion below
```suggestion
the thread for an unspecified (potentially long or even infinite)
```
--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Change-Id: I9434939d2a9a41bb0011a067f5ff9b94752fa781
Gerrit-Change-Number: 41842
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 15 Jan 2026 09:34:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith <osmith(a)sysmocom.de>
Attention is currently required from: daniel, fixeria, laforge, pespin.
osmith has posted comments on this change by pespin. ( https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842?usp=email )
Change subject: logging: Improve GSMTAP log documentation
......................................................................
Patch Set 2:
(7 comments)
File common/chapters/logging.adoc:
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842/comment/6171dacd_4ef7… :
PS2, Line 239:
I just tested it with osmo-mgw and it works as described in the section you have deleted:
* when starting with either the default config or the default config with no `log` section, it logs to stderr by default (in both cases)
* `logging level force-all fatal` works to set the log output to a minimum
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842/comment/e9f3bbf9_13e4… :
PS2, Line 233: syncrhonous
```suggestion
the GSMTAP source socket as non-blocking, and attempt synchronous write
```
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842/comment/67f68f40_6221… :
PS2, Line 238: blocking mode, and attempt syncrhonous write to the UDP socket, blocking
```suggestion
blocking mode, and attempt synchronous write to the UDP socket, blocking
```
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842/comment/ddf6c631_171f… :
PS2, Line 242: the thread for an un specified (potentially long or event infinite)
```suggestion
the thread for an un specified (potentially long or even infinite)
```
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842/comment/76c8b211_a372… :
PS2, Line 250: asyncrhonous
```suggestion
GSMTAP source socket as non-blocking, and attempt asynchronous write to
```
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842/comment/eb5a46e2_ba2a… :
PS2, Line 255: , messages
```suggestion
buffer *and* the GSMTAP log target workqueue are full. This
```
https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842/comment/77c9ae91_08e8… :
PS2, Line 260: mode
```suggestion
In any of the I/O modes above, the UDP socket send buffer size of the GSMTAP log
```
--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/41842?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Change-Id: I9434939d2a9a41bb0011a067f5ff9b94752fa781
Gerrit-Change-Number: 41842
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: daniel <dwillmann(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 15 Jan 2026 09:31:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: fixeria, pespin.
osmith has posted comments on this change by osmith. ( https://gerrit.osmocom.org/c/docker-playground/+/41846?usp=email )
Change subject: ttcn3-bts-test: add --no-warnings to bpftrace
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
build4 and build5 ran out of space because of this, so I've temporarily disabled the ttcn3-bts-test jobs until we merge this
--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/41846?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I0e4c62f27f67d4b8601516ce5c1ebfa415331b4a
Gerrit-Change-Number: 41846
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 15 Jan 2026 08:53:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/docker-playground/+/41846?usp=email )
Change subject: ttcn3-bts-test: add --no-warnings to bpftrace
......................................................................
ttcn3-bts-test: add --no-warnings to bpftrace
Since switching to debian 13 and having bpftrace 0.23.2 instead of
0.17.0, bpftrace is constantly printing warnings. Turn off warnings by
default so we don't end up filling up the disk space of jenkins runners
while ttcn3-bts-test runs for >2h.
We can turn on warnings in copies of the main jenkins job for
development, while also ensuring that we only run a few tests instead of
the whole testsuite.
Warnings look like this:
root@deb12build-ansible:/home/osmocom-build/jenkins/workspace/ttcn3-bts-test/logs/bts/bpftrace# head udp_sendmsg_delay.log
[Thu Jan 15 01:31:13 UTC 2026] respawn: 0: starting: /data/bpftrace/udp_sendmsg_delay.sh
+ pidof osmo-bts-trx
+ bpftrace /data/bpftrace/udp_sendmsg_delay.bt -p 9
Attaching 3 probes...
Tracing udp_sendmsg() latency... Hit Ctrl-C to end.
/data/bpftrace/udp_sendmsg_delay.bt:29:3-13: WARNING: Invalid argument
Additional Info - helper: get_ns_current_pid_tgid, retcode: -22
@start[tid] = nsecs;
~~~~~~~~~~
/data/bpftrace/udp_sendmsg_delay.bt:30:3-13: WARNING: Invalid argument
Change-Id: I0e4c62f27f67d4b8601516ce5c1ebfa415331b4a
---
M ttcn3-bts-test/jenkins.sh
1 file changed, 6 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/46/41846/1
diff --git a/ttcn3-bts-test/jenkins.sh b/ttcn3-bts-test/jenkins.sh
index 6e5cc67..6d738c4 100755
--- a/ttcn3-bts-test/jenkins.sh
+++ b/ttcn3-bts-test/jenkins.sh
@@ -90,8 +90,13 @@
cp "$script" "$VOL_BASE_DIR"/bts/bpftrace
+ # --no-warnings: without this, the log file can easily
+ # fill up gigabytes of data while ttcn3-bts-test does a
+ # full run. For development --no-warnings can be
+ # removed, but make sure that only few tests are
+ # running!
( echo "#!/bin/sh -ex"
- echo "bpftrace /data/bpftrace/$(basename "$script") -p \$(pidof osmo-bts-$variant)" ) >"$startscript"
+ echo "bpftrace --no-warnings /data/bpftrace/$(basename "$script") -p \$(pidof osmo-bts-$variant)" ) >"$startscript"
chmod +x "$startscript"
docker exec \
--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/41846?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I0e4c62f27f67d4b8601516ce5c1ebfa415331b4a
Gerrit-Change-Number: 41846
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/41845?usp=email )
Change subject: rather move BatchPersonalization to separate module
......................................................................
rather move BatchPersonalization to separate module
Change-Id: I01ae40a06605eb205bfb409189fcd2b3a128855a
---
A pySim/esim/saip/batch.py
M pySim/esim/saip/personalization.py
2 files changed, 117 insertions(+), 95 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/45/41845/1
diff --git a/pySim/esim/saip/batch.py b/pySim/esim/saip/batch.py
new file mode 100644
index 0000000..0355ad2
--- /dev/null
+++ b/pySim/esim/saip/batch.py
@@ -0,0 +1,117 @@
+"""Implementation of Personalization of eSIM profiles in SimAlliance/TCA Interoperable Profile:
+ Run a batch of N personalizations"""
+
+# (C) 2025-2026 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+#
+# Author: nhofmeyr(a)sysmocom.de
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import copy
+from typing import Generator
+from pysim.esim.saip.personalization import ConfigurableParameter
+from pySim.esim.saip import param_source
+from pySim.esim.saip import ProfileElementSequence
+
+class BatchPersonalization:
+ """Produce a series of eSIM profiles from predefined parameters.
+ Personalization parameters are derived from pysim.esim.saip.param_source.ParamSource.
+
+ Usage example:
+
+ der_input = some_file.open('rb').read()
+ pes = ProfileElementSequence.from_der(der_input)
+ p = pers.BatchPersonalization(
+ n=10,
+ src_pes=pes,
+ csv_rows=get_csv_reader())
+
+ p.add_param_and_src(
+ personalization.Iccid(),
+ param_source.IncDigitSource(
+ num_digits=18,
+ first_value=123456789012340001,
+ last_value=123456789012340010))
+
+ # add more parameters here, using ConfigurableParameter and ParamSource subclass instances to define the profile
+ # ...
+
+ # generate all 10 profiles (from n=10 above)
+ for result_pes in p.generate_profiles():
+ upp = result_pes.to_der()
+ store_upp(upp)
+ """
+
+ class ParamAndSrc:
+ 'tie a ConfigurableParameter to a source of actual values'
+ def __init__(self, param:ConfigurableParameter, src:param_source.ParamSource):
+ self.param = param
+ self.src = src
+
+ def __init__(self,
+ n:int,
+ src_pes:ProfileElementSequence,
+ params:list[ParamAndSrc]=None,
+ csv_rows:Generator=None,
+ ):
+ """
+ n: number of eSIM profiles to generate.
+ src_pes: a decoded eSIM profile as ProfileElementSequence, to serve as template. This is not modified, only
+ copied.
+ params: list of ParamAndSrc instances, defining a ConfigurableParameter and corresponding ParamSource to fill in
+ profile values.
+ csv_rows: A list or generator producing all CSV rows one at a time, starting with a row containing the column
+ headers. This is compatible with the python csv.reader. Each row gets passed to
+ ParamSource.get_next(), such that ParamSource implementations can access the row items.
+ See param_source.CsvSource.
+ """
+ self.n = n
+ self.params = params or []
+ self.src_pes = src_pes
+ self.csv_rows = csv_rows
+
+ def add_param_and_src(self, param:ConfigurableParameter, src:param_source.ParamSource):
+ self.params.append(BatchPersonalization.ParamAndSrc(param=param, src=src))
+
+ def generate_profiles(self):
+ # get first row of CSV: column names
+ csv_columns = None
+ if self.csv_rows:
+ try:
+ csv_columns = next(self.csv_rows)
+ except StopIteration as e:
+ raise ValueError('the input CSV file appears to be empty') from e
+
+ for i in range(self.n):
+ csv_row = None
+ if self.csv_rows and csv_columns:
+ try:
+ csv_row_list = next(self.csv_rows)
+ except StopIteration as e:
+ raise ValueError(f'not enough rows in the input CSV for eSIM nr {i+1} of {self.n}') from e
+
+ csv_row = dict(zip(csv_columns, csv_row_list))
+
+ pes = copy.deepcopy(self.src_pes)
+
+ for p in self.params:
+ try:
+ input_value = p.src.get_next(csv_row=csv_row)
+ assert input_value is not None
+ value = p.param.__class__.validate_val(input_value)
+ p.param.__class__.apply_val(pes, value)
+ except Exception as e:
+ raise ValueError(f'{p.param.name} fed by {p.src.name}: {e}') from e
+
+ yield pes
diff --git a/pySim/esim/saip/personalization.py b/pySim/esim/saip/personalization.py
index 550cb6c..e024163 100644
--- a/pySim/esim/saip/personalization.py
+++ b/pySim/esim/saip/personalization.py
@@ -17,14 +17,12 @@
import abc
import io
-import copy
from typing import List, Tuple, Generator
from osmocom.tlv import camel_to_snake
from pySim.utils import enc_iccid, enc_imsi, h2b, rpad, sanitize_iccid
from pySim.esim.saip import ProfileElement, ProfileElementSequence
from pySim.ts_51_011 import EF_SMSP
-from pySim.esim.saip import param_source
def remove_unwanted_tuples_from_list(l: List[Tuple], unwanted_keys: List[str]) -> List[Tuple]:
"""In a list of tuples, remove all tuples whose first part equals 'unwanted_key'."""
@@ -666,96 +664,3 @@
min_val = 1
max_val = 255
example_input = '1'
-
-
-class BatchPersonalization:
- """Produce a series of eSIM profiles from predefined parameters.
- Personalization parameters are derived from pysim.esim.saip.param_source.ParamSource.
-
- Usage example:
-
- der_input = some_file.open('rb').read()
- pes = ProfileElementSequence.from_der(der_input)
- p = pers.BatchPersonalization(
- n=10,
- src_pes=pes,
- csv_rows=get_csv_reader())
-
- p.add_param_and_src(
- personalization.Iccid(),
- param_source.IncDigitSource(
- num_digits=18,
- first_value=123456789012340001,
- last_value=123456789012340010))
-
- # add more parameters here, using ConfigurableParameter and ParamSource subclass instances to define the profile
- # ...
-
- # generate all 10 profiles (from n=10 above)
- for result_pes in p.generate_profiles():
- upp = result_pes.to_der()
- store_upp(upp)
- """
-
- class ParamAndSrc:
- 'tie a ConfigurableParameter to a source of actual values'
- def __init__(self, param:ConfigurableParameter, src:param_source.ParamSource):
- self.param = param
- self.src = src
-
- def __init__(self,
- n:int,
- src_pes:ProfileElementSequence,
- params:list[ParamAndSrc]=None,
- csv_rows:Generator=None,
- ):
- """
- n: number of eSIM profiles to generate.
- src_pes: a decoded eSIM profile as ProfileElementSequence, to serve as template. This is not modified, only
- copied.
- params: list of ParamAndSrc instances, defining a ConfigurableParameter and corresponding ParamSource to fill in
- profile values.
- csv_rows: A list or generator producing all CSV rows one at a time, starting with a row containing the column
- headers. This is compatible with the python csv.reader. Each row gets passed to
- ParamSource.get_next(), such that ParamSource implementations can access the row items.
- See param_source.CsvSource.
- """
- self.n = n
- self.params = params or []
- self.src_pes = src_pes
- self.csv_rows = csv_rows
-
- def add_param_and_src(self, param:ConfigurableParameter, src:param_source.ParamSource):
- self.params.append(BatchPersonalization.ParamAndSrc(param=param, src=src))
-
- def generate_profiles(self):
- # get first row of CSV: column names
- csv_columns = None
- if self.csv_rows:
- try:
- csv_columns = next(self.csv_rows)
- except StopIteration as e:
- raise ValueError('the input CSV file appears to be empty') from e
-
- for i in range(self.n):
- csv_row = None
- if self.csv_rows and csv_columns:
- try:
- csv_row_list = next(self.csv_rows)
- except StopIteration as e:
- raise ValueError(f'not enough rows in the input CSV for eSIM nr {i+1} of {self.n}') from e
-
- csv_row = dict(zip(csv_columns, csv_row_list))
-
- pes = copy.deepcopy(self.src_pes)
-
- for p in self.params:
- try:
- input_value = p.src.get_next(csv_row=csv_row)
- assert input_value is not None
- value = p.param.__class__.validate_val(input_value)
- p.param.__class__.apply_val(pes, value)
- except Exception as e:
- raise ValueError(f'{p.param.name} fed by {p.src.name}: {e}') from e
-
- yield pes
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/41845?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: I01ae40a06605eb205bfb409189fcd2b3a128855a
Gerrit-Change-Number: 41845
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr(a)sysmocom.de>