Change in osmo-bsc[master]: vty: join UL/DL SACCH repetition commands together

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
Mon Jan 4 21:40:32 UTC 2021


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

Change subject: vty: join UL/DL SACCH repetition commands together
......................................................................

vty: join UL/DL SACCH repetition commands together

Both commands are basically doing the same thing, so we can merge
them into a single command by adding a parameter to the command
string.  The VTY syntax remains the same:

  do-something foo
  do-something bar

becomes:

  do-something (foo|bar)

This change reduces code duplication.

Change-Id: Ibe98718d8f4933926eed0e622109c9c82537f526
Related: SYS#5114
---
M src/osmo-bsc/bsc_vty.c
1 file changed, 20 insertions(+), 45 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 7a68c3e..34ea87e 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -2784,11 +2784,13 @@
 	return CMD_SUCCESS;
 }
 
-DEFUN_ATTR(cfg_bts_rep_dl_sacch,
-	   cfg_bts_rep_dl_sacch_cmd,
-	   "repeat dl-sacch",
+DEFUN_ATTR(cfg_bts_rep_ul_dl_sacch,
+	   cfg_bts_rep_ul_dl_sacch_cmd,
+	   "repeat (ul-sacch|dl-sacch)",
 	   REP_ACCH_STR
-	   "Enable DL-SACCH repetition for this BTS\n", CMD_ATTR_IMMEDIATE)
+	   "Enable UL-SACCH repetition for this BTS\n"
+	   "Enable DL-SACCH repetition for this BTS\n",
+	   CMD_ATTR_IMMEDIATE)
 {
 	struct gsm_bts *bts = vty->index;
 
@@ -2798,52 +2800,27 @@
 		return CMD_WARNING;
 	}
 
-	bts->repeated_acch_policy.dl_sacch = true;
+	if (strcmp(argv[0], "ul-sacch") == 0)
+		bts->repeated_acch_policy.ul_sacch = true;
+	else
+		bts->repeated_acch_policy.dl_sacch = true;
 
 	return CMD_SUCCESS;
 }
 
-DEFUN_ATTR(cfg_bts_rep_no_dl_sacch,
-	   cfg_bts_rep_no_dl_sacch_cmd,
-	   "no repeat dl-sacch",
+DEFUN_ATTR(cfg_bts_rep_no_ul_dl_sacch,
+	   cfg_bts_rep_no_ul_dl_sacch_cmd,
+	   "no repeat (ul-sacch|dl-sacch)",
 	   NO_STR REP_ACCH_STR
+	   "Disable UL-SACCH repetition for this BTS\n"
 	   "Disable DL-SACCH repetition for this BTS\n", CMD_ATTR_IMMEDIATE)
 {
 	struct gsm_bts *bts = vty->index;
 
-	bts->repeated_acch_policy.dl_sacch = false;
-
-	return CMD_SUCCESS;
-}
-
-DEFUN_ATTR(cfg_bts_rep_ul_sacch,
-	   cfg_bts_rep_ul_sacch_cmd,
-	   "repeat ul-sacch",
-	   REP_ACCH_STR
-	   "Enable UL-SACCH repetition for this BTS\n", CMD_ATTR_IMMEDIATE)
-{
-	struct gsm_bts *bts = vty->index;
-
-	if (bts->model->type != GSM_BTS_TYPE_OSMOBTS) {
-		vty_out(vty, "%% repeated ACCH not supported by BTS %u%s",
-			bts->nr, VTY_NEWLINE);
-		return CMD_WARNING;
-	}
-
-	bts->repeated_acch_policy.ul_sacch = true;
-
-	return CMD_SUCCESS;
-}
-
-DEFUN_ATTR(cfg_bts_rep_no_ul_sacch,
-	   cfg_bts_rep_no_ul_sacch_cmd,
-	   "no repeat ul-sacch",
-	   NO_STR REP_ACCH_STR
-	   "Disable UL-SACCH repetition for this BTS\n", CMD_ATTR_IMMEDIATE)
-{
-	struct gsm_bts *bts = vty->index;
-
-	bts->repeated_acch_policy.ul_sacch = false;
+	if (strcmp(argv[0], "ul-sacch") == 0)
+		bts->repeated_acch_policy.ul_sacch = false;
+	else
+		bts->repeated_acch_policy.dl_sacch = false;
 
 	return CMD_SUCCESS;
 }
@@ -7705,10 +7682,8 @@
 	install_element(BTS_NODE, &cfg_bts_no_t3113_dynamic_cmd);
 	install_element(BTS_NODE, &cfg_bts_rep_dl_facch_cmd);
 	install_element(BTS_NODE, &cfg_bts_rep_no_dl_facch_cmd);
-	install_element(BTS_NODE, &cfg_bts_rep_dl_sacch_cmd);
-	install_element(BTS_NODE, &cfg_bts_rep_no_dl_sacch_cmd);
-	install_element(BTS_NODE, &cfg_bts_rep_ul_sacch_cmd);
-	install_element(BTS_NODE, &cfg_bts_rep_no_ul_sacch_cmd);
+	install_element(BTS_NODE, &cfg_bts_rep_ul_dl_sacch_cmd);
+	install_element(BTS_NODE, &cfg_bts_rep_no_ul_dl_sacch_cmd);
 	install_element(BTS_NODE, &cfg_bts_rep_rxqual_cmd);
 
 	neighbor_ident_vty_init(network, network->neighbor_bss_cells);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ibe98718d8f4933926eed0e622109c9c82537f526
Gerrit-Change-Number: 21911
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy 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/20210104/6d1b1aeb/attachment.htm>


More information about the gerrit-log mailing list