Change in osmo-ttcn3-hacks[master]: BSSAP/IPA integration: Wait for SCCPLite to be established

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
Thu May 24 18:03:03 UTC 2018


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


Change subject: BSSAP/IPA integration: Wait for SCCPLite to be established
......................................................................

BSSAP/IPA integration: Wait for SCCPLite to be established

Before this patch, we had some problems related to synchronization
between the IPA transport, SCCP emulation and BSSAP layer in SCCPlite
configurations.

This code ensures that f_bssap_init() will block until the IPA
connection (client or server) is established, and then start the SCCP
and BSSAP emulation components in the right order.

This in turn ensures that the initial BSSMAP RESET that we're sending
from the TTCN-3 side is only sent once the IPA connection is fully
established, and the CCM Identity handshake has happened before.

Change-Id: I483ddd45c1cf631a5a9d8f862b6ca728b38bdc14
Related: OS#2544
---
M library/BSSAP_Adapter.ttcn
M library/IPA_Emulation.ttcnpp
2 files changed, 44 insertions(+), 4 deletions(-)



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

diff --git a/library/BSSAP_Adapter.ttcn b/library/BSSAP_Adapter.ttcn
index 1a9fdb4..7404a6f 100644
--- a/library/BSSAP_Adapter.ttcn
+++ b/library/BSSAP_Adapter.ttcn
@@ -28,8 +28,9 @@
 
 type record BSSAP_Adapter {
 	/* component references */
-	M3UA_CT vc_M3UA, /* only in 3GPP AoIP */
-	IPA_Emulation_CT vc_IPA, /* only in SCCPliste */
+	M3UA_CT vc_M3UA,		/* only in 3GPP AoIP */
+	IPA_Emulation_CT vc_IPA,	/* only in SCCPlite */
+	IPA_EventWaiter_CT vc_WAIT,	/* only in SCCPlite */
 	SCCP_CT vc_SCCP,
 
 	MSC_SCCP_MTP3_parameters sccp_pars,
@@ -114,18 +115,32 @@
 		map(ba.vc_IPA:IPA_PORT, system:IPA_CODEC_PT);
 		/* connect MTP3 service provider (IPA) to lower side of SCCP */
 		connect(ba.vc_IPA:MTP3_SP_PORT, ba.vc_SCCP:MTP3_SCCP_PORT);
+		/* connect waiter to general IPA port (for ASP_IPA_Event) */
+		ba.vc_WAIT := IPA_EventWaiter_CT.create(id & "-IPA-WAIT");
+		connect(ba.vc_IPA:IPA_SP_PORT, ba.vc_WAIT:IPA_SP_PORT);
+		ba.vc_WAIT.start(IPA_Emulation.waiter_main());
 		ba.vc_IPA.start(IPA_Emulation.main_server(cfg.sctp_addr.local_ip_addr,
 							cfg.sctp_addr.local_sctp_port));
+		/* wait until we received an IPA CCM ID_ACK */
+		ba.vc_WAIT.done;
+		disconnect(ba.vc_IPA:IPA_SP_PORT, ba.vc_WAIT:IPA_SP_PORT);
 		}
 	case (BSSAP_TRANSPORT_SCCPlite_CLIENT) {
 		ba.vc_IPA := IPA_Emulation_CT.create(id & "-IPA");
 		map(ba.vc_IPA:IPA_PORT, system:IPA_CODEC_PT);
 		/* connect MTP3 service provider (IPA) to lower side of SCCP */
 		connect(ba.vc_IPA:MTP3_SP_PORT, ba.vc_SCCP:MTP3_SCCP_PORT);
+		/* connect waiter to general IPA port (for ASP_IPA_Event) */
+		ba.vc_WAIT := IPA_EventWaiter_CT.create(id & "-IPA-WAIT");
+		connect(ba.vc_IPA:IPA_SP_PORT, ba.vc_WAIT:IPA_SP_PORT);
+		ba.vc_WAIT.start(IPA_Emulation.waiter_main());
 		ba.vc_IPA.start(IPA_Emulation.main_client(cfg.sctp_addr.remote_ip_addr,
 							cfg.sctp_addr.remote_sctp_port,
 							cfg.sctp_addr.local_ip_addr,
 							cfg.sctp_addr.local_sctp_port));
+		/* wait until we received an IPA CCM ID_ACK */
+		ba.vc_WAIT.done;
+		disconnect(ba.vc_IPA:IPA_SP_PORT, ba.vc_WAIT:IPA_SP_PORT);
 		}
 	case else {
 		setverdict(fail, "Unsuppored BSSAP_Transport");
@@ -133,8 +148,6 @@
 		}
 	}
 
-	ba.vc_SCCP.start(SCCPStart(ba.sccp_pars));
-
 	if (isvalue(ops)) {
 		timer T := 5.0;
 		T.start;
@@ -145,6 +158,9 @@
 		/* start the BSSMAP emulation */
 		ba.vc_BSSMAP.start(BSSMAP_Emulation.main(valueof(ops), ""));
 	}
+
+	ba.vc_SCCP.start(SCCPStart(ba.sccp_pars));
+
 }
 
 
diff --git a/library/IPA_Emulation.ttcnpp b/library/IPA_Emulation.ttcnpp
index 41a3968..df2b15e 100644
--- a/library/IPA_Emulation.ttcnpp
+++ b/library/IPA_Emulation.ttcnpp
@@ -243,6 +243,9 @@
 }
 
 private function f_send_IPA_EVT(template ASP_IPA_Event evt) runs on IPA_Emulation_CT {
+	if (IPA_SP_PORT.checkstate("Connected")) {
+		IPA_SP_PORT.send(evt);
+	}
 #ifdef IPA_EMULATION_RSL
 	if (IPA_RSL_PORT.checkstate("Connected")) {
 		IPA_RSL_PORT.send(evt);
@@ -368,6 +371,7 @@
 			 * the TCP connection is established.  Other implementations may differ.
 			 * We currently ignore it completely - but actually we should make sure that
 			 * one ID_ACK is received by the server at some point */
+			f_send_IPA_EVT(t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_ID_ACK));
 		}
 		case (IPAC_MSGT_ID_RESP) {
 			log("IPA ID RESP: ", ccm.u.resp);
@@ -635,4 +639,24 @@
 	}
 }
 
+/***********************************************************************
+ * IPA Event waiter component. Wait for ASP_IPA_EVENT_ID_ACK
+ ***********************************************************************/
+
+type component IPA_EventWaiter_CT {
+	port IPA_SP_PT IPA_SP_PORT;
+}
+
+function waiter_main(template ASP_IPA_Event wait_for := t_ASP_IPA_EVT_UD(ASP_IPA_EVENT_ID_ACK))
+runs on IPA_EventWaiter_CT {
+
+	alt {
+	[] IPA_SP_PORT.receive(wait_for) {
+		setverdict(pass);
+		}
+	[] IPA_SP_PORT.receive { repeat; }
+	}
+}
+
+
 }

-- 
To view, visit https://gerrit.osmocom.org/9293
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: I483ddd45c1cf631a5a9d8f862b6ca728b38bdc14
Gerrit-Change-Number: 9293
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/20180524/2bd8181f/attachment.htm>


More information about the gerrit-log mailing list