aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/db
AgeCommit message (Collapse)AuthorFilesLines
2020-09-18db_test: Disable using color in log outputPau Espin Pedrol2-2/+2
It's really not used and only adds unneeded variabilities to output. Older libosmocore versions had a bug where extra color format characters were printed while newer versions have that fixed. Fixes: OS#4759 Change-Id: Idce85aa355d334929d8abdf5b99dad0622ecff58
2019-05-23tests: Mute stdout during db_prepare()Keith1-1/+21
libdbi on debian unstable (at least) outputs: "no table in statement !" breaking the db_test. Redirect stdout to /dev/null and restore after the function completes. Closes OS#4016 Change-Id: I8227aa8fa44d3237019db52dd0825f827797261b
2018-03-29Migrate from OpenSSL to osmo_get_rand_id()Neels Hofmeyr1-1/+0
Drop OpenSSL/libcrypto dependency, use osmo_get_rand_id() instead. Backport osmo-msc 753c15de2f00e24f76ac9b01a20e1e2ff0f86ce2 = I71cd631704a4dc155c6c752fee2a42cd6e2fa336 " Migrate from OpenSSL to osmo_get_rand_id() This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. " Apply similar changes in bsc-nat, mm_auth_test etc. Tested manually with osmo-nitb and sysmoBTS, and verified that Authentication Requests send heterogenous RAND tokens. Related: OS#1694 Change-Id: I81ebd55c7c90a436c5f2090e6790d78b773d2c92
2017-08-09libmsc: update database to accomodate SMS status-report fieldsPablo Neira Ayuso1-0/+1
SMPP DELIVER_SM messages with esm_class = Delivery Receipt need to send this message reference (that the mobile phone allocates) to the ESME. Thus, the ESME propagates it via SUBMIT_SM with esm_class = Delivery Acknoledgment so that the SMSC sends the GSM 03.40 status-report to the origin including this. Given this field is useful for status-reports, we need to store it in the HLR database. Moreover, we need a new field that specifies if the entry represents a SMS status-report, to do the right handling from the gsm411_send_sms() - such new handling comes in a follow up patch entitled "libmsc: handle delivery ack via SMPP SUBMIT SM / send GSM 03.40 status report". This patch includes the migration routines to the new database schema revision 5, it's quite a bit of dbi boilerplate code - copied-pasted and adapted. Change-Id: I7276d356d805a83ebeec72b02c8563b7135ea0b6
2016-11-24move to libcommon-cs: net init 3: actual moveNeels Hofmeyr1-1/+1
Reincarnate gsm_network_init() as the parts not specific to libbsc. Move from bsc_network_init() those bits that are not BSC specific (and useful for upcoming osmo-cscn). Add libcommon-cs to all linkages that use gsm_network_init(). Note: the only requirement to allow linking gsm_network_init() without libbsc is to keep the call to gsm_net_update_ctype() out of libcommon-cs. The other items are kept out of libcommon-cs because it makes sense semantically. But the separation is not strong in that the BSC specific data members are of course still omnipresent in struct gsm_network. If bsc_network_init() is not called, these are not initialized properly -- for now no users of uninitialized members exist. So this is just a first step towards a sensible split of the BSC and MSC gsm_network structs. The long term aim should be to have entirely separate structs with some common general items. Change-Id: If06316b97002390dc9a434686750cb96193ea63b
2016-09-15Consistenly format variables in */Makefile.am filesAlexander Huemer1-13/+44
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-07-09Make random MSISDN assignment optionalMax1-9/+21
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-14Make random extension range configurableMax1-3/+3
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-05-17Cleanup db testMax1-53/+34
Move copy-pasted code into separate function to make writing more tests easier. Related: OS#1658 Change-Id: I9e39af85718514dd0f081d41c234c9dda77c4b27 Reviewed-on: https://gerrit.osmocom.org/43 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-04-06subscr: Make db_create_subscriber fail on duplicatesHolger Hans Peter Freyther1-1/+5
The issue of db_create_subscriber updating an already existing subscr is that the same subscriber will then have two entries in the active subscribers list. In general this will break assumptions that a subscr can be compared by comparing the pointer. In the case of the VTY this was not an issue as the created subscr was immediately destroyed again but it is better to avoid this problem. Change the VTY command to find the subscriber and then call sync to have the updated time set. The side-effect is we will now have two queries for the subscriber. Once through subscr_get_by_imsi and once through db_create_subscriber. Change the db_create_subscriber to fail if a subscriber already exists, and add a testcase for this behavior and do not updated the 'updated' timestamp of an already existing subscriber. Add a testcase for this behavior. Related: OS Issue #1657
2016-03-17Revert "move to hex TMSI representation"Harald Welte1-2/+2
This reverts commit 044fbe6568f82a12bf4e3addc7e3d6db529b6548.
2016-03-17move to hex TMSI representationVadim Yanitskiy1-2/+2
In OpenBSC, we traditionally displayed a TMSI in its integer representation, which is quite unusual in the telecom world. A TMSI is normally printed as a series of 8 hex digits. This patch aligns OpenBSC with the telecom industry standard. Signed-off-by: Vadim Yanitskiy <axilirator@gmail.com>
2015-10-12libmsc: Use RAND_bytes when choosing a tmsiDaniel Willmann1-1/+1
Require openssl version to be >= 0.9.5 because we rely on the RAND_bytes return value. [hfreyther: Add cast to uint8_t*]
2014-12-25db: Extend the test to mark a SMS as delivered and verify itHolger Hans Peter Freyther1-0/+7
Mark the SMS as delivered, then free it and try to get an undelivered SMS to that subscriber again and make sure it is failing.
2014-12-05msc: Add and use gsm_subscriber_groupJacob Erlbeck1-3/+7
Currently every subcriber object directly refers to the gsm_network which contains a flag shared by every related subscriber (keep_subscr). This adds a dependency on gsm_network even if only the function defined in gsm_subscriber_base.c are used. This patch adds a new struct gsm_subscriber_group which contains the keep_subscr flag and a back reference to the network object. The latter is not dereferenced in gsm_subscriber_base.c, so it can safely be set to NULL when only that part of the gsm_subscriber API is being used. It also changes that API to use gsm_subscriber_group instead of gsm_network parameters. Since there are some places where a pointer to the gsm_network is needed but where only a gsm_subscriber is available, a 'net' back pointer is added to the group struct, too. Nevertheless subscr group and network could be separated completely, but this is not the topic of this commit. Sponsored-by: On-Waves ehf
2014-05-01db: Fix next fall-out with make distcheckHolger Hans Peter Freyther2-1/+2
2014-04-30db: Add testcase for the db migration.Holger Hans Peter Freyther4-1/+37
2014-04-30db: Add testcase for storing/loading/comparing a smsHolger Hans Peter Freyther1-0/+61
Use the already created subscriber, create a sms and read it back from the subscriber.
2014-03-09db: Add more tests for retrieving subscribers from a DB.Alexander Chemeris1-2/+36
2013-12-13build: db_test does not use dlopen/dlsym.. remove LIBRARY_DL from depsHolger Hans Peter Freyther1-1/+1
2013-12-13freebsd: dlopen/dlsym/dlerror is part of libc, use LIBRARY_DL for linkingNikola1-1/+1
In FreeBSD there is no spearate library for dlopen, dlsym and dlerror. Use LIBRARY_DL to check for this condition.
2013-10-13db: Remove the struct gsm_network from the database layerHolger Hans Peter Freyther1-6/+6
The database code should not know about the network. Move the setting of the network pointer into the subscriber layer.
2013-10-04Fix copy-paste error in console output in db_test.Alexander Chemeris1-1/+1
2013-06-12Makefile.am: Use AM_CPPFLAGSAlexander Huemer1-1/+1
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-03-21db: Link to the VTY library for the vty_config_unlock symbolHolger Hans Peter Freyther1-1/+1
Linking started to fail for me due the symbol coming from the vty library and the db code not linking to it.
2012-11-24tests: Fix build of 'db' test after smpp mergeHarald Welte1-2/+2
2012-01-06tests: Introduce running tests with GNU autotest in OpenBSCHolger Hans Peter Freyther2-0/+6
The quality of the tests is of different value but it is good to get started and improve from here.
2012-01-06db: Fix the test codeHolger Hans Peter Freyther1-14/+27
* Initialize logging * use a dummy net before calling subcr_put as the keep in ram option is going to be set.
2011-08-19src: port openBSC over libosmo-abis0.9.15Pablo Neira Ayuso1-3/+3
This is a big patch that ports openBSC over libosmo-abis. Sorry, the changes that are included here are all dependent of libosmo-abis, splitting them into smaller pieces would leave the repository in some intermediate state, which is not desired. The main changes are: - The directory libabis/ has been removed as it now lives in libosmo-abis. - new configuration file format for nanoBTS and HSL femto, we need to define the virtual e1_line and attach it to the OML link. - all the existing BTS drivers (nanoBTS, hsl femto, Nokia site, BS11 and rbs2000) now use the new libosmo-abis framework. - use r232 input driver available in libosmo-abis for bs11_config. - use ipa_msg_recv instead of old ipaccess_read_msg function. - delete definition of gsm_e1_subslot and input_signal_data. These structures now lives in libosmo-abis. Most of this patch are deletions of libabis/ which has been moved to libosmo-abis. This patch also modifies openBSC to use all the new definitions available in libosmocore and libosmo-abis. In order to do that, we have replaced the following: - DINP, DMI, DMIB and DMUX by their respective DL* correspondences. - SS_GLOBAL by SS_L_GLOBAL - SS_INPUT by SS_L_INPUT - S_GLOBAL_SHUTDOWN by S_L_GLOBAL_SHUTDOWN - SS_INPUT by SS_L_INPUT - S_INP_* by S_L_INP_* sub-signals - E1INP_NODE by L_E1INP_NODE vty node This patch has been tested with: - one nanoBTS - the HSL femto with the examples available under libosmo-abis - BS11 with both dahdi and misdn drivers.
2011-03-23src: use new library libosmogsm and new path to headers in libosmocorePablo Neira Ayuso1-2/+2
libosmogsm is a new library that is distributed in the libosmocore. Now, openbsc depends on it. This patch gets openbsc with this change. This patch also rewrites all include path to the new osmocom/[gsm|core] Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-04prefix sub-directories containing libraries with 'lib'Harald Welte1-1/+7
... and make sure tests work again after restructuring
2011-02-11[BSC] Move the BTS-type specific code from bcs_init.c to bts_*.cHarald Welte1-2/+0
bsc_init.c was a big mess even only for two supported BTS models, so before adding more BTS types, this needs a cleanup. All the BTS specific code from bsc_init.c has now moved into bts_{siemens_bs11,ipaccess_nanobts}.c This has required that input_event() and nm_state_event() get both converted to proper libosmocore signals instead of referencing external symbols.
2011-01-06subscr: Dump the pending requests to help with debugging state.Holger Hans Peter Freyther1-0/+1
2011-01-01License change: We are now AGPLv3+ instead of GPLv2+Harald Welte1-5/+4
The reason for this is quite simple: We want to make sure anyone running a customized version of OpenBSC to operate a network will have to release all custom modifiations to the source code.
2010-12-22misc: Remove gsm_subscriber.h from the db.h fileHolger Hans Peter Freyther1-0/+1
Reduce the dependencies on the header files.
2010-11-15misc: Introduce a --enable-coverage mode to build with gprof coverageHolger Hans Peter Freyther1-1/+2
This adds a test coverage build. One can use gcov and lcov on the resulting data afterwards to see which code paths were executed and which were not.
2010-02-26[misc] Add LIBOSMOCORE_CFLAGS to the includesHolger Hans Peter Freyther1-1/+1
2010-02-20finish openbsc / libosmocore separationHarald Welte1-1/+1
* use pkg-config from openbsc to find header and library * move sms and timer tests to libosmocore itself * ensure "make distcheck" works on both packages
2010-02-09liblaf0rge: Make the other targets depend on the liblaforge...Holger Hans Peter Freyther1-1/+1
Everything is linking fine here.
2009-09-28[tmsi] Make the tmsi a 4 octet numberHolger Hans Peter Freyther1-2/+2
tmsi is four octets long, there is no need to make it a string and then jump through hoops to convert it to a number. Keep the database using it as a string to benefit from the NULL handling of the db. Introduce the reserved tmsi which has all bits set to 1 according to GSM 03.03 ยง2.4 and start checking for it and make sure the db code will never allocate such a tmsi.
2009-08-17[msc] Move gsm_04_08.c, mncc and various others to libmscHolger Hans Peter Freyther1-1/+1
Currently we have circular dependencies from libbsc to libmsc and this requires to play some linker tricks. The problem will be solved in two ways, first we will get rid of the circular dependencies and second we can start using --start-group and --end-group of the linker to play the tricks for us.
2009-08-17[subscr] Split gsm_subscriber.c in BSC and MSC partHolger Hans Peter Freyther1-1/+1
For the BSC part we still assign a gsm_subscriber to lchan but it might only contain the TMSI of this subscriber. For the MSC part we will need the HLR/VLR feature of the gsm_subscriber, specially the lookup's by number... So if libbsc.a/libmsc.a are compiled in one app and used the subscribers will be shared, and if only libbsc.a gets used we will have more empty gsm_subscriber.c..
2009-08-17[msc] Introduce a libmsc.a libraryHolger Hans Peter Freyther1-1/+1
Attempt to split up bsc/msc functionality according to the specs. The libbsc.a will be responsible for communicating with the BTS, configuring it, paging, channel allocation and passing layer3 messages in both ways. libmsc.a will implement the policy and such.
2009-07-29db_test.c: Make it compile againHolger Hans Peter Freyther1-6/+6
2009-06-10move openbsc into its own subdirectoryHarald Welte2-0/+114