Change in osmo-bsc[master]: vty: add "msc N bssmap reset" command

neels gerrit-no-reply at lists.osmocom.org
Mon Aug 30 16:18:12 UTC 2021


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/25225 )

Change subject: vty: add "msc N bssmap reset" command
......................................................................

vty: add "msc N bssmap reset" command

Allow resetting the BSSMAP link from VTY, for BSC_Tests.ttcn.

In the field, detecting that an MSC is lost is done by getting three
connection failures in a row. For the BSC_Tests, it is easier to just
provide a VTY command to reset an MSC's link status.

I want to add tests that verify the stat items reflecting the MSC
connection status. To be able to run a test expecting fewer connected
MSC after a test that launched more MSCs requires the links to be reset.

Related: SYS#5542
Related: Ice3056dc46c94f9399f8379db7aeb7193782f2f2 (osmo-ttcn3-hacks)
Change-Id: I1975941b790d2b30d0904d41e456220cba26ecff
---
M include/osmocom/bsc/bssmap_reset.h
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/bssmap_reset.c
M tests/handover/handover_test.c
4 files changed, 31 insertions(+), 3 deletions(-)

Approvals:
  neels: Looks good to me, approved
  dexter: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/bssmap_reset.h b/include/osmocom/bsc/bssmap_reset.h
index f90f5ec..fcd850b 100644
--- a/include/osmocom/bsc/bssmap_reset.h
+++ b/include/osmocom/bsc/bssmap_reset.h
@@ -27,4 +27,5 @@
 
 struct bssmap_reset *bssmap_reset_alloc(void *ctx, const char *label, const struct bssmap_reset_cfg *cfg);
 bool bssmap_reset_is_conn_ready(const struct bssmap_reset *bssmap_reset);
+void bssmap_reset_resend_reset(struct bssmap_reset *bssmap_reset);
 void bssmap_reset_term_and_free(struct bssmap_reset *bssmap_reset);
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 6d10426..5ce1d69 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -62,6 +62,7 @@
 #include <osmocom/bsc/bts.h>
 #include <osmocom/bsc/bsc_subscr_conn_fsm.h>
 #include <osmocom/bsc/assignment_fsm.h>
+#include <osmocom/bsc/bssmap_reset.h>
 
 #include <inttypes.h>
 
@@ -3324,6 +3325,28 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(msc_bssmap_reset, msc_bssmap_reset_cmd,
+      "msc " MSC_NR_RANGE " bssmap reset",
+      "Query or manipulate a specific A-interface link\n"
+      "MSC nr\n"
+      "Query or manipulate BSSMAP layer of A-interface\n"
+      "Flip this MSC to disconnected state and re-send BSSMAP RESET\n")
+{
+	int msc_nr = atoi(argv[0]);
+	struct bsc_msc_data *msc;
+
+	msc = osmo_msc_data_find(bsc_gsmnet, msc_nr);
+
+	if (!msc) {
+		vty_out(vty, "%% No such MSC: nr %d\n", msc_nr);
+		return CMD_WARNING;
+	}
+
+	LOGP(DMSC, LOGL_NOTICE, "(msc%d) VTY requests BSSMAP RESET\n", msc_nr);
+	bssmap_reset_resend_reset(msc->a.bssmap_reset);
+	return CMD_SUCCESS;
+}
+
 int bsc_vty_init(struct gsm_network *network)
 {
 	OSMO_ASSERT(vty_global_gsm_network == NULL);
@@ -3477,6 +3500,7 @@
 
 	install_element(ENABLE_NODE, &gen_position_trap_cmd);
 	install_element(ENABLE_NODE, &mscpool_roundrobin_next_cmd);
+	install_element(ENABLE_NODE, &msc_bssmap_reset_cmd);
 
 	install_element(CFG_LOG_NODE, &logging_fltr_imsi_cmd);
 
diff --git a/src/osmo-bsc/bssmap_reset.c b/src/osmo-bsc/bssmap_reset.c
index 6c54560..beb8968 100644
--- a/src/osmo-bsc/bssmap_reset.c
+++ b/src/osmo-bsc/bssmap_reset.c
@@ -243,6 +243,12 @@
 	return bssmap_reset->fi->state == BSSMAP_RESET_ST_CONN;
 }
 
+void bssmap_reset_resend_reset(struct bssmap_reset *bssmap_reset)
+{
+	/* Immediately (1ms) kick off reset sending mechanism */
+	osmo_fsm_inst_state_chg_ms(bssmap_reset->fi, BSSMAP_RESET_ST_DISC, 1, 0);
+}
+
 static __attribute__((constructor)) void bssmap_reset_fsm_init()
 {
 	OSMO_ASSERT(osmo_fsm_register(&bssmap_reset_fsm) == 0);
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 315fc10..f76a700 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -1703,9 +1703,6 @@
 void osmo_bsc_sigtran_tx_reset(void) {}
 void osmo_bsc_sigtran_tx_reset_ack(void) {}
 void osmo_bsc_sigtran_reset(void) {}
-void bssmap_reset_alloc(void) {}
-void bssmap_reset_is_conn_ready(void) {}
-void bssmap_reset_term_and_free(void) {}
 const char *osmo_mgcpc_ep_name(const struct osmo_mgcpc_ep *ep)
 {
 	return "fake-ep";

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/25225
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I1975941b790d2b30d0904d41e456220cba26ecff
Gerrit-Change-Number: 25225
Gerrit-PatchSet: 4
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210830/85c255a3/attachment.htm>


More information about the gerrit-log mailing list