diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2013-10-23 11:24:15 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-24 08:21:29 +0200 |
commit | 6d233718053a59ebb23eea0d19d605d62334f3f1 (patch) | |
tree | 21f7fa666d0f1ad1850e5d1b56c98004bd9321d8 /openbsc/tests/vty_test_runner.py | |
parent | 7587727445e772f16f8449217324efaabd577e32 (diff) |
gbproxy: Add basic VTY tests
This checks for the ns and gbproxy config nodes and show commands.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/tests/vty_test_runner.py')
-rw-r--r-- | openbsc/tests/vty_test_runner.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py index 09352b839..e040caccf 100644 --- a/openbsc/tests/vty_test_runner.py +++ b/openbsc/tests/vty_test_runner.py @@ -495,6 +495,38 @@ class TestVTYNAT(TestVTYGenericBSC): res = self.vty.verify("show ussd-connection", ['The USSD side channel provider is not connected and not authorized.']) self.assertTrue(res) +class TestVTYGbproxy(TestVTYGenericBSC): + + def vty_command(self): + return ["./src/gprs/osmo-gbproxy", "-c", + "doc/examples/osmo-gbproxy/osmo-gbproxy.cfg"] + + def vty_app(self): + return (4246, "./src/gprs/osmo-gbproxy", "OsmoGbProxy", "bsc") + + def testVtyTree(self): + self.vty.enable() + self.assertTrue(self.vty.verify('configure terminal', [''])) + self.assertEquals(self.vty.node(), 'config') + self.ignoredCheckForEndAndExit() + self.assertTrue(self.vty.verify('ns', [''])) + self.assertEquals(self.vty.node(), 'config-ns') + self.checkForEndAndExit() + self.assertTrue(self.vty.verify('exit', [''])) + self.assertEquals(self.vty.node(), 'config') + self.assertTrue(self.vty.verify('gbproxy', [''])) + self.assertEquals(self.vty.node(), 'config-gbproxy') + self.checkForEndAndExit() + self.assertTrue(self.vty.verify('exit', [''])) + self.assertEquals(self.vty.node(), 'config') + + def testVtyShow(self): + res = self.vty.command("show ns") + self.assert_(res.find('Encapsulation NS-UDP-IP') >= 0) + + res = self.vty.command("show gbproxy stats") + self.assert_(res.find('GBProxy Global Statistics') >= 0) + def add_nat_test(suite, workdir): if not os.path.isfile(os.path.join(workdir, "src/osmo-bsc_nat/osmo-bsc_nat")): print("Skipping the NAT test") @@ -509,6 +541,13 @@ def add_bsc_test(suite, workdir): test = unittest.TestLoader().loadTestsFromTestCase(TestVTYBSC) suite.addTest(test) +def add_gbproxy_test(suite, workdir): + if not os.path.isfile(os.path.join(workdir, "src/gprs/osmo-gbproxy")): + print("Skipping the Gb-Proxy test") + return + test = unittest.TestLoader().loadTestsFromTestCase(TestVTYGbproxy) + suite.addTest(test) + if __name__ == '__main__': import argparse import sys @@ -541,5 +580,6 @@ if __name__ == '__main__': suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYNITB)) add_bsc_test(suite, workdir) add_nat_test(suite, workdir) + add_gbproxy_test(suite, workdir) res = unittest.TextTestRunner(verbosity=verbose_level).run(suite) sys.exit(len(res.errors) + len(res.failures)) |