aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-11-04 11:15:01 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-11-14 10:06:53 +0100
commit144b8b1ca77f628ea4cf87ff903b7e79f0abf9dd (patch)
tree427a9fb8f120df2ca2cba2d4fdb344d1c7c007b4
parent423f8bfa027d544867dcf7afc188a8ea5221e2bc (diff)
sgsn/test: Add VTY tests for the SGSN
This patch adds some basic SGSN tests to vty_test_runner.py: - check for config tree nodes - check specific show commands Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/tests/vty_test_runner.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/openbsc/tests/vty_test_runner.py b/openbsc/tests/vty_test_runner.py
index 10e1ae425..82c0871a8 100644
--- a/openbsc/tests/vty_test_runner.py
+++ b/openbsc/tests/vty_test_runner.py
@@ -677,6 +677,51 @@ class TestVTYGbproxy(TestVTYGenericBSC):
self.assert_(res.find('Deleted 0 BVC') >= 0)
self.assert_(res.find('Deleted 0 NS-VC') >= 0)
+class TestVTYSGSN(TestVTYGenericBSC):
+
+ def vty_command(self):
+ return ["./src/gprs/osmo-sgsn", "-c",
+ "doc/examples/osmo-sgsn/osmo-sgsn.cfg"]
+
+ def vty_app(self):
+ return (4245, "./src/gprs/osmo-sgsn", "OsmoSGSN", "sgsn")
+
+ def testVtyTree(self):
+ self.vty.enable()
+ self.assertTrue(self.vty.verify('configure terminal', ['']))
+ self.assertEquals(self.vty.node(), 'config')
+ self.checkForEndAndExit()
+ 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('sgsn', ['']))
+ self.assertEquals(self.vty.node(), 'config-sgsn')
+ 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)
+ self.assertTrue(self.vty.verify('show bssgp', ['']))
+ self.assertTrue(self.vty.verify('show bssgp stats', ['']))
+ # TODO: uncomment when the command does not segfault anymore
+ # self.assertTrue(self.vty.verify('show bssgp nsei 123', ['']))
+ # self.assertTrue(self.vty.verify('show bssgp nsei 123 stats', ['']))
+
+ self.assertTrue(self.vty.verify('show sgsn', ['']))
+ self.assertTrue(self.vty.verify('show mm-context all', ['']))
+ self.assertTrue(self.vty.verify('show mm-context imsi 000001234567', ['No MM context for IMSI 000001234567']))
+ self.assertTrue(self.vty.verify('show pdp-context all', ['']))
+
+ res = self.vty.command("show sndcp")
+ self.assert_(res.find('State of SNDCP Entities') >= 0)
+
+ res = self.vty.command("show llc")
+ self.assert_(res.find('State of LLC Entities') >= 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")
@@ -698,6 +743,13 @@ def add_gbproxy_test(suite, workdir):
test = unittest.TestLoader().loadTestsFromTestCase(TestVTYGbproxy)
suite.addTest(test)
+def add_sgsn_test(suite, workdir):
+ if not os.path.isfile(os.path.join(workdir, "src/gprs/osmo-sgsn")):
+ print("Skipping the SGSN test")
+ return
+ test = unittest.TestLoader().loadTestsFromTestCase(TestVTYSGSN)
+ suite.addTest(test)
+
if __name__ == '__main__':
import argparse
import sys
@@ -732,5 +784,6 @@ if __name__ == '__main__':
add_bsc_test(suite, workdir)
add_nat_test(suite, workdir)
add_gbproxy_test(suite, workdir)
+ add_sgsn_test(suite, workdir)
res = unittest.TextTestRunner(verbosity=verbose_level).run(suite)
sys.exit(len(res.errors) + len(res.failures))