nitb/ctrl: Implement creating and deleting subscribers

Sadly there is no proper foreign key relationship on the tables
that related to the Subscriber. This means we can't use a DELETE
with Cascade and need to delete everything by hand. To make things
worse maybe the SMS/Paging code is still using the subscriber
making the operation more dangerous. I had added NULL checks for
sender_id/receiver_id at 30C3 so we should not crash in this
situation.

Fixes: SYS#274
diff --git a/openbsc/tests/ctrl_test_runner.py b/openbsc/tests/ctrl_test_runner.py
index 07a005d..56e9514 100644
--- a/openbsc/tests/ctrl_test_runner.py
+++ b/openbsc/tests/ctrl_test_runner.py
@@ -319,7 +319,7 @@
     def ctrl_app(self):
         return (4249, "./src/osmo-nitb/osmo-nitb", "OsmoBSC", "nitb")
 
-    def testSubscriberAdd(self):
+    def testSubscriberAddRemove(self):
         r = self.do_set('subscriber-modify-v1', '2620345,445566')
         self.assertEquals(r['mtype'], 'SET_REPLY')
         self.assertEquals(r['var'], 'subscriber-modify-v1')
@@ -333,6 +333,14 @@
         # TODO. verify that the entry has been created and modified? Invoke
         # the sqlite3 CLI or do it through the DB libraries?
 
+        r = self.do_set('subscriber-delete-v1', '2620345')
+        self.assertEquals(r['mtype'], 'SET_REPLY')
+        self.assertEquals(r['value'], 'Removed')
+
+        r = self.do_set('subscriber-delete-v1', '2620345')
+        self.assertEquals(r['mtype'], 'ERROR')
+        self.assertEquals(r['error'], 'Failed to find subscriber')
+
 class TestCtrlNAT(TestCtrlBase):
 
     def ctrl_command(self):