Change in libosmocore[master]: Add VTY command to reset nsvcs

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
Wed Nov 18 13:21:48 UTC 2020


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


Change subject: Add VTY command to reset nsvcs
......................................................................

Add VTY command to reset nsvcs

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



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/32/21232/1

diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 65fe88e..15b9e93 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,61 @@
 	return CMD_SUCCESS;
 }
 
+struct nsvc_foreach_data {
+	const char *operation;
+	struct vty *vty;
+};
+
+int nsvc_operation_cb(struct gprs_ns2_vc *nsvc, void *ctx)
+{
+	struct nsvc_foreach_data *data = (struct nsvc_foreach_data *)ctx;
+	struct vty *vty = data->vty;
+
+	if (!strcmp(data->operation, "block")) {
+		vty_out(vty, "WARNING: Block not implemented%s", VTY_NEWLINE);
+//		gprs_ns_tx_block(nsvc, NS_CAUSE_OM_INTERVENTION);
+	} else if (!strcmp(data->operation, "unblock")) {
+		vty_out(vty, "WARNING: Unblock not implemented%s", VTY_NEWLINE);
+//		gprs_ns_tx_unblock(nsvc);
+	} else if (!strcmp(data->operation, "reset")) {
+		vty_out(vty, "Resetting NSVC %s%s", gprs_ns2_ll_str(nsvc), VTY_NEWLINE);
+		gprs_ns2_vc_reset(nsvc);
+	}
+
+
+}
+
+DEFUN(nsvc_nsei, nsvc_nsei_cmd,
+	"nsvc nsei <0-65535> (block|unblock|reset)",
+	"Perform an operation on all NSVCs of an NSE\n"
+	"The NSEI\n"
+	"Initiate BLOCK procedure\n"
+	"Initiate UNBLOCK procedure\n"
+	"Initiate RESET procedure\n")
+{
+	struct gprs_ns2_inst *nsi = vty_nsi;
+	struct gprs_ns2_nse *nse;
+
+	uint16_t id = atoi(argv[0]);
+	struct nsvc_foreach_data data = {
+		.operation = argv[1],
+		.vty = vty,
+	};
+
+
+	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_operation_cb, (void *)&data);
+
+	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 +755,8 @@
 	install_lib_element_ve(&show_nse_cmd);
 	install_lib_element_ve(&logging_fltr_nsvc_cmd);
 
+	install_lib_element(ENABLE_NODE, &nsvc_nsei_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: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201118/89bf31c8/attachment.htm>


More information about the gerrit-log mailing list