From patchwork Thu Mar 31 19:40:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraev X-Patchwork-Id: 604276 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by ozlabs.org (Postfix) with ESMTP id 3qbZcY3cJMz9sBM for ; Fri, 1 Apr 2016 06:40:42 +1100 (AEDT) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 6AD941CA90; Thu, 31 Mar 2016 19:40:39 +0000 (UTC) X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received: from hylle05.itea.ntnu.no (hylle05.itea.ntnu.no [129.241.56.225]) by lists.osmocom.org (Postfix) with ESMTP id 32AAC1CA89 for ; Thu, 31 Mar 2016 19:40:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hylle05.itea.ntnu.no (Postfix) with ESMTP id 9CF429069DA; Thu, 31 Mar 2016 21:40:36 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at hylle05.itea.ntnu.no Received: from alumnimail01.it.ntnu.no (alumnimail01.it.ntnu.no [129.241.18.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by hylle05.itea.ntnu.no (Postfix) with ESMTPS id 1570690699F; Thu, 31 Mar 2016 21:40:35 +0200 (CEST) Received: from localhost (dslb-188-103-079-198.188.103.pools.vodafone-ip.de [188.103.79.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: suraev) by alumnimail01.it.ntnu.no (Postfix) with ESMTPSA id C77585E9CA; Thu, 31 Mar 2016 21:40:34 +0200 (CEST) From: suraev@alumni.ntnu.no To: openbsc@lists.osmocom.org Subject: [PATCH] Add vty command to explicitly reset given BVCI Date: Thu, 31 Mar 2016 21:40:26 +0200 Message-Id: <1459453226-8966-1-git-send-email-suraev@alumni.ntnu.no> X-Mailer: git-send-email 2.5.0 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: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" From: Max It's useful for debugging and is similar to existing reset command for nsvc. --- src/gb/gprs_bssgp_vty.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/gb/gprs_bssgp_vty.c b/src/gb/gprs_bssgp_vty.c index 080867b..a3af69b 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,24 @@ static void dump_bssgp(struct vty *vty, int stats) } } +DEFUN(bvc_reset, bvc_reset_cmd, + "bssgp bvc nsei <0-65535> bvci <0-65535> reset", + "Initiate BVC RESET procedure for a given NSEI and BVCI\n") +{ + int r; + uint16_t nsei = atoi(argv[0]), bvci = atoi(argv[1]); + struct bssgp_bvc_ctx *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; + } + 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 +204,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);