Change in osmo-bsc[master]: vty: add lchan modify '(vamos|non-vamos)' command

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


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

Change subject: vty: add lchan modify '(vamos|non-vamos)' command
......................................................................

vty: add lchan modify '(vamos|non-vamos)' command

Change-Id: If44c3483d4d3d86f5822c5ad882aaeeaff27e3af
---
M src/osmo-bsc/bsc_vty.c
M tests/osmo-bsc.vty
2 files changed, 113 insertions(+), 28 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 724a3b0..79026a1 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -102,6 +102,12 @@
 	BTS_NR_TRX_TS_STR2 \
 	"Sub-slot for manual command\n" SS_NR_STR
 
+#define TSC_ARGS_OPT "[tsc] [<1-4>] [<0-7>]"
+#define TSC_ARGS_DOC \
+      "Provide specific TSC Set and Training Sequence Code\n" \
+      "TSC Set\n" \
+      "Training Sequence Code\n"
+
 /* FIXME: this should go to some common file */
 static const struct value_string gprs_ns_timer_strs[] = {
 	{ 0, "tns-block" },
@@ -192,6 +198,34 @@
 	return CMD_SUCCESS;
 }
 
+/* resolve a gsm_bts_trx_ts basd on the given numeric identifiers */
+static struct gsm_bts_trx_ts *vty_get_ts(struct vty *vty, const char *bts_str, const char *trx_str,
+					 const char *ts_str)
+{
+	int bts_nr = atoi(bts_str);
+	int trx_nr = atoi(trx_str);
+	int ts_nr = atoi(ts_str);
+	struct gsm_bts *bts;
+	struct gsm_bts_trx *trx;
+	struct gsm_bts_trx_ts *ts;
+
+	bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr);
+	if (!bts) {
+		vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
+		return NULL;
+	}
+
+	trx = gsm_bts_trx_num(bts, trx_nr);
+	if (!trx) {
+		vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
+		return NULL;
+	}
+
+	ts = &trx->ts[ts_nr];
+
+	return ts;
+}
+
 static void net_dump_nmstate(struct vty *vty, struct gsm_nm_state *nms)
 {
 	vty_out(vty,"Oper '%s', Admin '%s', Avail '%s'%s",
@@ -1975,6 +2009,21 @@
 	return CMD_WARNING;
 }
 
+static int trigger_vamos_mode_modify(struct vty *vty, struct gsm_lchan *lchan, bool vamos, int tsc_set, int tsc)
+{
+	struct lchan_modify_info info = {
+		.modify_for = MODIFY_FOR_VTY,
+		.ch_mode_rate = lchan->current_ch_mode_rate,
+		.requires_voice_stream = (lchan->fi_rtp != NULL),
+		.vamos = vamos,
+		.tsc_set = tsc_set,
+		.tsc = tsc,
+	};
+
+	lchan_mode_modify(lchan, &info);
+	return CMD_SUCCESS;
+}
+
 #define MANUAL_HANDOVER_STR "Manually trigger handover (for debugging)\n"
 #define MANUAL_ASSIGNMENT_STR "Manually trigger assignment (for debugging)\n"
 
@@ -6023,34 +6072,6 @@
 	return CMD_SUCCESS;
 }
 
