summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-08-23 17:03:48 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-08-23 17:03:48 +0200
commit0755cdb138ba58db4ece6bb7611dbbd5086e2f67 (patch)
treecfce7f4e86c2de13f7cda5d70e16ac941e87ab65
parent6610dfe0f58aea6301fa702e7cfd1ae02ba9d4dd (diff)
hlr: Implement subscriber_delete API
-rw-r--r--src/osmo_gsm_tester/osmo_hlr.py13
1 files changed, 13 insertions, 0 deletions
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 @@ class OsmoHlr(log.Origin):
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))