Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14298 )

Change subject: ggsn: vty: Require ggsn param in <show pdp-context> cmd
......................................................................

ggsn: vty: Require ggsn param in <show pdp-context> cmd

Other similar commands already do it. This way we also get rid of
deprecated APIs, supporting search when more than one GSN is set up.

Related: OS#2873
Change-Id: I8357e20076348c8ded5e9f5b8e7252566b0fbfea
---
M doc/manuals/vty/ggsn_vty_reference.xml
M ggsn/ggsn_vty.c
2 files changed, 22 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/doc/manuals/vty/ggsn_vty_reference.xml 
b/doc/manuals/vty/ggsn_vty_reference.xml
index a226f8f..a395b23 100644
--- a/doc/manuals/vty/ggsn_vty_reference.xml
+++ b/doc/manuals/vty/ggsn_vty_reference.xml
@@ -351,10 +351,12 @@
         <param name='APN' doc='APN name' />
       </params>
     </command>
-    <command id='show pdp-context imsi IMSI [&lt;0-15&gt;]'>
+    <command id='show pdp-context ggsn NAME imsi IMSI [&lt;0-15&gt;]'>
       <params>
         <param name='show' doc='Show running system information' />
         <param name='pdp-context' doc='Display information on PDP Context' />
+        <param name='ggsn' doc='Gateway GPRS Support NODE (GGSN)' />
+        <param name='NAME' doc='GGSN Name' />
         <param name='imsi' doc='PDP contexts for given IMSI' />
         <param name='IMSI' doc='PDP context for given NSAPI' />
         <param name='[&lt;0-15&gt;]' doc='(null)' />
@@ -709,10 +711,12 @@
         <param name='APN' doc='APN name' />
       </params>
     </command>
-    <command id='show pdp-context imsi IMSI [&lt;0-15&gt;]'>
+    <command id='show pdp-context ggsn NAME imsi IMSI [&lt;0-15&gt;]'>
       <params>
         <param name='show' doc='Show running system information' />
         <param name='pdp-context' doc='Display information on PDP Context' />
+        <param name='ggsn' doc='Gateway GPRS Support NODE (GGSN)' />
+        <param name='NAME' doc='GGSN Name' />
         <param name='imsi' doc='PDP contexts for given IMSI' />
         <param name='IMSI' doc='PDP context for given NSAPI' />
         <param name='[&lt;0-15&gt;]' doc='(null)' />
diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index 9101361..eb7cca7 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -764,25 +764,35 @@
 }

 DEFUN(show_pdpctx_imsi, show_pdpctx_imsi_cmd,
-       "show pdp-context imsi IMSI [<0-15>]",
+       "show pdp-context ggsn NAME imsi IMSI [<0-15>]",
        SHOW_STR "Display information on PDP Context\n"
+       GGSN_STR "GGSN Name\n"
        "PDP contexts for given IMSI\n"
        "PDP context for given NSAPI\n")
 {
-       uint64_t imsi = strtoull(argv[0], NULL, 10);
+       struct ggsn_ctx *ggsn;
+       uint64_t imsi;
        unsigned int nsapi;
        struct pdp_t *pdp;
        int num_found = 0;

-       if (argc > 1) {
-               nsapi = atoi(argv[1]);
-               if (pdp_getimsi(&pdp, imsi, nsapi)) {
+       ggsn = ggsn_find(argv[0]);
+       if (!ggsn) {
+               vty_out(vty, "%% No such GGSN '%s'%s", argv[0], VTY_NEWLINE);
+               return CMD_WARNING;
+       }
+
+       imsi = strtoull(argv[1], NULL, 10);
+
+       if (argc > 2) {
+               nsapi = atoi(argv[2]);
+               if (gtp_pdp_getimsi(ggsn->gsn, &pdp, imsi, nsapi)) {
                        show_one_pdp(vty, pdp);
                        num_found++;
                }
        } else {
                for (nsapi = 0; nsapi < PDP_MAXNSAPI; nsapi++) {
-                       if (pdp_getimsi(&pdp, imsi, nsapi))
+                       if (gtp_pdp_getimsi(ggsn->gsn, &pdp, imsi, nsapi))
                                continue;
                        show_one_pdp(vty, pdp);
                        num_found++;

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

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I8357e20076348c8ded5e9f5b8e7252566b0fbfea
Gerrit-Change-Number: 14298
Gerrit-PatchSet: 4
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to