pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41967?usp=email )
Change subject: BSSAP_LE_Emulation: Handle N-PCSTATE.ind to wait for peer
availability
......................................................................
BSSAP_LE_Emulation: Handle N-PCSTATE.ind to wait for peer availability
Take the chance to explicitly log and discard other .ind primitives
which would otherwise block the processing of messages.
Related: OS#6907
Change-Id: I6a40d1ddcd3a7dbde9f6c8b51439e9ab4d1da469
---
M library/BSSAP_LE_CodecPort.ttcn
M library/BSSAP_LE_Emulation.ttcn
M msc/MSC_Tests.ttcn
3 files changed, 68 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks
refs/changes/67/41967/1
diff --git a/library/BSSAP_LE_CodecPort.ttcn b/library/BSSAP_LE_CodecPort.ttcn
index 418e55a..3e82cab 100644
--- a/library/BSSAP_LE_CodecPort.ttcn
+++ b/library/BSSAP_LE_CodecPort.ttcn
@@ -375,7 +375,7 @@
ASP_SCCP_N_RESET_ind -> ASP_SCCP_N_RESET_ind: simple;
ASP_SCCP_N_RESET_cfm -> ASP_SCCP_N_RESET_cfm: simple;
ASP_SCCP_N_STATE_ind -> ASP_SCCP_N_STATE_ind: simple;
- ASP_SCCP_N_PCSTATE_ind -> -: discard)"
+ ASP_SCCP_N_PCSTATE_ind -> ASP_SCCP_N_PCSTATE_ind: simple)"
}
diff --git a/library/BSSAP_LE_Emulation.ttcn b/library/BSSAP_LE_Emulation.ttcn
index 15930d5..2608243 100644
--- a/library/BSSAP_LE_Emulation.ttcn
+++ b/library/BSSAP_LE_Emulation.ttcn
@@ -371,6 +371,12 @@
var BSSAP_LE_N_CONNECT_cfm conn_cfm;
var BSSAP_LE_N_DATA_ind data_ind;
var BSSAP_LE_N_DISCONNECT_ind disc_ind;
+
+ var ASP_SCCP_N_RESET_ind n_reset_ind;
+ var ASP_SCCP_N_RESET_cfm n_reset_cfm;
+ var ASP_SCCP_N_STATE_ind n_state_ind;
+ var ASP_SCCP_N_PCSTATE_ind n_pcstate_ind;
+
var BSSAP_LE_Conn_Req creq;
var PDU_BSSAP_LE bssap;
var BSSAP_LE_N_UNITDATA_req bssap_ud;
@@ -427,6 +433,24 @@
f_handle_userData(vc_conn, conn_cfm.userData);
}
}
+
+ /* SCCP -> Client: N-RESET.ind */
+ [] BSSAP_LE.receive(ASP_SCCP_N_RESET_ind:?) -> value
n_reset_ind {
+ log("Discard ", n_reset_ind)
+ }
+ /* SCCP -> Client: N-RESET.cfm */
+ [] BSSAP_LE.receive(ASP_SCCP_N_RESET_cfm:?) -> value
n_reset_cfm {
+ log("Discard ", n_reset_cfm)
+ }
+ /* SCCP -> Client: N-STATE.ind */
+ [] BSSAP_LE.receive(ASP_SCCP_N_STATE_ind:?) -> value
n_state_ind {
+ log("Discard ", n_state_ind)
+ }
+ /* SCCP -> Client: N-PCSTATE.ind */
+ [] BSSAP_LE.receive(ASP_SCCP_N_PCSTATE_ind:?) -> value
n_pcstate_ind {
+ log("Discard ", n_pcstate_ind)
+ }
+
[] CLIENT.receive(PDU_BSSAP_LE:?) -> value bssap sender vc_conn
{
var integer conn_id := f_conn_id_by_comp(vc_conn);
/* send it to dispatcher */
@@ -506,6 +530,45 @@
f_ML3_patch_seq_nr(seq_nr, enc_l3);
}
+function f_bssap_le_wait_sccp_peer_available(BSSAP_LE_CODEC_PT pt, integer
peer_pc, float timeout_sec := 3.0)
+{
+ timer T;
+ var ASP_SCCP_N_PCSTATE_ind n_pcstate_ind;
+ var boolean rx_explicit_down := false;
+
+ log("Waiting for SCCP peer PC=", peer_pc, " to become available");
+ T.start(timeout_sec);
+
+ alt {
+ [] pt.receive(t_ASP_N_PCSTATE_ind(?, ?, *, *)) -> value n_pcstate_ind {
+ var integer aff_pc := bit2int(n_pcstate_ind.affectedSP);
+ if (aff_pc != peer_pc) {
+ log("Waiting for SCCP peer PC=", peer_pc, ": Rx
N-PCSTATE.ind for another peer PC=", aff_pc, ", ",n_pcstate_ind);
+ repeat;
+ }
+ if (n_pcstate_ind.spStatus == SCCP_PAR_SP_Status_accessible and
+ n_pcstate_ind.remSCCPStatus ==
SCCP_PAR_Remote_SCCP_Status_available) {
+ log("SCCP peer PC=", aff_pc," is now available");
+ /* All peer is available, we are done */
+ T.stop;
+ return;
+ }
+ log("SCCP peer PC=", aff_pc," is NOT available: ",
n_pcstate_ind);
+ rx_explicit_down := true;
+ repeat;
+ }
+ [] T.timeout {
+ if (rx_explicit_down) {
+ /* explicitly unavailable:*/
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+ log2str("Timeout waiting for
SCCP peer PC=", peer_pc));
+ }
+ /* Done, assume PCs for which we didn't receive an explicit
"unavailable" are actually available. */
+ }
+ }
+ log("Done waiting for SCCP peer PC=", peer_pc);
+}
+
function main(BssapLeOps ops, charstring id) runs on BSSAP_LE_Emulation_CT {
g_ran_id := id;
@@ -514,6 +577,9 @@
f_expect_table_init();
if (isvalue(ops.sccp_addr_peer) and isvalue(ops.sccp_addr_local)) {
+ if (ispresent(ops.sccp_addr_peer.signPointCode)) {
+ f_bssap_le_wait_sccp_peer_available(BSSAP_LE,
bit2int(ops.sccp_addr_peer.signPointCode));
+ }
f_bssap_le_reset(ops.sccp_addr_peer, ops.sccp_addr_local);
}
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index c85a458..51d8755 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -2310,8 +2310,7 @@
f_init_bssap_direct();
f_sccp_adapter_start(g_bssap[0].sccpa);
-
- f_sleep(3.0);
+ f_bssap_wait_sccp_peer_available(BSSAP_DIRECT,
bit2int(g_bssap[0].sccpa.sccp_addr_peer.signPointCode));
/* Make a blind connection attemt, to trigger the deadlock condition */
BSSAP_DIRECT.send(ts_BSSAP_CONNECT_req(g_bssap[0].sccpa.sccp_addr_peer,
g_bssap[0].sccpa.sccp_addr_own, 1, omit));
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41967?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I6a40d1ddcd3a7dbde9f6c8b51439e9ab4d1da469
Gerrit-Change-Number: 41967
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>