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

neels gerrit-no-reply at lists.osmocom.org
Thu Jun 10 15:22:05 UTC 2021


neels has submitted this change. ( 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
M tests/osmo-bsc.vty
4 files changed, 129 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  fixeria: Looks good to me, but someone else must approve
  pespin: Looks good to me, but someone else must approve



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 11b19ec..dccf5a1 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 71a0f0b..430863b 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -6590,6 +6590,94 @@
 	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_TRX_TS_STR2
+	"Primary sub-slot\n" "VAMOS secondary shadow subslot, range <0-1>, only valid for TCH type timeslots\n"
+	SS_NR_STR
+	"Trigger Assignment to an unused lchan on the same cell\n"
+	"Target TRX\nTRX nr\nTarget timeslot\ntimeslot nr\n"
+	"Primary sub-slot\n" "VAMOS secondary shadow subslot, range <0-1>, only valid for TCH type timeslots\n"
+	SS_NR_STR
+	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;
+
+	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 (!ts_is_capable_of_pchan(to_ts, from_ts->pchan_is)) {
+		vty_out(vty, "cannot re-assign, target timeslot has mismatching physical channel config: %s -> %s%s",
+			gsm_pchan_name(from_ts->pchan_is), gsm_pchan_name(to_ts->pchan_on_init), VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	if (from_ss_nr >= from_ts->max_primary_lchans) {
+		vty_out(vty, "cannot re-assign, invalid source subslot number: %d%s",
+			from_ss_nr, VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	if (to_ss_nr >= to_ts->max_primary_lchans) {
+		vty_out(vty, "cannot re-assign, invalid target subslot number: %d%s",
+			to_ss_nr, VTY_NEWLINE);
+		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"
@@ -8069,6 +8157,7 @@
 	install_element(ENABLE_NODE, &vamos_modify_lchan_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 33a2249..0d1395c 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -1061,6 +1061,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),
 	{}
 };
 
diff --git a/tests/osmo-bsc.vty b/tests/osmo-bsc.vty
index cbd4985..48f3f0b 100644
--- a/tests/osmo-bsc.vty
+++ b/tests/osmo-bsc.vty
@@ -11,6 +11,7 @@
   deactivate      Manual Channel Deactivation (e.g. for BER test)
   modify          Manually send Channel Mode Modify (for debugging)
   mdcx            Modify RTP Connection
+  reassign-to     Trigger Assignment to an unused lchan on the same cell
   handover        Manually trigger handover (for debugging)
   assignment      Manually trigger assignment (for debugging)
 
@@ -72,6 +73,7 @@
   deactivate      Manual Channel Deactivation (e.g. for BER test)
   modify          Manually send Channel Mode Modify (for debugging)
   mdcx            Modify RTP Connection
+  reassign-to     Trigger Assignment to an unused lchan on the same cell
   handover        Manually trigger handover (for debugging)
   assignment      Manually trigger assignment (for debugging)
 
@@ -88,6 +90,42 @@
 OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 activate fr 0 ?
   <cr>  
 
+OsmoBSC# list
+...
+  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] [<1-4>] [<0-7>]
+...
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to ?
+  trx  Target TRX
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to trx ?
+  <0-255>  TRX nr
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to trx 0 ?
+  timeslot  Target timeslot
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to trx 0 timeslot ?
+  <0-7>  timeslot nr
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to trx 0 timeslot 0 ?
+  sub-slot        Primary sub-slot
+  vamos-sub-slot  VAMOS secondary shadow subslot, range <0-1>, only valid for TCH type timeslots
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to trx 0 timeslot 0 vamos-sub-slot ?
+  <0-7>  Sub-slot Number
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to trx 0 timeslot 0 vamos-sub-slot 0 ?
+  [tsc]  Provide specific TSC Set and Training Sequence Code
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to trx 0 timeslot 0 vamos-sub-slot 0 tsc ?
+  [<1-4>]  TSC Set
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to trx 0 timeslot 0 vamos-sub-slot 0 tsc 1 ?
+  [<0-7>]  Training Sequence Code
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 reassign-to trx 0 timeslot 0 vamos-sub-slot 0 tsc 1 0 ?
+  <cr>  
+
 OsmoBSC# configure terminal
 OsmoBSC(config)# network
 OsmoBSC(config-net)# list

-- 
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: 29
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210610/43047ede/attachment.htm>


More information about the gerrit-log mailing list