Change in osmo-ggsn[master]: ggsn: vty: Require ggsn param in <show pdp-context> cmd

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri May 31 15:03:33 UTC 2019


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/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 ggsn/ggsn_vty.c
1 file changed, 16 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/98/14298/1

diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index 3f012d2..456f6cb 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/14298
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8357e20076348c8ded5e9f5b8e7252566b0fbfea
Gerrit-Change-Number: 14298
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190531/31852812/attachment.html>


More information about the gerrit-log mailing list