[MERGED] osmo-gsm-tester[master]: hlr: Implement subscriber_delete API

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Aug 24 16:39:15 UTC 2017


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: hlr: Implement subscriber_delete API
......................................................................


hlr: Implement subscriber_delete API

Change-Id: Iefb30ad552929386743d936bf629fe7a760a4713
---
M src/osmo_gsm_tester/osmo_hlr.py
1 file changed, 13 insertions(+), 0 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/osmo_hlr.py b/src/osmo_gsm_tester/osmo_hlr.py
index 16548ad..08de07c 100644
--- a/src/osmo_gsm_tester/osmo_hlr.py
+++ b/src/osmo_gsm_tester/osmo_hlr.py
@@ -129,6 +129,19 @@
             conn.close()
         return subscriber_id
 
+    def subscriber_delete(self, modem):
+        self.log('Add subscriber', imsi=modem.imsi())
+        conn = sqlite3.connect(self.db_file)
+        try:
+            c = conn.cursor()
+            c.execute('select id from subscriber where imsi = ?', (modem.imsi(),))
+            subscriber_id = c.fetchone()[0]
+            c.execute('delete from subscriber where id = ?', (subscriber_id,))
+            c.execute('delete from auc_2g where subscriber_id = ?', (subscriber_id,))
+            conn.commit()
+        finally:
+            conn.close()
+
     def conf_for_msc(self):
         return dict(hlr=dict(ip_address=self.ip_address))
 

-- 
To view, visit https://gerrit.osmocom.org/3593
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iefb30ad552929386743d936bf629fe7a760a4713
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list