Change in libosmocore[master]: ns2: Add a VTY command to reset NSVC FSM

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

daniel gerrit-no-reply at lists.osmocom.org
Fri Nov 20 14:50:29 UTC 2020


daniel has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/21232 )

Change subject: ns2: Add a VTY command to reset NSVC FSM
......................................................................

ns2: Add a VTY command to reset NSVC FSM

Mainly useful for testing so implemented as a hidden command

Change-Id: I83b9cd7381c25da0e8aa847038a2d422c8dd63cf
Related: SYS#5002
---
M src/gb/gprs_ns2_vty.c
1 file changed, 33 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  daniel: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve



diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 65fe88e..63331b9 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -34,6 +34,7 @@
 
 #include <osmocom/core/msgb.h>
 #include <osmocom/core/byteswap.h>
+#include <osmocom/core/fsm.h>
 #include <osmocom/core/talloc.h>
 #include <osmocom/core/select.h>
 #include <osmocom/core/rate_ctr.h>
@@ -354,6 +355,36 @@
 	return CMD_SUCCESS;
 }
 
+static int nsvc_force_unconf_cb(struct gprs_ns2_vc *nsvc, void *ctx)
+{
+	gprs_ns2_vc_force_unconfigured(nsvc);
+	return 0;
+}
+
+DEFUN_HIDDEN(nsvc_force_unconf, nsvc_force_unconf_cmd,
+	"nsvc nsei <0-65535> force-unconfigured",
+	"NS Virtual Connection\n"
+	"The NSEI\n"
+	"Reset the NSVCs back to initial state\n"
+	)
+{
+	struct gprs_ns2_inst *nsi = vty_nsi;
+	struct gprs_ns2_nse *nse;
+
+	uint16_t id = atoi(argv[0]);
+
+	nse = gprs_ns2_nse_by_nsei(nsi, id);
+	if (!nse) {
+		vty_out(vty, "Could not find NSE for NSEI %u%s", id, VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	/* Perform the operation for all nsvc */
+	gprs_ns2_nse_foreach_nsvc(nse, nsvc_force_unconf_cb, NULL);
+
+	return CMD_SUCCESS;
+}
+
 #define NSE_CMD_STR "Persistent NS Entity\n" "NS Entity ID (NSEI)\n"
 
 DEFUN(cfg_nse_nsvc, cfg_nse_nsvci_cmd,
@@ -699,6 +730,8 @@
 	install_lib_element_ve(&show_nse_cmd);
 	install_lib_element_ve(&logging_fltr_nsvc_cmd);
 
+	install_lib_element(ENABLE_NODE, &nsvc_force_unconf_cmd);
+
 	install_lib_element(CFG_LOG_NODE, &logging_fltr_nsvc_cmd);
 
 	install_lib_element(CONFIG_NODE, &cfg_ns_cmd);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I83b9cd7381c25da0e8aa847038a2d422c8dd63cf
Gerrit-Change-Number: 21232
Gerrit-PatchSet: 5
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201120/b43d2e7d/attachment.htm>


More information about the gerrit-log mailing list