Change in osmo-bsc[master]: VTY: add lchan re-assignment command

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Sun May 23 23:03:07 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24381 )


Change subject: VTY: add lchan re-assignment command
......................................................................

VTY: add lchan re-assignment command

Add VTY command to trigger an intra-cell re-assignment, also allowing to
re-assign to a secondary VAMOS lchan.

Related: SYS#5315 OS#4940
Change-Id: If006f5caaf83b07675f57e5665cfa79328da55e6
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/gsm_data.c
3 files changed, 70 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/81/24381/1

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 4690a2c..1891786 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -131,6 +131,7 @@
 	ASSIGN_FOR_NONE,
 	ASSIGN_FOR_BSSMAP_REQ,
 	ASSIGN_FOR_CONGESTION_RESOLUTION,
+	ASSIGN_FOR_VTY,
 };
 
 extern const struct value_string assign_for_names[];
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 48f397e..2581b98 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -6534,6 +6534,73 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(lchan_reassign, lchan_reassign_cmd,
+	"bts <0-255> trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> "
+	" reassign-to trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> "
+	TSC_ARGS_OPT,
+	"BTS nr\nTRX nr\ntimeslot nr\nnormal lchan\nvamos secondary lchan\nsub-slot nr\n"
+	"TRX nr\ntimeslot nr\nnormal lchan\nvamos secondary lchan\nsub-slot nr\n"
+	TSC_ARGS_DOC)
+{
+	const char *bts_str = argv[0];
+	const char *from_trx_str = argv[1];
+	const char *from_ts_str = argv[2];
+	bool from_vamos = (strcmp(argv[3], "vamos-sub-slot") == 0);
+	int from_ss_nr = atoi(argv[4]);
+	const char *to_trx_str = argv[5];
+	const char *to_ts_str = argv[6];
+	bool to_vamos = (strcmp(argv[7], "vamos-sub-slot") == 0);
+	int to_ss_nr = atoi(argv[8]);
+	int tsc_set = (argc > 10) ? atoi(argv[10]) : -1;
+	int tsc = (argc > 11) ? atoi(argv[11]) : -1;
+
+	struct gsm_bts_trx_ts *from_ts;
+	struct gsm_bts_trx_ts *to_ts;
+	struct gsm_lchan *from_lchan;
+	struct gsm_lchan *to_lchan;
+
+	LOGP(DLGLOBAL, LOGL_NOTICE, "hi\n");
+
+	from_ts = vty_get_ts(vty, bts_str, from_trx_str, from_ts_str);
+	if (!from_ts)
+		return CMD_WARNING;
+	to_ts = vty_get_ts(vty, bts_str, to_trx_str, to_ts_str);
+	if (!to_ts)
+		return CMD_WARNING;
+
+	if (from_vamos)
+		from_ss_nr += from_ts->max_primary_lchans;
+	from_lchan = &from_ts->lchan[from_ss_nr];
+
+	if (to_vamos)
+		to_ss_nr += to_ts->max_primary_lchans;
+	to_lchan = &to_ts->lchan[to_ss_nr];
+
+	if (!lchan_state_is(from_lchan, LCHAN_ST_ESTABLISHED)) {
+		vty_out(vty, "cannot re-assign, source lchan is not in ESTABLISHED state%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+	if (!lchan_state_is(to_lchan, LCHAN_ST_UNUSED)) {
+		vty_out(vty, "cannot re-assign, target lchan is already in use%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	/* lchan_select_*() sets the lchan->type, we need to do the same here, so that activation will work out. */
+	to_lchan->type = chan_mode_to_chan_type(from_lchan->current_ch_mode_rate.chan_mode,
+						from_lchan->current_ch_mode_rate.chan_rate);
+
+	LOG_LCHAN(from_lchan, LOGL_NOTICE, "VTY requests re-assignment of this lchan to %s%s\n",
+		  gsm_lchan_name(to_lchan), to_lchan->vamos.is_secondary ? " (to VAMOS mode)" : "");
+	LOG_LCHAN(to_lchan, LOGL_NOTICE, "VTY requests re-assignment of %s to this lchan%s TSC %d/%d\n",
+		  gsm_lchan_name(from_lchan), to_lchan->vamos.is_secondary ? " (to VAMOS mode)" : "",
+		  tsc_set, tsc);
+	if (reassignment_request_to_lchan(ASSIGN_FOR_VTY, from_lchan, to_lchan, tsc_set, tsc)) {
+		vty_out(vty, "failed to request re-assignment%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+	return CMD_SUCCESS;
+}
+
 DEFUN(ctrl_trap, ctrl_trap_cmd,
 	"ctrl-interface generate-trap TRAP VALUE",
 	"Commands related to the CTRL Interface\n"
@@ -8012,6 +8079,7 @@
 	install_element(ENABLE_NODE, &lchan_act_all_trx_cmd);
 	install_element(ENABLE_NODE, &lchan_mdcx_cmd);
 	install_element(ENABLE_NODE, &lchan_set_borken_cmd);
+	install_element(ENABLE_NODE, &lchan_reassign_cmd);
 
 	install_element(ENABLE_NODE, &handover_subscr_conn_cmd);
 	install_element(ENABLE_NODE, &assignment_subscr_conn_cmd);
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index 85ce8bf..e7a461d 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -1047,6 +1047,7 @@
 	OSMO_VALUE_STRING(ASSIGN_FOR_NONE),
 	OSMO_VALUE_STRING(ASSIGN_FOR_BSSMAP_REQ),
 	OSMO_VALUE_STRING(ASSIGN_FOR_CONGESTION_RESOLUTION),
+	OSMO_VALUE_STRING(ASSIGN_FOR_VTY),
 	{}
 };
 

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If006f5caaf83b07675f57e5665cfa79328da55e6
Gerrit-Change-Number: 24381
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210523/2336bb46/attachment.htm>


More information about the gerrit-log mailing list