Change in ...osmo-ttcn3-hacks[master]: PCU_Tests_RAW.ttcn: initial version of component RAW_PCU_BTS_CT

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Thu Sep 5 22:30:31 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15430


Change subject: PCU_Tests_RAW.ttcn: initial version of component RAW_PCU_BTS_CT
......................................................................

PCU_Tests_RAW.ttcn: initial version of component RAW_PCU_BTS_CT

The purpose of RAW_PCU_BTS_CT is to emulate the BTS by sending
TDMA frame clock and RTS (Ready To Send) indications, so that
we can build new test cases on top of it, and move both
osmo-bts-virtual and virt_phy out of the scope of IUT.

== Current state

  - After creation, the component starts a listening UNIX socket
    and waits for a connection from OsmoPCU.
  - As soon as OsmoPCU is connected, we wait for the TXT.ind with
    its version, and respond with INFO.ind (SI13).
  - After sending the INFO.ind, we start TDMA clock timer that
    triggers transmission of TIME.ind messages at the beginning
    of every MAC block.

== What's missing?

  - TDMA clock timer generates tons of logging messages, so
    we probably want to move it into a separate component.
  - Sending of RTS indications for free DL blocks.
  - We may need to handle OsmoPCU disconnection.

Change-Id: I63a23abebab88fd5318eb4d907d6028e7c38e9a3
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 84 insertions(+), 0 deletions(-)



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

diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index dcd1f96..c3537d4 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -477,6 +477,89 @@
 	}
 }
 
+type enumerated pcu_if_state {
+	/* Server started, waiting for connection from the BTS */
+	PCU_IF_ST_INIT,
+	/* The BTS is connected and wants TIME.ind / RTS.ind from us */
+	PCU_IF_ST_CONNECTED
+}
+
+type component RAW_PCU_BTS_CT {
+	/* TDMA frame clock generator. One TDMA frame is 4.615 ms long */
+	timer T_TDMAClock := 4.615 / 1000.0;
+	var integer tdma_abs_fn := 0;
+	var integer tdma_rel_fn := 0;
+
+	/* PCU interface (UNIX domain socket) */
+	var pcu_if_state g_pcu_conn_state := PCU_IF_ST_INIT;
+	var ConnectionId g_pcu_conn_id := -1;
+	port PCUIF_CODEC_PT PCU;
+}
+
+private function f_bts_ct_handler(integer bts_nr, charstring pcu_sock_path)
+runs on RAW_PCU_BTS_CT {
+	/* Port mappings */
+	map(self:PCU, system:PCU);
+
+	/* Init the Unix Domain Socket */
+	log("Init PCU interface on '" & pcu_sock_path & "'");
+	g_pcu_conn_id := f_pcuif_listen(PCU, pcu_sock_path);
+	PCU.receive(UD_connected:?);
+
+	alt {
+	/* Wait for PCU_VERSION and return INFO_IND */
+	[g_pcu_conn_state == PCU_IF_ST_INIT] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_TXT_IND(0, PCU_VERSION, ?))) {
+		log("OsmoPCU is now connected, sending INFO.ind");
+		g_pcu_conn_state := PCU_IF_ST_CONNECTED;
+
+		/* FIXME: make sure to use parameters from mp_gb_cfg.cell_id in the PCU INFO IND */
+		PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_INFO_IND(
+			bts_nr := bts_nr, nsei := mp_nsconfig.nsei,
+			nsvci := mp_nsconfig.nsvci, bvci := mp_gb_cfg.bvci,
+			local_port := mp_nsconfig.remote_udp_port,
+			remote_port := mp_nsconfig.local_udp_port,
+			remote_ip := f_inet_haddr(mp_nsconfig.local_ip))));
+
+		/* Start TDMA clock timer */
+		T_TDMAClock.start;
+		repeat;
+		}
+	/* TODO: separate component for the clock module */
+	[g_pcu_conn_state == PCU_IF_ST_CONNECTED] T_TDMAClock.timeout {
+		/* We don't really need to send every frame to OsmoPCU, because
+		 * it omits frame numbers not starting at a MAC block. */
+		if (tdma_rel_fn == 0 or tdma_rel_fn == 4 or tdma_rel_fn == 8) {
+			// log("Sending clock indication fn=", tdma_abs_fn);
+			PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TIME_IND(bts_nr, tdma_abs_fn)));
+		}
+
+		/* TDMA hyperframe period is (2048 * 51 * 26) frames */
+		if (tdma_abs_fn == (2048 * 51 * 26)) {
+			tdma_abs_fn := 0;
+			tdma_rel_fn := 0;
+		} else {
+			tdma_abs_fn := tdma_abs_fn + 1;
+			tdma_rel_fn := tdma_abs_fn mod 13;
+		}
+
+		/* Keep it going */
+		T_TDMAClock.start;
+		repeat;
+		}
+	}
+}
+
+testcase TC_bts_ct_tuwat() runs on RAW_Test_CT {
+	var RAW_PCU_BTS_CT vc_EUSE;
+
+	/* Init NS codec (emulate SGSN) */
+	f_init_ns_codec();
+
+	vc_EUSE := RAW_PCU_BTS_CT.create("BTS-" & testcasename());
+	vc_EUSE.start(f_bts_ct_handler(0, mp_pcu_sock_path));
+	vc_EUSE.done;
+}
+
 control {
 	execute( TC_ns_reset() );
 	execute( TC_ns_reset_retrans() );
@@ -491,6 +574,7 @@
 
 	/* Timing Advance tests (see GSM TS 43.064, section 6) */
 	execute( TC_ta_init_prach() );
+	execute( TC_bts_ct_tuwat() );
 }
 
 

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I63a23abebab88fd5318eb4d907d6028e7c38e9a3
Gerrit-Change-Number: 15430
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190905/ce20dd54/attachment.htm>


More information about the gerrit-log mailing list