Change in ...osmo-hlr[master]: VTY: add subscriber update network-access-mode

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Tue Jul 16 07:19:00 UTC 2019


osmith has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-hlr/+/14778 )

Change subject: VTY: add subscriber update network-access-mode
......................................................................

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
---
M doc/manuals/vty/hlr_vty_reference.xml
M src/hlr_vty_subscr.c
M tests/test_subscriber.vty
3 files changed, 82 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



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 @@
 	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 @@
 	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 @@
   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 @@
     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 @@
     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'

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/14778
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I231e03219355ebe6467d62ae2e40bef9d8303e3b
Gerrit-Change-Number: 14778
Gerrit-PatchSet: 4
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190716/4a0a8876/attachment.htm>


More information about the gerrit-log mailing list