[PATCH] libosmo-sccp[master]: osmo_ss7_vty: Make 'instance <0-15>' mandatory of all show c...

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Apr 14 15:12:43 UTC 2017


Review at  https://gerrit.osmocom.org/2332

osmo_ss7_vty: Make 'instance <0-15>' mandatory of all show commands

This way it is systematic and doesn't clash with other optional
arguments we may introduce sooner or later at the end of the commands

Change-Id: I5c1050b0564791b5684619d3737d1cb6c4539d63
---
M src/osmo_ss7_vty.c
1 file changed, 12 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/32/2332/1

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 59c4008..d97610d 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -37,6 +37,7 @@
 
 #define CS7_STR	"ITU-T Signaling System 7\n"
 #define PC_STR	"Point Code\n"
+#define INST_STR "An instance of the SS7 stack\n"
 
 /***********************************************************************
  * Core CS7 Configuration
@@ -52,7 +53,7 @@
 
 DEFUN(cs7_instance, cs7_instance_cmd,
 	"cs7 instance <0-15>",
-	CS7_STR "Configure a SS7 Instance\n"
+	CS7_STR "Configure a SS7 Instance\n" INST_STR
 	"Number of the instance\n")
 {
 	int id = atoi(argv[0]);
@@ -307,14 +308,12 @@
 }
 
 DEFUN(show_cs7_route, show_cs7_route_cmd,
-	"show cs7 route [instance <0-15>]",
-	SHOW_STR CS7_STR "Routing Table\n")
+	"show cs7 instance <0-15> route",
+	SHOW_STR CS7_STR INST_STR INST_STR "Routing Table\n")
 {
-	int id = 0;
+	int id = atoi(argv[0]);
 	struct osmo_ss7_instance *inst;
 
-	if (argc > 0)
-		id = atoi(argv[0]);
 	inst = osmo_ss7_instance_find(id);
 	if (!inst) {
 		vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
@@ -504,15 +503,13 @@
 }
 
 DEFUN(show_cs7_asp, show_cs7_asp_cmd,
-	"show cs7 asp [instance <0-15>]",
-	SHOW_STR CS7_STR "Application Server Process (ASP)\n")
+	"show cs7 instance <0-15> asp",
+	SHOW_STR CS7_STR INST_STR INST_STR "Application Server Process (ASP)\n")
 {
 	struct osmo_ss7_instance *inst;
 	struct osmo_ss7_asp *asp;
-	int id = 0;
+	int id = atoi(argv[0]);
 
-	if (argc > 0)
-		id = atoi(argv[0]);
 	inst = osmo_ss7_instance_find(id);
 	if (!inst) {
 		vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);
@@ -760,8 +757,8 @@
 }
 
 DEFUN(show_cs7_as, show_cs7_as_cmd,
-	"show cs7 as (active|all|m3ua|sua) [instance <0-15>]",
-	SHOW_STR CS7_STR "Application Server (AS)\n"
+	"show cs7 instance <0-15> as (active|all|m3ua|sua)",
+	SHOW_STR CS7_STR INST_STR INST_STR "Application Server (AS)\n"
 	"Display all active ASs\n"
 	"Display all ASs (default)\n"
 	"Display all m3ua ASs\n"
@@ -769,14 +766,9 @@
 {
 	struct osmo_ss7_instance *inst;
 	struct osmo_ss7_as *as;
-	const char *filter = NULL;
-	int id = 0;
+	const char *filter = argv[1];
+	int id = atoi(argv[0]);
 
-	if (argc)
-		filter = argv[0];
-
-	if (argc > 1)
-		id = atoi(argv[1]);
 	inst = osmo_ss7_instance_find(id);
 	if (!inst) {
 		vty_out(vty, "No SS7 instance %d found%s", id, VTY_NEWLINE);

-- 
To view, visit https://gerrit.osmocom.org/2332
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5c1050b0564791b5684619d3737d1cb6c4539d63
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list