gbproxy: Add basic VTY tests

This checks for the ns and gbproxy config nodes and show commands.

Sponsored-by: On-Waves ehf
This commit is contained in:
Jacob Erlbeck 2013-10-23 11:24:15 +02:00 committed by Holger Hans Peter Freyther
parent 5c46e93a6d
commit 7553d1c66d
1 changed files with 40 additions and 0 deletions

View File

@ -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))