Change in ...osmo-hlr[master]: VTY: add subscriber update nam

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
Mon Jul 15 09:30:15 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hlr/+/14778


Change subject: VTY: add subscriber update nam
......................................................................

VTY: add subscriber update nam

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
---
A doc/manuals/chapters/counters_generated.adoc
M doc/manuals/vty/hlr_vty_reference.xml
M src/hlr_vty_subscr.c
M tests/test_subscriber.vty
4 files changed, 93 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/78/14778/1

diff --git a/doc/manuals/chapters/counters_generated.adoc b/doc/manuals/chapters/counters_generated.adoc
new file mode 100644
index 0000000..f8f64f5
--- /dev/null
+++ b/doc/manuals/chapters/counters_generated.adoc
@@ -0,0 +1,14 @@
+
+// autogenerated by show asciidoc counters
+These counters and their description based on OsmoHLR 1.0.0.41-16e4 (OsmoHLR).
+
+=== Rate Counters
+
+// generating tables for rate_ctr_group
+== Osmo Stat Items
+
+// generating tables for osmo_stat_items
+== Osmo Counters
+
+// generating tables for osmo_counters
+// there are no ungrouped osmo_counters
diff --git a/doc/manuals/vty/hlr_vty_reference.xml b/doc/manuals/vty/hlr_vty_reference.xml
index e5fd0f2..ef3c360 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 nam (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='nam' doc='Set NAM (Network Access Mode) of the subscriber' />
+        <param name='none' doc='Do not allow any NAM' />
+        <param name='cs' doc='Allow access to circuit switched NAM' />
+        <param name='ps' doc='Allow access to packet switched NAM' />
+        <param name='cs+ps' doc='Allow access to circuit and packet switched NAM' />
+      </params>
+    </command>
   </node>
   <node id='config'>
     <name>config</name>
@@ -1027,8 +1043,7 @@
     </command>
     <command id='stats reporter log'>
       <params>
-        <param name='stats' doc='Configure stats sub-system' />
-        <param name='reporter' doc='Configure a stats reporter' />
+        <param name='stats' doc='Configure stats sub-system' />        <param name='reporter' doc='Configure a stats reporter' />
         <param name='log' doc='Report to the logger' />
       </params>
     </command>
diff --git a/src/hlr_vty_subscr.c b/src/hlr_vty_subscr.c
index 3078577..4c57831 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 "nam (none|cs|ps|cs+ps)",
+      SUBSCR_UPDATE_HELP
+      "Set NAM (Network Access Mode) of the subscriber\n"
+      "Do not allow any NAM\n"
+      "Allow access to circuit switched NAM\n"
+      "Allow access to packet switched NAM\n"
+      "Allow access to circuit and packet switched NAM\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..2627ee3 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 nam (none|cs|ps|cs+ps)
 
 OsmoHLR# subscriber?
   subscriber  Subscriber management commands
@@ -129,6 +130,7 @@
   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)
+  nam     Set NAM (Network Access Mode) 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 nam none
+OsmoHLR# subscriber imsi 123456789023000 show
+    ID: 101
+    IMSI: 123456789023000
+    MSISDN: none
+    CS disabled
+    PS disabled
+OsmoHLR# subscriber imsi 123456789023000 update nam cs
+OsmoHLR# subscriber imsi 123456789023000 show
+    ID: 101
+    IMSI: 123456789023000
+    MSISDN: none
+    PS disabled
+OsmoHLR# subscriber imsi 123456789023000 update nam ps
+OsmoHLR# subscriber imsi 123456789023000 show
+    ID: 101
+    IMSI: 123456789023000
+    MSISDN: none
+    CS disabled
+OsmoHLR# subscriber imsi 123456789023000 update nam 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: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190715/bac31309/attachment.htm>


More information about the gerrit-log mailing list