Change in ...osmo-ttcn3-hacks[master]: bts: Factor out mobile-originated LAPDm establishment

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Jun 2 21:26:48 UTC 2019


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


Change subject: bts: Factor out mobile-originated LAPDm establishment
......................................................................

bts: Factor out mobile-originated LAPDm establishment

which avoids us to have to copy+pate this between several test cases.

Change-Id: I8da753bb3d809ec09f9380bb4bac666ceaf61f00
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 29 insertions(+), 24 deletions(-)



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

diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index b98ef80..6ba0968 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -292,6 +292,31 @@
 	f_lapdm_exit();
 }
 
+/* Mobile-Originated LAPDm establishment on given Link ID */
+private function f_establish_mo(RslLinkId link_id) runs on ConnHdlr
+{
+	var integer sapi := link_id.sapi;
+	var boolean is_sacch := false;
+	if (link_id.c == SACCH) {
+		is_sacch := true;
+	}
+
+	var octetstring l3_mo := f_rnd_octstring(5);
+
+	/* MO Establish Request via LADPm: SAPI = 0, C = 0, P = 1, M = 0, 0 ≤ L ≤ N201.. */
+	if (is_sacch) {
+		/* no payload permitted, as this is not contention resolution */
+		l3_mo := ''O;
+		LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
+		RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id));
+	} else {
+		LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
+		RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
+	}
+	/* UA: SAPI = 0, R = 0, F = 1, M = 0, L = L of SABM. */
+	LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, l3:=l3_mo)));
+}
+
 /* Verify that the BTS is re-transmitting SABM messages after T200 timeout, inspired
    by 3GPP TS 51.010-1 25.2.1.1.2.1 + 25.2.1.2.4 */
 private function f_TC_sabm_retransmit_bts(charstring id) runs on ConnHdlr {
@@ -549,11 +574,7 @@
 	RSL.clear;
 	LAPDM.clear;
 
-	/* MO Establish Request via LADPm: SAPI = 0, C = 0, P = 1, M = 0, 0 ≤ L ≤ N201.. */
-	LAPDM.send(t_PH_DATA(0, false, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=true, l3:=l3)));
-	RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3));
-	/* UA: SAPI = 0, R = 0, F = 1, M = 0, L = L of SABM. */
-	LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, l3:=l3)));
+	f_establish_mo(link_id);
 
 	var integer last_ns_rx := 0;
 
@@ -806,22 +827,9 @@
 	RSL.clear;
 	LAPDM.clear;
 
-	var octetstring l3_mo := f_rnd_octstring(5);
+	f_establish_mo(link_id);
 
-	/* MO Establish Request via LADPm: SAPI = 0, C = 0, P = 1, M = 0, 0 ≤ L ≤ N201.. */
-	if (is_sacch) {
-		/* no payload permitted, as this is not contention resolution */
-		l3_mo := ''O;
-		LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
-		RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id));
-	} else {
-		LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
-		RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
-	}
-	/* UA: SAPI = 0, R = 0, F = 1, M = 0, L = L of SABM. */
-	LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, l3:=l3_mo)));
-
-	l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS);
+	var octetstring l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS);
 
 	deactivate(d);
 
@@ -884,10 +892,7 @@
 	RSL.clear;
 	LAPDM.clear;
 
-	var octetstring l3_mo := f_rnd_octstring(20);
-	LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
-	RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
-	LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, l3:=l3_mo)));
+	f_establish_mo(link_id);
 
 	var octetstring l3_mt := f_rnd_octstring(20);
 	RSL.send(ts_RSL_DATA_REQ(g_chan_nr, link_id, l3_mt));

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14348
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: I8da753bb3d809ec09f9380bb4bac666ceaf61f00
Gerrit-Change-Number: 14348
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190602/5e1313f2/attachment.html>


More information about the gerrit-log mailing list