dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/37641?usp=email )
Change subject: pySim-shell: enable export of DF and ADF files
......................................................................
pySim-shell: enable export of DF and ADF files
Since we now have the ability to provide export methods for all files
in the file system (this also includes DF and ADF files), we need
to support this at shell command level as well.
Related: OS#6092
Change-Id: I3ee661dbae5c11fec23911775f352ac13bc2c6e5
---
M pySim-shell.py
1 file changed, 82 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/41/37641/1
diff --git a/pySim-shell.py b/pySim-shell.py
index 168c916..8fc348e 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -494,12 +494,22 @@
self._cmd.poutput(directory_str)
self._cmd.poutput("%d files" % len(selectables))
+ def _walk_action(self, action, file, context, **kwargs):
+ df_before_action = self._cmd.lchan.selected_file
+ action(file, context, **kwargs)
+ # When walking through the file system tree the action must not
+ # always restore the currently selected file to the file that
+ # was selected before executing the action() callback.
+ if df_before_action != self._cmd.lchan.selected_file:
+ raise RuntimeError("inconsistent walk, %s is currently selected but expecting %s to be selected"
+ % (str(self._cmd.lchan.selected_file), str(df_before_action)))
+
def walk(self, indent=0, action_ef=None, action_df=None, context=None, **kwargs):
"""Recursively walk through the file system, starting at the currently selected DF"""
if isinstance(self._cmd.lchan.selected_file, CardDF):
if action_df:
- action_df(context, **kwargs)
+ self._walk_action(action_df, self._cmd.lchan.selected_file.name, context, **kwargs)
files = self._cmd.lchan.selected_file.get_selectables(
flags=['FNAMES', 'ANAMES'])
@@ -536,14 +546,7 @@
self._cmd.lchan.select_parent(self._cmd)
elif action_ef:
- df_before_action = self._cmd.lchan.selected_file
- action_ef(f, context, **kwargs)
- # When walking through the file system tree the action must not
- # always restore the currently selected file to the file that
- # was selected before executing the action() callback.
- if df_before_action != self._cmd.lchan.selected_file:
- raise RuntimeError("inconsistent walk, %s is currently selected but expecting %s to be selected"
- % (str(self._cmd.lchan.selected_file), str(df_before_action)))
+ self._walk_action(action_ef, f, context, **kwargs)
def do_tree(self, opts):
"""Display a filesystem-tree with all selectable files"""
@@ -594,11 +597,58 @@
self._cmd.poutput("#")
+ def export_df(self, filename, context, as_json):
+ """ Select and export a single application dedicated file (ADF) """
+ context['COUNT'] += 1
+ df = self._cmd.lchan.selected_file
+
+ # The currently selected file (not the file we are going to export)
+ # must always be an ADF or DF. From this starting point we select
+ # the ADF we want to export. To maintain consistency we will then
+ # select the current DF again (see comment below).
+ if not isinstance(df, CardDF):
+ raise RuntimeError(
+ "currently selected file %s is not a DF or ADF" % str(df))
+
+ df_path_list = df.fully_qualified_path(True)
+ df_path = df.fully_qualified_path_str(True)
+ df_path_fid = df.fully_qualified_path_str(False)
+
+ file_str = df_path + "/" + str(filename)
+ self._cmd.poutput(boxed_heading_str(file_str))
+
+ self._cmd.poutput("# directory: %s (%s)" % (df_path, df_path_fid))
+ try:
+ fcp_dec = self._cmd.lchan.select(filename, self._cmd)
+ self._cmd.poutput("# file: %s (%s)" %
+ (self._cmd.lchan.selected_file.name, self._cmd.lchan.selected_file.aid))
+ self._cmd.poutput("# RAW FCP Template: %s" % str(self._cmd.lchan.selected_file_fcp_hex))
+ self._cmd.poutput("# Decoded FCP Template: %s" % str(self._cmd.lchan.selected_file_fcp))
+ self._cmd.poutput("select " + self._cmd.lchan.selected_file.fully_qualified_path_str())
+ self._cmd.poutput(self._cmd.lchan.selected_file.export(as_json, self._cmd.lchan))
+
+ except Exception as e:
+ bad_file_str = df_path + "/" + str(filename) + ", " + str(e)
+ self._cmd.poutput("# bad file: %s" % bad_file_str)
+ context['ERR'] += 1
+ context['BAD'].append(bad_file_str)
+
+ # When reading the file is done, make sure the parent file is
+ # selected again. This will be the usual case, however we need
+ # to check before since we must not select the same DF twice
+ if df != self._cmd.lchan.selected_file:
+ self._cmd.lchan.select_parent(self._cmd)
+
+ self._cmd.poutput("#")
+
+
export_parser = argparse.ArgumentParser()
export_parser.add_argument(
'--filename', type=str, default=None, help='only export specific file')
export_parser.add_argument(
'--json', action='store_true', help='export as JSON (less reliable)')
+ export_parser.add_argument(
+ '--include_df', action='store_true', help='also export DF and ADF files (where possible)')
@cmd2.with_argparser(export_parser)
def do_export(self, opts):
@@ -609,10 +659,17 @@
exception_str_add = ""
if opts.filename:
- self.export_ef(opts.filename, context, **kwargs_export)
+ file = self._cmd.lchan.get_file_for_filename(opts.filename)
+ if isinstance(file, CardDF):
+ self.export_df(opts.filename, context, **kwargs_export)
+ else:
+ self.export_ef(opts.filename, context, **kwargs_export)
else:
try:
- self.walk(0, self.export_ef, None, context, **kwargs_export)
+ if opts.include_df:
+ self.walk(0, self.export_ef, self.export_df, context, **kwargs_export)
+ else:
+ self.walk(0, self.export_ef, None, context, **kwargs_export)
except Exception as e:
print("# Stopping early here due to exception: " + str(e))
print("#")
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37641?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I3ee661dbae5c11fec23911775f352ac13bc2c6e5
Gerrit-Change-Number: 37641
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/37636?usp=email )
Change subject: Fix DeactPDPCtxAcc when UE goes PMM ENABLED but lost its PDP context
......................................................................
Fix DeactPDPCtxAcc when UE goes PMM ENABLED but lost its PDP context
Scenario: UE activates a PDP context, then after a while goes PMM IDLE
(Iu conn is destroyed but PDP is kept).
When UE connects through Iu again, it sends eg. RAU or ServiceRequest
with pdp_status bitmask statis the active NSAPIs.
If some NSAPI (PDP context) is enabled at SGSN but doesn't show up in
the bitmask, SGSN will destroy the PDP context with GGSN
(DeletePDPContextReq) towards GGSN prior to re-creating it.
When SGSN receives the DeletePDPContextResp, it would forward a
DeactivatePDPContextReq to the UE for a PDP context which was not known
by the UE anymore, this is wrong.
With this patch, the state of the NSAPI/PDP at the UE side is tracked,
and used to know whether when the PDP gets deleted on the GGSN side then
it needs to also be deleted on the Iu side.
Change-Id: I0ccd9228d71c29248b5f510356dbfdb09565dc30
---
M include/osmocom/sgsn/pdpctx.h
M src/sgsn/gprs_gmm.c
M src/sgsn/sgsn_libgtp.c
3 files changed, 32 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/36/37636/1
diff --git a/include/osmocom/sgsn/pdpctx.h b/include/osmocom/sgsn/pdpctx.h
index 255a77d..f3cf0ed 100644
--- a/include/osmocom/sgsn/pdpctx.h
+++ b/include/osmocom/sgsn/pdpctx.h
@@ -68,6 +68,7 @@
//uint32_t qos_profile_neg;
uint8_t radio_prio;
//uint32_t charging_id;
+ bool ue_pdp_active; /* PDP Context is active for this NSAPI? */
struct osmo_timer_list timer;
unsigned int T; /* Txxxx number */
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index 653c425..ab8b7ef 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -1591,6 +1591,7 @@
LOGMMCTXP(LOGL_NOTICE, mmctx, "Dropping PDP context for NSAPI=%u "
"due to PDP CTX STATUS IE=0x%02x%02x\n",
pdp->nsapi, pdp_status[1], pdp_status[0]);
+ pdp->ue_pdp_active = false;
if (pdp->ggsn)
sgsn_delete_pdp_ctx(pdp);
else /* GTP side already detached, freeing */
diff --git a/src/sgsn/sgsn_libgtp.c b/src/sgsn/sgsn_libgtp.c
index 9edd0c6..4885ada 100644
--- a/src/sgsn/sgsn_libgtp.c
+++ b/src/sgsn/sgsn_libgtp.c
@@ -378,6 +378,7 @@
rc = gsm48_tx_gsm_act_pdp_acc(pctx);
if (rc < 0)
return rc;
+ pctx->ue_pdp_active = true;
if (pctx->mm->ran_type == MM_CTX_T_GERAN_Gb) {
/* Send SNDCP XID to MS */
@@ -567,9 +568,11 @@
return -ENOTSUP;
#endif
}
-
- /* Confirm deactivation of PDP context to MS */
- rc = gsm48_tx_gsm_deact_pdp_acc(pctx);
+ if (pctx->ue_pdp_active) {
+ /* Confirm deactivation of PDP context to MS */
+ rc = gsm48_tx_gsm_deact_pdp_acc(pctx);
+ pctx->ue_pdp_active = false;
+ }
} else {
LOGPDPCTXP(LOGL_NOTICE, pctx,
"Not deactivating SNDCP layer since the MM context "
--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/37636?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I0ccd9228d71c29248b5f510356dbfdb09565dc30
Gerrit-Change-Number: 37636
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: newchange
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37625?usp=email )
Change subject: sgsn: Introduce test TC_attach_pdp_act_pmm_idle_lost_pdp_status
......................................................................
Patch Set 2:
This change is ready for review.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37625?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I34a0dabc37ba24d0c9fb1ae2587e7ec8c1b606fa
Gerrit-Change-Number: 37625
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Fri, 26 Jul 2024 14:36:15 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: osmith.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/37633?usp=email )
Change subject: jobs/osmocom-depcheck: remove
......................................................................
Patch Set 1: Code-Review+1
(1 comment)
Patchset:
PS1:
This may still be useful in case where a single project is released for instance.
I'm not sure we should simply remove it, but you know better.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/37633?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I8b159ececaed86369fe272ae8a8bf0e88b0effa2
Gerrit-Change-Number: 37633
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: osmith <osmith(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 26 Jul 2024 11:44:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment