aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/bsc/gsm_data.h1
-rw-r--r--src/osmo-bsc/bsc_vty.c89
-rw-r--r--src/osmo-bsc/gsm_data.c1
-rw-r--r--tests/osmo-bsc.vty38
4 files changed, 129 insertions, 0 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 11b19ecf8..dccf5a144 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -131,6 +131,7 @@ enum assign_for {
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 71a0f0b7d..430863bc5 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -6590,6 +6590,94 @@ DEFUN(lchan_mdcx, lchan_mdcx_cmd,
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 @@ int bsc_vty_init(struct gsm_network *network)
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 33a224921..0d1395c70 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -1061,6 +1061,7 @@ const struct value_string assign_for_names[] = {
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 cbd498538..48f3f0b6f 100644
--- a/tests/osmo-bsc.vty
+++ b/tests/osmo-bsc.vty
@@ -11,6 +11,7 @@ OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 ?
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 @@ OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 ?
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 ?
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