gprs_ns2: add vty `nse <0-65535> restart sns`

Allow to restart SNS procedure and initiate a SNS-SIZE procedure with Reset.
SGSN side SNS restart will stop answer on ALIVE and is sending NS STATUS
invalid protocol state.
BSS side SNS restart will send a SNS Size procedure to reset the state.

Change-Id: Icb55d8449908d348ab10572eebcf971737fba00d
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 41f581e..016199d 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -2069,6 +2069,31 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(nse_restart_sns, nse_restart_sns_cmd,
+      "nse <0-65535> restart-sns",
+      "NSE specific commands\n"
+      "NS Entity ID (NSEI)\n"
+      "Restart SNS procedure\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;
+	}
+
+	if (nse->dialect != GPRS_NS2_DIALECT_SNS) {
+		vty_out(vty, "Given NSEI %u doesn't use IP-SNS%s", id, VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	gprs_ns2_free_nsvcs(nse);
+	return CMD_SUCCESS;
+}
+
 DEFUN(nsvc_block, nsvc_block_cmd,
       "nsvc <0-65535> (block|unblock|reset)",
       "NS Virtual Connection\n"
@@ -2236,6 +2261,7 @@
 
 	install_lib_element(ENABLE_NODE, &nsvc_force_unconf_cmd);
 	install_lib_element(ENABLE_NODE, &nsvc_block_cmd);
+	install_lib_element(ENABLE_NODE, &nse_restart_sns_cmd);
 
 	install_lib_element(CFG_LOG_NODE, &logging_fltr_nse_cmd);
 	install_lib_element(CFG_LOG_NODE, &logging_fltr_nsvc_cmd);