dexter has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/28163 )
Change subject: pySim-shell: make APDU command available on the lowest level
......................................................................
pySim-shell: make APDU command available on the lowest level
The apdu command is used to communicate with the card on the lowest
possible level. Lets make it available even before a card profile (rs)
is avalable. This is especially useful when the card has no files on it,
in this situation pySim-shell will not be able to assign a profile to
the card at all. We can then use the apdu command to equip the card with
the most basic files and start over.
Change-Id: I601b8f17bd6af41dcbf7bbb53c75903dd46beee7
---
M pySim-shell.py
1 file changed, 21 insertions(+), 15 deletions(-)
Approvals:
laforge: Looks good to me, approved
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/pySim-shell.py b/pySim-shell.py
index 7ec77d3..7fa9d81 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -91,7 +91,7 @@
profile = CardProfile.pick(scc)
if profile is None:
print("Unsupported card type!")
- return None, None
+ return None, card
print("Info: Card is of type: %s" % str(profile))
@@ -224,7 +224,10 @@
not self.numeric_path)
self.prompt = 'pySIM-shell (%s)> ' % ('/'.join(path_list))
else:
- self.prompt = 'pySIM-shell (no card)> '
+ if self.card:
+ self.prompt = 'pySIM-shell (no card profile)> '
+ else:
+ self.prompt = 'pySIM-shell (no card)> '
@cmd2.with_category(CUSTOM_CATEGORY)
def do_intro(self, _):
@@ -241,6 +244,21 @@
rs, card = init_card(sl)
self.equip(card, rs)
+ apdu_cmd_parser = argparse.ArgumentParser()
+ apdu_cmd_parser.add_argument('APDU', type=str, help='APDU as hex string')
+
+ @cmd2.with_argparser(apdu_cmd_parser)
+ def do_apdu(self, opts):
+ """Send a raw APDU to the card, and print SW + Response.
+ DANGEROUS: pySim-shell will not know any card state changes, and
+ not continue to work as expected if you e.g. select a different
+ file."""
+ data, sw = self.card._scc._tp.send_apdu(opts.APDU)
+ if data:
+ self.poutput("SW: %s, RESP: %s" % (sw, data))
+ else:
+ self.poutput("SW: %s" % sw)
+
class InterceptStderr(list):
def __init__(self):
self._stderr_backup = sys.stderr
@@ -683,18 +701,6 @@
else:
raise ValueError("error: cannot authenticate, no adm-pin!")
- apdu_cmd_parser = argparse.ArgumentParser()
- apdu_cmd_parser.add_argument('APDU', type=str, help='APDU as hex string')
-
- @cmd2.with_argparser(apdu_cmd_parser)
- def do_apdu(self, opts):
- """Send a raw APDU to the card, and print SW + Response.
- DANGEROUS: pySim-shell will not know any card state changes, and
- not continue to work as expected if you e.g. select a different
- file."""
- data, sw = self._cmd.card._scc._tp.send_apdu(opts.APDU)
- self._cmd.poutput("SW: %s %s, RESP: %s" % (sw, self._cmd.rs.interpret_sw(sw), data))
-
@with_default_category('ISO7816 Commands')
class Iso7816Commands(CommandSet):
@@ -940,7 +946,7 @@
" it should also be noted that some readers may behave strangely when no card")
print(" is inserted.)")
print("")
- app = PysimApp(None, None, sl, ch, opts.script)
+ app = PysimApp(card, None, sl, ch, opts.script)
# If the user supplies an ADM PIN at via commandline args authenticate
# immediately so that the user does not have to use the shell commands
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/28163
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I601b8f17bd6af41dcbf7bbb53c75903dd46beee7
Gerrit-Change-Number: 28163
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>
Gerrit-MessageType: merged
Attention is currently required from: fixeria, dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/28185 )
Change subject: ts_102_221: The BTLV IEs FILE SIZE and TOTAL FILE SIZE have a min length
......................................................................
Patch Set 7: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/28185
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ief113ce8fe3bcae2c9fb2ff4138df9ccf98d26ff
Gerrit-Change-Number: 28185
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 03 Jun 2022 07:37:03 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/28163 )
Change subject: pySim-shell: make APDU command available on the lowest level
......................................................................
Patch Set 3: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/28163
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I601b8f17bd6af41dcbf7bbb53c75903dd46beee7
Gerrit-Change-Number: 28163
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Fri, 03 Jun 2022 07:36:20 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/28160 )
Change subject: pySim-shell: extend walk() so that we can also have an action of ADF or DF
......................................................................
Patch Set 5: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/28160
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iabcd78552a14a2d3f8f31273dda7731e1f640cdb
Gerrit-Change-Number: 28160
Gerrit-PatchSet: 5
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: Fri, 03 Jun 2022 07:35:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28220 )
Change subject: BSC_Tests: fix a race condition in TC_imm_ass_pre_ts_ack
......................................................................
BSC_Tests: fix a race condition in TC_imm_ass_pre_ts_ack
This test case sporadically fails on Jenkins and 9/10 times on my
machine. The problem appears to be that we are sending both the
RSL CHANnel ReQuireD and the VTY command simultaneously, and the
later may be handled earlier than the former by osmo-bsc.
Ensure that the RSL message is handled first by sending the VTY
command after we have received the RSL CHANnel ACTivation message.
Change-Id: I38cd31041741b69eb15098a089b4d4b6b918ffd4
---
M bsc/BSC_Tests.ttcn
1 file changed, 3 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/20/28220/1
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index feb8bfb..2ee47b3 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -10951,9 +10951,6 @@
var uint8_t ra := 2;
f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn));
- /* (set bts 0 cfg back to default) */
- f_vty_set_imm_ass(BSCVTY);
-
chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr;
var DchanTuple dt;
@@ -10964,6 +10961,9 @@
mtc.stop;
}
+ /* (set bts 0 cfg back to default) */
+ f_vty_set_imm_ass(BSCVTY);
+
/* *FIRST* expect the Immediate Assignment, before we ACK the chan act */
imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0));
f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn,
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28220
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: I38cd31041741b69eb15098a089b4d4b6b918ffd4
Gerrit-Change-Number: 28220
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: pespin, fixeria.
neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28214 )
Change subject: BSC_Tests: add TC_chan_alloc_algo_{a,de}scending
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
BTW, even though ttcn3 tests are generally the "proper" tests, testing which channels are allocated in which order should be a lot easier and faster using osmo-bsc/tests/handover/ VTY scripts. ...Those tests shouldn't be called "handover" anymore because they already contain channel allocation tests unrelated to handover.
In such test, I'd even fill up the entire BTS to test the complete order in which it fills up,
then release a few channels in the middle, activate new ones, and so forth;
such elaborate stuff runs extremely fast in handover test scripts.
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/28214
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: Ic74a9cd264320a9a17648f9331b67fb2c2404122
Gerrit-Change-Number: 28214
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Thu, 02 Jun 2022 18:50:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment