Change in osmo-ttcn3-hacks[master]: bts: Fully implement TC_pcu_data_req_{wrong_{bts, trx, ts}, ts_inactive}()

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon May 27 10:00:07 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/14190 )

Change subject: bts: Fully implement TC_pcu_data_req_{wrong_{bts,trx,ts},ts_inactive}()
......................................................................

bts: Fully implement TC_pcu_data_req_{wrong_{bts,trx,ts},ts_inactive}()

The four existing test in BTS_Tests.ttcn so far didn't have any chance
to verify if the invalid messages actually ended up on the air interface
or not.  By using virtphy instead of trxcon, we can finally add that missing part.

Change-Id: Ie05d6b1530bd4d4cf4eaa574b068870682439ee4
Related: OS#4023
---
M bts/BTS_Tests.ttcn
1 file changed, 57 insertions(+), 25 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index e56e033..2b22ac4 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -3312,63 +3312,95 @@
 
 /* Send DATA.req on invalid BTS */
 testcase TC_pcu_data_req_wrong_bts() runs on test_CT {
-	f_init_pcu_test();
+	var TfiUsfArr tua := f_TfiUsfArrInit();
+	var octetstring data := '0000'O & f_rnd_octstring(21);
+
+	f_virtphy_common();
 
 	f_TC_pcu_act_req(0, 0, 7, true);
-	f_pcu_data_req(23, 0, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
-	/* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
-	f_sleep(10.0);
+	f_TfiUsfArrSet(tua, 7, 0);
+	f_L1CTL_TBF_CFG(L1CTL, false, tua);
+	f_sleep(1.0);
+
+	f_pcu_to_l1(23, 0, 7, PCU_IF_SAPI_PDTCH, data, false, false);
 }
 
 /* Send DATA.req on invalid TRX */
 testcase TC_pcu_data_req_wrong_trx() runs on test_CT {
-	f_init_pcu_test();
+	var TfiUsfArr tua := f_TfiUsfArrInit();
+	var octetstring data := '0000'O & f_rnd_octstring(21);
+
+	f_virtphy_common();
 
 	f_TC_pcu_act_req(0, 0, 7, true);
-	f_pcu_data_req(0, 100, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
-	/* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
-	f_sleep(10.0);
+	f_TfiUsfArrSet(tua, 7, 0);
+	f_L1CTL_TBF_CFG(L1CTL, false, tua);
+	f_sleep(1.0);
+
+	f_pcu_to_l1(0, 100, 7, PCU_IF_SAPI_PDTCH, data, false, false);
 }
 
 /* Send DATA.req on invalid timeslot */
 testcase TC_pcu_data_req_wrong_ts() runs on test_CT {
-	f_init_pcu_test();
+	var TfiUsfArr tua := f_TfiUsfArrInit();
+	var octetstring data := '0000'O & f_rnd_octstring(21);
+
+	f_virtphy_common();
 
 	f_TC_pcu_act_req(0, 0, 7, true);
-	f_pcu_data_req(0, 0, 70, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
-	/* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
-	f_sleep(10.0);
+	f_TfiUsfArrSet(tua, 7, 0);
+	f_L1CTL_TBF_CFG(L1CTL, false, tua);
+	f_sleep(1.0);
+
+	f_pcu_to_l1(0, 0, 70, PCU_IF_SAPI_PDTCH, data, false, false);
 }
 
 /* Send DATA.req on timeslot that hasn't been activated */
 testcase TC_pcu_data_req_ts_inactive() runs on test_CT {
-	f_init_pcu_test();
+	var TfiUsfArr tua := f_TfiUsfArrInit();
+	var octetstring data := '0000'O & f_rnd_octstring(21);
 
-	f_pcu_data_req(0, 0, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
-	/* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
-	f_sleep(2.0);
+	f_virtphy_common();
+
+	f_TfiUsfArrSet(tua, 7, 0);
+	f_L1CTL_TBF_CFG(L1CTL, false, tua);
+	f_sleep(1.0);
+
+	f_pcu_to_l1(0, 0, 7, PCU_IF_SAPI_PDTCH, data, false, false);
 }
 
 private function f_pcu_to_l1(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
-			     PCUIF_Sapi sapi, octetstring data) runs on test_CT
-{
+			     PCUIF_Sapi sapi, octetstring data, boolean expect_data := true,
+			     boolean wait_rts := true)
+runs on test_CT {
 	timer T := 5.0;
+	var L1ctlDlMessage rx_dl;
 
 	PCU.clear;
-	f_pcu_wait_rts_and_data_req(bts_nr, trx_nr, ts_nr, sapi, data);
+	if (wait_rts) {
+		f_pcu_wait_rts_and_data_req(bts_nr, trx_nr, ts_nr, sapi, data);
+	} else {
+		f_pcu_data_req(bts_nr, trx_nr, ts_nr, 0, 0, sapi, data);
+	}
 
 	T.start;
 	alt {
-	[] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PDCH(ts_nr), ?, data)) {
+	[expect_data] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PDCH(ts_nr), ?, data)) {
 		/* FIXME: why is fn of DATA_IND different to fn of RTS / DATA_REQ above? */
 		setverdict(pass);
 		}
+	[not expect_data] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PDCH(ts_nr), ?, data)) -> value rx_dl {
+		setverdict(fail, "Received unexpected ", rx_dl);
+		}
 	[] L1CTL.receive {
 		repeat;
 		}
-	[] T.timeout {
+	[expect_data] T.timeout {
 		setverdict(fail, "Timeout waiting for ", data);
 		}
+	[not expect_data] T.timeout {
+		setverdict(pass);
+		}
 	}
 }
 
@@ -5035,13 +5067,13 @@
 		execute( TC_pcu_deact_req() );
 		execute( TC_pcu_deact_req_wrong_ts() );
 		execute( TC_pcu_ver_si13() );
-		execute( TC_pcu_data_req_wrong_bts() );
-		execute( TC_pcu_data_req_wrong_trx() );
-		execute( TC_pcu_data_req_wrong_ts() );
-		execute( TC_pcu_data_req_ts_inactive() );
 		if (mp_l1_supports_gprs) {
 			execute( TC_pcu_data_req_pdtch() );
 			execute( TC_pcu_data_req_ptcch() );
+			execute( TC_pcu_data_req_wrong_bts() );
+			execute( TC_pcu_data_req_wrong_trx() );
+			execute( TC_pcu_data_req_wrong_ts() );
+			execute( TC_pcu_data_req_ts_inactive() );
 		}
 		execute( TC_pcu_data_req_agch() );
 		execute( TC_pcu_data_req_imm_ass_pch() );

-- 
To view, visit https://gerrit.osmocom.org/14190
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie05d6b1530bd4d4cf4eaa574b068870682439ee4
Gerrit-Change-Number: 14190
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190527/29e70022/attachment.html>


More information about the gerrit-log mailing list