Change in osmo-bsc[master]: handover_test: also show when an lchan is busy

neels gerrit-no-reply at lists.osmocom.org
Thu Jul 15 09:28:19 UTC 2021


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

Change subject: handover_test: also show when an lchan is busy
......................................................................

handover_test: also show when an lchan is busy

In expect-ts-use, indicate a busy lchan with letter '!'.

The code is a bit complex because of the choice made earlier to show two
TCH/H subslots as "TCH/HH", "TCH/H-" or "TCH/-H" depending on the
subslot states:
- show "-" as a shorthand for "all subslots UNUSED"
- show a "TCH/" prefix only when there is any "H" or "F" following, i.e.
  when any subslot is actually established
- if a subslot is busy (any other state besides ESTABLISHED and UNUSED),
  indicate the subslot as '!'.

The spectrum of reported state strings for TCH/F is:

 TCH/F  !  -

For TCH/H:

 TCH/HH TCH/H- TCH/-H TCH/H! TCH/!H !- -! -

The only current test affected is test_penalty_timer.ho_vty, where a
failed handover leaves an lchan in LCHAN_ST_WAIT_AFTER_ERROR. Adjust
that test.

Rationale: I will soon add tests to verify the accurate timeout of a
handover2 penalty timer. While implementing, I noticed that immediate
retry of the handover ends up in timeslot 2, because timeslot 1 is still
in WAIT_AFTER_ERROR. Instead of working around that, I would like to
explicitly show the error state in the test -- it is an important
aspect.

Related: SYS#5198
Change-Id: I735ce7e2c3e0e450d3f76047d7e47691fe889cad
---
M tests/handover/handover_test.c
M tests/handover/test_penalty_timer.ho_vty
2 files changed, 33 insertions(+), 13 deletions(-)

Approvals:
  neels: Looks good to me, approved
  daniel: Looks good to me, but someone else must approve
  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 2c97f78..60a31be 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -287,6 +287,34 @@
 	return bts;
 }
 
+char *lchans_use_str(struct gsm_bts_trx_ts *ts, const char *established_prefix, char established_char)
+{
+	char state_chars[8] = { 0 };
+	struct gsm_lchan *lchan;
+	bool any_lchans_established = false;
+	bool any_lchans_in_use = false;
+	ts_for_n_lchans(lchan, ts, ts->max_primary_lchans) {
+		char state_char;
+		if (lchan_state_is(lchan, LCHAN_ST_UNUSED)) {
+			state_char = '-';
+		} else {
+			any_lchans_in_use = true;
+			if (lchan_state_is(lchan, LCHAN_ST_ESTABLISHED)) {
+				any_lchans_established = true;
+				state_char = established_char;
+			} else {
+				state_char = '!';
+			}
+		}
+		state_chars[lchan->nr] = state_char;
+	}
+	if (!any_lchans_in_use)
+		return "-";
+	if (!any_lchans_established)
+		established_prefix = "";
+	return talloc_asprintf(OTC_SELECT, "%s%s", established_prefix, state_chars);
+}
+
 const char *ts_use_str(struct gsm_bts_trx_ts *ts)
 {
 	switch (ts->pchan_is) {
@@ -297,20 +325,10 @@
 		return "-";
 
 	case GSM_PCHAN_TCH_F:
-		if (lchan_state_is(&ts->lchan[0], LCHAN_ST_ESTABLISHED))
-			return "TCH/F";
-		else
-			return "-";
+		return lchans_use_str(ts, "TCH/", 'F');
 
 	case GSM_PCHAN_TCH_H:
-		if (lchan_state_is(&ts->lchan[0], LCHAN_ST_ESTABLISHED)
-		    && lchan_state_is(&ts->lchan[1], LCHAN_ST_ESTABLISHED))
-			return "TCH/HH";
-		if (lchan_state_is(&ts->lchan[0], LCHAN_ST_ESTABLISHED))
-			return "TCH/H-";
-		if (lchan_state_is(&ts->lchan[1], LCHAN_ST_ESTABLISHED))
-			return "TCH/-H";
-		return "-";
+		return lchans_use_str(ts, "TCH/", 'H');
 
 	default:
 		return gsm_pchan_name(ts->pchan_is);
diff --git a/tests/handover/test_penalty_timer.ho_vty b/tests/handover/test_penalty_timer.ho_vty
index 7528a0f..22b9a95 100644
--- a/tests/handover/test_penalty_timer.ho_vty
+++ b/tests/handover/test_penalty_timer.ho_vty
@@ -9,7 +9,9 @@
 expect-chan lchan 1 0 1 0
 expect-ho-cmd lchan 0 0 1 0
 ho-failed
+# first BTS still services the call:
 expect-ts-use trx 0 0 states * TCH/F - - - - - -
-expect-ts-use trx 1 0 states * - - - - - - -
+# lchan 1 0 1 0 is in LCHAN_ST_WAIT_AFTER_ERROR because the handover failed:
+expect-ts-use trx 1 0 states * !     - - - - - -
 meas-rep lchan 0 0 1 0 rxlev 20 rxqual 0 ta 0 neighbors 30
 expect-no-chan

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I735ce7e2c3e0e450d3f76047d7e47691fe889cad
Gerrit-Change-Number: 24931
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
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/20210715/57294a13/attachment.htm>


More information about the gerrit-log mailing list