-/* resolve a gsm_bts_trx_ts basd on the given numeric identifiers */
-static struct gsm_bts_trx_ts *vty_get_ts(struct vty *vty, const char *bts_str, const char *trx_str,
-					 const char *ts_str)
-{
-	int bts_nr = atoi(bts_str);
-	int trx_nr = atoi(trx_str);
-	int ts_nr = atoi(ts_str);
-	struct gsm_bts *bts;
-	struct gsm_bts_trx *trx;
-	struct gsm_bts_trx_ts *ts;
-
-	bts = gsm_bts_num(gsmnet_from_vty(vty), bts_nr);
-	if (!bts) {
-		vty_out(vty, "%% No such BTS (%d)%s", bts_nr, VTY_NEWLINE);
-		return NULL;
-	}
-
-	trx = gsm_bts_trx_num(bts, trx_nr);
-	if (!trx) {
-		vty_out(vty, "%% No such TRX (%d)%s", trx_nr, VTY_NEWLINE);
-		return NULL;
-	}
-
-	ts = &trx->ts[ts_nr];
-
-	return ts;
-}
-
 DEFUN(pdch_act, pdch_act_cmd,
 	"bts <0-255> trx <0-255> timeslot <0-7> pdch (activate|deactivate)",
 	BTS_NR_TRX_TS_STR2
@@ -6421,6 +6442,40 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(vamos_modify_lchan, vamos_modify_lchan_cmd,
+      "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> modify (vamos|non-vamos) " TSC_ARGS_OPT,
+      BTS_NR_TRX_TS_SS_STR2
+      "Manually send Channel Mode Modify (for debugging)\n"
+      "Enable VAMOS channel mode\n" "Disable VAMOS channel mode\n"
+      TSC_ARGS_DOC)
+{
+	struct gsm_bts_trx_ts *ts;
+	struct gsm_lchan *lchan;
+	int ss_nr = atoi(argv[3]);
+	const char *vamos_str = argv[4];
+	/* argv[5] is the "tsc" string from TSC_ARGS_OPT */
+	int tsc_set = (argc > 6) ? atoi(argv[6]) : -1;
+	int tsc = (argc > 7) ? atoi(argv[7]) : -1;
+
+	ts = vty_get_ts(vty, argv[0], argv[1], argv[2]);
+	if (!ts)
+		return CMD_WARNING;
+
+	if (ss_nr >= ts->max_primary_lchans) {
+		vty_out(vty, "%% Invalid sub-slot number for this timeslot type%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	if (!osmo_bts_has_feature(&ts->trx->bts->features, BTS_FEAT_VAMOS)) {
+		vty_out(vty, "%% BTS does not support VAMOS%s", VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+
+	lchan = &ts->lchan[ss_nr];
+
+	return trigger_vamos_mode_modify(vty, lchan, strcmp(vamos_str, "vamos") == 0, tsc_set, tsc);
+}
+
 /* Debug command to send lchans from state LCHAN_ST_UNUSED to state
  * LCHAN_ST_BORKEN and vice versa. */
 DEFUN_HIDDEN(lchan_set_borken, lchan_set_borken_cmd,
@@ -7982,6 +8037,7 @@
 	install_element(ENABLE_NODE, &lchan_act_all_cmd);
 	install_element(ENABLE_NODE, &lchan_act_all_bts_cmd);
 	install_element(ENABLE_NODE, &lchan_act_all_trx_cmd);
+	install_element(ENABLE_NODE, &vamos_modify_lchan_cmd);
 	install_element(ENABLE_NODE, &lchan_mdcx_cmd);
 	install_element(ENABLE_NODE, &lchan_set_borken_cmd);
 
diff --git a/tests/osmo-bsc.vty b/tests/osmo-bsc.vty
index 560fb36..e03ed03 100644
--- a/tests/osmo-bsc.vty
+++ b/tests/osmo-bsc.vty
@@ -1,5 +1,34 @@
 OsmoBSC> enable
 
+OsmoBSC# list
+...
+  bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> modify (vamos|non-vamos) [tsc] [<1-4>] [<0-7>]
+...
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 ?
+  activate    Manual Channel Activation (e.g. for BER test)
+  deactivate  Manual Channel Deactivation (e.g. for BER test)
+  modify      Manually send Channel Mode Modify (for debugging)
+  mdcx        Modify RTP Connection
+  handover    Manually trigger handover (for debugging)
+  assignment  Manually trigger assignment (for debugging)
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 modify ?
+  vamos      Enable VAMOS channel mode
+  non-vamos  Disable VAMOS channel mode
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 modify vamos ?
+  [tsc]  Provide specific TSC Set and Training Sequence Code
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 modify vamos tsc ?
+  [<1-4>]  TSC Set
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 modify vamos tsc 1 ?
+  [<0-7>]  Training Sequence Code
+
+OsmoBSC# bts 0 trx 0 timeslot 0 sub-slot 0 modify vamos tsc 1 0 ?
+  <cr>  
+
 OsmoBSC# configure terminal
 OsmoBSC(config)# network
 OsmoBSC(config-net)# list

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If44c3483d4d3d86f5822c5ad882aaeeaff27e3af
Gerrit-Change-Number: 24625
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210610/4bc41712/attachment.htm>


More information about the gerrit-log mailing list