aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2017-10-17replace ctrl_test_runner.py with transcript test_subscriber.ctrlNeels Hofmeyr3-243/+46
Use the new osmo_verify_transcript_ctrl.py from osmo-python-tests to completely replace current ctrl_test_runner.py with a CTRL interaction transcript. Add missing EXTRA_DIST entry of test_subscriber.sql. Depends: osmo-python-tests Id47331009910e651372b9c9c76e12f2e8964cc2c Change-Id: Iff93abe370b8f3ecf42082d1d0eaa1fbeca5b122
2017-10-17add test_nodes.vtyNeels Hofmeyr2-0/+118
Automatically picked up by the vty-test target, by file name extension. Change-Id: I8dba373cee1be954504f79c3305b0111071757e7
2017-10-17implement subscriber vty interface, testsNeels Hofmeyr2-2/+367
Implement VTY commands for subscriber manipulation: - create / delete subscriber - modify MSISDN - add/edit/remove 2G and 3G authentication data - show by IMSI, MSISDN or DB ID. (enable/disable CS/PS and purge/unpurge to follow later.) Implement VTY unit tests for the new commands using new osmo_verify_transcript_vty.py from osmo-python-tests. Depends: libosmocore I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522 osmo-python-tests Id47331009910e651372b9c9c76e12f2e8964cc2c Change-Id: I42b3b70a0439a8f2e4964d7cc31e593c1f0d7537
2017-10-15fix db_subscr_get_by_*(): clear output data; test in db_test.cNeels Hofmeyr1-3/+16
db_subscr_get_by_*() failed to clear the out-param struct, meaning that data could remain in a struct even though it is not present in the database. Always zero out the struct before writing to it. Adjust the db_test to catch this error by writing "-invalid-data-" to each struct before running db get functions. Change-Id: I038bd437452c87841d709fcdd5ac30ab1356b2db
2017-10-11fix db_update_sqn(): reset stmt in all error casesNeels Hofmeyr2-0/+291
Use the common db_bind_int64() so that the stmt bindings are cleared for any errors and to get error logging for free. On error with sqlite3_step(), log the SQL error message, and make sure the stmt is cleared of bindings and reset. After sqlite3_step(), verify that exactly one row was modifed, log and return errors otherwise. After this patch, the DB interaction closely matches the other (refactored) DB functions. Change-Id: I0d870d405e2e0a830360d9ad19f0a3f9e09d8cf2
2017-10-11refactor db_get_auth_data return valNeels Hofmeyr2-59/+59
Adopt the error handling of the other db functions: return -ENOENT on unknown subscriber and -EIO on SQL failure. Return 0 for no error, instead of the number of rows modified. Adjust the single caller: db_get_auc() (and db_test.c). Change-Id: I006f471962bdad95d00a3a4c41a28ebbc9740884
2017-10-11add db_subscr_update_aud_by_id(), complete db_subscr_delete_by_id()Neels Hofmeyr2-0/+760
Add ability to add and remove auc_2g and auc_3g table rows with db_subscr_update_aud_by_id(). In db_subscr_delete_by_id(), make sure that when deleting a subscriber, also all auth data associated with that user ID is removed as well. A newly created subscriber must not obtain the same auth tokens just by getting the same id. Depends: libosmocore Idf75946eb0a84e145adad13fc7c78bb7a267aa0a Change-Id: Icb11b5e059fb920447a9aa414db1819a0c020529
2017-10-11refactor db_subscr_purgeNeels Hofmeyr2-0/+175
Use named parameters in the SQL statements. Use db_bind_* functions to drop some code dup. Adopt error handling (rc and logging) to match the other db functions: return -ENOENT for unknown subscriber, -EIO for SQL failures. Change-Id: Iad49d29b90a708c6cf55bfb3bcc02d9e29001a15
2017-10-11refactor db_subscr_lu()Neels Hofmeyr2-0/+174
Use named parameters in the SQL statement. Use db_bind_* functions to drop some code dup. Use explicit subscriber id arg instead of subscriber struct. Match return values and error logging to other db functions. Change-Id: I35665e84ddbe54a6f218b24033df969ad2e669a0
2017-10-11refactor db_subscr_ps() to db_subscr_nam()Neels Hofmeyr2-0/+183
Allow to set nam_ps and nam_cs from this same function, by adding the is_ps arg. Combine both NAM_PS stmts to DB_STMT_UPD_NAM_PS_BY_IMSI, add another such stmt for CS. Use named parameters instead of parameter indexes. Improve error return values as well as error logging to clearly indicate whether the operation could not find the requested IMSI, or other errors occured. Adjust the single caller. This prepares for upcoming VTY and possibly CTRL commands, and the error handling introduced here has been or will be adopted by other functions in previous or subsequent patches. Change-Id: I6e70e15228f5bb10bee6758ae5dc9687d65839bd
2017-10-11add db_subscr_get_by_msisdn() and db_subscr_get_by_id()Neels Hofmeyr2-24/+85
Factor out the selected SQL columns as SEL_COLUMNS macro, so that each of the new DB_STMTs will select identical columns: the old DB_STMT_SEL_BY_IMSI as well as the new DB_STMT_SEL_BY_MSISDN and DB_STMT_SEL_BY_ID. Add the new functions db_subscr_get_by_msisdn() and db_subscr_get_by_id() and factor out common parts with db_subscr_get_by_imsi() to static db_sel(). Change-Id: I6d0ddd1b7e3f6b180b4b1b2663c5725d2a4a9428
2017-10-11less noise: simplify db_remove_reset()Neels Hofmeyr1-5/+0
db_remove_reset() needs to be called after each stmt run, whether it succeeded or not. In case sqlite3_clear_bindings() would fail to unbind a stmt, we would anyway be beyond recovery. There seem to be no plausible situations where such failure would occur, unless there have been no bindings in the first place. In case there was an SQL stmt failure, sqlite3_reset() will re-barf the same error message, we will always have logged it earlier already in the proper context. We are never evaluating the return value, nor would we know how to recover from non-success. The conclusions: - db_remove_reset() does not need to log any errors. - db_remove_reset() does not need to return success. Change-Id: I21678463e59f607f5f5c5732963e274392f0fffd
2017-10-11add initial db_test: creating and deleting subscribersNeels Hofmeyr6-0/+661
Change-Id: I2a0d277f55162bf5ceb0fc7d50390f2994daed71
2017-10-11ctrl_test_runner.py: use proper constant as test db pathNeels Hofmeyr1-1/+1
Change-Id: I9533a9ff8c0f8d24c678583a9197143a187908f3
2017-09-28add CTRL tests for enable-/disable-/status-psNeels Hofmeyr2-0/+55
Change-Id: I014437db9c0f15d818e04810f6cb14bf475ee002
2017-09-28add basic CTRL interface testsNeels Hofmeyr2-0/+209
Prepare for adding tests of enable-/disable-/status-ps CTRL commands. Change-Id: Ie195169c574716b514da7e04a3ce9727ef70a55e
2017-07-13Another attempt at fixing .debMax1-1/+1
The previous efforts have failed: python3 does not supply /usr/bin/python symlink. Let's use python-minimal dependency. Change-Id: If9e3f31622efae132b25683c54ce09c83ce43415
2017-07-12deb: use python in shebangMax1-2/+2
This should fix the .deb build on OBS. Change-Id: I095e5c273e30a6e124833bf58b231c6367ab48d6
2017-07-11Attempt to fix .deb packageMax2-5/+3
After recent switch to legacy python2 .deb fails on OBS. Let's put known-to-work python3 dependency back but keep the script itself on python without version specifier as it seems to work fine with both versions. This, in turn, causes tests to fail on FreeBSD so disable them for now. Change-Id: I4a87252d411d840fca7362736a8c7877efa6ff52 Related: SYS#3322
2017-06-07tests/auc: Don't require python3Daniel Willmann1-1/+1
Our jenkins buildslave does not have python3 installed so call python2 instead. Change-Id: Ifb59b79021b2c935b326496ed339f12e13c96b8e Ticket: SYS#3322
2017-03-16debug log: output ind slot, previous sqn, and sqn db updateNeels Hofmeyr2-0/+26
Change-Id: Ib86442ea45f6c1948b3d260f59d35bdca38fbd32
2017-03-16UMTS AKA: implement SQN increment according to SEQ and INDNeels Hofmeyr6-0/+287
Add ind_bitlen column to auc_3g to record each USIM's IND size according to 3GPP TS 33.102 -- default is 5 bits, as suggested by the spec. Introduce auc_3g_ind to each connecting GSUP client to use as IND index for generating auth tuples sent to this client. With osmo_gsup_server_add_conn(), implement a scheme where clients receive fixed auc_3g_ind indexes based on the order in which they connect; each new connection takes the lowest unused auc_3g_ind, so in case one of the clients restarts, it will most likely receive the same auc_3g_ind, and if one client disconnects, no other clients' auc_3g_ind are affected. Add gsup_server_test.c to test the auc_3g_ind index distribution scheme. Depends: libosmocore I4eac5be0c0b2cede04464c4c3a0873102d952453 for llist_first Related: OS#1969 Change-Id: If4501ed4ff8e923fa6fe8b80c44c5ad647a8ed60
2017-03-16fix debug log: adjust to new SQN increment schemeNeels Hofmeyr2-30/+30
We can no longer accurately print the SQN from AUTS resync, since the SQN is incremented after AUTS. Instead, always print the SQN from the generated tuple, i.e. exactly the one left in auth data *after* the tuple was generated. This change was forgotten in recent adjustments to the new SQN incrementing scheme from libosmocore, in change-id I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894 for libosmocore change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3. It should have been obvious that something was missing in the previous patch from the auc_test output: the SQN in the output changed while the AUTN remained the same. That slipped by without being noticed :/ Change-Id: I0e1e828da931a3d22c75306c55bdb7f44df6512f
2017-03-15auc tests: fix after SQN scheme changes from libosmocoreNeels Hofmeyr4-107/+106
In change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3, libosmocore changes from incrementing SQN after tuple generation to incrementing SQN before tuple generation. Thus we now need to pass desired_sqn - 1 to get the same tuples. Adjust all regression tests, showing that the tuples as well as the SQNs used to generate the tuples remain unchanged, and only the SQN before and after generating reflect different values. Related: OS#1968 OS#1969 Change-Id: I4ec5a578537acb1d9e1ebfe00a72417fc3ca5894
2017-03-15auc tests: adjust cosmetically to prepare for SQN changesNeels Hofmeyr5-93/+118
The current auc tests test a lot with SQN == 0. An upcoming change in the SQN algorithms from libosmocore [1] will require us to pass desired_sqn - 1, because the tuple generation will increment the SQN before calculating. Later on [2] we will also want to employ ind_bits and ind in the test. In order to have some room in the number range, cosmetically adjust the current SQN tested for from 0 to 32, changing the generated AUTN. The upcoming adjustment to the new situation will then be able to show that only the SQN values before and after vector generation change while the auth tuples as well as the SQNs used for generation remain the same (without having to trick around with wrapping SQN past its maximum value). Note that the TS 55.205 test sets include neither SQN nor AUTN. While AUTN changes with changing SQN, all the other values are invariant of the SQN used. So we can simply choose a different SQN and ignore the difference in the AUTN. [1] change-id Iadf43f21e0605e9e85f7e8026c40985f7ceff1a3 "store last sqn" [2] change-id Ibc97e1736a797ffcbf8c1f7d41c5c4518f4e41bf "fix SQN increment" Related: OS#1969 Change-Id: I45d1866cde1b3e777460df76100af2fe4767c678
2017-02-22cosmetic: rename auc_3g_test.c to auc_test.cNeels Hofmeyr5-9/+9
The test includes 2G-only tests so the name is misleading. Splitting up makes no sense. Change-Id: I1a5a40413bf6636ead9370fb827aa0338c049e7f
2017-02-22cosmetic: auc_3g_test: improve test debugging toolsNeels Hofmeyr1-5/+66
In the test failure mismatch printf, better indicate the place of first mismatch. Helpful if some byte within a hexdump differs, the case when debugging AUTS. Copy some optarg code from openbsc's msc_vlr tests to provide verbose mode that prints log statements' source file and line. Change-Id: I1b23da055b5edacba09310411caf43c4cd1c29bc
2017-02-22auc_compute_vectors(): fix AUTS resync for multiple vectorsNeels Hofmeyr2-55/+5
Fix bug where AUTS was fed to each vector generation and thus each vector was generated with the same SQN. In auc_3g_test, adjust the bug indicating test expectations to now expect the proper results. Depends: libosmocore change-id If943731a78089f0aac3d55245de80596d01314a4 Change-Id: I425a1d92c85896227341f565f5361c0d830ce866
2017-02-22cosmetic: refactor auc_compute_vectors(), add debug logNeels Hofmeyr4-363/+438
Make the generation logic easier to understand (hopefully). Massively extend debug logging, which serves to illustrate the current AUTS failure shown by auc_3g_test. Since DAUC now logs the vectors, there is no need to print the vectors in VEC_IS() in auc_3g_test and auc_ts_55_205_test_sets anymore. Adjust testlog expectations accordingly. Change-Id: Ifb36d010a4ac64c765517e15b9074424ec19cc60
2017-02-22auc_3g_test: add AUTS test with N vectors, to show bugNeels Hofmeyr2-0/+198
Add test that shows how passing AUTS to auc_compute_vectors performs an AUTS sync on each vector and hence produces the same SQN each time. This will generate one working vector as resync result, and then N-1 more with the wrong SQN as far as the USIM is concerned. This causes a resync to be necessary on every authentication. Depends: libosmocore change-id If943731a78089f0aac3d55245de80596d01314a4 Change-Id: I246c9edfb009b593f834bb5b0577b65bfde7083c
2017-02-22auc_3g_test: allow to inc fake rand bytes upon rand requestNeels Hofmeyr1-10/+16
Preparing for upcoming unit test, in a separate commit for cosmetic reasons (setting the flag to false across the code). Change-Id: I6b9899cd898eecc95b244432f416041b194a7187
2017-02-22auc_gen_vectors(): ensure sane arguments, testNeels Hofmeyr2-0/+242
In auc_gen_vectors(), add various checks that the auth data arguments passed make sense, and add unit test to verify that they work. (Caught a segfault due to NULL dereference with this.) Change-Id: I775652b6a91d382707ce32176a3fe4ef547cbca7
2017-02-22auc_3g_test: add AUTS resync testNeels Hofmeyr2-0/+87
Used this to catch a bug where the AUTS process failed to copy RAND to the auth vector (libosmocore). Depends: libosmocore change-id If943731a78089f0aac3d55245de80596d01314a4 Change-Id: I06dd8671aa515139bdc3f08883f08276662cf25f
2017-02-01auth: verify test sets from 3GPP TS 55.205Neels Hofmeyr10-14/+1605
Put to-text conversion of the 3GPP TS 55.205 PDF's section defining the test vectors in tests/auc/gen_ts_55_205_test_sets/ts55_205_test_sets.txt and add python script to generate auc_ts_55_205_test_sets.c from that at build time. The generated auc_ts_55_205_test_sets.c runs through all 19 test sets, verifying that our gsm_milenage() matches the reference data. Change-Id: Idff9d757ab956179aa41ada2a223fd9f439aafbd
2017-02-01tests: auc_3g_test: implement vector generation testNeels Hofmeyr2-1/+366
Change-Id: I291bccd62661ff5790dc43d91dc63a9e4b0e0ff2
2017-02-01Add test suite skeleton with empty test (auc_3g_test)Neels Hofmeyr6-0/+159
Change-Id: I6359b0809ce8578850fd65887a568714fb35dbd8