Change in osmo-bsc[master]: vty: lchan deact: allow omitting the lchan type arg

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/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Jul 27 07:34:06 UTC 2021


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

Change subject: vty: lchan deact: allow omitting the lchan type arg
......................................................................

vty: lchan deact: allow omitting the lchan type arg

In the command

  bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7> deactivate fr

the final argument indicating the channel type does not make sense and
is not actually used. Define a separate vty command for 'deactivate', so
that it doesn't require arguments only used for 'activate'.

Change-Id: Ibdeca3b1d75b9f6092f566544e9d5f4da67fffce
---
M src/osmo-bsc/bsc_vty.c
M tests/osmo-bsc.vty
2 files changed, 44 insertions(+), 17 deletions(-)

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



diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 5966f85..b0fe8bf 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -1548,6 +1548,11 @@
 	      GSM0808_SC_CFG_AMR_12_2 };
 
 	if (activate) {
+		if (!codec_str) {
+			vty_out(vty, "%% Error: need a channel type argument to activate%s", VTY_NEWLINE);
+			return CMD_WARNING;
+		}
+
 		LOG_LCHAN(lchan, LOGL_NOTICE, "attempt from VTY to activate lchan %s with codec %s\n",
 			  gsm_lchan_name(lchan), codec_str);
 		if (!lchan->fi) {
@@ -1700,28 +1705,21 @@
 	return CMD_SUCCESS;
 }
 
-/* Debug/Measurement command to activate a given logical channel
- * manually in a given mode/codec.  This is useful for receiver
- * performance testing (FER/RBER/...) */
-DEFUN(lchan_act, lchan_act_cmd,
-	"bts <0-255> trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> (activate|activate-vamos|deactivate) (hr|fr|efr|amr|sig) [<0-7>]",
-	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
-	"Manual Channel Activation (e.g. for BER test)\n"
-	"Manual Channel Activation, in VAMOS mode\n"
-	"Manual Channel Deactivation (e.g. for BER test)\n"
-	"Half-Rate v1\n" "Full-Rate\n" "Enhanced Full Rate\n" "Adaptive Multi-Rate\n" "Signalling\n" "AMR Mode\n")
+static int lchan_act_deact(struct vty *vty, const char **argv, int argc)
 {
 	struct gsm_bts_trx_ts *ts;
 	struct gsm_lchan *lchan;
 	bool vamos = (strcmp(argv[3], "vamos-sub-slot") == 0);
 	int ss_nr = atoi(argv[4]);
-	const char *act_str = argv[5];
-	const char *codec_str = argv[6];
+	const char *act_str = NULL;
+	const char *codec_str = NULL;
 	int activate;
 	int amr_mode = -1;
 
+	if (argc > 5)
+		act_str = argv[5];
+	if (argc > 6)
+		codec_str = argv[6];
 	if (argc > 7)
 		amr_mode = atoi(argv[7]);
 
@@ -1744,16 +1742,43 @@
 
 	lchan = &ts->lchan[ss_nr];
 
-	if (!strcmp(act_str, "activate"))
+	if (!act_str)
+		activate = 0;
+	else if (!strcmp(act_str, "activate"))
 		activate = 1;
 	else if (!strcmp(act_str, "activate-vamos"))
 		activate = 2;
 	else
-		activate = 0;
+		return CMD_WARNING;
 
 	return lchan_act_single(vty, lchan, codec_str, amr_mode, activate);
 }
 
+/* Debug/Measurement command to activate a given logical channel
+ * manually in a given mode/codec.  This is useful for receiver
+ * performance testing (FER/RBER/...) */
+DEFUN(lchan_act, lchan_act_cmd,
+	"bts <0-255> trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> (activate|activate-vamos) (hr|fr|efr|amr|sig) [<0-7>]",
+	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
+	"Manual Channel Activation (e.g. for BER test)\n"
+	"Manual Channel Activation, in VAMOS mode\n"
+	"Half-Rate v1\n" "Full-Rate\n" "Enhanced Full Rate\n" "Adaptive Multi-Rate\n" "Signalling\n" "AMR Mode\n")
+{
+	return lchan_act_deact(vty, argv, argc);
+}
+
+DEFUN(lchan_deact, lchan_deact_cmd,
+	"bts <0-255> trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> deactivate",
+	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
+	"Manual Channel Deactivation (e.g. for BER test)\n")
+{
+	return lchan_act_deact(vty, argv, argc);
+}
+
 #define ACTIVATE_ALL_LCHANS_STR "Manual Channel Activation of all logical channels (e.g. for BER test)\n"
 #define DEACTIVATE_ALL_LCHANS_STR "Manual Channel Deactivation of all logical channels (e.g. for BER test)\n"
 
@@ -3365,6 +3390,7 @@
 	install_element(ENABLE_NODE, &bts_c0_power_red_cmd);
 	install_element(ENABLE_NODE, &pdch_act_cmd);
 	install_element(ENABLE_NODE, &lchan_act_cmd);
+	install_element(ENABLE_NODE, &lchan_deact_cmd);
 	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);
diff --git a/tests/osmo-bsc.vty b/tests/osmo-bsc.vty
index 3bc2707..7351056 100644
--- a/tests/osmo-bsc.vty
+++ b/tests/osmo-bsc.vty
@@ -34,7 +34,8 @@
 
 OsmoBSC# list
 ...
-  bts <0-255> trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> (activate|activate-vamos|deactivate) (hr|fr|efr|amr|sig) [<0-7>]
+  bts <0-255> trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> (activate|activate-vamos) (hr|fr|efr|amr|sig) [<0-7>]
+  bts <0-255> trx <0-255> timeslot <0-7> (sub-slot|vamos-sub-slot) <0-7> deactivate
 ...
 
 OsmoBSC# bts?

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ibdeca3b1d75b9f6092f566544e9d5f4da67fffce
Gerrit-Change-Number: 25039
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20210727/4ae7338f/attachment.htm>


More information about the gerrit-log mailing list