Change in osmo-bsc[master]: handover_test: saner ho request handling

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 11 14:35:36 UTC 2021


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

Change subject: handover_test: saner ho request handling
......................................................................

handover_test: saner ho request handling

Similar to chan act handling, clarify and safeguard HO Request handling.
Ensure that each HO Request is handled by the test script.

Place unhandled HO Requests in new_ho_req pointer, moving to last_ho_req
upon handling it. Instead of the got_ho_req flag and additional
ho_req_lchan pointer, just keep a last_ho_req pointer.

Drop a bunch of utterly useless RSL message parsing code.

Fix unhandled HO Request in test_max_handovers.ho_vty.

Change-Id: I0a664f24d7dd3d7b254b29675fdc49cd70a1a480
---
M tests/handover/handover_test.c
M tests/handover/test_max_handovers.ho_vty
2 files changed, 29 insertions(+), 50 deletions(-)

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



diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index eddf753..167f1ce 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -528,42 +528,8 @@
 static struct gsm_lchan *new_chan_req = NULL;
 static struct gsm_lchan *last_chan_req = NULL;
 
-/* parse handover request */
-
-static int got_ho_req = 0;
-static struct gsm_lchan *ho_req_lchan = NULL;
-
-static int parse_ho_command(struct gsm_lchan *lchan, uint8_t *data, int len)
-{
-	struct gsm48_hdr *gh = (struct gsm48_hdr *) data;
-	struct gsm48_ho_cmd *ho = (struct gsm48_ho_cmd *) gh->data;
-	int arfcn;
-	struct gsm_bts *neigh;
-
-	switch (gh->msg_type) {
-	case GSM48_MT_RR_HANDO_CMD:
-		arfcn = (ho->cell_desc.arfcn_hi << 8) | ho->cell_desc.arfcn_lo;
-
-		/* look up trx. since every dummy bts uses different arfcn and
-		 * only one trx, it is simple */
-		llist_for_each_entry(neigh, &bsc_gsmnet->bts_list, list) {
-			if (neigh->c0->arfcn != arfcn)
-				continue;
-			ho_req_lchan = lchan;
-			return 0;
-		}
-		break;
-	case GSM48_MT_RR_ASS_CMD:
-		ho_req_lchan = lchan;
-		return 0;
-		break;
-	default:
-		fprintf(stderr, "Error, expecting HO or AS command\n");
-		return -EINVAL;
-	}
-
-	return -1;
-}
+static struct gsm_lchan *new_ho_req = NULL;
+static struct gsm_lchan *last_ho_req = NULL;
 
 /* send channel activation ack */
 static void send_chan_act_ack(struct gsm_lchan *lchan, int act)
@@ -683,6 +649,7 @@
 	int rc;
 	struct gsm_lchan *lchan = rsl_lchan_lookup(sign_link->trx, dh->chan_nr, &rc);
 	struct gsm_lchan *other_lchan;
+	struct gsm48_hdr *gh;
 
 	if (rc) {
 		fprintf(stderr, "rsl_lchan_lookup() failed\n");
@@ -726,9 +693,18 @@
 
 		break;
 	case RSL_MT_DATA_REQ:
-		rc = parse_ho_command(lchan, msg->l3h, msgb_l3len(msg));
-		if (rc == 0)
-			got_ho_req = 1;
+		gh = (struct gsm48_hdr*)msg->l3h;
+		switch (gh->msg_type) {
+		case GSM48_MT_RR_HANDO_CMD:
+		case GSM48_MT_RR_ASS_CMD:
+			if (new_ho_req) {
+				fprintf(stderr, "Test script is erratic: a handover is requested"
+					" while a previous handover request is still unhandled\n");
+				exit(1);
+			}
+			new_ho_req = lchan;
+			break;
+		}
 		break;
 	case RSL_MT_IPAC_CRCX:
 		break;
@@ -968,15 +944,17 @@
 	fprintf(stderr, "- Expecting handover/assignment request at %s\n",
 		gsm_lchan_name(lchan));
 
-	if (!got_ho_req) {
+	if (!new_ho_req) {
 		fprintf(stderr, "Test failed, because no handover was requested\n");
 		exit(1);
 	}
-	fprintf(stderr, " * Got handover/assignment request at %s\n", gsm_lchan_name(ho_req_lchan));
-	if (ho_req_lchan != lchan) {
+	fprintf(stderr, " * Got handover/assignment request at %s\n", gsm_lchan_name(new_ho_req));
+	if (new_ho_req != lchan) {
 		fprintf(stderr, "Test failed, because handover/assignment was not commanded on the expected lchan\n");
 		exit(1);
 	}
+	last_ho_req = new_ho_req;
+	new_ho_req = NULL;
 }
 
 DEFUN(expect_chan, expect_chan_cmd,
@@ -1005,10 +983,6 @@
 		fprintf(stderr, "Cannot ack handover/assignment, because no chan request\n");
 		exit(1);
 	}
-	if (!got_ho_req) {
-		fprintf(stderr, "Cannot ack handover/assignment, because no ho request\n");
-		exit(1);
-	}
 	send_ho_detect(last_chan_req);
 	return CMD_SUCCESS;
 }
@@ -1021,12 +995,12 @@
 		fprintf(stderr, "Cannot ack handover/assignment, because no chan request\n");
 		exit(1);
 	}
-	if (!got_ho_req) {
+	if (!last_ho_req) {
 		fprintf(stderr, "Cannot ack handover/assignment, because no ho request\n");
 		exit(1);
 	}
 	send_ho_complete(last_chan_req, true);
-	lchan_release_ack(ho_req_lchan);
+	lchan_release_ack(last_ho_req);
 	return CMD_SUCCESS;
 }
 
@@ -1056,8 +1030,11 @@
 		fprintf(stderr, "Cannot fail handover, because no chan request\n");
 		exit(1);
 	}
-	got_ho_req = 0;
-	send_ho_complete(ho_req_lchan, false);
+	if (!last_ho_req) {
+		fprintf(stderr, "Cannot fail handover, because no handover request\n");
+		exit(1);
+	}
+	send_ho_complete(last_ho_req, false);
 	lchan_release_ack(last_chan_req);
 	return CMD_SUCCESS;
 }
diff --git a/tests/handover/test_max_handovers.ho_vty b/tests/handover/test_max_handovers.ho_vty
index 31482d2..e5d9ef5 100644
--- a/tests/handover/test_max_handovers.ho_vty
+++ b/tests/handover/test_max_handovers.ho_vty
@@ -9,8 +9,10 @@
 set-ts-use trx 0 0 states * TCH/F TCH/F TCH/F - - - -
 meas-rep lchan 0 0 1 0 rxlev 0 rxqual 0 ta 0 neighbors 30
 expect-chan lchan 1 0 1 0
+expect-ho-req lchan 0 0 1 0
 meas-rep lchan 0 0 2 0 rxlev 0 rxqual 0 ta 0 neighbors 30
 expect-chan lchan 1 0 2 0
+expect-ho-req lchan 0 0 2 0
 meas-rep lchan 0 0 3 0 rxlev 0 rxqual 0 ta 0 neighbors 30
 expect-no-chan
 

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I0a664f24d7dd3d7b254b29675fdc49cd70a1a480
Gerrit-Change-Number: 21983
Gerrit-PatchSet: 3
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/20210111/87073cee/attachment.htm>


More information about the gerrit-log mailing list