dexter has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37775?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: filesystem: add placeholder export method in CardFile base class
......................................................................
filesystem: add placeholder export method in CardFile base class
We add export methods in subclasses of CardFile but the base class
itself lacks an export method. To make the code more readable and
to avoid unnecessary exceptions, les's add a default export method
that just returns a comment.
Related: OS#6092
Change-Id: Ife2a9bad14750db84a87fab907297028c33f1f7d
---
M pySim/filesystem.py
1 file changed, 11 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 2151c21..a4659cf 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -298,6 +298,17 @@
return True
raise ValueError("self.service must be either int or list or tuple")
+ @staticmethod
+ def export(as_json: bool, lchan):
+ """
+ Export file contents in the form of commandline script. This method is meant to be overloaded by a subclass in
+ case any exportable contents are present. The generated script may contain multiple command lines separated by
+ line breaks ("\n"), where the last commandline shall have no line break at the end
+ (e.g. "update_record 1 112233\nupdate_record 1 445566"). Naturally this export method will always refer to the
+ currently selected file of the presented lchan.
+ """
+ return "# %s has no exportable contents" % str(lchan.selected_file)
+
class CardDF(CardFile):
"""DF (Dedicated File) in the smart card filesystem. Those are basically sub-directories."""
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37775?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: Ife2a9bad14750db84a87fab907297028c33f1f7d
Gerrit-Change-Number: 37775
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
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>
fixeria has restored this change. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37787?usp=email )
Change subject: [TEST] rebar.config: specify repository and tag for meck
......................................................................
Restored
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/37787?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: restore
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: Id36eab57cf4dce723c8bbf2554c35fe85b6e2378
Gerrit-Change-Number: 37787
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37766?usp=email )
Change subject: testenv/podman: use explicit no_podman=True
......................................................................
testenv/podman: use explicit no_podman=True
Add an explicit no_podman=True to the commands that are meant to run
outside of the podman container. Previously it was implicit by relying
on logic in testenv.cmd.run, which would run the commands outside of
podman unless the podman container was running.
In the next patch I will remove the implicit logic, because it could
lead to the bug of running commands outside of the container by accident
if the container crashed.
Related: OS#6494
Change-Id: I41afe6d6b565a8e8c384229ee44f1b75f25c0a4b
---
M _testenv/testenv/podman.py
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index bda6f9d..a972d95 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -22,13 +22,14 @@
def image_exists():
- return testenv.cmd.run(["podman", "image", "exists", image_name], check=False).returncode == 0
+ return testenv.cmd.run(["podman", "image", "exists", image_name], check=False, no_podman=True).returncode == 0
def image_up_to_date():
history = testenv.cmd.run(
["podman", "history", image_name, "--format", "json"],
capture_output=True,
+ no_podman=True,
text=True,
)
created = json.loads(history.stdout)[0]["created"].split(".", 1)[0]
@@ -69,7 +70,8 @@
"-t",
image_name,
os.path.join(testenv.data_dir, "podman"),
- ]
+ ],
+ no_podman=True,
)
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37766?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I41afe6d6b565a8e8c384229ee44f1b75f25c0a4b
Gerrit-Change-Number: 37766
Gerrit-PatchSet: 2
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: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37766?usp=email )
Change subject: testenv/podman: use explicit no_podman=True
......................................................................
testenv/podman: use explicit no_podman=True
Add an explicit no_podman=True to the commands that are meant to run
outside of the podman container. Previously it was implicit by relying
on logic in testenv.cmd.run, which would run the commands outside of
podman unless the podman container was running.
In the next patch I will remove the implicit logic, because it could
lead to the bug of running commands outside of the container by accident
if the container crashed.
Related: OS#6494
Change-Id: I41afe6d6b565a8e8c384229ee44f1b75f25c0a4b
---
M _testenv/testenv/podman.py
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/66/37766/1
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index bda6f9d..a972d95 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -22,13 +22,14 @@
def image_exists():
- return testenv.cmd.run(["podman", "image", "exists", image_name], check=False).returncode == 0
+ return testenv.cmd.run(["podman", "image", "exists", image_name], check=False, no_podman=True).returncode == 0
def image_up_to_date():
history = testenv.cmd.run(
["podman", "history", image_name, "--format", "json"],
capture_output=True,
+ no_podman=True,
text=True,
)
created = json.loads(history.stdout)[0]["created"].split(".", 1)[0]
@@ -69,7 +70,8 @@
"-t",
image_name,
os.path.join(testenv.data_dir, "podman"),
- ]
+ ],
+ no_podman=True,
)
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37766?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I41afe6d6b565a8e8c384229ee44f1b75f25c0a4b
Gerrit-Change-Number: 37766
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
dexter has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37642?usp=email )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: filesystem: add export method for ADF files
......................................................................
filesystem: add export method for ADF files
This patch adds an export method to CardADF, which calls the application
specific export method in CardApplication class
Related: OS#6092
Change-Id: I8129656096ecaf41b36e5f2afbbfbebcd0587886
---
M pySim/filesystem.py
1 file changed, 18 insertions(+), 0 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index a4659cf..e3efcab 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -541,6 +541,15 @@
else:
return self.aid
+ @staticmethod
+ def export(as_json: bool, lchan):
+ """
+ Export application specific parameters that are not part of the UICC filesystem.
+ """
+ if not isinstance(lchan.selected_file, CardADF):
+ raise TypeError('currently selected file is not of type CardADF')
+ return lchan.selected_file.application.export(as_json, lchan)
+
class CardEF(CardFile):
"""EF (Entry File) in the smart card filesystem"""
@@ -1428,6 +1437,15 @@
"""
return interpret_sw(self.sw, sw)
+ @staticmethod
+ def export(as_json: bool, lchan):
+ """
+ Export application specific parameters, in the form of commandline script. (see also comment in the export
+ method of class "CardFile")
+ """
+ return "# %s has no exportable features" % str(lchan.selected_file)
+
+
class CardModel(abc.ABC):
"""A specific card model, typically having some additional vendor-specific files. All
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37642?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: I8129656096ecaf41b36e5f2afbbfbebcd0587886
Gerrit-Change-Number: 37642
Gerrit-PatchSet: 4
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
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>
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/37775?usp=email )
Change subject: filesystem: add placeholder export method in CardFile base class
......................................................................
filesystem: add placeholder export method in CardFile base class
We add export methods in subclasses of CardFile but the base class
itself lacks an export method. To make the code more readable and
to avoid unnecessary exceptions, les's add a default export method
that just returns a comment.
Related: OS#6092
Change-Id: Ife2a9bad14750db84a87fab907297028c33f1f7d
---
M pySim/filesystem.py
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/75/37775/1
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 2151c21..a4659cf 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -298,6 +298,17 @@
return True
raise ValueError("self.service must be either int or list or tuple")
+ @staticmethod
+ def export(as_json: bool, lchan):
+ """
+ Export file contents in the form of commandline script. This method is meant to be overloaded by a subclass in
+ case any exportable contents are present. The generated script may contain multiple command lines separated by
+ line breaks ("\n"), where the last commandline shall have no line break at the end
+ (e.g. "update_record 1 112233\nupdate_record 1 445566"). Naturally this export method will always refer to the
+ currently selected file of the presented lchan.
+ """
+ return "# %s has no exportable contents" % str(lchan.selected_file)
+
class CardDF(CardFile):
"""DF (Dedicated File) in the smart card filesystem. Those are basically sub-directories."""
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37775?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: Ife2a9bad14750db84a87fab907297028c33f1f7d
Gerrit-Change-Number: 37775
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37741?usp=email )
Change subject: pySim.esim.saip.templates: Add expand_default_value() method
......................................................................
pySim.esim.saip.templates: Add expand_default_value() method
This method can be used to expand the default value pattern of the
file system template for the file to the specified (record, file) length.
Change-Id: Id3eb16910c0bdfa572294e14ca1cd44ca95ca69f
---
M pySim/esim/saip/templates.py
1 file changed, 33 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/pySim/esim/saip/templates.py b/pySim/esim/saip/templates.py
index f1fd975..eff28c2 100644
--- a/pySim/esim/saip/templates.py
+++ b/pySim/esim/saip/templates.py
@@ -17,7 +17,7 @@
from typing import *
from copy import deepcopy
-from pySim.utils import all_subclasses
+from pySim.utils import all_subclasses, h2b
from pySim.filesystem import Path
import pySim.esim.saip.oid as OID
@@ -51,6 +51,10 @@
# initialize empty
self.parent = None
self.children = []
+ if self.default_val:
+ length = self._default_value_len() or 100
+ # run the method once to verify the pattern can be processed
+ self.expand_default_value_pattern(length)
def __str__(self) -> str:
return "FileTemplate(%s)" % (self.name)
@@ -85,6 +89,34 @@
if path[1].lower() == c.name.lower():
return c.get_file_by_path(path[1:])
+ def _default_value_len(self):
+ if self.file_type in ['TR']:
+ return self.file_size
+ elif self.file_type in ['LF', 'CY']:
+ return self.rec_len
+
+ def expand_default_value_pattern(self, length: Optional[int] = None) -> Optional[bytes]:
+ """Expand the default value pattern to the specified length."""
+ if not length:
+ length = self._default_value_len()
+ if not length:
+ raise ValueError("%s does not have a default length" % self)
+ if not self.default_val:
+ return None
+ if not '...' in self.default_val:
+ return h2b(self.default_val)
+ l = self.default_val.split('...')
+ if len(l) != 2:
+ raise ValueError("Pattern '%s' contains more than one ..." % self.default_val)
+ prefix = h2b(l[0])
+ suffix = h2b(l[1])
+ pad_len = length - len(prefix) - len(suffix)
+ if pad_len <= 0:
+ ret = prefix + suffix
+ return ret[:length]
+ return prefix + prefix[-1:] * pad_len + suffix
+
+
class ProfileTemplate:
"""Representation of a SimAlliance/TCA Profile Template. Each Template is identified by its OID and
consists of a number of file definitions. We implement each profile template as a class derived from this
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37741?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: Id3eb16910c0bdfa572294e14ca1cd44ca95ca69f
Gerrit-Change-Number: 37741
Gerrit-PatchSet: 3
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>