Change in osmo-sgsn[master]: gbproxy: Improve VTY state intropsection

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

laforge gerrit-no-reply at lists.osmocom.org
Sat Dec 12 14:18:27 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sgsn/+/21690 )


Change subject: gbproxy: Improve VTY state intropsection
......................................................................

gbproxy: Improve VTY state intropsection

* allow to print not only BSS-side BVCs, but also SGSN-side
* differentiate between SIG and PTP BVC
* print the actual BVC FSM state name instead of just UNBLOCKED/nothing

Change-Id: I8e09a9dc296b15094d191b0451d04457c815d116
---
M src/gbproxy/gb_proxy_vty.c
1 file changed, 34 insertions(+), 19 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/90/21690/1

diff --git a/src/gbproxy/gb_proxy_vty.c b/src/gbproxy/gb_proxy_vty.c
index a9db596..fd102d6 100644
--- a/src/gbproxy/gb_proxy_vty.c
+++ b/src/gbproxy/gb_proxy_vty.c
@@ -58,15 +58,29 @@
 
 static void gbprox_vty_print_bvc(struct vty *vty, struct gbproxy_bvc *bvc)
 {
-	struct gprs_ra_id raid;
-	gsm48_parse_ra(&raid, bvc->ra);
 
-	vty_out(vty, "NSEI %5u, PTP-BVCI %5u, "
-		"RAI %s", bvc->nse->nsei, bvc->bvci, osmo_rai_name(&raid));
-	if (bssgp_bvc_fsm_is_unblocked(bvc->fi))
-		vty_out(vty, " [BVC-BLOCKED]");
+	if (bvc->bvci == 0) {
+		vty_out(vty, "NSEI %5u, SIG-BVCI %5u [%s]%s", bvc->nse->nsei, bvc->bvci,
+			osmo_fsm_inst_state_name(bvc->fi), VTY_NEWLINE);
+	} else {
+		struct gprs_ra_id raid;
+		gsm48_parse_ra(&raid, bvc->ra);
+		vty_out(vty, "NSEI %5u, PTP-BVCI %5u, RAI %s [%s]%s", bvc->nse->nsei, bvc->bvci,
+			osmo_rai_name(&raid), osmo_fsm_inst_state_name(bvc->fi), VTY_NEWLINE);
+	}
+}
 
-	vty_out(vty, "%s", VTY_NEWLINE);
+static void gbproxy_vty_print_nse(struct vty *vty, struct gbproxy_nse *nse, bool show_stats)
+{
+	struct gbproxy_bvc *bvc;
+	int j;
+
+	hash_for_each(nse->bvcs, j, bvc, list) {
+		gbprox_vty_print_bvc(vty, bvc);
+
+		if (show_stats)
+			vty_out_rate_ctr_group(vty, "  ", bvc->ctrg);
+	}
 }
 
 static int config_write_gbproxy(struct vty *vty)
@@ -170,24 +184,25 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN(show_gbproxy, show_gbproxy_cmd, "show gbproxy [stats]",
-       SHOW_STR "Display information about the Gb proxy\n" "Show statistics\n")
+DEFUN(show_gbproxy, show_gbproxy_cmd, "show gbproxy (bss|sgsn) [stats]",
+       SHOW_STR "Display information about the Gb proxy\n"
+       "Display BSS-side BVCs\n"
+       "Display SGSN-side BVCs\n"
+       "Show statistics\n")
 {
 	struct gbproxy_nse *nse;
-	int show_stats = argc >= 1;
-	int i, j;
+	bool show_stats = argc >= 2;
+	int i;
 
 	if (show_stats)
 		vty_out_rate_ctr_group(vty, "", g_cfg->ctrg);
 
-	hash_for_each(g_cfg->bss_nses, i, nse, list) {
-		struct gbproxy_bvc *bvc;
-		hash_for_each(nse->bvcs, j, bvc, list) {
-			gbprox_vty_print_bvc(vty, bvc);
-
-			if (show_stats)
-				vty_out_rate_ctr_group(vty, "  ", bvc->ctrg);
-		}
+	if (!strcmp(argv[0], "bss")) {
+		hash_for_each(g_cfg->bss_nses, i, nse, list)
+			gbproxy_vty_print_nse(vty, nse, show_stats);
+	} else {
+		hash_for_each(g_cfg->sgsn_nses, i, nse, list)
+			gbproxy_vty_print_nse(vty, nse, show_stats);
 	}
 	return CMD_SUCCESS;
 }

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

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I8e09a9dc296b15094d191b0451d04457c815d116
Gerrit-Change-Number: 21690
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201212/25792612/attachment.htm>


More information about the gerrit-log mailing list