[MERGED] osmo-gsm-tester[master]: nitb: Introduce 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: nitb: Introduce subscriber_delete API
......................................................................


nitb: Introduce subscriber_delete API

Change-Id: I62829ed243857681bcc40a4a1861c5c583907f4b
---
M src/osmo_gsm_tester/osmo_nitb.py
1 file changed, 17 insertions(+), 0 deletions(-)

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



diff --git a/src/osmo_gsm_tester/osmo_nitb.py b/src/osmo_gsm_tester/osmo_nitb.py
index 3b396fa..be3b24b 100644
--- a/src/osmo_gsm_tester/osmo_nitb.py
+++ b/src/osmo_gsm_tester/osmo_nitb.py
@@ -119,6 +119,10 @@
         self.log('Add subscriber', msisdn=msisdn, imsi=modem.imsi())
         OsmoNitbCtrl(self).subscriber_add(modem.imsi(), msisdn, modem.ki())
 
+    def subscriber_delete(self, modem):
+        self.log('Delete subscriber', imsi=modem.imsi())
+        OsmoNitbCtrl(self).subscriber_delete(modem.imsi())
+
     def subscriber_attached(self, *modems):
         return self.imsi_attached(*[m.imsi() for m in modems])
 
@@ -138,6 +142,8 @@
     PORT = 4249
     SUBSCR_MODIFY_VAR = 'subscriber-modify-v1'
     SUBSCR_MODIFY_REPLY_RE = re.compile("SET_REPLY (\d+) %s OK" % SUBSCR_MODIFY_VAR)
+    SUBSCR_DELETE_VAR = 'subscriber-delete-v1'
+    SUBSCR_DELETE_REPLY_RE = re.compile("SET_REPLY (\d+) %s Removed" % SUBSCR_DELETE_VAR)
     SUBSCR_LIST_ACTIVE_VAR = 'subscriber-list-active-v1'
 
     def __init__(self, nitb):
@@ -167,6 +173,17 @@
                 raise RuntimeError('Cannot create subscriber %r (answer=%r)' % (imsi, answer_str))
             self.dbg('Created subscriber', imsi=imsi, msisdn=msisdn)
 
+    def subscriber_delete(self, imsi):
+        with self.ctrl() as ctrl:
+            ctrl.do_set(OsmoNitbCtrl.SUBSCR_DELETE_VAR, imsi)
+            data = ctrl.receive()
+            (answer, data) = ctrl.remove_ipa_ctrl_header(data)
+            answer_str = answer.decode('utf-8')
+            res = OsmoNitbCtrl.SUBSCR_DELETE_REPLY_RE.match(answer_str)
+            if not res:
+                raise RuntimeError('Cannot delete subscriber %r (answer=%r)' % (imsi, answer_str))
+            self.dbg('Deleted subscriber', imsi=imsi)
+
     def subscriber_list_active(self):
         aslist_str = ""
         with self.ctrl() as ctrl:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I62829ed243857681bcc40a4a1861c5c583907f4b
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