summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-05-14 19:36:59 +0200
committerHarald Welte <laforge@gnumonks.org>2010-05-14 19:36:59 +0200
commit43f3b69c4329b29bfca2d21c825bda0e54528b02 (patch)
treeb6783ae7e4424f19b1980fd2f1f1e230492349a0 /openbsc
parenta52ff459ec4995f0a529ba62581f374cf95fa7e6 (diff)
[GPRS] NS: Add 'nsvc nsei ... (block|unblock|reset)' command to VTY
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/gprs/gprs_ns_vty.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/openbsc/src/gprs/gprs_ns_vty.c b/openbsc/src/gprs/gprs_ns_vty.c
index 410c35f6..b119dea8 100644
--- a/openbsc/src/gprs/gprs_ns_vty.c
+++ b/openbsc/src/gprs/gprs_ns_vty.c
@@ -272,6 +272,37 @@ DEFUN(cfg_ns_timer, cfg_ns_timer_cmd,
return CMD_SUCCESS;
}
+DEFUN(nsvc_nsei, nsvc_nsei_cmd,
+ "nsvc nsei <0-65535> (block|unblock|reset)",
+ "Perform an operation on a NSVC\n"
+ "NS-VC Identifier (NS-VCI)\n"
+ "Initiate BLOCK procedure\n"
+ "Initiate UNBLOCK procedure\n"
+ "Initiate RESET procedure\n")
+{
+ uint16_t nsvci = atoi(argv[0]);
+ const char *operation = argv[1];
+ struct gprs_nsvc *nsvc;
+
+ nsvc = nsvc_by_nsei(vty_nsi, nsvci);
+ if (!nsvc) {
+ vty_out(vty, "No such NSVCI (%u)%s", nsvci, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (!strcmp(operation, "block"))
+ gprs_ns_tx_block(nsvc, NS_CAUSE_OM_INTERVENTION);
+ else if (!strcmp(operation, "unblock"))
+ gprs_ns_tx_unblock(nsvc);
+ else if (!strcmp(operation, "reset"))
+ gprs_nsvc_reset(nsvc, NS_CAUSE_OM_INTERVENTION);
+ else
+ return CMD_WARNING;
+
+ return CMD_SUCCESS;
+}
+
+
int gprs_ns_vty_init(struct gprs_ns_inst *nsi)
{
vty_nsi = nsi;
@@ -291,5 +322,7 @@ int gprs_ns_vty_init(struct gprs_ns_inst *nsi)
install_element(NS_NODE, &cfg_no_nse_cmd);
install_element(NS_NODE, &cfg_ns_timer_cmd);
+ install_element(ENABLE_NODE, &nsvc_nsei_cmd);
+
return 0;
}