pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/29970 )

Change subject: vty: Make new libgtp tdefs configurable through VTY
......................................................................

vty: Make new libgtp tdefs configurable through VTY

Related: OS#5485
Depends: osmo-ggsn.git Change-Id I10bc8e2e197c0e8753b23b684b5ae41025672bf7
Change-Id: I46e9cd158a9f2f721c69f807beb7bb67a459f4a4
---
M TODO-RELEASE
M include/osmocom/sgsn/sgsn.h
M src/sgsn/sgsn_vty.c
M tests/osmo-sgsn_test-nodes.vty
4 files changed, 29 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  fixeria: Looks good to me, but someone else must approve



diff --git a/TODO-RELEASE b/TODO-RELEASE
index 1c5d61f..21bfa66 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -1 +1,2 @@
 #component     what            description / commit summary line
+libgtp          >1.9.0          gtp_T_defs
\ No newline at end of file
diff --git a/include/osmocom/sgsn/sgsn.h b/include/osmocom/sgsn/sgsn.h
index f0eda98..f08037a 100644
--- a/include/osmocom/sgsn/sgsn.h
+++ b/include/osmocom/sgsn/sgsn.h
@@ -93,6 +93,7 @@

        /* Timer defintions */
        struct osmo_tdef *T_defs;
+       struct osmo_tdef *T_defs_gtp;

        int dynamic_lookup;

diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c
index a394c41..0929f1f 100644
--- a/src/sgsn/sgsn_vty.c
+++ b/src/sgsn/sgsn_vty.c
@@ -136,6 +136,26 @@
        return osmo_tdef_vty_set_cmd(vty, g_cfg->T_defs, argv);
 }

+DEFUN(show_timer_gtp, show_timer_gtp_cmd,
+      "show timer gtp " OSMO_TDEF_VTY_ARG_T_OPTIONAL,
+      SHOW_STR "Show timers\n" "GTP (libgtp) timers\n"
+      OSMO_TDEF_VTY_DOC_T)
+{
+       const char *T_arg = argc > 0 ? argv[0] : NULL;
+       return osmo_tdef_vty_show_cmd(vty, g_cfg->T_defs_gtp, T_arg, NULL);
+}
+
+DEFUN(cfg_sgsn_timer_gtp, cfg_sgsn_timer_gtp_cmd,
+      "timer gtp " OSMO_TDEF_VTY_ARG_SET_OPTIONAL,
+      "Configure or show timers\n" "GTP (libgtp) timers\n"
+      OSMO_TDEF_VTY_DOC_SET)
+{
+       /* If any arguments are missing, redirect to 'show' */
+       if (argc < 2)
+               return show_timer(self, vty, argc, argv);
+       return osmo_tdef_vty_set_cmd(vty, g_cfg->T_defs_gtp, argv);
+}
+
 char *gprs_pdpaddr2str(uint8_t *pdpa, uint8_t len, bool return_ipv6)
 {
        static char str[INET6_ADDRSTRLEN + 10];
@@ -312,6 +332,7 @@
        vty_out(vty, " cdr interval %d%s", g_cfg->cdr.interval, VTY_NEWLINE);

        osmo_tdef_vty_write(vty, g_cfg->T_defs, " timer ");
+       osmo_tdef_vty_write(vty, g_cfg->T_defs_gtp, " timer gtp ");

        if (g_cfg->pcomp_rfc1144.active) {
                vty_out(vty, " compression rfc1144 active slots %d%s",
@@ -1719,6 +1740,9 @@
        g_cfg->T_defs = sgsn_T_defs;
        osmo_tdefs_reset(g_cfg->T_defs);

+       g_cfg->T_defs_gtp = gtp_T_defs;
+       osmo_tdefs_reset(g_cfg->T_defs_gtp);
+
        install_element_ve(&show_sgsn_cmd);
        //install_element_ve(&show_mmctx_tlli_cmd);
        install_element_ve(&show_mmctx_imsi_cmd);
@@ -1726,6 +1750,7 @@
        install_element_ve(&show_pdpctx_all_cmd);
        install_element_ve(&show_subscr_cache_cmd);
        install_element_ve(&show_timer_cmd);
+       install_element_ve(&show_timer_gtp_cmd);

        install_element(ENABLE_NODE, &update_subscr_insert_auth_triplet_cmd);
        install_element(ENABLE_NODE, &update_subscr_create_cmd);
@@ -1773,6 +1798,7 @@
        install_element(SGSN_NODE, &cfg_grx_ggsn_cmd);

        install_element(SGSN_NODE, &cfg_sgsn_timer_cmd);
+       install_element(SGSN_NODE, &cfg_sgsn_timer_gtp_cmd);

        install_element(SGSN_NODE, &cfg_no_comp_rfc1144_cmd);
        install_element(SGSN_NODE, &cfg_comp_rfc1144_cmd);
diff --git a/tests/osmo-sgsn_test-nodes.vty b/tests/osmo-sgsn_test-nodes.vty
index 7e2e3a3..22d81d2 100644
--- a/tests/osmo-sgsn_test-nodes.vty
+++ b/tests/osmo-sgsn_test-nodes.vty
@@ -55,6 +55,7 @@
   ggsn dynamic
   grx-dns-add A.B.C.D
   timer [TNNNN] [(<0-2147483647>|default)]
+  timer gtp [TNNNN] [(<0-2147483647>|default)]
   no compression rfc1144
   compression rfc1144 active slots <1-256>
   compression rfc1144 passive

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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I46e9cd158a9f2f721c69f807beb7bb67a459f4a4
Gerrit-Change-Number: 29970
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanits...@sysmocom.de>
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to