Change in libosmo-sccp[master]: cs7 vty: add 'show cs7 config'

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

neels gerrit-no-reply at lists.osmocom.org
Tue Mar 17 23:57:07 UTC 2020


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/17501 )


Change subject: cs7 vty: add 'show cs7 config'
......................................................................

cs7 vty: add 'show cs7 config'

When 'cs7' was added, it was generally possible to get the full automatic
configuration spelled out by using 'show running-config'. Later, the vty was
modified so that automatically configured parts were omitted.

Since figuring out the 'cs7' configuration is far from trivial, it is very
convenient to get the program's current configuration spelled out in detail,
whether it is automatic or not. For this purpose, add a new 'show' command
which simply calls the ss7 VTY's write function with a new switch to disable
all omissions.

Change-Id: I84707561a6f54851c5599c39ea9bf1d971a2a1d7
---
M src/osmo_ss7_vty.c
1 file changed, 28 insertions(+), 11 deletions(-)



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

diff --git a/src/osmo_ss7_vty.c b/src/osmo_ss7_vty.c
index 2931fb9..9a2f8bb 100644
--- a/src/osmo_ss7_vty.c
+++ b/src/osmo_ss7_vty.c
@@ -202,18 +202,23 @@
 	return CMD_SUCCESS;
 }
 
-static void write_one_cs7(struct vty *vty, struct osmo_ss7_instance *inst);
+static void write_one_cs7(struct vty *vty, struct osmo_ss7_instance *inst, bool show_dyn_config);
 
-static int config_write_cs7(struct vty *vty)
+static int write_all_cs7(struct vty *vty, bool show_dyn_config)
 {
 	struct osmo_ss7_instance *inst;
 
 	llist_for_each_entry(inst, &osmo_ss7_instances, list)
-		write_one_cs7(vty, inst);
+		write_one_cs7(vty, inst, show_dyn_config);
 
 	return 0;
 }
 
+static int config_write_cs7(struct vty *vty)
+{
+	return write_all_cs7(vty, false);
+}
+
 DEFUN(show_cs7_user, show_cs7_user_cmd,
 	"show cs7 instance <0-15> users",
 	SHOW_STR CS7_STR INST_STR INST_STR "User Table\n")
@@ -543,6 +548,14 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(show_cs7_config, show_cs7_config_cmd,
+      "show cs7 config",
+      SHOW_STR CS7_STR "Currently running cs7 configuration")
+{
+	write_all_cs7(vty, true);
+	return CMD_SUCCESS;
+}
+
 
 /***********************************************************************
  * Application Server Process
@@ -728,11 +741,12 @@
 	return CMD_SUCCESS;
 }
 
-static void write_one_asp(struct vty *vty, struct osmo_ss7_asp *asp)
+static void write_one_asp(struct vty *vty, struct osmo_ss7_asp *asp, bool show_dyn_config)
 {
 	int i;
 	/* skip any dynamically created ASPs (e.g. auto-created at connect time) */
-	if (asp->dyn_allocated || asp->simple_client_allocated)
+	if ((asp->dyn_allocated || asp->simple_client_allocated)
+	    && !show_dyn_config)
 		return;
 
 	vty_out(vty, " asp %s %u %u %s%s",
@@ -1025,13 +1039,14 @@
 	return CMD_SUCCESS;
 }
 
-static void write_one_as(struct vty *vty, struct osmo_ss7_as *as)
+static void write_one_as(struct vty *vty, struct osmo_ss7_as *as, bool show_dyn_config)
 {
 	struct osmo_ss7_routing_key *rkey;
 	unsigned int i;
 
 	/* skip any dynamically allocated AS definitions */
-	if (as->rkm_dyn_allocated || as->simple_client_allocated)
+	if ((as->rkm_dyn_allocated || as->simple_client_allocated)
+	    && !show_dyn_config)
 		return;
 
 	vty_out(vty, " as %s %s%s", as->cfg.name,
@@ -1043,7 +1058,8 @@
 		if (!asp)
 			continue;
 		/* skip any dynamically created ASPs (e.g. auto-created at connect time) */
-		if (asp->dyn_allocated || asp->simple_client_allocated)
+		if ((asp->dyn_allocated || asp->simple_client_allocated)
+		    && !show_dyn_config)
 			continue;
 		vty_out(vty, "  asp %s%s", asp->cfg.name, VTY_NEWLINE);
 	}
@@ -1700,7 +1716,7 @@
  * Common
  ***********************************************************************/
 
-static void write_one_cs7(struct vty *vty, struct osmo_ss7_instance *inst)
+static void write_one_cs7(struct vty *vty, struct osmo_ss7_instance *inst, bool show_dyn_config)
 {
 	struct osmo_ss7_asp *asp;
 	struct osmo_ss7_as *as;
@@ -1741,11 +1757,11 @@
 
 	/* first dump ASPs, as ASs reference them */
 	llist_for_each_entry(asp, &inst->asp_list, list)
-		write_one_asp(vty, asp);
+		write_one_asp(vty, asp, show_dyn_config);
 
 	/* then dump ASPs, as routes reference them */
 	llist_for_each_entry(as, &inst->as_list, list)
-		write_one_as(vty, as);
+		write_one_as(vty, as, show_dyn_config);
 
 	/* now dump everything that is relevent for the SG role */
 	if (cs7_role == CS7_ROLE_SG) {
@@ -1880,6 +1896,7 @@
 
 	install_element_ve(&show_cs7_user_cmd);
 	install_element_ve(&show_cs7_xua_cmd);
+	install_element_ve(&show_cs7_config_cmd);
 
 	/* the mother of all VTY config nodes */
 	install_element(CONFIG_NODE, &cs7_instance_cmd);

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/17501
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I84707561a6f54851c5599c39ea9bf1d971a2a1d7
Gerrit-Change-Number: 17501
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200317/1a31fbe4/attachment.htm>


More information about the gerrit-log mailing list