aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/vty_test_runner.py
AgeCommit message (Collapse)AuthorFilesLines
2020-12-10Add very clear obsolescence / unmaintained warningsHarald Welte1-1/+2
* add messages at start-up and to the VTY * users must explicitly confirm they want to run osmo-nitb Change-Id: I5d5c0ff386dbc2e7b7dd02d6c33d1f9fec70707b
2019-12-12osmoappdesc.py, tests, ipa.py: switch to python 3Oliver Smith1-200/+200
Make build and external tests work with python3, so we can drop the python2 dependency. This should be merged shortly after osmo-python-tests was migrated to python3, and the jenkins build slaves were (automatically) updated to have the new osmo-python-tests installed. Related: OS#2819 Depends: osmo-python-tests I3ffc3519bf6c22536a49dad7a966188ddad351a7 Change-Id: Id7d006f892198bb8a7c0d4a8a8ea00b8d0e62df4
2019-05-03tests: Fix selection of python versionPau Espin Pedrol1-1/+1
According to documentation (and personal experience), AM_PATH_PYTHON selects the highest version of python, no matter if major version is different, which means if both python2 and 3 are available, 3 will be chosen an PYTHON will point to "/.../python" which is python3. Apparently, the macro cannot be easily used to pick highest python2 version. chosen an PYTHON will point to "/.../python" which is python3. Apparently, the macro cannot be easily used to pick highest python2 version. As {vty,ctrl}_test_runner.py require python2 and are incompatible with python3, let's instead rely on the system having a "python2" binary available, which is the case in most distros. cherry-picked from: osmo-bsc.git 7e78681f0f740bd68ed5255b506a1efa08a231b1. Change-Id: Icc147c8457116ad551d166313f3a79e1c2107a22
2019-03-28vty_test_runner: Handle MGCP message recv len dynamicallyPau Espin Pedrol1-1/+12
Change-Id: I536d78a2a1962240e5e369cda9927d8c9955ab86
2019-03-28Replace broken ipa_ccm_idtag APIs with new ipa_ccm_id onesPau Espin Pedrol1-3/+3
ipa_ccm_idtag_parse_off is broken, and can only be used with len_offset=1 on ID Request messages, otherwise won't work correctly. Modify ipa_ccm_idtag_parse to at least parse those correctly, and document the limitations. Those two functions are already deprecated and only used in openbsc by 3 callers: * ipa_ccm_idtag_parse in ussd_read_cb(): Broken, that function can only work for Requests and it's used to parse a Response. * ipa_ccm_idtag_parse_off in forward_sccp_to_msc (NAT): Broken, it can only be used to parse Requests and it's used to parse a Response. Furthermore, len_offset=2 is passed which makes no sense and most probably it fails always, or can even make the program crash. * ipa_ccm_idtag_parse_off in (answer_challenge): This one is fine and could actually be replaced with ipa_ccm_id_get_parse after libosmocore commit (see below) is merged. See libosmocore I6efc852dfc041192f554e41a58290a0f63298021 for more information. As a consequence of the fixes, osmo-bsc-nat now parses messages sent from VTY test correctly and thus it goes into processing them instead of silently dropping them. As a result, some VTY tests fail because they are sending incorrect format (missing NULL char in unit id strings) and osmo-bsc-nat closses its connection (due to bad auth). Change-Id: I3b995f8ef0b48c0a5b3375e42926641934359cd2
2018-09-13Install sample cfg file to /etc/osmocomPau Espin Pedrol1-3/+3
Change-Id: I080ae6a4c4f92dd8df055efd25e308f8a3377d34
2017-10-26rename osmo-bsc to osmo-bsc-sccpliteHarald Welte1-4/+4
This is to avoid naming conflicts with the new osmo-bsc, which resides in its own git repository (osmo-bsc.git) and which uses libosmo-sigtran and implements (primarily) 3GPP AoIP. Change-Id: If10d1599b62d010726336134091a4e855c380d93
2017-10-26remove sgsn, gbproxy and gtphub from openbsc.gitHarald Welte1-216/+0
The GPRS related programs osmo-sgsn, osmo-gtphub and osmo-gbproxy have been split off into the separate osmo-sgsn repository, which can be found at git://git.osmocom.org/osmo-sgsn.git http://git.osmocom.org/osmo-sgsn/ This is technically unrelated but conceptually part of the larger NITB-split activities. I did a brief log of all changes in src/gprs and couldn't find any commits that we might have applied here but which are missing from osmo-sgsn.git. Change-Id: If60e28b23f5cfb2c4eb354951363a2bb63f3e0de
2017-09-13fix vty tests: vty no longer goes to parent node implicitlyNeels Hofmeyr1-22/+0
Fix four instances of VTY tests working because it used to include implicit 'exit' commands to the parent node. Since libosmocore change-id Id73cba2dd34676bad8a130e9c45e67a272f19588 = commit d64b6aed235f6e4d84a2cb8e84b32c3179260254, we no longer do this implicit-exit in interactive VTY shells. *) the nitb node lacked the default command set (including 'end' and 'exit'), so it was impossible to leave the nitb node. This hit in testSubscriberCreateDelete. Add vty_install_default(NITB_NODE). *) in testPingPongConfiguration, the intention is to enter the /msc 0 node. Drop prior entry of the 'network' node, which looks like an oversight. So far the 'msc 0' caused an implicit 'exit' and thus worked, now fails. *) Two instances following comments "# Check searching for outer node's commands", which look like they are intended to check for this implicit-exit behavior. This is obsolete, drop those parts of the tests. Change-Id: I77931d6a09c42c443c6936000592f22a7fd06cab
2017-05-12fix subscriber random extension allocation rangeNeels Hofmeyr1-0/+11
The VTY config allows above 32bit range extensions, but db_subscriber_alloc_exten() was unable to generate extensions outside of 32bit. Add VTY regression test and fix the problem by using proper 64bit types. Related: OS#2253 Change-Id: I9afe6a8833004ecd2f3f936b2d5aa4de8e7dbcb0
2017-05-12fix VTY parsing: subscriber-create-on-demand randomNeels Hofmeyr1-0/+11
Fix parsing of the 'subscriber-create-on-demand random' VTY: atoi() is not enough to include the specified range of 1-9999999999. Use atoll() instead to ensure a large enough number space also on 32bit systems. (Note: for me, atoll() truncates at 32 bit when <stdlib.h> is not included.) Add a VTY regression test for this. Related: OS#2253 Change-Id: I353e04481ec567adca383d6b51ba8fb865eed73e
2017-03-20python tests: allow running from separate build dirNeels Hofmeyr1-2/+5
The VTY tests assume that $top_builddir == $top_srcdir. Use the script's location from sys.path[0] to find the correct locations of example configs even when building in another directory. Change-Id: I2731f361e3b72d0980968e6cf83594ea450db7c2
2017-03-14python tests: vty and smpp: speed up >10 timesNeels Hofmeyr1-1/+0
osmo-python-tests now includes code that retries connecting the VTY socket and needs no external sleep()ing. This flies through most tests without any sleep() at all. See osmo-python-tests.git change-id Icc337f52a93d5fe31fc4ff235ccaf4e0fe75fa39 Change-Id: I42161d9716fe5bb0ef1c56e4bfb770bb99bbca7a
2017-03-05vty tests: close msc socket after nat_msc_testNeels Hofmeyr1-23/+27
Change-Id: Ib64cf8690627803e1b4a8497ea63f1e766960478
2017-03-02vty tests: allow picking specific tests to run by nameNeels Hofmeyr1-0/+5
Depends: osmo-python-tests change-id I92f90c334169f31920c63dd5c5ac8dac215065e6 Change-Id: I849455e0423e1a63d6890aef7f9c6075ad53a920
2017-02-28vty test: nat_msc_test: setsockopt REUSE to avoid TIME_WAIT problemsNeels Hofmeyr1-0/+1
When running the testBSCreload test in close succession, I get a "Connection refused" error because the socket is still in TIME_WAIT state. Passing the SO_REUSEADDR flag allows reusing the addr despite a TIME_WAIT socket. Change-Id: I941851b062999ab4b962430f7b27c19935993e0a
2017-02-25python tests: remove process 'Launch' message, now at osmoutilNeels Hofmeyr1-1/+0
Change-Id: Id8eb70ddfdc1d0d9f90aa5343a4ea522042c34ee
2017-02-25vty_rest_runner.py: remove debug monitoring for TCP socketsNeels Hofmeyr1-22/+0
Change-Id: I7361bb0ce5302d00ccb18dc04eeb75ee1f6844a8
2017-02-24vty_test_runner.py: fix socket leakNeels Hofmeyr1-0/+2
Each running test would open up another socket without ever closing unused ones. Close the sockets after each test is done. Change-Id: Ie433c8560de54f9a9d05fa07c44bae3126d19b30
2017-02-07vty tests: more attempts to resolve 'Broken Pipe' errorNeels Hofmeyr1-7/+39
Change-Id: I4251a24eb7a57a354aa76de711547c3e76ebb846
2017-02-03Revert "vty tests: more attempts to resolve sporadic 'Broken Pipe' error"Neels Hofmeyr1-3/+1
'self' will not be accessible in that context, so this patch isn't useful. This reverts commit b39053ad6de50df5a2efcb4ec0c6551020b513e1. Change-Id: Ic1a9ba5fdfd7bdc6c5cf0974e8c637ae23b81ece
2017-02-03vty tests: testBSCreload: ipa_handle_small: ensure rx of 4 bytesNeels Hofmeyr1-0/+2
Change-Id: I995b7aba9d0b51b0861a4281dbbca888f36e9e00
2017-02-03vty tests: more attempts to resolve sporadic 'Broken Pipe' errorNeels Hofmeyr1-1/+3
Change-Id: I3d833ddf8c62845fe68d1e5503332541a4a04a2d
2017-02-02vty tests: attempt to get at sporadic 'Broken Pipe' errorNeels Hofmeyr1-1/+15
Add verbose logging as well as three retries around the place that often fails on our build server with a 'Broken Pipe' error. Change-Id: I8851b76b2d7b87dd500ae40f47e6bea716ef3fc4
2016-12-13Use IPA module for vty testsMax1-31/+9
Replace hackish ipa_send_* routines with proper implementation from IPA module thus making it part of extended tests. Change-Id: If13ed7fd243ce3aeef505d2e8468e221aa62f79e
2016-12-02Move timezone settings up to network levelNeels Hofmeyr1-1/+0
Time zone used to be configurable per-BTS. In the upcoming MSC-split, no BTS structures will be available on the MSC level. To simplify, drop the ability to manage several time zones in a core network and place the time zone config on the network VTY level, i.e. in gsm_network. If we are going to re-add fine grained time zone settings, it should probably be tied to the LAC. Adjust time zone VTY config code (to be moved to libcommon-cs in subsequent commit). Adjust time zone Ctrl Interface code. Change-Id: I69848887d92990f3d6f969be80f6ef91f6bdbbe8
2016-09-30vty_test_runner.py: fix indents to use spaces, fix vim commentNeels Hofmeyr1-27/+27
Most of this file uses four spaces of indenting. Replace all tabs with spaces. Remove the erratic 'set' from the recently added vim comment at the bottom. Change-Id: I4273b3314defb1e5b31b509c2ac7d7c6cd6834cf
2016-09-30vty_test_runner.py: make unittest print all output by defaultNeels Hofmeyr1-1/+1
Add option to TextTestRunner that shows print output on stdout. It's better to see everything in our jenkins runs and not hide test output. Change-Id: If4be1ad1c81c9ed4ab9b208b4c6d1e4b2cc8fdd5
2016-09-28vty_test_runner.py: fix nat_msc_test(): socket attach: reduce timeout, retryNeels Hofmeyr1-5/+22
In nat_msc_test(), upon socket timeout, retry up to six times. Reduce the timeout between retries. This should get rid of sporadic test failures that we've been seeing a lot on jenkins lately. Raise an exception upon unexpected vty response. Print more detail to stdout. Since we would actually want as much output as we can get in a test suite, remove the 'if (verbose)' and just always print the connection source. unittest is keeping all stdout silent by default anyway. Change-Id: I2f83eef55592778e54164a90e1eabeb80fb918da
2016-09-26vty_test_runner.py: raise exception when MSC socket connection failsNeels Hofmeyr1-0/+4
Instead of below error, raise an exception to describe what's happening. Seen in a jenkins run on https://gerrit.osmocom.org/#/c/945/2: ERROR: testBSCreload (__main__.TestVTYNAT) ---------------------------------------------------------------------- Traceback (most recent call last): File "./vty_test_runner.py", line 787, in testBSCreload msc = nat_msc_test(self, ip, port) File "./vty_test_runner.py", line 1251, in nat_msc_test return conn UnboundLocalError: local variable 'conn' referenced before assignment Change-Id: Iae26e7345267a21aed0b108b089453832889c9fa
2016-09-26cosmetic: vty_test_runner.py: add comment for vim auto settingsNeels Hofmeyr1-0/+2
Change-Id: I61a0476a0317b011432bb4f6f593cfdcaf1c072b
2016-07-11SGSN: prevent starting with inconsistent configMax1-0/+2
Previously it was possible to start osmo-sgsn with "auth-policy remote" but without "gsup remote-*" which resulted in broken setup: no MS could perform GPRS ATTACH. Add consistency check to vty code to fix this. Related: OS#1582 Change-Id: Ie4296e7d99d7833f7d828b0196435ea81097cf6e
2016-07-09Make random MSISDN assignment optionalMax1-1/+50
Previously if subscriber was automatically created it got assigned random MSISDN number. Make it optional (defaulting to previous behavior) by adding following: * new optional no-extension argument for subscriber-create-on-demand vty command * db unit tests * vty test Note: using the db made with new code might result in subscribers with empty extension. Such subscribers cannot be deleted using old code. Make sure not to mix db versions or manually fix it by editing sqlite with external program. Fixes: OS#1658 Change-Id: Ibbc2e88e4722b08854ebc631485f19ed56443cbb
2016-06-29Fix vty tests with subscriber deletionMax1-9/+11
Use correct vty command for subscriber deletion, adjust assertions accordingly. The error was cause by inconsistent syntax of vty commands for subscriber creation and deletion. Change-Id: I9b9376b4ac0ec066000545167de312ca4460493b
2016-06-14Make random extension range configurableMax1-0/+21
Previously if subscriber was automatically created it got assigned random MSISDN number between 20000 and 49999. Make it configurable with new vty command "subscriber-create-on-demand random" and expand vty tests to check it. Change-Id: I040a1d227b0c7a1601dc7c33eccb0007941408a6 Related: OS#1658
2016-06-05Add regexp authorization policy for IMSIMax1-0/+16
* extend "auth policy" vty command with new option "regexp" * add vty command "authorized-regexp" for setting arbitrary POSIX regular expression * add basic vty test * add optional "regexp" argument to subscriber-create-on-demand vty command With those in place we can now set the regexp against which MS's IMSI will be matched. If IMSI match the regexp than MS is allowed to access the network. If subscriber is already marked as authorized in HLR than it'll be allowed regardless of IMSI matching. The same way we can decide whether to create subscribers on-demand basesd on IMSI regexp match. Similar to authorization this restriction can be overridden by manually creating subscriber via vty, ctrl interface or directly in HLR. Change-Id: I525f4b80676de47d1d422686da2ca012301b0129 Fixes: OS#1647
2016-04-22Add basic UARFCN supportMax1-0/+23
* add data structures, generation functions * vty interface for neightbor UARFCNs specific to SI2quater * vty test * unit test Fixes: OS#1666
2016-04-22Fix earfcn deletionMax1-0/+14
* fix typo in arg index * fix sign in error reporting * add vty test
2016-04-14nat/vty: Fix construct not working with python 2.6Holger Hans Peter Freyther1-1/+1
Use the simpler approach and just call encode('hex') on the str and then convert it to lower case to keep the tests working. reproduce: Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> d = '\0\0' >>> d '\x00\x00' >>> "".join("{:02x}".format(ord(c)) for c in d) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 1, in <genexpr> ValueError: zero length field name in format fixes: ====================================================================== ERROR: testBSCreload (__main__.TestVTYNAT) ---------------------------------------------------------------------- Traceback (most recent call last): File "./vty_test_runner.py", line 658, in testBSCreload b0 = nat_bsc_sock_test(0, "lol") File "./vty_test_runner.py", line 1150, in nat_bsc_sock_test ipa_handle_small(bsc, verbose) File "./vty_test_runner.py", line 1116, in ipa_handle_small s = data2str(x.recv(4)) File "./vty_test_runner.py", line 1100, in data2str return "".join("{:02x}".format(ord(c)) for c in d) File "./vty_test_runner.py", line 1100, in <genexpr> return "".join("{:02x}".format(ord(c)) for c in d) ValueError: zero length field name in format ----------------------------------------------------------------------
2016-04-14nat/vty: Remove second assumption about lo and bindingHolger Hans Peter Freyther1-1/+1
If we want to separate the BSCs we should separate based on the source port and not the source ip (at least in the current test setup). Fixes: ====================================================================== ERROR: testBSCreload (__main__.TestVTYNAT) ---------------------------------------------------------------------- Traceback (most recent call last): File "./vty_test_runner.py", line 658, in testBSCreload b0 = nat_bsc_sock_test(0, "lol") File "./vty_test_runner.py", line 1145, in nat_bsc_sock_test bsc.bind(('127.0.0.1' + str(nr), 0)) File "<string>", line 1, in bind error: [Errno 99] Cannot assign requested address ----------------------------------------------------------------------
2016-04-14nat/vty: And move to a different port..Holger Hans Peter Freyther1-1/+1
2016-04-14nat/vty: Convert into str for the VTY commandHolger Hans Peter Freyther1-1/+1
====================================================================== ERROR: testBSCreload (__main__.TestVTYNAT) ---------------------------------------------------------------------- Traceback (most recent call last): File "./vty_test_runner.py", line 656, in testBSCreload nat_msc_ip(self, ip, port) File "./vty_test_runner.py", line 1096, in nat_msc_ip x.vty.command("msc port " + port) TypeError: cannot concatenate 'str' and 'int' objects ----------------------------------------------------------------------
2016-04-14nat/vty: Use different port for the mock MSCHolger Hans Peter Freyther1-5/+9
Update the comment to reflect that the NAT itself will bind to port 5000 and then the mock MSC will fail to bind to it. Try to move the mock MSC to another port. Could fix: ====================================================================== ERROR: testBSCreload (__main__.TestVTYNAT) ---------------------------------------------------------------------- Traceback (most recent call last): File "./vty_test_runner.py", line 654, in testBSCreload msc = nat_msc_test(self, ip) File "./vty_test_runner.py", line 1101, in nat_msc_test msc.bind((ip, 5000)) File "<string>", line 1, in bind error: [Errno 98] Address already in use ----------------------------------------------------------------------
2016-04-14nat/vty: Don't assume one can magically add IPv4 addresses to loHolger Hans Peter Freyther1-2/+1
Don't assume that one can just bind to a local address that has not been configured. Remove the unspecific comment as I don't know to which other tests it is referred to. This should fix: ====================================================================== ERROR: testBSCreload (__main__.TestVTYNAT) ---------------------------------------------------------------------- Traceback (most recent call last): File "./vty_test_runner.py", line 655, in testBSCreload msc = nat_msc_test(self, ip) File "./vty_test_runner.py", line 1102, in nat_msc_test msc.bind((ip, 5000)) File "<string>", line 1, in bind error: [Errno 99] Cannot assign requested address ----------------------------------------------------------------------
2016-04-14NAT: reload BSCs config dynamicallyMax1-1/+119
Add vty tests for BSC configuration reloading. Load BSCs configuration on bscs-config-file command: * remove all runtime configured BSC not in the config file * close connections to all BSC with updated token value Fixes: OS#1670 Sponsored-by: On-Waves ehf
2016-04-14vty_test_runner: update ipa sending codeMax1-2/+27
Factor out 2, add 3 functions. Those functions are simple wrappers around hex strings specific to IPA protocol. Not all of them are utilized at the moment but they were checked with wireshark while working on the tests. It might come in handy if we'd like to further expand related test harness in future. The same goes for optional verbosity argument which is not used right now but will be handy for future debugging.
2016-04-06subscr: Add testcase creating an already created subscriberHolger Hans Peter Freyther1-0/+36
Add testcase to issue the subscriber create twice. db_create_subscriber in db.c will first try to find the subscriber and if it exists, it will update the "updated" column in the database. Related: OS Issue #1657
2015-08-20mgcp: Allow to bind to different ports for net/bts portsHolger Hans Peter Freyther1-0/+22
When using multiple interfaces on a system one can now configure which will be served for the BTS ports and which will be served for the network. The direct usage of source_addr is now only to initialize the MGCP receiving port itself.
2015-07-13sms: Fix the non-SMPP mode of the testHolger Hans Peter Freyther1-3/+4
List needs to be executed from within the right configuration node to see if it is available or not. list on the toplevel will uncoditionally show "smpp" as part of the logging config.
2015-07-06sms: Add a way to always route SMS through SMPP systemsHolger Hans Peter Freyther1-0/+22
default-route would only be looked at after there has been no subscriber in the local database. Depending on the setup this is not what one wants. This has been discussed at the OsmoDevCon and there have been hacks in some branches. Let's introduce a VTY command to select if SMPP should be consulted first and then fallback to the current behavior.