Change in pysim[master]: sysmoISIM-SJA2: Add support for programming EF.ePDGSelection (ePDG Se...

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/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Jan 5 09:53:49 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/21850 )

Change subject: sysmoISIM-SJA2: Add support for programming EF.ePDGSelection (ePDG Selection Information)
......................................................................

sysmoISIM-SJA2: Add support for programming EF.ePDGSelection (ePDG Selection Information)

If the EF.ePDGSelection is present, it is populated with a single entry with PLMN 1 set
to Home PLMN of USIM, ePDG FQDN format set to Operator Identifier FQDN and ePDG Priority value
set to 1.

Change-Id: I92f3f813afa41ae497ebc0dc2ca73da810f82364
---
M pySim-prog.py
M pySim/cards.py
2 files changed, 34 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/pySim-prog.py b/pySim-prog.py
index e172d80..93ae924 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -150,6 +150,9 @@
 	parser.add_option("--epdgid", dest="epdgid",
 			help="Set Home Evolved Packet Data Gateway (ePDG) Identifier. (Only FQDN format supported)",
 		)
+	parser.add_option("--epdgSelection", dest="epdgSelection",
+			help="Set PLMN for ePDG Selection Information. (Only Operator Identifier FQDN format supported)",
+		)
 	parser.add_option("--read-imsi", dest="read_imsi", action="store_true",
 			help="Read the IMSI from the CARD", default=False
 		)
@@ -433,6 +436,15 @@
 
 	pin_adm = sanitize_pin_adm(opts)
 
+	# ePDG Selection Information
+	if opts.epdgSelection:
+		if len(opts.epdgSelection) < 5 or len(opts.epdgSelection) > 6:
+			raise ValueError('ePDG Selection Information is not valid')
+		epdg_mcc = opts.epdgSelection[:3]
+		epdg_mnc = opts.epdgSelection[3:]
+		if not epdg_mcc.isdigit() or not epdg_mnc.isdigit():
+			raise ValueError('PLMN for ePDG Selection must only contain decimal digits')
+
 	# Return that
 	return {
 		'name'	: opts.name,
@@ -447,6 +459,7 @@
 		'pin_adm' : pin_adm,
 		'msisdn' : opts.msisdn,
 		'epdgid' : opts.epdgid,
+		'epdgSelection' : opts.epdgSelection,
 	}
 
 
diff --git a/pySim/cards.py b/pySim/cards.py
index 6243d4a..dc612df 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -284,6 +284,16 @@
 		else:
 			return (None, sw)
 
+	def update_ePDGSelection(self, mcc, mnc):
+		(res, sw) = self._scc.read_binary(EF_USIM_ADF_map['ePDGSelection'], length=None, offset=0)
+		if sw == '9000' and (len(mcc) == 0 or len(mnc) == 0):
+			# Reset contents
+			# 80 - Tag value
+			(res, sw) = self._scc.update_binary(EF_USIM_ADF_map['ePDGSelection'], rpad('', len(res)))
+		elif sw == '9000':
+			(res, sw) = self._scc.update_binary(EF_USIM_ADF_map['ePDGSelection'], enc_ePDGSelection(res, mcc, mnc))
+		return sw
+
 	def read_ust(self):
 		(res, sw) = self._scc.read_binary(EF_USIM_ADF_map['UST'])
 		if sw == '9000':
@@ -1195,6 +1205,17 @@
 					if sw != '9000':
 						print("Programming ePDGId failed with code %s"%sw)
 
+			# update EF.ePDGSelection in ADF.USIM
+			if self.file_exists(EF_USIM_ADF_map['ePDGSelection']):
+				if p.get('epdgSelection'):
+					epdg_plmn = p['epdgSelection']
+					sw = self.update_ePDGSelection(epdg_plmn[:3], epdg_plmn[3:])
+				else:
+					sw = self.update_ePDGSelection("", "")
+				if sw != '9000':
+					print("Programming ePDGSelection failed with code %s"%sw)
+
+
 		return
 
 

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I92f3f813afa41ae497ebc0dc2ca73da810f82364
Gerrit-Change-Number: 21850
Gerrit-PatchSet: 5
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210105/14ab970f/attachment.htm>


More information about the gerrit-log mailing list