From 6d233718053a59ebb23eea0d19d605d62334f3f1 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Wed, 23 Oct 2013 11:24:15 +0200 Subject: gbproxy: Add basic VTY tests This checks for the ns and gbproxy config nodes and show commands. Sponsored-by: On-Waves ehf --- openbsc/tests/vty_test_runner.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) 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)) -- cgit v1.2.3