aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/vty_test_runner.py
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-27 21:07:57 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-27 22:02:24 +0200
commitc63f6f1f324baaff41f8ea543f32479a09a71cd0 (patch)
tree58601ec5ddd1c3f8ec24d43b911b327d7a12df0e /openbsc/tests/vty_test_runner.py
parente7bd863f763809b152fb21655abe7e8bba557561 (diff)
expiration: Allow to disable the periodic location updating procedure
Disable the periodic LU using "no periodic location update" VTY command. In that case set the expire_lu to 0 which will then be translated to a NULL in the database layer. This leads to a bit of copy and paste in the db_sync_subscriber method but I don't see how we could easily use 'datetime(%i, 'unixepoch')' and 'NULL' at the same time. Change the query to find expired queries to check for NOT NULL and the time being in the past. This means if there are still old subscribers in the database they might not be expired. One would need to execute a query like "UPATE Subscriber SET expire_lu = 0 WHERE expire_lu is null". The same applies when disabling the periodic LU. One would need to update the database by hand. Manual tests executed/passed: 1.) periodic LU enabled: * use gst LUTest.st to do a LU * UPDATE Subscriber SET expire_lu=datetime('now'); * observe the subscriber being expired (it was) 2.) periodic LU disabled: * use gst LUTest.st to do a LU * verify that the expire_lu is NULL in the database
Diffstat (limited to 'openbsc/tests/vty_test_runner.py')
-rw-r--r--openbsc/tests/vty_test_runner.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 9d283fd97..fb01b8976 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -55,6 +55,37 @@ class TestVTYBase(unittest.TestCase):
self.vty = None
osmoutil.end_proc(self.proc)
+class TestVTYNITB(TestVTYBase):
+
+ def vty_command(self):
+ return ["./src/osmo-nitb/osmo-nitb", "-c",
+ "doc/examples/osmo-nitb/nanobts/openbsc.cfg"]
+
+ def vty_app(self):
+ return (4242, "./src/osmo-nitb/osmo-nitb", "OpenBSC", "nitb")
+
+ def testEnableDisablePeriodicLU(self):
+ self.vty.enable()
+ self.vty.command("configure terminal")
+ self.vty.command("network")
+ self.vty.command("bts 0")
+
+ # Test invalid input
+ self.vty.verify("periodic location update 0", ['% Unknown command.'])
+ self.vty.verify("periodic location update 5", ['% Unknown command.'])
+ self.vty.verify("periodic location update 1531", ['% Unknown command.'])
+
+ # Enable periodic lu..
+ self.vty.verify("periodic location update 60", [''])
+ res = self.vty.command("write terminal")
+ self.assertGreater(res.find('periodic location update 60'), 0)
+ self.assertEquals(res.find('no periodic location update'), -1)
+
+ # Now disable it..
+ self.vty.verify("no periodic location update", [''])
+ res = self.vty.command("write terminal")
+ self.assertEquals(res.find('periodic location update 60'), -1)
+ self.assertGreater(res.find('no periodic location update'), 0)
class TestVTYNAT(TestVTYBase):
@@ -105,6 +136,7 @@ if __name__ == '__main__':
os.chdir(workdir)
print "Running tests for specific VTY commands"
suite = unittest.TestSuite()
+ suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYNITB))
add_nat_test(suite, workdir)
res = unittest.TextTestRunner(verbosity=verbose_level).run(suite)
sys.exit(len(res.errors) + len(res.failures))