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
This commit is contained in:
Pau Espin 2019-05-31 16:15:16 +02:00
parent 25ab381c0f
commit 7b52f00192
2 changed files with 22 additions and 8 deletions

View File

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

View File

@ -764,25 +764,35 @@ static void show_one_pdp(struct vty *vty, struct pdp_t *pdp)
}
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++;