laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/32326 )
Change subject: stp: Discard any ASP-UP retransmissions ......................................................................
stp: Discard any ASP-UP retransmissions
In some cases, there's some time between accepting the SCTP connection and the execution of f_M3UA_CLNT_asp_up(). This may cause the client sending re-transmitted ASP-UP messages. Let's simply flush and ignore those, rather than failing the test case.
Change-Id: Iea39e9543535977a3004b150e222ce8c7f4d821a --- M stp/STP_Tests_M3UA.ttcn 1 file changed, 33 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, approved neels: Looks good to me, but someone else must approve pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/stp/STP_Tests_M3UA.ttcn b/stp/STP_Tests_M3UA.ttcn index 08fc9c9..41b2e2c 100644 --- a/stp/STP_Tests_M3UA.ttcn +++ b/stp/STP_Tests_M3UA.ttcn @@ -148,6 +148,22 @@ } }
+/* flush any number of queued messages matching 'msg' */ +friend function f_M3UA_flush(integer idx, template (present) PDU_M3UA msg) runs on RAW_M3UA_CT { + var M3UA_RecvFrom rx; + timer T := 0.01; + T.start; + alt { + /* this should normally be possible with something like M3UA[idx].check(receive(...)) but somehow + * TITAN complains about the 'check' token, so it looks that feature of TTCN3 is not supported? */ + [] M3UA[idx].receive(t_M3UA_RecvFrom(msg)) { + repeat; + } + [] T.timeout { + } + } +} + private template (value) Socket ts_Socket(HostName hostName, PortNumber portNumber) := { hostName := hostName, portNumber := portNumber @@ -672,6 +688,9 @@ /* expect/perform an inbound ASP-UP procedure */ friend function f_M3UA_CLNT_asp_up(integer idx, template OCT4 aspid := omit) runs on RAW_M3UA_CT { f_M3UA_exp(idx, tr_M3UA_ASPUP(aspid)); + /* there might have been multiple re-transmissions that have queued up in the ATS between + * the SCTP connection establishment and this function execution, so let's flush those copies. */ + f_M3UA_flush(idx, tr_M3UA_ASPUP(aspid)); f_M3UA_send(idx, ts_M3UA_ASPUP_ACK); }