Change in pysim[master]: Initial implementation for programming MSISDN

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

herlesupreeth gerrit-no-reply at lists.osmocom.org
Mon Jan 20 12:18:00 UTC 2020


herlesupreeth has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/16946 )


Change subject: Initial implementation for programming MSISDN
......................................................................

Initial implementation for programming MSISDN

Change-Id: Ie033a0ffc3697ae562eaa7a241a0f6af6c2b0594
---
M pySim-prog.py
1 file changed, 22 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/46/16946/1

diff --git a/pySim-prog.py b/pySim-prog.py
index 2638eef..739c7b1 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -157,6 +157,10 @@
 			help="Perform a 'dry run', don't actually program the card",
 			default=False, action="store_true")
 
+	parser.add_option("--msisdn", dest="msisdn",
+			help="MSISDN",
+		)
+
 	(options, args) = parser.parse_args()
 
 	if options.type == 'list':
@@ -262,6 +266,22 @@
 	# Digitize MCC/MNC (5 or 6 digits)
 	plmn_digits = _mcc_mnc_digits(mcc, mnc)
 
+	if opts.name is not None and len(opts.name) > 16:
+		raise ValueError('Service Provider Name must max 16 characters!');
+		name = opts.name
+	else:
+		name = None
+
+	if opts.msisdn is not None:
+		if not _isnum(opts.msisdn):
+			raise ValueError('MSISDN must be digits only!');
+		if len(opts.msisdn) > 10*2:
+			# Need to support MSISDN of length > 20
+			raise ValueError('For now support for MSISDN of length <= 20 digits!');
+		msisdn = opts.msisdn
+	else:
+		msisdn = None
+
 	# ICCID (19 digits, E.118), though some phase1 vendors use 20 :(
 	if opts.iccid is not None:
 		iccid = opts.iccid
@@ -390,7 +410,7 @@
 
 	# Return that
 	return {
-		'name'	: opts.name,
+		'name'	: name,
 		'iccid'	: iccid,
 		'mcc'	: mcc,
 		'mnc'	: mnc,
@@ -400,6 +420,7 @@
 		'opc'	: opc,
 		'acc'	: acc,
 		'pin_adm' : pin_adm,
+		'msisdn' : msisdn,
 	}
 
 

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/16946
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie033a0ffc3697ae562eaa7a241a0f6af6c2b0594
Gerrit-Change-Number: 16946
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200120/8128e2cc/attachment.htm>


More information about the gerrit-log mailing list