Change in osmo-msc[master]: VTY: add osmo_tdef introspection and configuration commands

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Sat Jan 18 23:43:35 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-msc/+/16932 )


Change subject: VTY: add osmo_tdef introspection and configuration commands
......................................................................

VTY: add osmo_tdef introspection and configuration commands

This change introduces a group of new VTY commands letting the user
a possibility to introspect and reconfigure some of the existing
timers implemented using libosmocore's osmo_tdef API.

At the moment this covers the following timers:

  - MGW specific timers:
    - X1 - MGCP response timeout,
    - X2 - RTP stream establishing timeout,

  - RAN specific timers (common for GERAN and UTRAN):
    - X1 - Authentication and Ciphering timeout,
    - X2 - RAN connection release sanity timeout,
    - X3 - Handover procedure timeout.

The following commands are introduced:

  - 'enable' node:
    - show timer (mgw|mncc|sccp) [TNNNN]
    - show timer ran (geran|utran|sgs) [TNNNN]
    - show timer [all]

  - 'config-msc' node:
    - timer (mgw|mncc|sccp) [TNNNN] [(<0-2147483647>|default)]
    - timer ran (geran|utran|sgs) [TNNNN] [(<0-2147483647>|default)]

Both MNCC and SCCP related timer definitions are empty at the moment.

Change-Id: I6024c104b6101666c8aa1108a043910eb75db9a5
Related: OS#4368
---
M doc/manuals/vty/msc_vty_reference.xml
M src/libmsc/msc_vty.c
M tests/test_nodes.vty
3 files changed, 230 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/32/16932/1

diff --git a/doc/manuals/vty/msc_vty_reference.xml b/doc/manuals/vty/msc_vty_reference.xml
index b98f76e..e3294cf 100644
--- a/doc/manuals/vty/msc_vty_reference.xml
+++ b/doc/manuals/vty/msc_vty_reference.xml
@@ -610,6 +610,34 @@
         <param name='sgs-connections' doc='Show SGs interface connections / MMEs' />
       </params>
     </command>
+    <command id='show timer (mgw|mncc|sccp) [TNNNN]'>
+      <params>
+        <param name='show' doc='Show running system information' />
+        <param name='timer' doc='Show timers' />
+        <param name='mgw' doc='MGW specific timers' />
+        <param name='mncc' doc='MNCC specific timers' />
+        <param name='sccp' doc='SCCP specific timers' />
+        <param name='[TNNNN]' doc='T- or X-timer-number -- 3GPP compliant timer number of the format '1234' or 'T1234' or 't1234'; Osmocom-specific timer number of the format: 'X1234' or 'x1234'.' />
+      </params>
+    </command>
+    <command id='show timer ran (geran|utran|sgs) [TNNNN]'>
+      <params>
+        <param name='show' doc='Show running system information' />
+        <param name='timer' doc='Show timers' />
+        <param name='ran' doc='Show timers for a given RAN type' />
+        <param name='geran' doc='GERAN specific timers' />
+        <param name='utran' doc='UTRAN specific timers' />
+        <param name='sgs' doc='SGs specific timers' />
+        <param name='[TNNNN]' doc='T- or X-timer-number -- 3GPP compliant timer number of the format '1234' or 'T1234' or 't1234'; Osmocom-specific timer number of the format: 'X1234' or 'x1234'.' />
+      </params>
+    </command>
+    <command id='show timer [all]'>
+      <params>
+        <param name='show' doc='Show running system information' />
+        <param name='timer' doc='Show timers' />
+        <param name='[all]' doc='Show all existing timers' />
+      </params>
+    </command>
     <command id='show subscriber (msisdn|extension|imsi|tmsi|id) ID [(conn|trans|conn+trans)]'>
       <params>
         <param name='show' doc='Show running system information' />
@@ -1434,6 +1462,34 @@
         <param name='sgs-connections' doc='Show SGs interface connections / MMEs' />
       </params>
     </command>
