[PATCH] osmo-ttcn3-hacks[master]: msc: generate mobile identity inside f_establish_fully()

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Apr 9 18:15:58 UTC 2018


Review at  https://gerrit.osmocom.org/7697

msc: generate mobile identity inside f_establish_fully()

This reduces the code duplication in every caller of the function.

Change-Id: Iaa071b131a8ff372d70677c8622d227f88e9ea53
---
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 20 insertions(+), 32 deletions(-)


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

diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 62eddf3..73368a2 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -190,9 +190,18 @@
 };
 
 /* helper function to fully establish a dedicated channel */
-function f_establish_fully(MobileIdentityLV mi, EstablishType etype := EST_TYPE_MO_CALL)
+function f_establish_fully(EstablishType etype := EST_TYPE_MO_CALL)
 runs on BSC_ConnHdlr {
 	var PDU_ML3_MS_NW l3_info;
+	var MobileIdentityLV mi;
+
+	/* If we have a TMSI, use TMSI instead of IMSI */
+	if (ispresent(g_pars.tmsi)) {
+		mi := valueof(ts_MI_TMSI_LV(g_pars.tmsi));
+	} else {
+		mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
+	}
+
 	select (etype) {
 	case (EST_TYPE_MO_CALL) {
 		l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
@@ -408,7 +417,6 @@
 function f_mt_call_establish(inout CallParameters cpars)
 runs on BSC_ConnHdlr {
 
-	var MobileIdentityLV mi;
 	var MNCC_PDU mncc;
 	var MgcpCommand mgcp_cmd;
 
@@ -421,13 +429,7 @@
 	/* BSC <- MSC: Expect paging. FIXME: By TMSI or not? */
 	BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi));
 
-	/* If we have a TMSI, use TMSI instead of IMSI */
-	if (ispresent(g_pars.tmsi)) {
-		mi := valueof(ts_MI_TMSI_LV(g_pars.tmsi));
-	} else {
-		mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
-	}
-	f_establish_fully(mi, EST_TYPE_PAG_RESP);
+	f_establish_fully(EST_TYPE_PAG_RESP);
 
 	/* MS <- MSC: Expect CC SETUP */
 	BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_SETUP(cpars.transaction_id, *, cpars.called_party)));
@@ -498,21 +500,14 @@
 function f_mo_call_establish(inout CallParameters cpars)
 runs on BSC_ConnHdlr {
 
-	var MobileIdentityLV mi;
 	var MNCC_PDU mncc;
 	var MgcpCommand mgcp_cmd;
 	var boolean respond_to_dlcx;
 
-	/* If we have a TMSI, use TMSI instead of IMSI */
-	if (ispresent(g_pars.tmsi)) {
-		mi := valueof(ts_MI_TMSI_LV(g_pars.tmsi));
-	} else {
-		mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
-	}
 	if (cpars.emergency) {
-		f_establish_fully(mi, EST_TYPE_EMERG_CALL);
+		f_establish_fully(EST_TYPE_EMERG_CALL);
 	} else {
-		f_establish_fully(mi, EST_TYPE_MO_CALL);
+		f_establish_fully(EST_TYPE_MO_CALL);
 	}
 
 	/* Create MNCC and MGCP expect */
@@ -664,18 +659,11 @@
 runs on BSC_ConnHdlr {
 
 	timer T := 1.0;
-	var MobileIdentityLV mi;
 	var MNCC_PDU mncc;
 	var MgcpCommand mgcp_cmd;
 	var template PDU_ML3_MS_NW dtmf_dtap;
 
-	/* If we have a TMSI, use TMSI instead of IMSI */
-	if (ispresent(g_pars.tmsi)) {
-		mi := valueof(ts_MI_TMSI_LV(g_pars.tmsi));
-	} else {
-		mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
-	}
-	f_establish_fully(mi);
+	f_establish_fully();
 
 	/* Create MNCC and MGCP expect */
 	f_create_mncc_expect(hex2str(cpars.called_party));
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 6ec08bb..503f98b 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1137,7 +1137,7 @@
 
 	f_perform_lu();
 
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+	f_establish_fully();
 	f_expect_clear();
 }
 testcase TC_establish_and_nothing() runs on MTC_CT {
@@ -1156,7 +1156,7 @@
 
 	f_perform_lu();
 
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+	f_establish_fully();
 	f_create_mncc_expect(hex2str(cpars.called_party));
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1181,7 +1181,7 @@
 
 	f_perform_lu();
 
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+	f_establish_fully();
 	f_create_mncc_expect(hex2str(cpars.called_party));
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1220,7 +1220,7 @@
 
 	f_perform_lu();
 
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+	f_establish_fully();
 	f_create_mncc_expect(hex2str(cpars.called_party));
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1312,7 +1312,7 @@
 	/* MSC->BSC: expect PAGING from MSC */
 	BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi));
 	/* MS -> MSC: PAGING RESPONSE */
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)), EST_TYPE_PAG_RESP);
+	f_establish_fully(EST_TYPE_PAG_RESP);
 
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1737,7 +1737,7 @@
 
 	f_perform_lu();
 
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+	f_establish_fully();
 	f_create_mncc_expect(hex2str(cpars.called_party));
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 

-- 
To view, visit https://gerrit.osmocom.org/7697
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaa071b131a8ff372d70677c8622d227f88e9ea53
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list