blob: 2b7fd196952d68229b766b297deac02b9a61bed4 [file] [log] [blame]
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +02001#!/usr/bin/env python
2
3# (C) 2013 by Katerina Barone-Adesi <kat.obsc@gmail.com>
4# (C) 2013 by Holger Hans Peter Freyther
5# This program is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14
15# You should have received a copy of the GNU General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18import os
19import time
20import unittest
Jacob Erlbeck6cb2ccc2013-08-14 11:10:34 +020021import socket
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +020022
23import osmopy.obscvty as obscvty
24import osmopy.osmoutil as osmoutil
25
26confpath = '.'
27
28class TestVTYBase(unittest.TestCase):
29
30 def vty_command(self):
31 raise Exception("Needs to be implemented by a subclass")
32
33 def vty_app(self):
34 raise Exception("Needs to be implemented by a subclass")
35
36 def setUp(self):
37 osmo_vty_cmd = self.vty_command()[:]
38 config_index = osmo_vty_cmd.index('-c')
39 if config_index:
40 cfi = config_index + 1
41 osmo_vty_cmd[cfi] = os.path.join(confpath, osmo_vty_cmd[cfi])
42
43 try:
44 print "Launch: %s from %s" % (' '.join(osmo_vty_cmd), os.getcwd())
45 self.proc = osmoutil.popen_devnull(osmo_vty_cmd)
46 except OSError:
47 print >> sys.stderr, "Current directory: %s" % os.getcwd()
48 print >> sys.stderr, "Consider setting -b"
49 time.sleep(1)
50
51 appstring = self.vty_app()[2]
52 appport = self.vty_app()[0]
53 self.vty = obscvty.VTYInteract(appstring, "127.0.0.1", appport)
54
55 def tearDown(self):
56 self.vty = None
57 osmoutil.end_proc(self.proc)
58
Holger Hans Peter Freyther8d998a72014-07-04 20:23:56 +020059class TestVTYMGCP(TestVTYBase):
60 def vty_command(self):
61 return ["./src/osmo-bsc_mgcp/osmo-bsc_mgcp", "-c",
62 "doc/examples/osmo-bsc_mgcp/mgcp.cfg"]
63
64 def vty_app(self):
65 return (4243, "./src/osmo-bsc_mgcp/osmo-bsc_mgcp", "OpenBSC MGCP", "mgcp")
66
67 def testForcePtime(self):
68 self.vty.enable()
69 res = self.vty.command("show running-config")
70 self.assert_(res.find(' rtp force-ptime 20\r') > 0)
71 self.assertEquals(res.find(' no rtp force-ptime\r'), -1)
72
73 self.vty.command("configure terminal")
74 self.vty.command("mgcp")
75 self.vty.command("no rtp force-ptime")
76 res = self.vty.command("show running-config")
77 self.assertEquals(res.find(' rtp force-ptime 20\r'), -1)
78 self.assertEquals(res.find(' no rtp force-ptime\r'), -1)
79
Holger Hans Peter Freyther619b0142014-11-19 16:04:45 +010080 def testOmitAudio(self):
81 self.vty.enable()
82 res = self.vty.command("show running-config")
83 self.assert_(res.find(' sdp audio-payload send-name\r') > 0)
84 self.assertEquals(res.find(' no sdp audio-payload send-name\r'), -1)
85
86 self.vty.command("configure terminal")
87 self.vty.command("mgcp")
88 self.vty.command("no sdp audio-payload send-name")
89 res = self.vty.command("show running-config")
90 self.assertEquals(res.find(' rtp sdp audio-payload send-name\r'), -1)
91 self.assert_(res.find(' no sdp audio-payload send-name\r') > 0)
92
93 # TODO: test it for the trunk!
94
Jacob Erlbeck96903c42013-09-02 13:17:14 +020095
96class TestVTYGenericBSC(TestVTYBase):
97
98 def checkForEndAndExit(self):
99 res = self.vty.command("list")
100 #print ('looking for "exit"\n')
101 self.assert_(res.find(' exit\r') > 0)
102 #print 'found "exit"\nlooking for "end"\n'
103 self.assert_(res.find(' end\r') > 0)
104 #print 'found "end"\n'
105
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200106 def _testConfigNetworkTree(self):
107 self.vty.enable()
108 self.assertTrue(self.vty.verify("configure terminal",['']))
109 self.assertEquals(self.vty.node(), 'config')
Jacob Erlbeck6e919db2013-10-29 09:30:31 +0100110 self.checkForEndAndExit()
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200111 self.assertTrue(self.vty.verify("network",['']))
112 self.assertEquals(self.vty.node(), 'config-net')
113 self.checkForEndAndExit()
114 self.assertTrue(self.vty.verify("bts 0",['']))
115 self.assertEquals(self.vty.node(), 'config-net-bts')
116 self.checkForEndAndExit()
117 self.assertTrue(self.vty.verify("trx 0",['']))
118 self.assertEquals(self.vty.node(), 'config-net-bts-trx')
119 self.checkForEndAndExit()
Jacob Erlbeck733bec82013-09-11 10:46:56 +0200120 self.vty.command("write terminal")
121 self.assertTrue(self.vty.verify("exit",['']))
122 self.assertEquals(self.vty.node(), 'config-net-bts')
123 self.assertTrue(self.vty.verify("exit",['']))
124 self.assertTrue(self.vty.verify("bts 1",['']))
125 self.assertEquals(self.vty.node(), 'config-net-bts')
126 self.checkForEndAndExit()
127 self.assertTrue(self.vty.verify("trx 1",['']))
128 self.assertEquals(self.vty.node(), 'config-net-bts-trx')
129 self.checkForEndAndExit()
130 self.vty.command("write terminal")
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200131 self.assertTrue(self.vty.verify("exit",['']))
132 self.assertEquals(self.vty.node(), 'config-net-bts')
133 self.assertTrue(self.vty.verify("exit",['']))
134 self.assertEquals(self.vty.node(), 'config-net')
135 self.assertTrue(self.vty.verify("exit",['']))
136 self.assertEquals(self.vty.node(), 'config')
137 self.assertTrue(self.vty.verify("exit",['']))
138 self.assertTrue(self.vty.node() is None)
139
140class TestVTYNITB(TestVTYGenericBSC):
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +0200141
142 def vty_command(self):
143 return ["./src/osmo-nitb/osmo-nitb", "-c",
144 "doc/examples/osmo-nitb/nanobts/openbsc.cfg"]
145
146 def vty_app(self):
147 return (4242, "./src/osmo-nitb/osmo-nitb", "OpenBSC", "nitb")
148
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200149 def testConfigNetworkTree(self):
Jacob Erlbeck75877272013-10-23 11:24:14 +0200150 self._testConfigNetworkTree()
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200151
Holger Hans Peter Freyther0df1ab92013-09-02 20:58:38 +0200152 def checkForSmpp(self):
153 """SMPP is not always enabled, check if it is"""
154 res = self.vty.command("list")
155 return "smpp" in res
156
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200157 def testVtyTree(self):
158 self.vty.enable()
159 self.assertTrue(self.vty.verify("configure terminal", ['']))
160 self.assertEquals(self.vty.node(), 'config')
Jacob Erlbeck6e919db2013-10-29 09:30:31 +0100161 self.checkForEndAndExit()
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200162 self.assertTrue(self.vty.verify('mncc-int', ['']))
163 self.assertEquals(self.vty.node(), 'config-mncc-int')
164 self.checkForEndAndExit()
165 self.assertTrue(self.vty.verify('exit', ['']))
Holger Hans Peter Freyther0df1ab92013-09-02 20:58:38 +0200166
167 if self.checkForSmpp():
168 self.assertEquals(self.vty.node(), 'config')
Jacob Erlbeck75877272013-10-23 11:24:14 +0200169 self.assertTrue(self.vty.verify('smpp', ['']))
170 self.assertEquals(self.vty.node(), 'config-smpp')
Jacob Erlbeck6e919db2013-10-29 09:30:31 +0100171 self.checkForEndAndExit()
Jacob Erlbeck75877272013-10-23 11:24:14 +0200172 self.assertTrue(self.vty.verify("exit", ['']))
Holger Hans Peter Freyther0df1ab92013-09-02 20:58:38 +0200173
Jacob Erlbeck0ae92a92013-09-02 13:17:16 +0200174 self.assertEquals(self.vty.node(), 'config')
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200175 self.assertTrue(self.vty.verify("exit", ['']))
176 self.assertTrue(self.vty.node() is None)
177
178 # Check searching for outer node's commands
179 self.vty.command("configure terminal")
180 self.vty.command('mncc-int')
Holger Hans Peter Freyther0df1ab92013-09-02 20:58:38 +0200181
182 if self.checkForSmpp():
183 self.vty.command('smpp')
184 self.assertEquals(self.vty.node(), 'config-smpp')
185 self.vty.command('mncc-int')
186
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200187 self.assertEquals(self.vty.node(), 'config-mncc-int')
188
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +0200189 def testEnableDisablePeriodicLU(self):
190 self.vty.enable()
191 self.vty.command("configure terminal")
192 self.vty.command("network")
193 self.vty.command("bts 0")
194
195 # Test invalid input
196 self.vty.verify("periodic location update 0", ['% Unknown command.'])
197 self.vty.verify("periodic location update 5", ['% Unknown command.'])
198 self.vty.verify("periodic location update 1531", ['% Unknown command.'])
199
200 # Enable periodic lu..
201 self.vty.verify("periodic location update 60", [''])
202 res = self.vty.command("write terminal")
Holger Hans Peter Freytherc0438e32013-07-27 22:23:25 +0200203 self.assert_(res.find('periodic location update 60') > 0)
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +0200204 self.assertEquals(res.find('no periodic location update'), -1)
205
206 # Now disable it..
207 self.vty.verify("no periodic location update", [''])
208 res = self.vty.command("write terminal")
209 self.assertEquals(res.find('periodic location update 60'), -1)
Holger Hans Peter Freytherc0438e32013-07-27 22:23:25 +0200210 self.assert_(res.find('no periodic location update') > 0)
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +0200211
Jacob Erlbeck65d114f2014-01-16 11:02:14 +0100212 def testEnableDisableSiHacks(self):
213 self.vty.enable()
214 self.vty.command("configure terminal")
215 self.vty.command("network")
216 self.vty.command("bts 0")
217
218 # Enable periodic lu..
219 self.vty.verify("force-combined-si", [''])
220 res = self.vty.command("write terminal")
221 self.assert_(res.find(' force-combined-si') > 0)
222 self.assertEquals(res.find('no force-combined-si'), -1)
223
224 # Now disable it..
225 self.vty.verify("no force-combined-si", [''])
226 res = self.vty.command("write terminal")
227 self.assertEquals(res.find(' force-combined-si'), -1)
228 self.assert_(res.find('no force-combined-si') > 0)
229
Ivan Kluchnikov67920592013-09-16 13:13:04 +0400230 def testRachAccessControlClass(self):
231 self.vty.enable()
232 self.vty.command("configure terminal")
233 self.vty.command("network")
234 self.vty.command("bts 0")
235
236 # Test invalid input
237 self.vty.verify("rach access-control-class", ['% Command incomplete.'])
238 self.vty.verify("rach access-control-class 1", ['% Command incomplete.'])
239 self.vty.verify("rach access-control-class -1", ['% Unknown command.'])
240 self.vty.verify("rach access-control-class 10", ['% Unknown command.'])
241 self.vty.verify("rach access-control-class 16", ['% Unknown command.'])
242
243 # Barred rach access control classes
244 for classNum in range(16):
245 if classNum != 10:
246 self.vty.verify("rach access-control-class " + str(classNum) + " barred", [''])
247
248 # Verify settings
249 res = self.vty.command("write terminal")
250 for classNum in range(16):
251 if classNum != 10:
252 self.assert_(res.find("rach access-control-class " + str(classNum) + " barred") > 0)
253
254 # Allowed rach access control classes
255 for classNum in range(16):
256 if classNum != 10:
257 self.vty.verify("rach access-control-class " + str(classNum) + " allowed", [''])
258
259 # Verify settings
260 res = self.vty.command("write terminal")
261 for classNum in range(16):
262 if classNum != 10:
263 self.assertEquals(res.find("rach access-control-class " + str(classNum) + " barred"), -1)
264
Ruben Pollaned04a0d2014-09-24 20:50:13 -0500265 def testSubscriberCreateDelete(self):
Alexander Chemerisbd6d40f2013-10-04 23:54:17 +0200266 self.vty.enable()
267
268 imsi = "204300854013739"
269
270 # Initially we don't have this subscriber
271 self.vty.verify('show subscriber imsi '+imsi, ['% No subscriber found for imsi '+imsi])
272
273 # Lets create one
274 res = self.vty.command('subscriber create imsi '+imsi)
275 self.assert_(res.find(" IMSI: "+imsi) > 0)
276
277 # Now we have it
278 res = self.vty.command('show subscriber imsi '+imsi)
279 self.assert_(res.find(" IMSI: "+imsi) > 0)
280
Ruben Pollaned04a0d2014-09-24 20:50:13 -0500281 # Delete it
282 res = self.vty.command('subscriber delete imsi '+imsi)
283 self.assert_(res != "")
284
285 # Now it should not be there anymore
286 res = self.vty.command('show subscriber imsi '+imsi)
287 self.assert_(res != '% No subscriber found for imsi '+imsi)
288
Holger Hans Peter Freytherec37bb22013-02-05 09:39:09 +0100289 def testShowPagingGroup(self):
290 res = self.vty.command("show paging-group 255 1234567")
291 self.assertEqual(res, "% can't find BTS 255")
292 res = self.vty.command("show paging-group 0 1234567")
293 self.assertEquals(res, "%Paging group for IMSI 1234567 on BTS #0 is 7")
294
Ciabyec6e4f82014-03-06 17:20:55 +0100295 def testShowNetwork(self):
296 res = self.vty.command("show network")
297 self.assert_(res.startswith('BSC is on Country Code') >= 0)
298
Holger Hans Peter Freyther86573262015-01-31 09:47:37 +0100299 def testMeasurementFeed(self):
300 self.vty.enable()
301 self.vty.command("configure terminal")
302 self.vty.command("mncc-int")
303
304 res = self.vty.command("write terminal")
305 self.assertEquals(res.find('meas-feed scenario'), -1)
306
307 self.vty.command("meas-feed scenario bla")
308 res = self.vty.command("write terminal")
309 self.assert_(res.find('meas-feed scenario bla') > 0)
310
311 self.vty.command("meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890")
312 res = self.vty.command("write terminal")
313 self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234567890'), -1)
314 self.assertEquals(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz012345'), -1)
315 self.assert_(res.find('meas-feed scenario abcdefghijklmnopqrstuvwxyz01234') > 0)
316
317
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200318class TestVTYBSC(TestVTYGenericBSC):
Jacob Erlbeck1b894022013-08-28 10:16:54 +0200319
320 def vty_command(self):
321 return ["./src/osmo-bsc/osmo-bsc", "-c",
322 "doc/examples/osmo-bsc/osmo-bsc.cfg"]
323
324 def vty_app(self):
325 return (4242, "./src/osmo-bsc/osmo-bsc", "OsmoBSC", "bsc")
326
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200327 def testConfigNetworkTree(self):
Jacob Erlbeck75877272013-10-23 11:24:14 +0200328 self._testConfigNetworkTree()
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200329
330 def testVtyTree(self):
331 self.vty.enable()
332 self.assertTrue(self.vty.verify("configure terminal", ['']))
333 self.assertEquals(self.vty.node(), 'config')
Jacob Erlbeck6e919db2013-10-29 09:30:31 +0100334 self.checkForEndAndExit()
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200335 self.assertTrue(self.vty.verify("msc 0", ['']))
336 self.assertEquals(self.vty.node(), 'config-msc')
Jacob Erlbeck0ae92a92013-09-02 13:17:16 +0200337 self.checkForEndAndExit()
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200338 self.assertTrue(self.vty.verify("exit", ['']))
Jacob Erlbeck0ae92a92013-09-02 13:17:16 +0200339 self.assertEquals(self.vty.node(), 'config')
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200340 self.assertTrue(self.vty.verify("bsc", ['']))
341 self.assertEquals(self.vty.node(), 'config-bsc')
Jacob Erlbeck0ae92a92013-09-02 13:17:16 +0200342 self.checkForEndAndExit()
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200343 self.assertTrue(self.vty.verify("exit", ['']))
Jacob Erlbeck0ae92a92013-09-02 13:17:16 +0200344 self.assertEquals(self.vty.node(), 'config')
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200345 self.assertTrue(self.vty.verify("exit", ['']))
346 self.assertTrue(self.vty.node() is None)
347
348 # Check searching for outer node's commands
349 self.vty.command("configure terminal")
350 self.vty.command('msc 0')
351 self.vty.command("bsc")
352 self.assertEquals(self.vty.node(), 'config-bsc')
353 self.vty.command("msc 0")
354 self.assertEquals(self.vty.node(), 'config-msc')
355
Jacob Erlbeck56595f82013-09-11 10:46:55 +0200356 def testUssdNotificationsMsc(self):
Jacob Erlbeck1b894022013-08-28 10:16:54 +0200357 self.vty.enable()
358 self.vty.command("configure terminal")
359 self.vty.command("msc")
360
361 # Test invalid input
362 self.vty.verify("bsc-msc-lost-text", ['% Command incomplete.'])
Jacob Erlbeck97e139f2013-08-28 10:16:55 +0200363 self.vty.verify("bsc-welcome-text", ['% Command incomplete.'])
Jacob Erlbeck56595f82013-09-11 10:46:55 +0200364 self.vty.verify("bsc-grace-text", ['% Command incomplete.'])
Jacob Erlbeck1b894022013-08-28 10:16:54 +0200365
366 # Enable USSD notifications
367 self.vty.verify("bsc-msc-lost-text MSC disconnected", [''])
Jacob Erlbeck97e139f2013-08-28 10:16:55 +0200368 self.vty.verify("bsc-welcome-text Hello MS", [''])
Jacob Erlbeck56595f82013-09-11 10:46:55 +0200369 self.vty.verify("bsc-grace-text In grace period", [''])
Jacob Erlbeck1b894022013-08-28 10:16:54 +0200370
371 # Verify settings
372 res = self.vty.command("write terminal")
373 self.assert_(res.find('bsc-msc-lost-text MSC disconnected') > 0)
374 self.assertEquals(res.find('no bsc-msc-lost-text'), -1)
Jacob Erlbeck97e139f2013-08-28 10:16:55 +0200375 self.assert_(res.find('bsc-welcome-text Hello MS') > 0)
376 self.assertEquals(res.find('no bsc-welcome-text'), -1)
Jacob Erlbeck56595f82013-09-11 10:46:55 +0200377 self.assert_(res.find('bsc-grace-text In grace period') > 0)
378 self.assertEquals(res.find('no bsc-grace-text'), -1)
Jacob Erlbeck1b894022013-08-28 10:16:54 +0200379
380 # Now disable it..
381 self.vty.verify("no bsc-msc-lost-text", [''])
Jacob Erlbeck97e139f2013-08-28 10:16:55 +0200382 self.vty.verify("no bsc-welcome-text", [''])
Jacob Erlbeck56595f82013-09-11 10:46:55 +0200383 self.vty.verify("no bsc-grace-text", [''])
Jacob Erlbeck1b894022013-08-28 10:16:54 +0200384
385 # Verify settings
386 res = self.vty.command("write terminal")
387 self.assertEquals(res.find('bsc-msc-lost-text MSC disconnected'), -1)
388 self.assert_(res.find('no bsc-msc-lost-text') > 0)
Jacob Erlbeck97e139f2013-08-28 10:16:55 +0200389 self.assertEquals(res.find('bsc-welcome-text Hello MS'), -1)
Jacob Erlbeck56595f82013-09-11 10:46:55 +0200390 self.assert_(res.find('no bsc-welcome-text') > 0)
391 self.assertEquals(res.find('bsc-grace-text In grace period'), -1)
392 self.assert_(res.find('no bsc-grace-text') > 0)
393
394 def testUssdNotificationsBsc(self):
395 self.vty.enable()
396 self.vty.command("configure terminal")
397 self.vty.command("bsc")
398
399 # Test invalid input
400 self.vty.verify("missing-msc-text", ['% Command incomplete.'])
401
402 # Enable USSD notifications
403 self.vty.verify("missing-msc-text No MSC found", [''])
404
405 # Verify settings
406 res = self.vty.command("write terminal")
407 self.assert_(res.find('missing-msc-text No MSC found') > 0)
408 self.assertEquals(res.find('no missing-msc-text'), -1)
409
410 # Now disable it..
411 self.vty.verify("no missing-msc-text", [''])
412
413 # Verify settings
414 res = self.vty.command("write terminal")
415 self.assertEquals(res.find('missing-msc-text No MSC found'), -1)
416 self.assert_(res.find('no missing-msc-text') > 0)
Jacob Erlbeck1b894022013-08-28 10:16:54 +0200417
Jacob Erlbeck946d1412013-09-17 13:59:29 +0200418 def testNetworkTimezone(self):
419 self.vty.enable()
420 self.vty.verify("configure terminal", [''])
421 self.vty.verify("network", [''])
422 self.vty.verify("bts 0", [''])
423
424 # Test invalid input
425 self.vty.verify("timezone", ['% Command incomplete.'])
426 self.vty.verify("timezone 20 0", ['% Unknown command.'])
427 self.vty.verify("timezone 0 11", ['% Unknown command.'])
428 self.vty.verify("timezone 0 0 99", ['% Unknown command.'])
429
430 # Set time zone without DST
431 self.vty.verify("timezone 2 30", [''])
432
433 # Verify settings
434 res = self.vty.command("write terminal")
435 self.assert_(res.find('timezone 2 30') > 0)
436 self.assertEquals(res.find('timezone 2 30 '), -1)
437
438 # Set time zone with DST
439 self.vty.verify("timezone 2 30 1", [''])
440
441 # Verify settings
442 res = self.vty.command("write terminal")
443 self.assert_(res.find('timezone 2 30 1') > 0)
444
445 # Now disable it..
446 self.vty.verify("no timezone", [''])
447
448 # Verify settings
449 res = self.vty.command("write terminal")
450 self.assertEquals(res.find(' timezone'), -1)
451
Ciabyec6e4f82014-03-06 17:20:55 +0100452 def testShowNetwork(self):
453 res = self.vty.command("show network")
454 self.assert_(res.startswith('BSC is on Country Code') >= 0)
455
Holger Hans Peter Freytherdb64f2e2014-10-29 10:06:15 +0100456 def testPingPongConfiguration(self):
457 self.vty.enable()
458 self.vty.verify("configure terminal", [''])
459 self.vty.verify("network", [''])
460 self.vty.verify("msc 0", [''])
461
462 self.vty.verify("timeout-ping 12", [''])
463 self.vty.verify("timeout-pong 14", [''])
464 res = self.vty.command("show running-config")
465 self.assert_(res.find(" timeout-ping 12") > 0)
466 self.assert_(res.find(" timeout-pong 14") > 0)
467 self.assert_(res.find(" no timeout-ping advanced") > 0)
468
469 self.vty.verify("timeout-ping advanced", [''])
470 res = self.vty.command("show running-config")
471 self.assert_(res.find(" timeout-ping 12") > 0)
472 self.assert_(res.find(" timeout-pong 14") > 0)
473 self.assert_(res.find(" timeout-ping advanced") > 0)
474
475 self.vty.verify("no timeout-ping advanced", [''])
476 res = self.vty.command("show running-config")
477 self.assert_(res.find(" timeout-ping 12") > 0)
478 self.assert_(res.find(" timeout-pong 14") > 0)
479 self.assert_(res.find(" no timeout-ping advanced") > 0)
480
481 self.vty.verify("no timeout-ping", [''])
482 res = self.vty.command("show running-config")
483 self.assertEquals(res.find(" timeout-ping 12"), -1)
484 self.assertEquals(res.find(" timeout-pong 14"), -1)
485 self.assertEquals(res.find(" no timeout-ping advanced"), -1)
486 self.assert_(res.find(" no timeout-ping") > 0)
487
488 self.vty.verify("timeout-ping advanced", ['%ping handling is disabled. Enable it first.'])
489
490 # And back to enabling it
491 self.vty.verify("timeout-ping 12", [''])
492 self.vty.verify("timeout-pong 14", [''])
493 res = self.vty.command("show running-config")
494 self.assert_(res.find(" timeout-ping 12") > 0)
495 self.assert_(res.find(" timeout-pong 14") > 0)
496 self.assert_(res.find(" timeout-ping advanced") > 0)
497
Holger Hans Peter Freyther32dd2f32015-04-01 18:15:48 +0200498 def testMscDataCoreLACCI(self):
499 self.vty.enable()
500 res = self.vty.command("show running-config")
501 self.assertEquals(res.find("core-location-area-code"), -1)
502 self.assertEquals(res.find("core-cell-identity"), -1)
503
504 self.vty.command("configure terminal")
505 self.vty.command("msc 0")
506 self.vty.command("core-location-area-code 666")
507 self.vty.command("core-cell-identity 333")
508
509 res = self.vty.command("show running-config")
510 self.assert_(res.find("core-location-area-code 666") > 0)
511 self.assert_(res.find("core-cell-identity 333") > 0)
512
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200513class TestVTYNAT(TestVTYGenericBSC):
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +0200514
515 def vty_command(self):
516 return ["./src/osmo-bsc_nat/osmo-bsc_nat", "-c",
517 "doc/examples/osmo-bsc_nat/osmo-bsc_nat.cfg"]
518
519 def vty_app(self):
520 return (4244, "src/osmo-bsc_nat/osmo-bsc_nat", "OsmoBSCNAT", "nat")
521
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200522 def testVtyTree(self):
523 self.vty.enable()
524 self.assertTrue(self.vty.verify('configure terminal', ['']))
525 self.assertEquals(self.vty.node(), 'config')
Jacob Erlbeck6e919db2013-10-29 09:30:31 +0100526 self.checkForEndAndExit()
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200527 self.assertTrue(self.vty.verify('mgcp', ['']))
528 self.assertEquals(self.vty.node(), 'config-mgcp')
529 self.checkForEndAndExit()
530 self.assertTrue(self.vty.verify('exit', ['']))
531 self.assertEquals(self.vty.node(), 'config')
532 self.assertTrue(self.vty.verify('nat', ['']))
533 self.assertEquals(self.vty.node(), 'config-nat')
534 self.checkForEndAndExit()
535 self.assertTrue(self.vty.verify('bsc 0', ['']))
536 self.assertEquals(self.vty.node(), 'config-nat-bsc')
537 self.checkForEndAndExit()
538 self.assertTrue(self.vty.verify('exit', ['']))
539 self.assertEquals(self.vty.node(), 'config-nat')
540 self.assertTrue(self.vty.verify('exit', ['']))
541 self.assertEquals(self.vty.node(), 'config')
542 self.assertTrue(self.vty.verify('exit', ['']))
543 self.assertTrue(self.vty.node() is None)
544
545 # Check searching for outer node's commands
546 self.vty.command('configure terminal')
547 self.vty.command('mgcp')
548 self.vty.command('nat')
549 self.assertEquals(self.vty.node(), 'config-nat')
Jacob Erlbeck4c9dff52013-09-02 13:17:17 +0200550 self.vty.command('mgcp')
551 self.assertEquals(self.vty.node(), 'config-mgcp')
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200552 self.vty.command('nat')
553 self.assertEquals(self.vty.node(), 'config-nat')
554 self.vty.command('bsc 0')
Jacob Erlbeck4c9dff52013-09-02 13:17:17 +0200555 self.vty.command('mgcp')
556 self.assertEquals(self.vty.node(), 'config-mgcp')
Jacob Erlbeck96903c42013-09-02 13:17:14 +0200557
Holger Hans Peter Freytherb718ad32013-06-25 09:08:02 +0200558 def testRewriteNoRewrite(self):
559 self.vty.enable()
560 res = self.vty.command("configure terminal")
561 res = self.vty.command("nat")
562 res = self.vty.command("number-rewrite rewrite.cfg")
563 res = self.vty.command("no number-rewrite")
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +0200564
Holger Hans Peter Freyther67e423c2013-06-25 15:38:31 +0200565 def testRewritePostNoRewrite(self):
566 self.vty.enable()
567 self.vty.command("configure terminal")
568 self.vty.command("nat")
569 self.vty.verify("number-rewrite-post rewrite.cfg", [''])
570 self.vty.verify("no number-rewrite-post", [''])
571
572
Holger Hans Peter Freytherddf191e2013-06-25 11:44:01 +0200573 def testPrefixTreeLoading(self):
574 cfg = os.path.join(confpath, "tests/bsc-nat-trie/prefixes.csv")
575
576 self.vty.enable()
577 self.vty.command("configure terminal")
578 self.vty.command("nat")
579 res = self.vty.command("prefix-tree %s" % cfg)
580 self.assertEqual(res, "% prefix-tree loaded 17 rules.")
581 self.vty.command("end")
582
583 res = self.vty.command("show prefix-tree")
584 self.assertEqual(res, '1,1\r\n12,2\r\n123,3\r\n1234,4\r\n12345,5\r\n123456,6\r\n1234567,7\r\n12345678,8\r\n123456789,9\r\n1234567890,10\r\n13,11\r\n14,12\r\n15,13\r\n16,14\r\n82,16\r\n823455,15\r\n+49123,17')
585
586 self.vty.command("configure terminal")
587 self.vty.command("nat")
588 self.vty.command("no prefix-tree")
589 self.vty.command("end")
590
591 res = self.vty.command("show prefix-tree")
592 self.assertEqual(res, "% there is now prefix tree loaded.")
593
Jacob Erlbeck6cb2ccc2013-08-14 11:10:34 +0200594 def testUssdSideChannelProvider(self):
595 self.vty.command("end")
596 self.vty.enable()
597 self.vty.command("configure terminal")
598 self.vty.command("nat")
599 self.vty.command("ussd-token key")
600 self.vty.command("end")
601
602 res = self.vty.verify("show ussd-connection", ['The USSD side channel provider is not connected and not authorized.'])
603 self.assertTrue(res)
604
605 ussdSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
606 ussdSocket.connect(('127.0.0.1', 5001))
607 ussdSocket.settimeout(2.0)
608 print "Connected to %s:%d" % ussdSocket.getpeername()
609
610 print "Expecting ID_GET request"
611 data = ussdSocket.recv(4)
612 self.assertEqual(data, "\x00\x01\xfe\x04")
613
614 print "Going to send ID_RESP response"
615 res = ussdSocket.send("\x00\x07\xfe\x05\x00\x04\x01\x6b\x65\x79")
616 self.assertEqual(res, 10)
617
618 # initiating PING/PONG cycle to know, that the ID_RESP message has been processed
619
620 print "Going to send PING request"
621 res = ussdSocket.send("\x00\x01\xfe\x00")
622 self.assertEqual(res, 4)
623
624 print "Expecting PONG response"
625 data = ussdSocket.recv(4)
626 self.assertEqual(data, "\x00\x01\xfe\x01")
627
628 res = self.vty.verify("show ussd-connection", ['The USSD side channel provider is connected and authorized.'])
629 self.assertTrue(res)
630
631 print "Going to shut down connection"
632 ussdSocket.shutdown(socket.SHUT_WR)
633
634 print "Expecting EOF"
635 data = ussdSocket.recv(4)
636 self.assertEqual(data, "")
637
638 ussdSocket.close()
639
640 res = self.vty.verify("show ussd-connection", ['The USSD side channel provider is not connected and not authorized.'])
641 self.assertTrue(res)
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +0200642
Holger Hans Peter Freyther64190182014-01-20 10:14:05 +0100643 def testAccessList(self):
644 """
645 Verify that the imsi-deny can have a reject cause or no reject cause
646 """
647 self.vty.enable()
648 self.vty.command("configure terminal")
649 self.vty.command("nat")
650
651 # Old default
652 self.vty.command("access-list test-default imsi-deny ^123[0-9]*$")
653 res = self.vty.command("show running-config").split("\r\n")
654 asserted = False
655 for line in res:
Holger Hans Peter Freyther4ecc6872014-03-04 15:38:00 +0100656 if line.startswith(" access-list test-default"):
Holger Hans Peter Freyther64190182014-01-20 10:14:05 +0100657 self.assertEqual(line, " access-list test-default imsi-deny ^123[0-9]*$ 11 11")
658 asserted = True
659 self.assert_(asserted)
660
661 # Check the optional CM Service Reject Cause
662 self.vty.command("access-list test-cm-deny imsi-deny ^123[0-9]*$ 42").split("\r\n")
663 res = self.vty.command("show running-config").split("\r\n")
664 asserted = False
665 for line in res:
666 if line.startswith(" access-list test-cm"):
667 self.assertEqual(line, " access-list test-cm-deny imsi-deny ^123[0-9]*$ 42 11")
668 asserted = True
669 self.assert_(asserted)
670
671 # Check the optional LU Reject Cause
672 self.vty.command("access-list test-lu-deny imsi-deny ^123[0-9]*$ 23 42").split("\r\n")
673 res = self.vty.command("show running-config").split("\r\n")
674 asserted = False
675 for line in res:
676 if line.startswith(" access-list test-lu"):
677 self.assertEqual(line, " access-list test-lu-deny imsi-deny ^123[0-9]*$ 23 42")
678 asserted = True
679 self.assert_(asserted)
680
Jacob Erlbeck6d233712013-10-23 11:24:15 +0200681class TestVTYGbproxy(TestVTYGenericBSC):
682
683 def vty_command(self):
684 return ["./src/gprs/osmo-gbproxy", "-c",
685 "doc/examples/osmo-gbproxy/osmo-gbproxy.cfg"]
686
687 def vty_app(self):
688 return (4246, "./src/gprs/osmo-gbproxy", "OsmoGbProxy", "bsc")
689
690 def testVtyTree(self):
691 self.vty.enable()
692 self.assertTrue(self.vty.verify('configure terminal', ['']))
693 self.assertEquals(self.vty.node(), 'config')
Jacob Erlbeck6e919db2013-10-29 09:30:31 +0100694 self.checkForEndAndExit()
Jacob Erlbeck6d233712013-10-23 11:24:15 +0200695 self.assertTrue(self.vty.verify('ns', ['']))
696 self.assertEquals(self.vty.node(), 'config-ns')
697 self.checkForEndAndExit()
698 self.assertTrue(self.vty.verify('exit', ['']))
699 self.assertEquals(self.vty.node(), 'config')
700 self.assertTrue(self.vty.verify('gbproxy', ['']))
701 self.assertEquals(self.vty.node(), 'config-gbproxy')
702 self.checkForEndAndExit()
703 self.assertTrue(self.vty.verify('exit', ['']))
704 self.assertEquals(self.vty.node(), 'config')
705
706 def testVtyShow(self):
707 res = self.vty.command("show ns")
708 self.assert_(res.find('Encapsulation NS-UDP-IP') >= 0)
709
710 res = self.vty.command("show gbproxy stats")
711 self.assert_(res.find('GBProxy Global Statistics') >= 0)
712
Jacob Erlbeck4211d792013-10-24 12:48:23 +0200713 def testVtyDeletePeer(self):
714 self.vty.enable()
715 self.assertTrue(self.vty.verify('delete-gbproxy-peer 9999 bvci 7777', ['BVC not found']))
716 res = self.vty.command("delete-gbproxy-peer 9999 all dry-run")
717 self.assert_(res.find('Not Deleted 0 BVC') >= 0)
718 self.assert_(res.find('Not Deleted 0 NS-VC') >= 0)
719 res = self.vty.command("delete-gbproxy-peer 9999 only-bvc dry-run")
720 self.assert_(res.find('Not Deleted 0 BVC') >= 0)
721 self.assert_(res.find('Not Deleted 0 NS-VC') < 0)
722 res = self.vty.command("delete-gbproxy-peer 9999 only-nsvc dry-run")
723 self.assert_(res.find('Not Deleted 0 BVC') < 0)
724 self.assert_(res.find('Not Deleted 0 NS-VC') >= 0)
725 res = self.vty.command("delete-gbproxy-peer 9999 all")
726 self.assert_(res.find('Deleted 0 BVC') >= 0)
727 self.assert_(res.find('Deleted 0 NS-VC') >= 0)
728
Jacob Erlbeck144b8b12014-11-04 11:15:01 +0100729class TestVTYSGSN(TestVTYGenericBSC):
730
731 def vty_command(self):
732 return ["./src/gprs/osmo-sgsn", "-c",
733 "doc/examples/osmo-sgsn/osmo-sgsn.cfg"]
734
735 def vty_app(self):
736 return (4245, "./src/gprs/osmo-sgsn", "OsmoSGSN", "sgsn")
737
738 def testVtyTree(self):
739 self.vty.enable()
740 self.assertTrue(self.vty.verify('configure terminal', ['']))
741 self.assertEquals(self.vty.node(), 'config')
742 self.checkForEndAndExit()
743 self.assertTrue(self.vty.verify('ns', ['']))
744 self.assertEquals(self.vty.node(), 'config-ns')
745 self.checkForEndAndExit()
746 self.assertTrue(self.vty.verify('exit', ['']))
747 self.assertEquals(self.vty.node(), 'config')
748 self.assertTrue(self.vty.verify('sgsn', ['']))
749 self.assertEquals(self.vty.node(), 'config-sgsn')
750 self.checkForEndAndExit()
751 self.assertTrue(self.vty.verify('exit', ['']))
752 self.assertEquals(self.vty.node(), 'config')
753
754 def testVtyShow(self):
755 res = self.vty.command("show ns")
756 self.assert_(res.find('Encapsulation NS-UDP-IP') >= 0)
757 self.assertTrue(self.vty.verify('show bssgp', ['']))
758 self.assertTrue(self.vty.verify('show bssgp stats', ['']))
759 # TODO: uncomment when the command does not segfault anymore
760 # self.assertTrue(self.vty.verify('show bssgp nsei 123', ['']))
761 # self.assertTrue(self.vty.verify('show bssgp nsei 123 stats', ['']))
762
763 self.assertTrue(self.vty.verify('show sgsn', ['']))
764 self.assertTrue(self.vty.verify('show mm-context all', ['']))
765 self.assertTrue(self.vty.verify('show mm-context imsi 000001234567', ['No MM context for IMSI 000001234567']))
766 self.assertTrue(self.vty.verify('show pdp-context all', ['']))
767
768 res = self.vty.command("show sndcp")
769 self.assert_(res.find('State of SNDCP Entities') >= 0)
770
771 res = self.vty.command("show llc")
772 self.assert_(res.find('State of LLC Entities') >= 0)
773
Jacob Erlbeck106f5472014-11-04 10:08:37 +0100774 def testVtyAuth(self):
775 self.vty.enable()
776 self.assertTrue(self.vty.verify('configure terminal', ['']))
777 self.assertEquals(self.vty.node(), 'config')
778 self.assertTrue(self.vty.verify('sgsn', ['']))
779 self.assertEquals(self.vty.node(), 'config-sgsn')
780 self.assertTrue(self.vty.verify('auth-policy accept-all', ['']))
781 res = self.vty.command("show running-config")
782 self.assert_(res.find('auth-policy accept-all') > 0)
783 self.assertTrue(self.vty.verify('auth-policy acl-only', ['']))
784 res = self.vty.command("show running-config")
785 self.assert_(res.find('auth-policy acl-only') > 0)
786 self.assertTrue(self.vty.verify('auth-policy closed', ['']))
787 res = self.vty.command("show running-config")
788 self.assert_(res.find('auth-policy closed') > 0)
Jacob Erlbeckbe2c8d92014-11-12 10:18:09 +0100789 self.assertTrue(self.vty.verify('auth-policy remote', ['']))
790 res = self.vty.command("show running-config")
791 self.assert_(res.find('auth-policy remote') > 0)
Jacob Erlbeck106f5472014-11-04 10:08:37 +0100792
Jacob Erlbeck207f4a52014-11-11 14:01:48 +0100793 def testVtySubscriber(self):
794 self.vty.enable()
795 res = self.vty.command('show subscriber cache')
796 self.assert_(res.find('1234567890') < 0)
Jacob Erlbeckd9193432015-01-19 14:11:46 +0100797 self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 create', ['']))
798 res = self.vty.command('show subscriber cache')
799 self.assert_(res.find('1234567890') >= 0)
800 self.assert_(res.find('Authorized: 0') >= 0)
801 self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 update-location-result ok', ['']))
Jacob Erlbeck207f4a52014-11-11 14:01:48 +0100802 res = self.vty.command('show subscriber cache')
803 self.assert_(res.find('1234567890') >= 0)
804 self.assert_(res.find('Authorized: 1') >= 0)
Jacob Erlbeck8000e0e2015-01-27 14:56:40 +0100805 self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 cancel update-procedure', ['']))
Jacob Erlbeck207f4a52014-11-11 14:01:48 +0100806 res = self.vty.command('show subscriber cache')
Jacob Erlbecke988ae42015-01-27 12:41:19 +0100807 self.assert_(res.find('1234567890') >= 0)
808 self.assertTrue(self.vty.verify('update-subscriber imsi 1234567890 destroy', ['']))
809 res = self.vty.command('show subscriber cache')
Jacob Erlbeck207f4a52014-11-11 14:01:48 +0100810 self.assert_(res.find('1234567890') < 0)
811
Jacob Erlbeckcb1db8b2015-02-03 13:47:53 +0100812 def testVtyGgsn(self):
813 self.vty.enable()
814 self.assertTrue(self.vty.verify('configure terminal', ['']))
815 self.assertEquals(self.vty.node(), 'config')
816 self.assertTrue(self.vty.verify('sgsn', ['']))
817 self.assertEquals(self.vty.node(), 'config-sgsn')
818 self.assertTrue(self.vty.verify('ggsn 0 remote-ip 127.99.99.99', ['']))
819 self.assertTrue(self.vty.verify('ggsn 0 gtp-version 1', ['']))
820 self.assertTrue(self.vty.verify('apn * ggsn 0', ['']))
821 self.assertTrue(self.vty.verify('apn apn1.test ggsn 0', ['']))
822 self.assertTrue(self.vty.verify('apn apn1.test ggsn 1', ['% a GGSN with id 1 has not been defined']))
823 self.assertTrue(self.vty.verify('apn apn1.test imsi-prefix 123456 ggsn 0', ['']))
824 self.assertTrue(self.vty.verify('apn apn2.test imsi-prefix 123456 ggsn 0', ['']))
825 res = self.vty.command("show running-config")
826 self.assert_(res.find('ggsn 0 remote-ip 127.99.99.99') >= 0)
827 self.assert_(res.find('ggsn 0 gtp-version 1') >= 0)
828 self.assert_(res.find('apn * ggsn 0') >= 0)
829 self.assert_(res.find('apn apn1.test ggsn 0') >= 0)
830 self.assert_(res.find('apn apn1.test imsi-prefix 123456 ggsn 0') >= 0)
831 self.assert_(res.find('apn apn2.test imsi-prefix 123456 ggsn 0') >= 0)
832
Holger Hans Peter Freyther9c20a5f2015-02-06 16:23:29 +0100833 def testVtyEasyAPN(self):
834 self.vty.enable()
835 self.assertTrue(self.vty.verify('configure terminal', ['']))
836 self.assertEquals(self.vty.node(), 'config')
837 self.assertTrue(self.vty.verify('sgsn', ['']))
838 self.assertEquals(self.vty.node(), 'config-sgsn')
839
840 res = self.vty.command("show running-config")
841 self.assertEquals(res.find("apn internet"), -1)
842
843 self.assertTrue(self.vty.verify("access-point-name internet.apn", ['']))
844 res = self.vty.command("show running-config")
845 self.assert_(res.find("apn internet.apn ggsn 0") >= 0)
846
847 self.assertTrue(self.vty.verify("no access-point-name internet.apn", ['']))
848 res = self.vty.command("show running-config")
849 self.assertEquals(res.find("apn internet"), -1)
850
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +0200851def add_nat_test(suite, workdir):
852 if not os.path.isfile(os.path.join(workdir, "src/osmo-bsc_nat/osmo-bsc_nat")):
853 print("Skipping the NAT test")
854 return
855 test = unittest.TestLoader().loadTestsFromTestCase(TestVTYNAT)
856 suite.addTest(test)
857
Jacob Erlbeck1b894022013-08-28 10:16:54 +0200858def add_bsc_test(suite, workdir):
859 if not os.path.isfile(os.path.join(workdir, "src/osmo-bsc/osmo-bsc")):
860 print("Skipping the BSC test")
861 return
862 test = unittest.TestLoader().loadTestsFromTestCase(TestVTYBSC)
863 suite.addTest(test)
864
Jacob Erlbeck6d233712013-10-23 11:24:15 +0200865def add_gbproxy_test(suite, workdir):
866 if not os.path.isfile(os.path.join(workdir, "src/gprs/osmo-gbproxy")):
867 print("Skipping the Gb-Proxy test")
868 return
869 test = unittest.TestLoader().loadTestsFromTestCase(TestVTYGbproxy)
870 suite.addTest(test)
871
Jacob Erlbeck144b8b12014-11-04 11:15:01 +0100872def add_sgsn_test(suite, workdir):
873 if not os.path.isfile(os.path.join(workdir, "src/gprs/osmo-sgsn")):
874 print("Skipping the SGSN test")
875 return
876 test = unittest.TestLoader().loadTestsFromTestCase(TestVTYSGSN)
877 suite.addTest(test)
878
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +0200879if __name__ == '__main__':
880 import argparse
881 import sys
882
883 workdir = '.'
884
885 parser = argparse.ArgumentParser()
886 parser.add_argument("-v", "--verbose", dest="verbose",
887 action="store_true", help="verbose mode")
888 parser.add_argument("-p", "--pythonconfpath", dest="p",
889 help="searchpath for config")
890 parser.add_argument("-w", "--workdir", dest="w",
891 help="Working directory")
892 args = parser.parse_args()
893
894 verbose_level = 1
895 if args.verbose:
896 verbose_level = 2
897
898 if args.w:
899 workdir = args.w
900
901 if args.p:
902 confpath = args.p
903
904 print "confpath %s, workdir %s" % (confpath, workdir)
905 os.chdir(workdir)
906 print "Running tests for specific VTY commands"
907 suite = unittest.TestSuite()
Holger Hans Peter Freyther8d998a72014-07-04 20:23:56 +0200908 suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYMGCP))
Holger Hans Peter Freytherc63f6f12013-07-27 21:07:57 +0200909 suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestVTYNITB))
Jacob Erlbeck1b894022013-08-28 10:16:54 +0200910 add_bsc_test(suite, workdir)
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +0200911 add_nat_test(suite, workdir)
Jacob Erlbeck6d233712013-10-23 11:24:15 +0200912 add_gbproxy_test(suite, workdir)
Jacob Erlbeck144b8b12014-11-04 11:15:01 +0100913 add_sgsn_test(suite, workdir)
Holger Hans Peter Freythereb0acb62013-06-24 15:47:34 +0200914 res = unittest.TextTestRunner(verbosity=verbose_level).run(suite)
915 sys.exit(len(res.errors) + len(res.failures))