aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-10-24 01:33:19 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-24 10:00:42 +0200
commit687b69087661237eb7b2ca34bd769ed715381cb6 (patch)
treeed72ce59b6bc492e5c3c7e72ca36b65d11ac12f8
parent317de52dfc6d9b66d21d01e283c9620e8ce3bd7d (diff)
gb/vty: Perform NS-VC operations based on NS-VCI
This adds a 'nsvc nsvci <0-65535> (block|unblock|reset)' vty command. It selects the NS-VC based on the nsvci instead of using the first with a matching NSEI, like it is done when the 'nsei' keyword is used instead. Sponsored-by: On-Waves ehf
-rw-r--r--src/gb/gprs_ns_vty.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gb/gprs_ns_vty.c b/src/gb/gprs_ns_vty.c
index a2e7beb..29f3159 100644
--- a/src/gb/gprs_ns_vty.c
+++ b/src/gb/gprs_ns_vty.c
@@ -499,21 +499,31 @@ DEFUN(cfg_frgre_enable, cfg_frgre_enable_cmd,
}
DEFUN(nsvc_nsei, nsvc_nsei_cmd,
- "nsvc nsei <0-65535> (block|unblock|reset)",
+ "nsvc (nsei|nsvci) <0-65535> (block|unblock|reset)",
"Perform an operation on a NSVC\n"
"NSEI to identify NS-VC Identifier (NS-VCI)\n"
+ "NS-VC Identifier (NS-VCI)\n"
"The NSEI\n"
"Initiate BLOCK procedure\n"
"Initiate UNBLOCK procedure\n"
"Initiate RESET procedure\n")
{
- uint16_t nsvci = atoi(argv[0]);
- const char *operation = argv[1];
+ const char *id_type = argv[0];
+ uint16_t id = atoi(argv[1]);
+ const char *operation = argv[2];
struct gprs_nsvc *nsvc;
- nsvc = gprs_nsvc_by_nsei(vty_nsi, nsvci);
+ if (!strcmp(id_type, "nsei"))
+ nsvc = gprs_nsvc_by_nsei(vty_nsi, id);
+ else if (!strcmp(id_type, "nsvci"))
+ nsvc = gprs_nsvc_by_nsvci(vty_nsi, id);
+ else {
+ vty_out(vty, "%%No such id_type '%s'%s", id_type, VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
if (!nsvc) {
- vty_out(vty, "No such NSVCI (%u)%s", nsvci, VTY_NEWLINE);
+ vty_out(vty, "No such %s (%u)%s", id_type, id, VTY_NEWLINE);
return CMD_WARNING;
}