+    <command id='show timer (mgw|mncc|sccp) [TNNNN]'>
+      <params>
+        <param name='show' doc='Show running system information' />
+        <param name='timer' doc='Show timers' />
+        <param name='mgw' doc='MGW specific timers' />
+        <param name='mncc' doc='MNCC specific timers' />
+        <param name='sccp' doc='SCCP specific timers' />
+        <param name='[TNNNN]' doc='T- or X-timer-number -- 3GPP compliant timer number of the format '1234' or 'T1234' or 't1234'; Osmocom-specific timer number of the format: 'X1234' or 'x1234'.' />
+      </params>
+    </command>
+    <command id='show timer ran (geran|utran|sgs) [TNNNN]'>
+      <params>
+        <param name='show' doc='Show running system information' />
+        <param name='timer' doc='Show timers' />
+        <param name='ran' doc='Show timers for a given RAN type' />
+        <param name='geran' doc='GERAN specific timers' />
+        <param name='utran' doc='UTRAN specific timers' />
+        <param name='sgs' doc='SGs specific timers' />
+        <param name='[TNNNN]' doc='T- or X-timer-number -- 3GPP compliant timer number of the format '1234' or 'T1234' or 't1234'; Osmocom-specific timer number of the format: 'X1234' or 'x1234'.' />
+      </params>
+    </command>
+    <command id='show timer [all]'>
+      <params>
+        <param name='show' doc='Show running system information' />
+        <param name='timer' doc='Show timers' />
+        <param name='[all]' doc='Show all existing timers' />
+      </params>
+    </command>
     <command id='show subscriber (msisdn|extension|imsi|tmsi|id) ID [(conn|trans|conn+trans)]'>
       <params>
         <param name='show' doc='Show running system information' />
@@ -2875,6 +2931,29 @@
         <param name='MSISDN_LAST' doc='Last Handover Number MSISDN' />
       </params>
     </command>
+    <command id='timer (mgw|mncc|sccp) [TNNNN] [(<0-2147483647>|default)]'>
+      <params>
+        <param name='timer' doc='Configure or show timers' />
+        <param name='mgw' doc='MGW specific timers' />
+        <param name='mncc' doc='MNCC specific timers' />
+        <param name='sccp' doc='SCCP specific timers' />
+        <param name='[TNNNN]' doc='T- or X-timer-number -- 3GPP compliant timer number of the format '1234' or 'T1234' or 't1234'; Osmocom-specific timer number of the format: 'X1234' or 'x1234'.' />
+        <param name='[<0-2147483647>]' doc='New timer value' />
+        <param name='[default]' doc='Set to default timer value' />
+      </params>
+    </command>
+    <command id='timer ran (geran|utran|sgs) [TNNNN] [(<0-2147483647>|default)]'>
+      <params>
+        <param name='timer' doc='Configure or show timers' />
+        <param name='ran' doc='Show timers for a given RAN type' />
+        <param name='geran' doc='GERAN specific timers' />
+        <param name='utran' doc='UTRAN specific timers' />
+        <param name='sgs' doc='SGs specific timers' />
+        <param name='[TNNNN]' doc='T- or X-timer-number -- 3GPP compliant timer number of the format '1234' or 'T1234' or 't1234'; Osmocom-specific timer number of the format: 'X1234' or 'x1234'.' />
+        <param name='[<0-2147483647>]' doc='New timer value' />
+        <param name='[default]' doc='Set to default timer value' />
+      </params>
+    </command>
     <command id='neighbor (a|iu) lac <0-65535> (ran-pc|msc-ipa-name) RAN_PC_OR_MSC_IPA_NAME'>
       <params>
         <param name='neighbor' doc='Add Handover target configuration' />
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index cd82a07..b43e950 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -40,6 +40,7 @@
 #include <osmocom/vty/logging.h>
 #include <osmocom/vty/misc.h>
 #include <osmocom/vty/stats.h>
+#include <osmocom/vty/tdef_vty.h>
 
 #ifdef BUILD_IU
 #include <osmocom/ranap/iu_client.h>
