dexter has uploaded this change for review.

View Change

pySim-shell: add command to manually query the Card Key Provider

The Card Key Provider is a built in mechanism of pySim-shell which
allows the user to read key material from a CSV file in order to
avoid having to lookup and enter the key material himself. The
lookup normally done by the pySim-shell commands automatically.

However, in some cases it may also be useful to be able to query the
CSV file manually in order to get certain fields displayed. Such a
command is in particular helpful to check and diagnose the CSV data
source.

Related: SYS#7725
Change-Id: I76e0f883572a029bdca65a5a6b3eef306db1c221
---
M pySim-shell.py
1 file changed, 15 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/67/41467/1
diff --git a/pySim-shell.py b/pySim-shell.py
index 8b0b58e..b933a03 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -498,6 +498,21 @@
"""Echo (print) a string on the console"""
self.poutput(' '.join(opts.STRING))

+ query_card_key_parser = argparse.ArgumentParser()
+ query_card_key_parser.add_argument('FIELDS', help="fields to query", type=str, nargs='+')
+ query_card_key_parser.add_argument('--key', help='lookup key (typically \'ICCID\' or \'EID\')',
+ type=str, required=True)
+ query_card_key_parser.add_argument('--value', help='lookup key match value (e.g \'8988211000000123456\')',
+ type=str, required=True)
+ @cmd2.with_argparser(query_card_key_parser)
+ @cmd2.with_category(CUSTOM_CATEGORY)
+ def do_query_card_key(self, opts):
+ """Manually query the Card Key Provider"""
+ result = card_key_provider_get(opts.FIELDS, opts.key, opts.value)
+ self.poutput("Result:")
+ for k in result.keys():
+ self.poutput(" %s: %s" % (str(k), str(result.get(k))))
+
@cmd2.with_category(CUSTOM_CATEGORY)
def do_version(self, opts):
"""Print the pySim software version."""

To view, visit change 41467. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I76e0f883572a029bdca65a5a6b3eef306db1c221
Gerrit-Change-Number: 41467
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>