Add vty command to explicitly reset given BVCI
diff mbox

Message ID 1459453226-8966-1-git-send-email-suraev@alumni.ntnu.no
State Superseded
Headers show

Commit Message

Suraev March 31, 2016, 7:40 p.m. UTC
From: Max <msuraev@sysmocom.de>

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(+)

Comments

Holger Freyther April 6, 2016, 7:38 p.m. UTC | #1
> On 31 Mar 2016, at 21:40, suraev@alumni.ntnu.no wrote:
> 

argh.. this breaks the build

<command id='bssgp bvc nsei &lt;0-65535&gt; bvci &lt;0-65535&gt; reset'>
        <param name='bvc' doc='(null)' />
        <param name='nsei' doc='(null)' />
        <param name='&lt;0-65535&gt;' doc='(null)' />
        <param name='bvci' doc='(null)' />
        <param name='&lt;0-65535&gt;' doc='(null)' />
        <param name='reset' doc='(null)' />

Documentation error (missing docs): 
<command id='bssgp bvc nsei &lt;0-65535&gt; bvci &lt;0-65535&gt; reset'>
        <param name='bvc' doc='(null)' />
        <param name='nsei' doc='(null)' />
        <param name='&lt;0-65535&gt;' doc='(null)' />
        <param name='bvci' doc='(null)' />
        <param name='&lt;0-65535&gt;' doc='(null)' />
        <param name='reset' doc='(null)' />



> +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")
> +{

each parameter needs to be documented. Please send a fix for this tomorrow morning.

holger

Patch
diff mbox

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 <osmocom/core/rate_ctr.h>
 #include <osmocom/gprs/gprs_ns.h>
 #include <osmocom/gprs/gprs_bssgp.h>
+#include <osmocom/gprs/gprs_bssgp_bss.h>
 
 #include <osmocom/vty/vty.h>
 #include <osmocom/vty/command.h>
@@ -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);