Change in osmo-ttcn3-hacks[master]: msc/USSD: introduce common GSUP/BSSAP matching functions

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

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Wed Jun 20 19:25:25 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/9687


Change subject: msc/USSD: introduce common GSUP/BSSAP matching functions
......................................................................

msc/USSD: introduce common GSUP/BSSAP matching functions

In order to avoid code duplication in the upcoming test cases,
let's introduce a few functions which basically do a GSUP/BSSAP
message matching within the alternative statement.

Change-Id: I846c2d40a7c37afa8647e644673b4df905e3e116
---
M msc/MSC_Tests.ttcn
1 file changed, 54 insertions(+), 56 deletions(-)



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

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 1af77cd..c56b9cc 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -2109,6 +2109,48 @@
  * USSD Testing
  ***********************************************************************/
 
+private function f_expect_gsup_msg(template GSUP_PDU gsup_msg)
+runs on BSC_ConnHdlr return GSUP_PDU {
+	var GSUP_PDU gsup_msg_complete;
+
+	alt {
+	[] GSUP.receive(gsup_msg) -> value gsup_msg_complete {
+		setverdict(pass);
+		}
+	[] GSUP.receive {
+		setverdict(fail, "Unknown/unexpected GSUP received");
+		self.stop;
+		}
+	[] BSSAP.receive {
+		setverdict(fail, "Unexpected BSSAP message received");
+		self.stop;
+		}
+	}
+
+	return gsup_msg_complete;
+}
+
+private function f_expect_mt_bssap_msg(template PDU_ML3_NW_MS bssap_msg)
+runs on BSC_ConnHdlr return PDU_ML3_NW_MS {
+	var PDU_DTAP_MT bssap_msg_complete;
+
+	alt {
+	[] BSSAP.receive(tr_PDU_DTAP_MT(bssap_msg)) -> value bssap_msg_complete {
+		setverdict(pass);
+		}
+	[] BSSAP.receive {
+		setverdict(fail, "Unknown/unexpected BSSAP received");
+		self.stop;
+		}
+	[] GSUP.receive {
+		setverdict(fail, "Unexpected GSUP message received");
+		self.stop;
+		}
+	}
+
+	return bssap_msg_complete.dtap;
+}
+
 /* LU followed by MO USSD request */
 private function f_tc_lu_and_mo_ussd_single_request(charstring id, BSC_ConnHdlrPars pars)
 runs on BSC_ConnHdlr {
@@ -2159,21 +2201,10 @@
 	/* To be used for sending response with correct session ID */
 	var GSUP_PDU gsup_req_complete;
 
-	/* Request own number request, wait for GSUP-request */
+	/* Request own number */
 	BSSAP.send(ts_PDU_DTAP_MO(ussd_req));
-	alt {
-	[] GSUP.receive(gsup_req) -> value gsup_req_complete {
-		setverdict(pass);
-		}
-	[] GSUP.receive {
-		setverdict(fail, "Unknown/unexpected GSUP received");
-		self.stop;
-		}
-	[] BSSAP.receive {
-		setverdict(fail, "Unexpected BSSAP message received");
-		self.stop;
-		}
-	}
+	/* Expect GSUP request with original Facility IE */
+	gsup_req_complete := f_expect_gsup_msg(gsup_req);
 
 	/* Compose the response from HLR using received session ID */
 	var template GSUP_PDU gsup_rsp := ts_GSUP_PROC_SS_REQ(
@@ -2183,21 +2214,10 @@
 		ss := valueof(facility_rsp)
 	);
 
+	/* Send response over GSUP */
 	GSUP.send(gsup_rsp);
-	alt {
-	/* We expect RELEASE_COMPLETE message with the response */
-	[] BSSAP.receive(tr_PDU_DTAP_MT(ussd_rsp)) {
-		setverdict(pass);
-		}
-	[] BSSAP.receive {
-		setverdict(fail, "Unknown/unexpected BSSAP received");
-		self.stop;
-		}
-	[] GSUP.receive {
-		setverdict(fail, "Unexpected GSUP message received");
-		self.stop;
-		}
-	}
+	/* Expect MT RELEASE COMPLETE message with USSD response */
+	f_expect_mt_bssap_msg(ussd_rsp);
 
 	f_expect_clear();
 }
@@ -2263,21 +2283,10 @@
 	/* To be used for sending response with correct session ID */
 	var GSUP_PDU gsup_req_complete;
 
-	/* Request own number request, wait for GSUP-request */
+	/* Request own number */
 	BSSAP.send(ts_PDU_DTAP_MO(ussd_req));
-	alt {
-	[] GSUP.receive(gsup_req) -> value gsup_req_complete {
-		setverdict(pass);
-		}
-	[] GSUP.receive {
-		setverdict(fail, "Unknown/unexpected GSUP received");
-		self.stop;
-		}
-	[] BSSAP.receive {
-		setverdict(fail, "Unexpected BSSAP message received");
-		self.stop;
-		}
-	}
+	/* Expect GSUP request with original Facility IE */
+	gsup_req_complete := f_expect_gsup_msg(gsup_req);
 
 	/* Compose the response from HLR using received session ID */
 	var template GSUP_PDU gsup_rsp := ts_GSUP_PROC_SS_REQ(
@@ -2287,21 +2296,10 @@
 		ss := valueof(facility_rsp)
 	);
 
+	/* Send response over GSUP */
 	GSUP.send(gsup_rsp);
-	alt {
-	/* We expect RELEASE_COMPLETE message with the response */
-	[] BSSAP.receive(tr_PDU_DTAP_MT(ussd_rsp)) {
-		setverdict(pass);
-		}
-	[] BSSAP.receive {
-		setverdict(fail, "Unknown/unexpected BSSAP received");
-		self.stop;
-		}
-	[] GSUP.receive {
-		setverdict(fail, "Unexpected GSUP message received");
-		self.stop;
-		}
-	}
+	/* Expect MT RELEASE COMPLETE message with USSD response */
+	f_expect_mt_bssap_msg(ussd_rsp);
 
 	/* Hold the call for some time */
 	f_sleep(1.0);

-- 
To view, visit https://gerrit.osmocom.org/9687
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: I846c2d40a7c37afa8647e644673b4df905e3e116
Gerrit-Change-Number: 9687
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180620/cddd78ba/attachment.htm>


More information about the gerrit-log mailing list