aboutsummaryrefslogtreecommitdiffstats
path: root/src/hlr_vty_subscr.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-25change format of 'last LU seen'neels/last_lu_seen_fmtNeels Hofmeyr1-10/+8
So far, the time string format comes from ctime_r, and we manually add "UTC" to it. The ctime_r format is wildly chaotic IMHO, mixing weekday, day-of-month and hour and year in very unsorted ways. Adding "UTC" to it is non-standard. Instead use an ISO-8601 standardized time string via strftime(). Change-Id: I6731968f05050399f4dd43b241290186e0c59e1a
2018-12-10display last location update timestamp in vtyStefan Sperling1-0/+17
Read the subscriber's last location update timestamp from the database and display it in the output of 'show subscriber'. For example: OsmoHLR> show subscriber id 1 ID: 1 IMSI: 123456789000000 MSISDN: 543210123456789 VLR number: 712 SGSN number: 5952 last LU seen: Fri Dec 7 11:30:51 2018 UTC While the database stores the timestamp as a string, we convert the timestamp into time_t for internal use. This allows for flexible potential use of the timestamp in contexts other than the VTY in the future. The timestamp displayed in the VTY is created with ctime_r(3). It does not match the format of the raw string in the database: sqlite> select id,last_lu_seen from subscriber; 1|2018-12-07 11:30:51 Related: OS#2838 Change-Id: Ie180c434f02ffec0d4b2f651a73258a8126b2e1a
2018-12-02implement removal of MSISDNNeels Hofmeyr1-15/+27
Add the first "official" way to remove the MSISDN from a subscriber entry, to go back to 'MSISDN: none' like just after 'subscriber create'. Add VTY command 'subscriber <ID> update msisdn none' to drop the MSISDN from the subscriber. (Like 'subscriber <ID> update aud3g none') Add DB_STMT_DELETE_MSISDN_BY_IMSI. In db_subscr_update_msisdn_by_imsi(), allow passing a NULL msisdn, and if NULL, call above delete SQL statement. Change-Id: I15419105ea461137776adb92d384d8985210c90e
2018-12-02add 'show subscriber' command, alias for 'subscriber ... show'Neels Hofmeyr1-2/+7
When I wrote the osmo-hlr subscriber command, I failed to heed the common 'show foo' scheme and instead created a 'subscriber [...] show' command. Relieve that weirdness by creating an alias that has 'show' at the start. Arrange string macros so that the 'show subscriber' cmd doesn't end in a space (the SUBSCR macro ends in a space ' ' to implicitly include the space to commands like 'create', 'show', 'update'). Add the new command to test_nodes.vty and test_subscriber.vty. Change-Id: I01ce9b0868302d40ed05c6a588316a194d6071e4
2018-07-30hlr_vty_subscr.c: fix subscriber creation command helpVadim Yanitskiy1-2/+3
Change-Id: Id8dda53cdd10aeedf5451109f9e61d6438c3e09b
2018-07-30hlr: Export + Declare global g_hlr symbolHarald Welte1-5/+1
It is a global variable, and it's sort of bogus if every C file re-declares it as a static global variable that is assigned to the same value as the "real" global one during start-up. Change-Id: I6f3e50f071fb2fbbe58413b4760dc2215055a444
2018-04-10notify GSUP clients when HLR subscriber information changesStefan Sperling1-0/+4
Add a function which triggers subscriber update notifications to all connected GSUP clients, and invoke it when the MSISDN of a subscriber is changed via VTY. This makes the TTCN3 HLR test TC_vty_msisdn_isd pass. Note that the new function currently relies on implementation details of the Location Update Operation (luop) code. Because of this we currently log a slightly misleading message when the updated Insert Subscriber Data message is sent: "luop.c:161 LU OP state change: LU RECEIVED -> ISD SENT" This message is misleading because, in fact, no location update message was received from a GSUP client at that moment. So while this change fixes the externally visible behaviour, we may want to follow this up with some refactoring to avoid relying on luop internals. It seems acceptable to do that in a separate step since such a change will be more involved and harder to review. We may want to trigger such notifications in other situations as well. This is left for future work, too. There are no TTCN3 test cases for other situations yet, as far as I can see. Related: OS#2785 Change-Id: Iffe1d7afb9fc7dbae542f70bbf5391ddc08a14b4
2018-03-01vty: Don't print error if removing auth data while none presentHarald Welte1-2/+2
It's a bit confusing to the user if he wants to set AUD=none and it's already none. Avoid printing error messages in that case. Change-Id: I5f32dd5d6e4939c738faf442c7e86671d18777f8
2017-11-29db_get_auth_data / db_get_auc: clarify return valuesNeels Hofmeyr1-8/+11
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
2017-10-23vty: fix output of empty IMSINeels Hofmeyr1-1/+1
Check *subscr->imsi, not subscr->imsi, since it is a char[]; same as msisdn below already does. Was introduced in change I42b3b70a0439a8f2e4964d7cc31e593c1f0d7537 / commit 183e7009afc8577f0d89c99f92a5720697040494. Fixes: coverity CID 178166 Change-Id: I72e13efefbac0495b8dd1949a39fa44ebfd46b56
2017-10-17implement subscriber vty interface, testsNeels Hofmeyr1-0/+484
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