@@ -654,6 +655,61 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(cfg_msc_timer, cfg_msc_timer_cmd,
+      "timer (mgw|mncc|sccp) " OSMO_TDEF_VTY_ARG_SET_OPTIONAL,
+      "Configure or show timers\n"
+      "MGW specific timers\n"
+      "MNCC specific timers\n"
+      "SCCP specific timers\n"
+      OSMO_TDEF_VTY_DOC_SET)
+{
+	const char *T_arg = argc > 1 ? argv[1] : NULL;
+	struct osmo_tdef *tdefs = NULL;
+
+	if (!strcmp(argv[0], "mgw"))
+		tdefs = gsmnet->mgw.tdefs;
+	else if (!strcmp(argv[0], "mncc"))
+		tdefs = gsmnet->mncc_tdefs;
+	else if (!strcmp(argv[0], "sccp"))
+		tdefs = g_sccp_tdefs;
+
+	/* Configure or show? */
+	if (argc < 3)
+		return osmo_tdef_vty_show_cmd(vty, tdefs, T_arg, NULL);
+	return osmo_tdef_vty_set_cmd(vty, tdefs, argv + 1);
+}
+
+DEFUN(cfg_msc_timer_ran, cfg_msc_timer_ran_cmd,
+      "timer ran (geran|utran|sgs) " OSMO_TDEF_VTY_ARG_SET_OPTIONAL,
+      "Configure or show timers\n"
+      "Show timers for a given RAN type\n"
+      "GERAN specific timers\n"
+      "UTRAN specific timers\n"
+      "SGs specific timers\n"
+      OSMO_TDEF_VTY_DOC_SET)
+{
+	const char *T_arg = argc > 1 ? argv[1] : NULL;
+	struct osmo_tdef *tdefs = NULL;
+
+	/* Match RAN type by the first character */
+	switch (argv[0][0]) {
+	case 'g':
+		tdefs = msc_tdefs_geran;
+		break;
+	case 'u':
+		tdefs = msc_tdefs_utran;
+		break;
+	case 's':
+		tdefs = msc_tdefs_sgs;
+		break;
+	}
+
+	/* Configure or show? */
+	if (argc < 3)
+		return osmo_tdef_vty_show_cmd(vty, tdefs, T_arg, NULL);
+	return osmo_tdef_vty_set_cmd(vty, tdefs, argv + 1);
+}
+
 static int config_write_msc(struct vty *vty)
 {
 	vty_out(vty, "msc%s", VTY_NEWLINE);
@@ -716,6 +772,92 @@
 
 	neighbor_ident_vty_write(vty);
 
+	/* Timer management commands */
+	osmo_tdef_vty_write(vty, gsmnet->mgw.tdefs, " timer mgw ");
+	osmo_tdef_vty_write(vty, gsmnet->mncc_tdefs, " timer mncc ");
+	osmo_tdef_vty_write(vty, g_sccp_tdefs, " timer sccp ");
+
+	/* TODO: can we use osmo_tdef_group for that? */
+	osmo_tdef_vty_write(vty, msc_tdefs_geran, " timer ran geran ");
+	osmo_tdef_vty_write(vty, msc_tdefs_utran, " timer ran utran ");
+	osmo_tdef_vty_write(vty, msc_tdefs_sgs, " timer ran sgs ");
+
+	return CMD_SUCCESS;
+}
+
+DEFUN(show_timer, show_timer_cmd,
+      "show timer (mgw|mncc|sccp) " OSMO_TDEF_VTY_ARG_T_OPTIONAL,
+      SHOW_STR "Show timers\n"
+      "MGW specific timers\n"
+      "MNCC specific timers\n"
+      "SCCP specific timers\n"
+      OSMO_TDEF_VTY_DOC_T)
+{
+	const char *T_arg = argc > 1 ? argv[1] : NULL;
+	struct osmo_tdef *tdefs = NULL;
+
+	if (!strcmp(argv[0], "mgw"))
+		tdefs = gsmnet->mgw.tdefs;
+	else if (!strcmp(argv[0], "mncc"))
+		tdefs = gsmnet->mncc_tdefs;
+	else if (!strcmp(argv[0], "sccp"))
+		tdefs = g_sccp_tdefs;
+
+	return osmo_tdef_vty_show_cmd(vty, tdefs, T_arg, NULL);
+}
+
+DEFUN(show_timer_ran, show_timer_ran_cmd,
+      "show timer ran (geran|utran|sgs) " OSMO_TDEF_VTY_ARG_T_OPTIONAL,
+      SHOW_STR "Show timers\n"
+      "Show timers for a given RAN type\n"
+      "GERAN specific timers\n"
+      "UTRAN specific timers\n"
+      "SGs specific timers\n"
+      OSMO_TDEF_VTY_DOC_T)
+{
+	const char *T_arg = argc > 1 ? argv[1] : NULL;
+	struct osmo_tdef *tdefs = NULL;
+
+	/* Match RAN type by the first character */
+	switch (argv[0][0]) {
+	case 'g':
+		tdefs = msc_tdefs_geran;
+		break;
+	case 'u':
+		tdefs = msc_tdefs_utran;
+		break;
+	case 's':
+		tdefs = msc_tdefs_sgs;
+		break;
+	}
+
+	return osmo_tdef_vty_show_cmd(vty, tdefs, T_arg, NULL);
+}
+
+/* TODO: move to libosmocore? */
+#define TDEF_LIST_EMPTY(list) \
+	!(list->T || list->default_val || list->desc)
+
+#define TDEF_LIST_PRINT(list, desc, offset) \
+	if (!(TDEF_LIST_EMPTY(list))) { \
+		vty_out(vty, "%s:%s", desc, VTY_NEWLINE); \
+		osmo_tdef_vty_out_all(vty, list, "%*c", offset, ' '); \
+	}
+
+DEFUN(show_timer_all, show_timer_all_cmd,
+      "show timer [all]",
+      SHOW_STR "Show timers\n"
+      "Show all existing timers\n")
+{
+	TDEF_LIST_PRINT(gsmnet->mgw.tdefs, "MGW specific timers", 2);
+	TDEF_LIST_PRINT(gsmnet->mncc_tdefs, "MNCC specific timers", 2);
+	TDEF_LIST_PRINT(g_sccp_tdefs, "SCCP specific timers", 2);
+
+	vty_out(vty, "%sRAN specific timers:%s", VTY_NEWLINE, VTY_NEWLINE);
+	TDEF_LIST_PRINT(msc_tdefs_geran, "  GERAN", 4);
+	TDEF_LIST_PRINT(msc_tdefs_utran, "  UTRAN", 4);
+	TDEF_LIST_PRINT(msc_tdefs_sgs, "  SGs", 4);
+
 	return CMD_SUCCESS;
 }
 
