Change in osmo-bsc[master]: vty: actually trigger Assignment for 'assignment', not HO

neels gerrit-no-reply at lists.osmocom.org
Tue Jun 1 17:29:42 UTC 2021


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

Change subject: vty: actually trigger Assignment for 'assignment', not HO
......................................................................

vty: actually trigger Assignment for 'assignment', not HO

Related: SYS#5315 OS#4940
Change-Id: Iee11f1ae0533d7db844e68a5c4c48d0fe3e27297
---
M src/osmo-bsc/bsc_vty.c
1 file changed, 32 insertions(+), 20 deletions(-)

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



diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index 7ede51a..09aec2b 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -78,6 +78,7 @@
 #include <osmocom/bsc/bts.h>
 #include <osmocom/mgcp_client/mgcp_client_endpoint_fsm.h>
 #include <osmocom/bsc/bsc_subscr_conn_fsm.h>
+#include <osmocom/bsc/assignment_fsm.h>
 
 #include <inttypes.h>
 
@@ -1867,23 +1868,32 @@
 	return CMD_SUCCESS;
 }
 
-static int trigger_ho_or_as(struct vty *vty, struct gsm_lchan *from_lchan, struct gsm_bts *to_bts)
+static int trigger_as(struct vty *vty, struct gsm_lchan *from_lchan, struct gsm_lchan *to_lchan)
 {
-	if (!to_bts || from_lchan->ts->trx->bts == to_bts) {
-		LOGP(DHO, LOGL_NOTICE, "%s Manually triggering Assignment from VTY\n",
-		     gsm_lchan_name(from_lchan));
-		to_bts = from_lchan->ts->trx->bts;
-	} else
-		LOGP(DHO, LOGL_NOTICE, "%s (ARFCN %u) --> BTS %u Manually triggering Handover from VTY\n",
-		     gsm_lchan_name(from_lchan), from_lchan->ts->trx->arfcn, to_bts->nr);
-	{
-		struct handover_out_req req = {
-			.from_hodec_id = HODEC_USER,
-			.old_lchan = from_lchan,
-		};
-		bts_cell_ab(&req.target_cell_ab, to_bts);
-		handover_request(&req);
+	LOG_LCHAN(from_lchan, LOGL_NOTICE, "Manually triggering Assignment from VTY\n");
+	if (!to_lchan) {
+		to_lchan = lchan_select_by_type(from_lchan->ts->trx->bts, from_lchan->type);
+		vty_out(vty, "Error: cannot find free lchan of type %s%s",
+			gsm_lchant_name(from_lchan->type), VTY_NEWLINE);
 	}
+	if (reassignment_request_to_lchan(ACTIVATE_FOR_VTY, from_lchan, to_lchan)) {
+		vty_out(vty, "Error: not allowed to start assignment for %s%s",
+			gsm_lchan_name(from_lchan), VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+	return CMD_SUCCESS;
+}
+
+static int trigger_ho(struct vty *vty, struct gsm_lchan *from_lchan, struct gsm_bts *to_bts)
+{
+	struct handover_out_req req = {
+		.from_hodec_id = HODEC_USER,
+		.old_lchan = from_lchan,
+	};
+	bts_cell_ab(&req.target_cell_ab, to_bts);
+	LOGP(DHO, LOGL_NOTICE, "%s (ARFCN %u) --> BTS %u Manually triggering Handover from VTY\n",
+	     gsm_lchan_name(from_lchan), from_lchan->ts->trx->arfcn, to_bts->nr);
+	handover_request(&req);
 	return CMD_SUCCESS;
 }
 
@@ -1897,11 +1907,10 @@
 	unsigned int trx_nr = atoi(argv[1]);
 	unsigned int ts_nr = atoi(argv[2]);
 	unsigned int ss_nr = atoi(argv[3]);
-	unsigned int bts_nr_new;
 	const char *action;
 
 	if (argc > 4) {
-		bts_nr_new = atoi(argv[4]);
+		unsigned int bts_nr_new = atoi(argv[4]);
 
 		/* Lookup the BTS where we want to handover to */
 		llist_for_each_entry(bts, &net->bts_list, list) {
@@ -1930,7 +1939,10 @@
 		    conn->lchan->ts->nr == ts_nr && conn->lchan->nr == ss_nr) {
 			vty_out(vty, "starting %s for lchan %s...%s", action, conn->lchan->name, VTY_NEWLINE);
 			lchan_dump_full_vty(vty, conn->lchan);
-			return trigger_ho_or_as(vty, conn->lchan, new_bts);
+			if (new_bts)
+				return trigger_ho(vty, conn->lchan, new_bts);
+			else
+				return trigger_as(vty, conn->lchan, NULL);
 		}
 	}
 
@@ -2055,7 +2067,7 @@
 	if (!to_bts)
 		return CMD_WARNING;
 
-	return trigger_ho_or_as(vty, from_lchan, to_bts);
+	return trigger_ho(vty, from_lchan, to_bts);
 }
 
 DEFUN(assignment_any, assignment_any_cmd,
@@ -2070,7 +2082,7 @@
 	if (!from_lchan)
 		return CMD_WARNING;
 
-	return trigger_ho_or_as(vty, from_lchan, NULL);
+	return trigger_as(vty, from_lchan, NULL);
 }
 
 DEFUN(handover_any_to_arfcn_bsic, handover_any_to_arfcn_bsic_cmd,

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Iee11f1ae0533d7db844e68a5c4c48d0fe3e27297
Gerrit-Change-Number: 24363
Gerrit-PatchSet: 5
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-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210601/8344c33c/attachment.htm>


More information about the gerrit-log mailing list