aboutsummaryrefslogtreecommitdiffstats
path: root/tests/vty_test_runner.py
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-07-09 22:09:18 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2017-08-30 14:11:25 +0200
commit7b656884cfadfd8c56355e8a6c690721827b5b30 (patch)
tree7f3357a94992d953021a28ec20336c4578f23052 /tests/vty_test_runner.py
parent31a11aa75b5aad8887213bcd88cddc1b79b5954f (diff)
split off osmo-bsc: remove files, apply build
Diffstat (limited to 'tests/vty_test_runner.py')
-rw-r--r--tests/vty_test_runner.py392
1 files changed, 0 insertions, 392 deletions
diff --git a/tests/vty_test_runner.py b/tests/vty_test_runner.py
index c4a3c8fbc..1727e5308 100644
--- a/tests/vty_test_runner.py
+++ b/tests/vty_test_runner.py
@@ -108,182 +108,6 @@ class TestVTYGenericBSC(TestVTYBase):
self.assertTrue(self.vty.verify("exit",['']))
self.assertTrue(self.vty.node() is None)
-class TestVTYMSC(TestVTYBase):
-
- def vty_command(self):
- return ["./src/osmo-msc/osmo-msc", "-c",
- "doc/examples/osmo-msc/osmo-msc.cfg"]
-
- def vty_app(self):
- return (4254, "./src/osmo-msc/osmo-msc", "OsmoMSC", "msc")
-
- def testConfigNetworkTree(self, include_bsc_items=True):
- self.vty.enable()
- self.assertTrue(self.vty.verify("configure terminal",['']))
- self.assertEquals(self.vty.node(), 'config')
- self.checkForEndAndExit()
- self.assertTrue(self.vty.verify("network",['']))
- self.assertEquals(self.vty.node(), 'config-net')
- self.checkForEndAndExit()
- self.vty.command("write terminal")
- self.assertTrue(self.vty.verify("exit",['']))
- self.assertEquals(self.vty.node(), 'config')
- self.assertTrue(self.vty.verify("exit",['']))
- self.assertTrue(self.vty.node() is None)
-
- def checkForSmpp(self):
- """SMPP is not always enabled, check if it is"""
- res = self.vty.command("list")
- return "smpp" in res
-
- def testSmppFirst(self):
- # enable the configuration
- self.vty.enable()
- self.vty.command("configure terminal")
-
- if not self.checkForSmpp():
- return
-
- self.vty.command("smpp")
-
- # check the default
- res = self.vty.command("write terminal")
- self.assert_(res.find(' no smpp-first') > 0)
-
- self.vty.verify("smpp-first", [''])
- res = self.vty.command("write terminal")
- self.assert_(res.find(' smpp-first') > 0)
- self.assertEquals(res.find('no smpp-first'), -1)
-
- self.vty.verify("no smpp-first", [''])
- res = self.vty.command("write terminal")
- self.assert_(res.find('no smpp-first') > 0)
-
- 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('mncc-int', ['']))
- self.assertEquals(self.vty.node(), 'config-mncc-int')
- self.checkForEndAndExit()
- self.assertTrue(self.vty.verify('exit', ['']))
-
- if self.checkForSmpp():
- self.assertEquals(self.vty.node(), 'config')
- self.assertTrue(self.vty.verify('smpp', ['']))
- self.assertEquals(self.vty.node(), 'config-smpp')
- self.checkForEndAndExit()
- self.assertTrue(self.vty.verify("exit", ['']))
-
- self.assertEquals(self.vty.node(), 'config')
- self.assertTrue(self.vty.verify("exit", ['']))
- self.assertTrue(self.vty.node() is None)
-
- # Check searching for outer node's commands
- self.vty.command("configure terminal")
- self.vty.command('mncc-int')
-
- if self.checkForSmpp():
- self.vty.command('smpp')
- self.assertEquals(self.vty.node(), 'config-smpp')
- self.vty.command('mncc-int')
-
- self.assertEquals(self.vty.node(), 'config-mncc-int')
-
- def testVtyAuthorization(self):
- self.vty.enable()
- self.vty.command("configure terminal")
- self.vty.command("network")
- self.assertTrue(self.vty.verify("auth policy closed", ['']))
- self.assertTrue(self.vty.verify("auth policy regexp", ['']))
- self.assertTrue(self.vty.verify("authorized-regexp ^001", ['']))
- self.assertTrue(self.vty.verify("authorized-regexp 02$", ['']))
- self.assertTrue(self.vty.verify("authorized-regexp *123.*", ['']))
- self.vty.command("end")
-
- def testSi2Q(self):
- self.vty.enable()
- self.vty.command("configure terminal")
- self.vty.command("network")
- self.vty.command("bts 0")
- before = self.vty.command("show running-config")
- self.vty.command("si2quater neighbor-list add earfcn 1911 threshold 11 2")
- self.vty.command("si2quater neighbor-list add earfcn 1924 threshold 11 3")
- self.vty.command("si2quater neighbor-list add earfcn 2111 threshold 11")
- self.vty.command("si2quater neighbor-list del earfcn 1911")
- self.vty.command("si2quater neighbor-list del earfcn 1924")
- self.vty.command("si2quater neighbor-list del earfcn 2111")
- self.assertEquals(before, self.vty.command("show running-config"))
- self.vty.command("si2quater neighbor-list add uarfcn 1976 13 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 38 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 44 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 120 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 140 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 163 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 166 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 217 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 224 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 225 1")
- self.vty.command("si2quater neighbor-list add uarfcn 1976 226 1")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 13")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 38")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 44")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 120")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 140")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 163")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 166")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 217")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 224")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 225")
- self.vty.command("si2quater neighbor-list del uarfcn 1976 226")
- self.assertEquals(before, self.vty.command("show running-config"))
-
- def testEnableDisablePeriodicLU(self):
- self.vty.enable()
- self.vty.command("configure terminal")
- self.vty.command("network")
- self.vty.command("bts 0")
-
- # Test invalid input
- self.vty.verify("periodic location update 0", ['% Unknown command.'])
- self.vty.verify("periodic location update 5", ['% Unknown command.'])
- self.vty.verify("periodic location update 1531", ['% Unknown command.'])
-
- # Enable periodic lu..
- self.vty.verify("periodic location update 60", [''])
- res = self.vty.command("write terminal")
- self.assert_(res.find('periodic location update 60') > 0)
- self.assertEquals(res.find('no periodic location update'), -1)
-
- # Now disable it..
- self.vty.verify("no periodic location update", [''])
- res = self.vty.command("write terminal")
- self.assertEquals(res.find('periodic location update 60'), -1)
- self.assert_(res.find('no periodic location update') > 0)
-
- def testShowNetwork(self):
- res = self.vty.command("show network")
- self.assert_(res.startswith('BSC is on Country Code') >= 0)
-
- def testMeasurementFeed(self):
- self.vty.enable()
- self.vty.command("configure terminal")
- self.vty.command("mncc-int")
-
- res = self.vty.command("write terminal")
- self.assertEquals(res.find('meas-feed scenario'), -1)
-
- self.vty.command("meas-feed scenario bla")
- res = self.vty.command("write terminal")
- self.assert_(res.find('meas-feed scenario bla') > 0)
-
- self.vty.command("meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890")
- res = self.vty.command("write terminal")
- self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890'), -1)
- self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz012345'), -1)
- self.assert_(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234') > 0)
-
class TestVTYBSC(TestVTYGenericBSC):
@@ -719,205 +543,6 @@ class TestVTYNAT(TestVTYGenericBSC):
asserted = True
self.assert_(asserted)
-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.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('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 testVtyDeletePeer(self):
- self.vty.enable()
- self.assertTrue(self.vty.verify('delete-gbproxy-peer 9999 bvci 7777', ['BVC not found']))
- res = self.vty.command("delete-gbproxy-peer 9999 all dry-run")
- self.assert_(res.find('Not Deleted 0 BVC') >= 0)
- self.assert_(res.find('Not Deleted 0 NS-VC') >= 0)
- res = self.vty.command("delete-gbproxy-peer 9999 only-bvc dry-run")
- self.assert_(res.find('Not Deleted 0 BVC') >= 0)
- self.assert_(res.find('Not Deleted 0 NS-VC') < 0)
- res = self.vty.command("delete-gbproxy-peer 9999 only-nsvc dry-run")
- self.assert_(res.find('Not Deleted 0 BVC') < 0)
- self.assert_(res.find('Not Deleted 0 NS-VC') >= 0)
- res = self.vty.command("delete-gbproxy-peer 9999 all")
- 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-accept-all.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 testVtyAuth(self):
- self.vty.enable()
- self.assertTrue(self.vty.verify('configure terminal', ['']))
- self.assertEquals(self.vty.node(), 'config')
- self.assertTrue(self.vty.verify('sgsn', ['']))
- self.assertEquals(self.vty.node(), 'config-sgsn')
- self.assertTrue(self.vty.verify('auth-policy accept-all', ['']))
- res = self.vty.command("show running-config")
- self.assert_(res.find('auth-policy accept-all') > 0)
- self.assertTrue(self.vty.verify('auth-policy acl-only', ['']))
- res = self.vty.command("show running-config")
- self.assert_(res.find('auth-policy acl-only') > 0)
- self.assertTrue(self.vty.verify('auth-policy closed', ['']))
- res = self.vty.command("show running-config")
- self.assert_(res.find('auth-policy closed') > 0)
- self.assertTrue(self.vty.verify('gsup remote-ip 127.0.0.4', ['']))
- self.assertTrue(self.vty.verify('gsup remote-port 2222', ['']))
- self.assertTrue(self.vty.verify('auth-policy remote', ['']))
- res = self.vty.command("show running-config")
- self.assert_(res.find('auth-policy remote') > 0)
-
- def testVtySubscriber(self):
- self.vty.enable()
- res = self.vty.command('show subscriber cache')
- self.assert_(res.find('1234567890') < 0)
- self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 create', ['']))
- res = self.vty.command('show subscriber cache')
- self.assert_(res.find('1234567890') >= 0)
- self.assert_(res.find('Authorized: 0') >= 0)
- self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 update-location-result ok', ['']))
- res = self.vty.command('show subscriber cache')
- self.assert_(res.find('1234567890') >= 0)
- self.assert_(res.find('Authorized: 1') >= 0)
- self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 cancel update-procedure', ['']))
- res = self.vty.command('show subscriber cache')
- self.assert_(res.find('1234567890') >= 0)
- self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 destroy', ['']))
- res = self.vty.command('show subscriber cache')
- self.assert_(res.find('1234567890') < 0)
-
- def testVtyGgsn(self):
- self.vty.enable()
- self.assertTrue(self.vty.verify('configure terminal', ['']))
- self.assertEquals(self.vty.node(), 'config')
- self.assertTrue(self.vty.verify('sgsn', ['']))
- self.assertEquals(self.vty.node(), 'config-sgsn')
- self.assertTrue(self.vty.verify('ggsn 0 remote-ip 127.99.99.99', ['']))
- self.assertTrue(self.vty.verify('ggsn 0 gtp-version 1', ['']))
- self.assertTrue(self.vty.verify('apn * ggsn 0', ['']))
- self.assertTrue(self.vty.verify('apn apn1.test ggsn 0', ['']))
- self.assertTrue(self.vty.verify('apn apn1.test ggsn 1', ['% a GGSN with id 1 has not been defined']))
- self.assertTrue(self.vty.verify('apn apn1.test imsi-prefix 123456 ggsn 0', ['']))
- self.assertTrue(self.vty.verify('apn apn2.test imsi-prefix 123456 ggsn 0', ['']))
- res = self.vty.command("show running-config")
- self.assert_(res.find('ggsn 0 remote-ip 127.99.99.99') >= 0)
- self.assert_(res.find('ggsn 0 gtp-version 1') >= 0)
- self.assert_(res.find('apn * ggsn 0') >= 0)
- self.assert_(res.find('apn apn1.test ggsn 0') >= 0)
- self.assert_(res.find('apn apn1.test imsi-prefix 123456 ggsn 0') >= 0)
- self.assert_(res.find('apn apn2.test imsi-prefix 123456 ggsn 0') >= 0)
-
- def testVtyEasyAPN(self):
- self.vty.enable()
- self.assertTrue(self.vty.verify('configure terminal', ['']))
- self.assertEquals(self.vty.node(), 'config')
- self.assertTrue(self.vty.verify('sgsn', ['']))
- self.assertEquals(self.vty.node(), 'config-sgsn')
-
- res = self.vty.command("show running-config")
- self.assertEquals(res.find("apn internet"), -1)
-
- self.assertTrue(self.vty.verify("access-point-name internet.apn", ['']))
- res = self.vty.command("show running-config")
- self.assert_(res.find("apn internet.apn ggsn 0") >= 0)
-
- self.assertTrue(self.vty.verify("no access-point-name internet.apn", ['']))
- res = self.vty.command("show running-config")
- self.assertEquals(res.find("apn internet"), -1)
-
- def testVtyCDR(self):
- self.vty.enable()
- self.assertTrue(self.vty.verify('configure terminal', ['']))
- self.assertEquals(self.vty.node(), 'config')
- self.assertTrue(self.vty.verify('sgsn', ['']))
- self.assertEquals(self.vty.node(), 'config-sgsn')
-
- res = self.vty.command("show running-config")
- self.assert_(res.find("no cdr filename") > 0)
-
- self.vty.command("cdr filename bla.cdr")
- res = self.vty.command("show running-config")
- self.assertEquals(res.find("no cdr filename"), -1)
- self.assert_(res.find(" cdr filename bla.cdr") > 0)
-
- self.vty.command("no cdr filename")
- res = self.vty.command("show running-config")
- self.assert_(res.find("no cdr filename") > 0)
- self.assertEquals(res.find(" cdr filename bla.cdr"), -1)
-
- res = self.vty.command("show running-config")
- self.assert_(res.find(" cdr interval 600") > 0)
-
- self.vty.command("cdr interval 900")
- res = self.vty.command("show running-config")
- self.assert_(res.find(" cdr interval 900") > 0)
- self.assertEquals(res.find(" cdr interval 600"), -1)
def add_nat_test(suite, workdir):
if not os.path.isfile(os.path.join(workdir, "src/osmo-bsc_nat/osmo-bsc_nat")):
@@ -1050,20 +675,6 @@ 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)
-
-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
@@ -1094,11 +705,8 @@ if __name__ == '__main__':
os.chdir(workdir)
print "Running tests for specific VTY commands"
suite = unittest.TestSuite()
- suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYMSC))
add_bsc_test(suite, workdir)
add_nat_test(suite, workdir)
- add_gbproxy_test(suite, workdir)
- add_sgsn_test(suite, workdir)
if args.test_name:
osmoutil.pick_tests(suite, *args.test_name)