[PATCH 2/5] gbproxy: Add basic VTY tests

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Wed Oct 23 09:24:15 UTC 2013


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 09352b8..e040cac 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))
-- 
1.7.9.5





More information about the OpenBSC mailing list