summaryrefslogtreecommitdiffstats
path: root/openbsc/tests/vty_test_runner.py
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-05-20 21:59:55 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-06-18 17:49:00 +0200
commit61692adb2b0cd090c8fb8c81376a28bca099d079 (patch)
treebee3b3fde06ec8dc2a4cb9208ceae3465cea25a5 /openbsc/tests/vty_test_runner.py
parent58774cba12ec4675e32fa524cfa631bdc690a9da (diff)
Implement IuCS (large refactoring and addition)
osmo-nitb becomes osmo-msc add DIUCS debug log constant add iucs.[hc] add msc vty, remove nitb vty add libiudummy, to avoid linking Iu deps in tests Use new msc_tx_dtap() instead of gsm0808_submit_dtap() libmgcp: add mgcpgw client API bridge calls via mgcpgw mgcp: hack RAB success from nano3G: patch first RTP payload The ip.access nano3G needs the first RTP payload's first two bytes to read hex 'e400', or it will reject the RAB assignment. Add flag patched_first_rtp_payload to mgcp_rtp_state to detect the first RTP payload on a stream, and overwrite its first bytes with e400. This should probably be configurable, but seems to not harm other femto cells (as long as we patch only the first RTP payload in each stream). Only do this when sending to the BTS side. Change-Id: Ie13ff348117e892d41b8355ab6c24915301eaeaf
Diffstat (limited to 'openbsc/tests/vty_test_runner.py')
-rw-r--r--openbsc/tests/vty_test_runner.py159
1 files changed, 27 insertions, 132 deletions
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 25900023a..b5c73755c 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -34,6 +34,14 @@ confpath = os.path.join(sys.path[0], '..')
class TestVTYBase(unittest.TestCase):
+ def checkForEndAndExit(self):
+ res = self.vty.command("list")
+ #print ('looking for "exit"\n')
+ self.assert_(res.find(' exit\r') > 0)
+ #print 'found "exit"\nlooking for "end"\n'
+ self.assert_(res.find(' end\r') > 0)
+ #print 'found "end"\n'
+
def vty_command(self):
raise Exception("Needs to be implemented by a subclass")
@@ -124,15 +132,7 @@ class TestVTYMGCP(TestVTYBase):
class TestVTYGenericBSC(TestVTYBase):
- def checkForEndAndExit(self):
- res = self.vty.command("list")
- #print ('looking for "exit"\n')
- self.assert_(res.find(' exit\r') > 0)
- #print 'found "exit"\nlooking for "end"\n'
- self.assert_(res.find(' end\r') > 0)
- #print 'found "end"\n'
-
- def _testConfigNetworkTree(self):
+ def _testConfigNetworkTree(self, include_bsc_items=True):
self.vty.enable()
self.assertTrue(self.vty.verify("configure terminal",['']))
self.assertEquals(self.vty.node(), 'config')
@@ -166,17 +166,28 @@ class TestVTYGenericBSC(TestVTYBase):
self.assertTrue(self.vty.verify("exit",['']))
self.assertTrue(self.vty.node() is None)
-class TestVTYNITB(TestVTYGenericBSC):
+class TestVTYMSC(TestVTYBase):
def vty_command(self):
- return ["./src/osmo-nitb/osmo-nitb", "-c",
- "doc/examples/osmo-nitb/nanobts/openbsc.cfg"]
+ return ["./src/osmo-msc/osmo-msc", "-c",
+ "doc/examples/osmo-msc/osmo-msc.cfg"]
def vty_app(self):
- return (4242, "./src/osmo-nitb/osmo-nitb", "OpenBSC", "nitb")
+ return (4254, "./src/osmo-msc/osmo-msc", "OsmoMSC", "msc")
- def testConfigNetworkTree(self):
- self._testConfigNetworkTree()
+ def testConfigNetworkTree(self, include_bsc_items=True):
+ self.vty.enable()
+ self.assertTrue(self.vty.verify("configure terminal",['']))
+ self.assertEquals(self.vty.node(), 'config')
+ self.checkForEndAndExit()
+ self.assertTrue(self.vty.verify("network",['']))
+ self.assertEquals(self.vty.node(), 'config-net')
+ self.checkForEndAndExit()
+ self.vty.command("write terminal")
+ self.assertTrue(self.vty.verify("exit",['']))
+ self.assertEquals(self.vty.node(), 'config')
+ self.assertTrue(self.vty.verify("exit",['']))
+ self.assertTrue(self.vty.node() is None)
def checkForSmpp(self):
"""SMPP is not always enabled, check if it is"""
@@ -248,13 +259,6 @@ class TestVTYNITB(TestVTYGenericBSC):
self.assertTrue(self.vty.verify("authorized-regexp 02$", ['']))
self.assertTrue(self.vty.verify("authorized-regexp *123.*", ['']))
self.vty.command("end")
- self.vty.command("configure terminal")
- self.vty.command("nitb")
- 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):
self.vty.enable()
@@ -316,115 +320,6 @@ class TestVTYNITB(TestVTYGenericBSC):
self.assertEquals(res.find('periodic location update 60'), -1)
self.assert_(res.find('no periodic location update') > 0)
- def testEnableDisableSiHacks(self):
- self.vty.enable()
- self.vty.command("configure terminal")
- self.vty.command("network")
- self.vty.command("bts 0")
-
- # Enable periodic lu..
- self.vty.verify("force-combined-si", [''])
- res = self.vty.command("write terminal")
- self.assert_(res.find(' force-combined-si') > 0)
- self.assertEquals(res.find('no force-combined-si'), -1)
-
- # Now disable it..
- self.vty.verify("no force-combined-si", [''])
- res = self.vty.command("write terminal")
- self.assertEquals(res.find(' force-combined-si'), -1)
- self.assert_(res.find('no force-combined-si') > 0)
-
- def testRachAccessControlClass(self):
- self.vty.enable()
- self.vty.command("configure terminal")
- self.vty.command("network")
- self.vty.command("bts 0")
-
- # Test invalid input
- self.vty.verify("rach access-control-class", ['% Command incomplete.'])
- self.vty.verify("rach access-control-class 1", ['% Command incomplete.'])
- self.vty.verify("rach access-control-class -1", ['% Unknown command.'])
- self.vty.verify("rach access-control-class 10", ['% Unknown command.'])
- self.vty.verify("rach access-control-class 16", ['% Unknown command.'])
-
- # Barred rach access control classes
- for classNum in range(16):
- if classNum != 10:
- self.vty.verify("rach access-control-class " + str(classNum) + " barred", [''])
-
- # Verify settings
- res = self.vty.command("write terminal")
- for classNum in range(16):
- if classNum != 10:
- self.assert_(res.find("rach access-control-class " + str(classNum) + " barred") > 0)
-
- # Allowed rach access control classes
- for classNum in range(16):
- if classNum != 10:
- self.vty.verify("rach access-control-class " + str(classNum) + " allowed", [''])
-
- # Verify settings
- res = self.vty.command("write terminal")
- for classNum in range(16):
- if classNum != 10:
- self.assertEquals(res.find("rach access-control-class " + str(classNum) + " barred"), -1)
-
- def testSubscriberCreateDelete(self):
- self.vty.enable()
-
- imsi = "204300854013739"
- imsi2 = "222301824913762"
- imsi3 = "333500854113763"
- imsi4 = "444583744053764"
-
- # Initially we don't have this subscriber
- self.assertTrue(self.vty.verify('show subscriber imsi '+imsi, ['% No subscriber found for imsi '+imsi]))
-
- # 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")
- self.vty.command("configure terminal")
- self.vty.command("nitb")
- self.assertTrue(self.vty.verify("subscriber-create-on-demand random 9999999998 9999999999", ['']))
- res = self.vty.command("show running-config")
- self.assert_(res.find("subscriber-create-on-demand random 9999999998 9999999999"))
- self.vty.command("end")
-
- res = self.vty.command('subscriber create imsi ' + imsi)
- print(res)
- self.assert_(res.find(" IMSI: " + imsi) > 0)
- self.assert_(res.find("9999999998") > 0 or res.find("9999999999") > 0)
- self.assert_(res.find(" Extension: ") > 0)
-
- res = self.vty.command('subscriber imsi ' + imsi + ' delete')
- self.assert_("" == res)
-
- res = self.vty.command('show subscriber imsi '+imsi)
- self.assert_(('% No subscriber found for imsi ' + imsi) == res)
-
-
- def testSubscriberSettings(self):
- self.vty.enable()
-
- imsi = "204300854013739"
-
- 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', ["% '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")
- self.assertEqual(res, "% can't find BTS 255")
- res = self.vty.command("show paging-group 0 1234567")
- self.assertEquals(res, "%Paging group for IMSI 1234567 on BTS #0 is 7")
-
def testShowNetwork(self):
res = self.vty.command("show network")
self.assert_(res.startswith('BSC is on Country Code') >= 0)
@@ -1258,7 +1153,7 @@ if __name__ == '__main__':
print "Running tests for specific VTY commands"
suite = unittest.TestSuite()
suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYMGCP))
- suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYNITB))
+ suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYMSC))
add_bsc_test(suite, workdir)
add_nat_test(suite, workdir)
add_gbproxy_test(suite, workdir)