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

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun May 26 10:59:47 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/14190


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

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 moving them to BTS_Tests_virtphy, we can finally add that
missing part.

Change-Id: Ie05d6b1530bd4d4cf4eaa574b068870682439ee4
Related: OS#4023
---
M bts/BTS_Tests.ttcn
M bts/BTS_Tests_virtphy.ttcn
2 files changed, 81 insertions(+), 48 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/90/14190/1

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index a555a83..f4f828f 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -3307,45 +3307,6 @@
 	}
 }
 
-/* Send DATA.req on invalid BTS */
-testcase TC_pcu_data_req_wrong_bts() runs on test_CT {
-	f_init_pcu_test();
-
-	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);
-}
-
-/* Send DATA.req on invalid TRX */
-testcase TC_pcu_data_req_wrong_trx() runs on test_CT {
-	f_init_pcu_test();
-
-	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);
-}
-
-/* Send DATA.req on invalid timeslot */
-testcase TC_pcu_data_req_wrong_ts() runs on test_CT {
-	f_init_pcu_test();
-
-	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);
-}
-
-/* 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();
-
-	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);
-}
-
 /* Send AGCH from PCU; check it appears on Um side */
 testcase TC_pcu_data_req_agch() runs on test_CT {
 	timer T := 3.0;
@@ -4965,10 +4926,6 @@
 		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() );
 		execute( TC_pcu_data_req_agch() );
 		execute( TC_pcu_data_req_imm_ass_pch() );
 		execute( TC_pcu_rach_content() );
diff --git a/bts/BTS_Tests_virtphy.ttcn b/bts/BTS_Tests_virtphy.ttcn
index fd82d6e..33b37e0 100644
--- a/bts/BTS_Tests_virtphy.ttcn
+++ b/bts/BTS_Tests_virtphy.ttcn
@@ -39,25 +39,37 @@
  ***********************************************************************/
 
 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);
+		}
 	}
 }
 
@@ -105,12 +117,76 @@
 	f_pcu_to_l1(0, 0, 7, PCU_IF_SAPI_PTCCH, data);
 }
 
+/* Send DATA.req on invalid BTS */
+testcase TC_pcu_data_req_wrong_bts() runs on test_CT {
+	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_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 {
+	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_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 {
+	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_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 {
+	var TfiUsfArr tua := f_TfiUsfArrInit();
+	var octetstring data := '0000'O & f_rnd_octstring(21);
+
+	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);
+}
+
+
 
 
 control {
 	if (mp_pcu_socket != "") {
 		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() );
 	} else {
 		log("PCU socket path not available, skipping PCU tests");
 	}

-- 
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: newchange
Gerrit-Change-Id: Ie05d6b1530bd4d4cf4eaa574b068870682439ee4
Gerrit-Change-Number: 14190
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190526/9d9801b9/attachment.html>


More information about the gerrit-log mailing list