From 687b69087661237eb7b2ca34bd769ed715381cb6 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Thu, 24 Oct 2013 01:33:19 +0200 Subject: 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 --- src/gb/gprs_ns_vty.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/gb/gprs_ns_vty.c b/src/gb/gprs_ns_vty.c index a2e7beb9..29f3159d 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; } -- cgit v1.2.3