Change in osmo-ttcn3-hacks[master]: bts: Fully implement TC_pcu_data_req_{pdtch, ptcch}

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/14183 )

Change subject: bts: Fully implement TC_pcu_data_req_{pdtch,ptcch}
......................................................................

bts: Fully implement TC_pcu_data_req_{pdtch,ptcch}

As trxcon+fake_trx don't have GPRS (TBF) support yet, we cannot do
any PCU related tests involving the Um interface yet.  Instead, let's
use virtphy to fill that gap.  Using virtphy, we can actually
receive/transmit GPRS blocks on the simulated Um interface.

TC_pcu_data_req_{pdtch,ptcch} are moved to a new test suite
"BTS_Tests_virtphy.ttcn" which should symbolize that the related tests
are to be executed with osmo-bts-virtual + virtphy instead of
osmo-bts-trx + fake_trx + trxcon.

You also have to set the following module parameter to make this work:
	BTS_Tests.mp_bts_trxc_port := -1

Related: OS#4023
Change-Id: I677f660b1076148b3317b08b06eb3d6551d9b577
---
M bts/BTS_Tests.ttcn
1 file changed, 71 insertions(+), 16 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 12e1a3a..e56e033 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -10,6 +10,7 @@
 import from L1CTL_PortType all;
 import from L1CTL_Types all;
 import from LAPDm_Types all;
+import from LAPDm_RAW_PT all;
 import from Osmocom_CTRL_Adapter all;
 import from Osmocom_CTRL_Functions all;
 
@@ -36,6 +37,7 @@
 import from TELNETasp_PortType all;
 
 friend module BTS_Tests_SMSCB;
+friend module BTS_Tests_virtphy;
 
 /* The tests assume a BTS with the following timeslot configuration:
  * TS0 : Combined CCCH + SDCCH/4
@@ -70,6 +72,8 @@
 	/* Time to wait for RSL conn from BTS during startup of test */
 	float mp_ipa_up_timeout := 15.0;
 	float mp_ipa_up_delay := 0.0;
+	/* false for now, as only virtphy supports it, not calypso-l1 nor trxcon */
+	boolean mp_l1_supports_gprs := false;
 }
 
 type record of RslChannelNr ChannelNrs;
@@ -3134,7 +3138,7 @@
  ***********************************************************************/
 
 /* Verify no RTS before ACT_REQ; verify RTS after ACT_REQ */
-private function f_TC_pcu_act_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, boolean exp_success)
+friend function f_TC_pcu_act_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, boolean exp_success)
 runs on test_CT {
 	timer T := 3.0;
 
@@ -3175,7 +3179,7 @@
 }
 
 /* verify no more RTS after DEACT_REQ */
-private function f_TC_pcu_deact_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr)
+friend function f_TC_pcu_deact_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr)
 runs on test_CT {
 	timer T := 3.0;
 
@@ -3196,7 +3200,7 @@
 	}
 }
 
-private function f_init_pcu_test() runs on test_CT {
+friend function f_init_pcu_test() runs on test_CT {
 	f_init();
 	PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_VERSION, testcasename())));
 }
@@ -3276,7 +3280,7 @@
 private const octetstring c_PCU_DATA := '000102030405060708090a0b0c0d0e0f10111213141516'O;
 
 /* helper function to send a PCU DATA.req */
-private function f_pcu_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
+friend function f_pcu_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
 				uint8_t block_nr, uint32_t fn, PCUIF_Sapi sapi, octetstring data)
 runs on test_CT
 {
@@ -3285,8 +3289,8 @@
 }
 
 /* helper function to wait for RTS.ind for given SAPI on given BTS/TRX/TS and then send */
-private function f_pcu_wait_rts_and_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
-					     PCUIF_Sapi sapi, octetstring data)
+friend function f_pcu_wait_rts_and_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
+					    PCUIF_Sapi sapi, octetstring data)
 runs on test_CT
 {
 	var PCUIF_send_data sd;
@@ -3345,22 +3349,71 @@
 	f_sleep(2.0);
 }
 
-testcase TC_pcu_data_req_pdtch() runs on test_CT {
+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
+{
+	timer T := 5.0;
+
+	PCU.clear;
+	f_pcu_wait_rts_and_data_req(bts_nr, trx_nr, ts_nr, sapi, data);
+
+	T.start;
+	alt {
+	[] 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);
+		}
+	[] L1CTL.receive {
+		repeat;
+		}
+	[] T.timeout {
+		setverdict(fail, "Timeout waiting for ", data);
+		}
+	}
+}
+
+private function f_disable_dynamic_ts() runs on test_CT
+{
+	f_init_vty_bsc();
+	/* I'm not quite sure why we need this with osmo-bts-virtual.  Somehow it deosn't seem to
+	 * support dynamic timeslots?  But it uses the same scheduler as osmo-bts-trx ?!? */
+	f_vty_config2(BSCVTY, {"network", "bts 0", "trx 0", "timeslot 3"}, "phys_chan_config TCH/F");
+	f_vty_config2(BSCVTY, {"network", "bts 0", "trx 0", "timeslot 4"}, "phys_chan_config TCH/F");
 	f_init_pcu_test();
+}
+
+private function f_virtphy_common() runs on test_CT {
+	f_disable_dynamic_ts();
+	f_init_l1ctl();
+	f_l1_tune(L1CTL);
+}
+
+testcase TC_pcu_data_req_pdtch() 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_pcu_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
-	/* FIXME: how to check this was actually sent */
-	f_sleep(2.0);
+	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); //c_PCU_DATA);
 }
 
 testcase TC_pcu_data_req_ptcch() 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_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PTCCH, c_PCU_DATA);
-	/* FIXME: how to check this was actually sent */
-	f_sleep(2.0);
+	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_PTCCH, data);
 }
 
 /* Send AGCH from PCU; check it appears on Um side */
@@ -4986,8 +5039,10 @@
 		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_pdtch() );
-		execute( TC_pcu_data_req_ptcch() );
+		if (mp_l1_supports_gprs) {
+			execute( TC_pcu_data_req_pdtch() );
+			execute( TC_pcu_data_req_ptcch() );
+		}
 		execute( TC_pcu_data_req_agch() );
 		execute( TC_pcu_data_req_imm_ass_pch() );
 		execute( TC_pcu_rach_content() );

-- 
To view, visit https://gerrit.osmocom.org/14183
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: I677f660b1076148b3317b08b06eb3d6551d9b577
Gerrit-Change-Number: 14183
Gerrit-PatchSet: 5
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/2c78146d/attachment.html>


More information about the gerrit-log mailing list