From patchwork Thu Mar 17 14:42:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max X-Patchwork-Id: 599068 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 3qQrfx72vqz9sRZ for ; Fri, 18 Mar 2016 01:42:33 +1100 (AEDT) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 85B6E1BB73; Thu, 17 Mar 2016 14:42:32 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from mail.sysmocom.de (mail.sysmocom.de [IPv6:2a01:4f8:191:444c::2:4]) by lists.osmocom.org (Postfix) with ESMTP id 5B47C1BB54 for ; Thu, 17 Mar 2016 14:42:30 +0000 (UTC) Received: from mail.sysmocom.de (mail.sysmocom.de [144.76.43.93]) by mail.sysmocom.de (Postfix) with ESMTP id 396F715CA32; Thu, 17 Mar 2016 14:42:30 +0000 (UTC) Received: from pbell.local (ip5b418565.dynamic.kabel-deutschland.de [91.65.133.101]) by mail.sysmocom.de (Postfix) with ESMTPSA id EE70115CA30; Thu, 17 Mar 2016 14:42:29 +0000 (UTC) From: msuraev@sysmocom.de To: openbsc@lists.osmocom.org Subject: [PATCH 2/2] Add vty command to explicitly reset given BVCI Date: Thu, 17 Mar 2016 15:42:27 +0100 Message-Id: <1458225747-19222-2-git-send-email-msuraev@sysmocom.de> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1458225747-19222-1-git-send-email-msuraev@sysmocom.de> References: <1458225747-19222-1-git-send-email-msuraev@sysmocom.de> X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Development of OpenBSC, OsmoBSC, OsmoNITB, OsmoCSCN" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Max It's useful for debugging and is similar to existing nsvc reset vty command. --- src/gb/gprs_bssgp_vty.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/gb/gprs_bssgp_vty.c b/src/gb/gprs_bssgp_vty.c index 080867b..2725d1f 100644 --- a/src/gb/gprs_bssgp_vty.c +++ b/src/gb/gprs_bssgp_vty.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -113,6 +114,31 @@ static void dump_bssgp(struct vty *vty, int stats) } } +DEFUN(bvc_reset, bvc_reset_cmd, + "bvc reset nsei <0-65535> bvci <0-65535>", + "Initiate BVC RESET procedure for a given NSEI and BVCI\n") +{ + uint16_t nsei = atoi(argv[0]), bvci = atoi(argv[1]); + struct bssgp_bvc_ctx *bvc; + + if (!strcmp(argv[0], "reset")) + return CMD_WARNING; + + if (argc != 2) + return CMD_WARNING; + + bvc = btsctx_by_bvci_nsei(bvci, nsei); + if (!bvc) { + vty_out(vty, "No BVC for NSEI %d BVCI %d%s", nsei, bvci, + VTY_NEWLINE); + return CMD_WARNING; + } + int r = bssgp_tx_bvc_reset(bvc, bvci, BSSGP_CAUSE_OML_INTERV); + vty_out(vty, "Sent BVC RESET for NSEI %d BVCI %d: %d%s", nsei, bvci, r, + VTY_NEWLINE); + return CMD_SUCCESS; +} + #define BSSGP_STR "Show information about the BSSGP protocol\n" DEFUN(show_bssgp, show_bssgp_cmd, "show bssgp", @@ -185,6 +211,7 @@ int bssgp_vty_init(void) install_element_ve(&show_bssgp_stats_cmd); install_element_ve(&show_bvc_cmd); install_element_ve(&logging_fltr_bvc_cmd); + install_element_ve(&bvc_reset_cmd); install_element(CFG_LOG_NODE, &logging_fltr_bvc_cmd);