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

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat May 25 15:33:58 UTC 2019


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


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

PCU: 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

Change-Id: I677f660b1076148b3317b08b06eb3d6551d9b577
---
M bts/BTS_Tests.ttcn
A bts/BTS_Tests_virtphy.ttcn
2 files changed, 126 insertions(+), 26 deletions(-)



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

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 12e1a3a..a555a83 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -36,6 +36,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
@@ -3134,7 +3135,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 +3176,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 +3197,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 +3277,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 +3286,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,24 +3346,6 @@
 	f_sleep(2.0);
 }
 
-testcase TC_pcu_data_req_pdtch() runs on test_CT {
-	f_init_pcu_test();
-
-	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);
-}
-
-testcase TC_pcu_data_req_ptcch() runs on test_CT {
-	f_init_pcu_test();
-
-	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);
-}
-
 /* Send AGCH from PCU; check it appears on Um side */
 testcase TC_pcu_data_req_agch() runs on test_CT {
 	timer T := 3.0;
@@ -4986,8 +4969,6 @@
 		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() );
 		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
new file mode 100644
index 0000000..f340574
--- /dev/null
+++ b/bts/BTS_Tests_virtphy.ttcn
@@ -0,0 +1,119 @@
+module BTS_Tests_virtphy {
+
+/* Integration Tests for OsmoBTS
+ * (C) 2019 by Harald Welte <laforge at gnumonks.org>
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * This test suite tests the PCU interface related functionality of
+ * OsmoBTS by attaching to the PCU socket and emulation a PCU, while
+ * also attaching to A-bis RSL and to L1CTL provided by virtphy.
+ *
+ * Contrary to other BTS tests which use trxcon + fake_trx, these
+ * tests currently still require virtphy (and hence osmo-bts-virtual),
+ * as trxcon doesn't yet implement the GPRS/TBF related L1CTL primitives.
+ */
+
+import from Misc_Helpers all;
+import from General_Types all;
+import from Osmocom_Types all;
+import from GSM_Types all;
+import from L1CTL_PortType all;
+import from L1CTL_Types all;
+import from LAPDm_Types all;
+import from IPA_Emulation all;
+import from LAPDm_RAW_PT all;
+import from PCUIF_Types all;
+
+import from RSL_Types all;
+
+import from Osmocom_VTY_Functions all;
+
+import from BTS_Tests all;
+
+
+/***********************************************************************
+ * PCU related tests using virtphy instead of L1CTL
+ ***********************************************************************/
+
+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();
+}
+
+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_disable_dynamic_ts();
+	f_init_l1ctl();
+	f_l1_tune(L1CTL);
+
+	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, 7, PCU_IF_SAPI_PDTCH, data); //c_PCU_DATA);
+}
+
+testcase TC_pcu_data_req_ptcch() runs on test_CT {
+	var TfiUsfArr tua := f_TfiUsfArrInit();
+	var octetstring data := '0000'O & f_rnd_octstring(21);
+
+	f_disable_dynamic_ts();
+	f_init_l1ctl();
+	f_l1_tune(L1CTL);
+
+	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, 7, PCU_IF_SAPI_PTCCH, data);
+}
+
+
+
+control {
+	if (mp_pcu_socket != "") {
+		execute( TC_pcu_data_req_pdtch() );
+		execute( TC_pcu_data_req_ptcch() );
+	} else {
+		log("PCU socket path not available, skipping PCU tests");
+	}
+
+}
+
+
+}

-- 
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: newchange
Gerrit-Change-Id: I677f660b1076148b3317b08b06eb3d6551d9b577
Gerrit-Change-Number: 14183
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/20190525/44d7e633/attachment.html>


More information about the gerrit-log mailing list