summaryrefslogtreecommitdiffstats
path: root/openbsc/tests/vty_test_runner.py
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2016-06-19 18:06:02 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-18 17:46:32 +0200
commit5fd3a2cd21d90027391f14466f737837dd6e6674 (patch)
tree64df9f678640465b060470600c9f2ad7b51e4eab /openbsc/tests/vty_test_runner.py
parent9e1721f332d283cc8832d6584cff8297b41101c7 (diff)
Use libvlr in libmsc (large refactoring)
Original libvlr code is by Harald Welte <laforge@gnumonks.org>, polished and tweaked by Neels Hofmeyr <nhofmeyr@sysmocom.de>. This is a long series of development collapsed in one patch. The original history may still be available as branch neels/vlr_orig. TODO: This commit may be split in several smaller changes before merging to master. SMS: The SQL based lookup of SMS for attached subscribers no longer works since the SQL database no longer has the subscriber data. Replace with a round-robin on the SMS recipient MSISDNs paired with a VLR subscriber RAM lookup whether the subscriber is currently attached. If there are many SMS for not-attached subscribers in the SMS database, this will become inefficient: a DB hit returns a pending SMS, the RAM lookup will reveal that the subscriber is not attached, after which the DB is hit for the next SMS. It would become more efficient e.g. by having an MSISDN based hash list for the VLR subscribers and by marking non-attached SMS recipients in the SMS database so that they can be excluded with the SQL query already. There is a sanity limit to do at most 100 db hits per attempt to find a pending SMS. So if there are more than 100 stored SMS waiting for their recipients to actually attach to the MSC, it may take more than one SMS queue trigger to deliver SMS for subscribers that are actually attached. This is not very beautiful, but is merely intended to carry us over to a time when we have a proper separate SMSC entity. Introduce gsm_subscriber_connection ref-counting in libmsc. Related: OS#1592 Change-Id: I702ba504ce2de93507312c28eca8d11f09f4ee8b
Diffstat (limited to 'openbsc/tests/vty_test_runner.py')
-rw-r--r--openbsc/tests/vty_test_runner.py150
1 files changed, 11 insertions, 139 deletions
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 92775d5b7..25900023a 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -250,8 +250,10 @@ class TestVTYNITB(TestVTYGenericBSC):
self.vty.command("end")
self.vty.command("configure terminal")
self.vty.command("nitb")
- self.assertTrue(self.vty.verify("subscriber-create-on-demand", ['']))
- self.assertTrue(self.vty.verify("subscriber-create-on-demand no-extension", ['']))
+ self.assertTrue(self.vty.verify('subscriber-create-on-demand',
+ ["% 'subscriber-create-on-demand' is no longer supported.", '% This is now up to osmo-hlr.']))
+ self.assertTrue(self.vty.verify("subscriber-create-on-demand no-extension",
+ ["% 'subscriber-create-on-demand' is no longer supported.", '% This is now up to osmo-hlr.']))
self.vty.command("end")
def testSi2Q(self):
@@ -367,42 +369,6 @@ class TestVTYNITB(TestVTYGenericBSC):
if classNum != 10:
self.assertEquals(res.find("rach access-control-class " + str(classNum) + " barred"), -1)
- def testSubscriberCreateDeleteTwice(self):
- """
- OS#1657 indicates that there might be an issue creating the
- same subscriber twice. This test will use the VTY command to
- create a subscriber and then issue a second create command
- with the same IMSI. The test passes if the VTY continues to
- respond to VTY commands.
- """
- self.vty.enable()
-
- imsi = "204300854013739"
-
- # Initially we don't have this subscriber
- self.vty.verify('show subscriber imsi '+imsi, ['% No subscriber found for imsi '+imsi])
-
- # Lets create one
- res = self.vty.command('subscriber create imsi '+imsi)
- self.assert_(res.find(" IMSI: "+imsi) > 0)
- # And now create one again.
- res2 = self.vty.command('subscriber create imsi '+imsi)
- self.assert_(res2.find(" IMSI: "+imsi) > 0)
- self.assertEqual(res, res2)
-
- # Verify it has been created
- res = self.vty.command('show subscriber imsi '+imsi)
- self.assert_(res.find(" IMSI: "+imsi) > 0)
-
- # Delete it
- res = self.vty.command('subscriber imsi ' + imsi + ' delete')
- self.assert_("" == res)
-
- # Now it should not be there anymore
- res = self.vty.command('show subscriber imsi '+imsi)
- self.assert_(('% No subscriber found for imsi ' + imsi) == res)
-
-
def testSubscriberCreateDelete(self):
self.vty.enable()
@@ -412,69 +378,10 @@ class TestVTYNITB(TestVTYGenericBSC):
imsi4 = "444583744053764"
# Initially we don't have this subscriber
- self.vty.verify('show subscriber imsi '+imsi, ['% No subscriber found for imsi '+imsi])
-
- # Lets create one
- res = self.vty.command('subscriber create imsi '+imsi)
- self.assert_(res.find(" IMSI: "+imsi) > 0)
- self.assert_(res.find("Extension") > 0)
-
- # Now we have it
- res = self.vty.command('show subscriber imsi '+imsi)
- self.assert_(res.find(" IMSI: "+imsi) > 0)
-
- # With narrow random interval
- self.vty.command("configure terminal")
- self.vty.command("nitb")
- self.assertTrue(self.vty.verify("subscriber-create-on-demand", ['']))
- # wrong interval
- res = self.vty.command("subscriber-create-on-demand random 221 122")
- # error string will contain arguments
- self.assert_(res.find("122") > 0)
- self.assert_(res.find("221") > 0)
- # correct interval - silent ok
- self.assertTrue(self.vty.verify("subscriber-create-on-demand random 221 222", ['']))
- self.vty.command("end")
-
- res = self.vty.command('subscriber create imsi ' + imsi2)
- self.assert_(res.find(" IMSI: " + imsi2) > 0)
- self.assert_(res.find("221") > 0 or res.find("222") > 0)
- self.assert_(res.find(" Extension: ") > 0)
+ self.assertTrue(self.vty.verify('show subscriber imsi '+imsi, ['% No subscriber found for imsi '+imsi]))
- # Without extension
- self.vty.command("configure terminal")
- self.vty.command("nitb")
- self.assertTrue(self.vty.verify("subscriber-create-on-demand no-extension", ['']))
- self.vty.command("end")
- res = self.vty.command('subscriber create imsi ' + imsi3)
- self.assert_(res.find(" IMSI: " + imsi3) > 0)
- self.assertEquals(res.find("Extension"), -1)
-
- # With extension again
- self.vty.command("configure terminal")
- self.vty.command("nitb")
- self.assertTrue(self.vty.verify("no subscriber-create-on-demand", ['']))
- self.assertTrue(self.vty.verify("subscriber-create-on-demand", ['']))
- self.assertTrue(self.vty.verify("subscriber-create-on-demand random 221 666", ['']))
- self.vty.command("end")
-
- res = self.vty.command('subscriber create imsi ' + imsi4)
- self.assert_(res.find(" IMSI: " + imsi4) > 0)
- self.assert_(res.find(" Extension: ") > 0)
-
- # Delete it
- res = self.vty.command('subscriber imsi ' + imsi + ' delete')
- self.assert_("" == res)
- res = self.vty.command('subscriber imsi ' + imsi2 + ' delete')
- self.assert_("" == res)
- res = self.vty.command('subscriber imsi ' + imsi3 + ' delete')
- self.assert_("" == res)
- res = self.vty.command('subscriber imsi ' + imsi4 + ' delete')
- self.assert_("" == res)
-
- # Now it should not be there anymore
- res = self.vty.command('show subscriber imsi '+imsi)
- self.assert_(('% No subscriber found for imsi ' + imsi) == res)
+ # deprecated
+ self.assertTrue(self.vty.verify('subscriber create imsi '+imsi, ["% 'subscriber create' now needs to be done at osmo-hlr"]))
# range
self.vty.command("end")
@@ -502,50 +409,15 @@ class TestVTYNITB(TestVTYGenericBSC):
self.vty.enable()
imsi = "204300854013739"
- imsi2 = "204301824913769"
- wrong_imsi = "204300999999999"
-
- # Lets create one
- res = self.vty.command('subscriber create imsi '+imsi)
- self.assert_(res.find(" IMSI: "+imsi) > 0)
- self.assert_(res.find("Extension") > 0)
-
- self.vty.verify('subscriber imsi '+wrong_imsi+' name wrong', ['% No subscriber found for imsi '+wrong_imsi])
- res = self.vty.command('subscriber imsi '+imsi+' name '+('X' * 160))
- self.assert_(res.find("NAME is too long") > 0)
-
- self.vty.verify('subscriber imsi '+imsi+' name '+('G' * 159), [''])
- self.vty.verify('subscriber imsi '+wrong_imsi+' extension 840', ['% No subscriber found for imsi '+wrong_imsi])
- res = self.vty.command('subscriber imsi '+imsi+' extension '+('9' * 15))
- self.assert_(res.find("EXTENSION is too long") > 0)
-
- self.vty.verify('subscriber imsi '+imsi+' extension '+('1' * 14), [''])
+ self.assertTrue(self.vty.verify('subscriber imsi '+imsi+' name foo', ["% 'subscriber name' is no longer supported.", '% This is now up to osmo-hlr.']))
+ self.assertTrue(self.vty.verify('subscriber imsi '+imsi+' extension 1234', ["% 'subscriber extension' is no longer supported.", '% This is now up to osmo-hlr.']))
+ self.assertTrue(self.vty.verify('subscriber imsi '+imsi+' delete', ["% 'subscriber delete' is no longer supported.", '% This is now up to osmo-hlr.']))
# With narrow random interval
self.vty.command("configure terminal")
self.vty.command("nitb")
- self.assertTrue(self.vty.verify("subscriber-create-on-demand", ['']))
- # wrong interval
- res = self.vty.command("subscriber-create-on-demand random 221 122")
- self.assert_(res.find("122") > 0)
- self.assert_(res.find("221") > 0)
- # correct interval
- self.assertTrue(self.vty.verify("subscriber-create-on-demand random 221 222", ['']))
- self.vty.command("end")
-
- # create subscriber with extension in a configured interval
- res = self.vty.command('subscriber create imsi ' + imsi2)
- self.assert_(res.find(" IMSI: " + imsi2) > 0)
- self.assert_(res.find("221") > 0 or res.find("222") > 0)
- self.assert_(res.find(" Extension: ") > 0)
-
- # Delete it
- res = self.vty.command('subscriber imsi ' + imsi + ' delete')
- self.assert_(res != "")
- # imsi2 is inactive so deletion should succeed
- res = self.vty.command('subscriber imsi ' + imsi2 + ' delete')
- self.assert_("" == res)
+ self.assertTrue(self.vty.verify('subscriber-create-on-demand', ["% 'subscriber-create-on-demand' is no longer supported.", '% This is now up to osmo-hlr.']))
def testShowPagingGroup(self):
res = self.vty.command("show paging-group 255 1234567")