@@ -2001,6 +2143,9 @@
 	install_element(MSC_NODE, &cfg_msc_osmux_cmd);
 	install_element(MSC_NODE, &cfg_msc_handover_number_range_cmd);
 
+	install_element(MSC_NODE, &cfg_msc_timer_cmd);
+	install_element(MSC_NODE, &cfg_msc_timer_ran_cmd);
+
 	neighbor_ident_vty_init(msc_network);
 
 	mgcp_client_vty_init(msc_network, MSC_NODE, &msc_network->mgw.conf);
@@ -2013,6 +2158,10 @@
 
 	osmo_signal_register_handler(SS_SCALL, scall_cbfn, NULL);
 
+	install_element_ve(&show_timer_cmd);
+	install_element_ve(&show_timer_ran_cmd);
+	install_element_ve(&show_timer_all_cmd);
+
 	install_element_ve(&show_subscr_cmd);
 	install_element_ve(&show_subscr_cache_cmd);
 	install_element_ve(&show_bsc_cmd);
diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty
index a4e0e15..da565f4 100644
--- a/tests/test_nodes.vty
+++ b/tests/test_nodes.vty
@@ -65,6 +65,8 @@
   no sms-over-gsup
   osmux (on|off|only)
   handover-number range MSISDN_FIRST MSISDN_LAST
+  timer (mgw|mncc|sccp) [TNNNN] [(<0-2147483647>|default)]
+  timer ran (geran|utran|sgs) [TNNNN] [(<0-2147483647>|default)]
   neighbor (a|iu) lac <0-65535> (ran-pc|msc-ipa-name) RAN_PC_OR_MSC_IPA_NAME
   neighbor (a|iu) lac-ci <0-65535> <0-65535> (ran-pc|msc-ipa-name) RAN_PC_OR_MSC_IPA_NAME
   neighbor (a|iu) cgi <0-999> <0-999> <0-65535> <0-65535> (ran-pc|msc-ipa-name) RAN_PC_OR_MSC_IPA_NAME

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I6024c104b6101666c8aa1108a043910eb75db9a5
Gerrit-Change-Number: 16932
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200118/792f8a2c/attachment.htm>


More information about the gerrit-log mailing list