Age | Commit message (Collapse) | Author | Files | Lines |
|
This can help with debugging and give operational insight.
Change-Id: I977b4b8cdb36dab42b3d736a28d8b5f17cff04cd
|
|
Move code to create an Insert Subscriber Data message into a common
function which can be shared by hlr.c and luop.c.
As a consequence, we always encode gsup.cn_domain in the corresponding
msgb and must adjust expected output of the 'gsup' test accordingly.
Change-Id: I6a92ca34cdaadca9eacc774bb1ca386c325ba865
Requested-by: neels
Related: OS#2785
|
|
Encode an Insert Subscr Data with is_ps == true to trigger the encoding bug
described in OS#3231, i.e. show that it is fixed.
Move osmo_gsup_addr_send() to a separate .c file, so that it can be overridden
in the regression test to just dump the msgb instead.
I used this test to reproduce issue OS#3231, and now that it's here we might as
well keep it, and possibly expand on it in the future.
Related: OS#3231
Change-Id: Id1453351758f3e1a9ff03bd99fefaf51886e77da
|
|
Change-Id: If4449cce1af46be22cc370abd3a6da8e22a31fa5
|
|
This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.
Change-Id: Ibc2c333b83f85fa69a364e3e342f12f50dbc2f70
|
|
Ever since libosmocore Change-Id I1c931bff1f1723aa82bead9dfe548e4cc5b685e0
was merged, the VTY tests were broken. Let's fix that by adjusting
the expected test output.
Change-Id: I929ca7f366220b5d1238d43eddc96fa9dde916b6
|
|
Change-Id: I2539f5dc7a512a57ad36c460a11195ccbd84d7d6
|
|
After libosmocore I96a9b6b6a3a5e0b80513aa9eaa727ae8c9c7d7a1 the CTRL interface
returns stricter errors. Adjust the expectations of
test_subscriber_errors.ctrl to fix the external tests on master.
Change-Id: I9337b6b4f3fa8822c91760deb01f18a77a073d19
|
|
Don't log "deriving 2G from 3G" when we're actually calculating separately; log
it when we're actually deriving from 3G.
Add log "calculating 2G separately" in the right place.
The test output changes show that each test said "separate 2G" at the top while
logging "deriving 2G from 3G" further down, which was obviously wrong.
Change-Id: I6679d7ef8fdcae39a0c2aff7ac638e63dddb10dc
|
|
libosmocore Ie35a02555b76913bb12734a76fc40fde7ffb244d
"ctrl: on parse errors, return a detailed message to sender"
the test_subscriber_errors.ctrl test fails.
Adjust the expected error message.
Change-Id: I3aee1507721cd073f72369150d0fb3cff0fdf66f
|
|
Verify that it returns -ENOENT on non-existing IMSI and -ENOKEY for no auth
data.
Move the auc_compute_vectors() stub to the top near the db_get_auc() call, and
just return num_vec to get a successful return value when auth data is present.
Change-Id: Ic0158228afbd78b8ca21f62dffa9f868674682b9
|
|
Differentiate between "IMSI unknown" and "IMSI has no auth data": in case of
known IMSI lacking auth data, return -ENOKEY instead of -ENOENT.
Fix API doc comments to reflect what the functions actually return, on top of
adding the -ENOKEY detail.
Adjust db_test expectations from -ENOENT to -ENOKEY where appropriate.
Adjust VTY and CTRL command rc evaluation.
A subsequent patch will use these return values to log details on each of these
situations.
Change-Id: Icf6304d23585f2ed45e050fa27c787f2d66fd3f7
|
|
A user on openbsc@ complained that with SQLite 3.8.2, the db_test fails with
--- expected
+++ stderr
-DDB (2067) abort at 18 in [INSERT INTO subscriber (imsi) VALUES ($imsi)]: UNIQUE constraint failed: subscriber.imsi
+DDB (2067) abort at 35 in [INSERT INTO subscriber (imsi) VALUES ($imsi)]: UNIQUE constraint failed: subscriber.imsi
i.e. a trivial difference in the error message issued by SQLite.
For db_test, don't output any SQLite error messages: Add argument
enable_sqlite_logging, pass as true, except in db_test.c.
Remove the SQLite error messages from expected output.
(Note that there is a src/db_test.c program that's not of interest here, this
is about the tests/db/db_test.c)
Change-Id: I2513d71cc0072aef8d08f47d0a1959f311176229
|
|
Tweak unit test binaries to still used DEBUG loglevels, so that their expected
outputs remain unchanged (and nicely verbose).
Adjust test_nodes.vty, now expecting the 'notice' log levels upon
'show running-config'.
Change-Id: Ic061e61c9625b49cef8bc2a2c0b936e262c22268
|
|
If a database file is missing, osmo-hlr creates it, as is the default sqlite3
API behavior -- before this patch, that db file is created, but lacks useful
tables. Actually also create initial tables in it, as osmo-nitb did.
In effect, the 'vty-test' target in tests/Makefile.am no longer needs to create
a database manually. (The 'ctrl-test' still does, because it also wants to add
subscriber data on top of the bare tables.)
Note: it could be desirable to bail if the desired database file does not
exist. That is however a different semantic from this patch; this is not
changing the fact that a db file is created, this just creates a usable one.
Note: I am about to add osmo-hlr-db-tool to do database migration from
osmo-nitb. For that, it is desirable to bootstrap a usable database, which is
the core reason for this patch.
Don't plainly duplicate hlr.sql to .c, but create db_bootstrap.h as a
BUILT_SOURCE from reading in sql/hlr.sql and mangling via sed to a list of SQL
statement strings. On each db_open(), run this bootstrap sequence.
In sql/hlr.sql, these tweaks are necessary:
* Add 'IF NOT EXISTS' to 'CREATE TABLE', so that the bootstrap sequence can be
run on an already bootstrapped db.
* Drop the final comment at the bottom, which ended up being an empty SQL
statement and causing sqlite3 API errors, seemed to have no purpose anyway.
Note: by composing the statement strings as multiline and including the SQL
comments, sqlite3 actually retains the comments contained in table definitions
and prints them back during 'sqlite3 hlr.db .dump'.
Change-Id: If77dbbfe1af3e66aaec91cb6295b687f37678636
|
|
The -I includes should be in CFLAGS, not CPPFLAGS.
I noticed problems with it when trying to add an -I$(builddir) in an upcoming
patch that adds a BUILT_SOURCE, If77dbbfe1af3e66aaec91cb6295b687f37678636.
Change-Id: Ie57a04b7efc7a1e16cf0e3625d8ad2f0ef0089b0
|
|
Change-Id: I9859b522b5ffa7f2c9ed33ab849199d4b4e6696c
|
|
Add a large enough subscriber id and add a test that ensures a leading zero is
not interpreted as octal, and that a leading 0x is invalid and not interpreted
as hexadecimal.
Change-Id: Ib468b7cb595cf52331ebb41e6de0e8f57f69e173
|
|
The previous commands are not conforming to how the CTRL interface is intended
to work:
SET enable-ps <IMSI>
SET disable-ps <IMSI>
SET status-ps <IMSI>
'status-ps' is a write-only command even though it returns the status.
'enable-ps' / 'disable-ps' indicate the value instead of a variable name of an
entity. The entity <IMSI> takes the place of the variable value.
See also https://lists.osmocom.org/pipermail/openbsc/2017-September/011236.html
Instead, replace with
SET subscriber.by-imsi-123456.ps-enabled {0,1}
GET subscriber.by-imsi-123456.ps-enabled
and also provide further CTRL functions while at it:
{SET,GET} subscriber.by-{imsi,msisdn,id}-123456.{cs,ps}-enabled {0,1}
GET subscriber.by-{imsi,msisdn,id}-123456.{info,info-aud,info-all}
Provide CTRL tests in the form of transcripts.
Adjust tests/test_subscriber.sql to feature nonzero SQN, to see some values for
SQN in the CTRL transcript tests. (This does not affect the VTY tests, because
that creates its own subscribers, and there's no VTY command to set the SQN.)
This is the first time an application uses CTRL_NODE ids that are defined
outside of libosmocore, see 'Depends' below.
Implementation choice: the first idea was to have a '.' between the 'by-xxx'
and the value, like:
subscriber.by-xxx.123456.function
but the difficulty with subscribers is that they are not in RAM, and I can't
just point node_data at a struct instance that is always there (like, say, a
global bts[0] struct in osmo-bsc). Instead, I want to store the selector and
later decide whether to read from the DB or whatever. With a '.' separating
things, the only way in a ctrl function to obtain both 'by-xxx' and '123456'
for picking a subscriber record would be to parse the entire variable path
string elements, including 'subscriber' and 'function', which would then also
clumsily fix at which node level we hook these commands; there could have been
separate CTRL_NODE_SUBSCR_BY_{IMSI,MSISDN,ID} parent nodes, but we cannot
introspect the current parent node dynamically within a ctrl function handler
(plus I'm not sure whether it's possible and a good idea to have the same
command under multiple parent nodes).
Rather than that, I store the 'by-foo-123' token in the node_data pointer to
have both bits of information pointed at by a single pointer; I use the
incoming command parsing to get this token pre-separated from surrounding node
names, and no need to re-allocate it, since the vector of tokens lives until
after command execution is complete. Each leaf command obtains this token from
cmd->node (aka node_data), and feeds this token to a common static function to
parse selector and value from it and to retrieve a subscriber record as needed.
(BTW, I have mentioned on the mailing list that this way might be necessary to
avoid numeric-only CTRL node names, but we don't need to, and that is not at
all related to this choice of structure.)
Depends: libosmocore I1bd62ae0d4eefde7e1517db15a2155640a1bab58
libosmocore Ic9dba0e4a1eb5a7dc3cee2f181b9024ed4fc7005
Change-Id: I98ee6a06b3aa6a67adb868e0b63b0e04eb42eb50
|
|
This code should not live in a CTRL interface function but be proper hlr_* API.
Change-Id: I4c9b8f9ad51d49517474e8b51afc3cc2e1c9299a
|
|
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
|
|
Automatically picked up by the vty-test target, by file name extension.
Change-Id: I8dba373cee1be954504f79c3305b0111071757e7
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
Change-Id: I2a0d277f55162bf5ceb0fc7d50390f2994daed71
|
|
Change-Id: I9533a9ff8c0f8d24c678583a9197143a187908f3
|
|
Change-Id: I014437db9c0f15d818e04810f6cb14bf475ee002
|
|
Prepare for adding tests of enable-/disable-/status-ps CTRL commands.
Change-Id: Ie195169c574716b514da7e04a3ce9727ef70a55e
|
|
The previous efforts have failed: python3 does not supply
/usr/bin/python symlink. Let's use python-minimal dependency.
Change-Id: If9e3f31622efae132b25683c54ce09c83ce43415
|
|
This should fix the .deb build on OBS.
Change-Id: I095e5c273e30a6e124833bf58b231c6367ab48d6
|
|
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
|
|
Our jenkins buildslave does not have python3 installed so call python2
instead.
Change-Id: Ifb59b79021b2c935b326496ed339f12e13c96b8e
Ticket: SYS#3322
|
|
Change-Id: Ib86442ea45f6c1948b3d260f59d35bdca38fbd32
|
|
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
|
|
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
|
|
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
|
|
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
|
|
The test includes 2G-only tests so the name is misleading. Splitting up makes
no sense.
Change-Id: I1a5a40413bf6636ead9370fb827aa0338c049e7f
|
|
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
|
|
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
|
|
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
|
|
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
|