diff options
author | Oliver Smith <osmith@sysmocom.de> | 2019-07-15 10:35:22 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2019-07-15 14:13:46 +0200 |
commit | 3b33b01fb039817b49c9c8c06bd33650dc5e4a7a (patch) | |
tree | cf7350749ff13cad6c51be27ae836bb482cd2a3e | |
parent | 78abea6a0e4824cb8e5baa770012c41524fa81dd (diff) |
VTY: add subscriber update network-access-mode
Allow updating the NAM (Network Access Mode) of subscribers with the
VTY. This is important for the subscriber create on demand use case
where subscribers get created without access to PS and CS NAM by
default. Regenerate hlr_vty_reference.xml.
Related: OS#2542
Change-Id: I231e03219355ebe6467d62ae2e40bef9d8303e3b
-rw-r--r-- | doc/manuals/vty/hlr_vty_reference.xml | 16 | ||||
-rw-r--r-- | src/hlr_vty_subscr.c | 28 | ||||
-rw-r--r-- | tests/test_subscriber.vty | 42 |
3 files changed, 82 insertions, 4 deletions
diff --git a/doc/manuals/vty/hlr_vty_reference.xml b/doc/manuals/vty/hlr_vty_reference.xml index e5fd0f2..71a0236 100644 --- a/doc/manuals/vty/hlr_vty_reference.xml +++ b/doc/manuals/vty/hlr_vty_reference.xml @@ -811,6 +811,22 @@ <param name='IMEI' doc='Set IMEI (use for debug only!)' /> </params> </command> + <command id='subscriber (imsi|msisdn|id|imei) IDENT update network-access-mode (none|cs|ps|cs+ps)'> + <params> + <param name='subscriber' doc='Subscriber management commands' /> + <param name='imsi' doc='Identify subscriber by IMSI' /> + <param name='msisdn' doc='Identify subscriber by MSISDN (phone number)' /> + <param name='id' doc='Identify subscriber by database ID' /> + <param name='imei' doc='Identify subscriber by IMEI' /> + <param name='IDENT' doc='IMSI/MSISDN/ID/IMEI of the subscriber' /> + <param name='update' doc='Set or update subscriber data' /> + <param name='network-access-mode' doc='Set Network Access Mode (NAM) of the subscriber' /> + <param name='none' doc='Do not allow access to circuit switched or packet switched services' /> + <param name='cs' doc='Allow access to circuit switched services only' /> + <param name='ps' doc='Allow access to packet switched services only' /> + <param name='cs+ps' doc='Allow access to both circuit and packet switched services' /> + </params> + </command> </node> <node id='config'> <name>config</name> diff --git a/src/hlr_vty_subscr.c b/src/hlr_vty_subscr.c index 3078577..73dfab6 100644 --- a/src/hlr_vty_subscr.c +++ b/src/hlr_vty_subscr.c @@ -577,6 +577,33 @@ DEFUN(subscriber_imei, return CMD_SUCCESS; } +DEFUN(subscriber_nam, + subscriber_nam_cmd, + SUBSCR_UPDATE "network-access-mode (none|cs|ps|cs+ps)", + SUBSCR_UPDATE_HELP + "Set Network Access Mode (NAM) of the subscriber\n" + "Do not allow access to circuit switched or packet switched services\n" + "Allow access to circuit switched services only\n" + "Allow access to packet switched services only\n" + "Allow access to both circuit and packet switched services\n") +{ + struct hlr_subscriber subscr; + const char *id_type = argv[0]; + const char *id = argv[1]; + bool nam_cs = strstr(argv[2], "cs"); + bool nam_ps = strstr(argv[2], "ps"); + + if (get_subscr_by_argv(vty, id_type, id, &subscr)) + return CMD_WARNING; + + if (nam_cs != subscr.nam_cs) + hlr_subscr_nam(g_hlr, &subscr, nam_cs, 0); + if (nam_ps != subscr.nam_ps) + hlr_subscr_nam(g_hlr, &subscr, nam_ps, 1); + + return CMD_SUCCESS; +} + void hlr_vty_subscriber_init(void) { @@ -590,4 +617,5 @@ void hlr_vty_subscriber_init(void) install_element(ENABLE_NODE, &subscriber_no_aud3g_cmd); install_element(ENABLE_NODE, &subscriber_aud3g_cmd); install_element(ENABLE_NODE, &subscriber_imei_cmd); + install_element(ENABLE_NODE, &subscriber_nam_cmd); } diff --git a/tests/test_subscriber.vty b/tests/test_subscriber.vty index 265f8fa..8e9026d 100644 --- a/tests/test_subscriber.vty +++ b/tests/test_subscriber.vty @@ -12,6 +12,7 @@ OsmoHLR# list subscriber (imsi|msisdn|id|imei) IDENT update aud3g none subscriber (imsi|msisdn|id|imei) IDENT update aud3g milenage k K (op|opc) OP_C [ind-bitlen] [<0-28>] subscriber (imsi|msisdn|id|imei) IDENT update imei (none|IMEI) + subscriber (imsi|msisdn|id|imei) IDENT update network-access-mode (none|cs|ps|cs+ps) OsmoHLR# subscriber? subscriber Subscriber management commands @@ -125,10 +126,11 @@ OsmoHLR# subscriber msisdn 423 show MSISDN: 423 OsmoHLR# subscriber imsi 123456789023000 update ? - msisdn Set MSISDN (phone number) of the subscriber - aud2g Set 2G authentication data - aud3g Set UMTS authentication data (3G, and 2G with UMTS AKA) - imei Set IMEI of the subscriber (normally populated from MSC, no need to set this manually) + msisdn Set MSISDN (phone number) of the subscriber + aud2g Set 2G authentication data + aud3g Set UMTS authentication data (3G, and 2G with UMTS AKA) + imei Set IMEI of the subscriber (normally populated from MSC, no need to set this manually) + network-access-mode Set Network Access Mode (NAM) of the subscriber OsmoHLR# subscriber imsi 123456789023000 update msisdn ? none Remove MSISDN (phone number) @@ -437,3 +439,35 @@ OsmoHLR# show subscriber id 99 IMSI: 000000000000099 MSISDN: none IMEI: 12345 (INVALID LENGTH!) + +OsmoHLR# subscriber imsi 123456789023000 create +% Created subscriber 123456789023000 + ID: 101 + IMSI: 123456789023000 + MSISDN: none +OsmoHLR# subscriber imsi 123456789023000 update network-access-mode none +OsmoHLR# subscriber imsi 123456789023000 show + ID: 101 + IMSI: 123456789023000 + MSISDN: none + CS disabled + PS disabled +OsmoHLR# subscriber imsi 123456789023000 update network-access-mode cs +OsmoHLR# subscriber imsi 123456789023000 show + ID: 101 + IMSI: 123456789023000 + MSISDN: none + PS disabled +OsmoHLR# subscriber imsi 123456789023000 update network-access-mode ps +OsmoHLR# subscriber imsi 123456789023000 show + ID: 101 + IMSI: 123456789023000 + MSISDN: none + CS disabled +OsmoHLR# subscriber imsi 123456789023000 update network-access-mode cs+ps +OsmoHLR# subscriber imsi 123456789023000 show + ID: 101 + IMSI: 123456789023000 + MSISDN: none +OsmoHLR# subscriber imsi 123456789023000 delete +% Deleted subscriber for IMSI '123456789023000' |