pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/40462?usp=email )
Change subject: stp: Expect and answer M3UA BEAT from IUT ......................................................................
stp: Expect and answer M3UA BEAT from IUT
This fixes tests failing with newer versions of libosmo-sigtran where HEARTBEAT procedure is enabled by default.
Change-Id: Idb70acde0683bc053db20781ce4926fbc318f51f --- M stp/STP_Tests_M3UA.ttcn 1 file changed, 17 insertions(+), 2 deletions(-)
Approvals: pespin: Looks good to me, approved Jenkins Builder: Verified laforge: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve
diff --git a/stp/STP_Tests_M3UA.ttcn b/stp/STP_Tests_M3UA.ttcn index 2f452de..7b78a72 100644 --- a/stp/STP_Tests_M3UA.ttcn +++ b/stp/STP_Tests_M3UA.ttcn @@ -140,6 +140,15 @@ } }
+private altstep as_m3ua_beat_answer(integer idx, template M3UA_Heartbeat_Data hbd := *) runs on RAW_M3UA_CT { + var M3UA_RecvFrom rx; + [] M3UA[idx].receive(t_M3UA_RecvFrom(tr_M3UA_BEAT(hbd))) -> value rx { + log("[", idx, "] Answering M3UA BEAT ", rx); + f_M3UA_send(idx, ts_M3UA_BEAT_ACK(rx.msg.m3UA_BEAT.messageParameters.heartbeat_Data)); + repeat; + } +} + friend function f_M3UA_send(integer idx, template (present) PDU_M3UA msg, integer stream := 0) runs on RAW_M3UA_CT { if (g_m3ua_configs[idx].use_tcp) { @@ -149,14 +158,16 @@ } }
-friend function f_M3UA_exp(integer idx, template (present) PDU_M3UA msg) runs on RAW_M3UA_CT { +friend function f_M3UA_exp(integer idx, template (present) PDU_M3UA msg, + float timeout_val := 5.0, boolean answer_beat := true) runs on RAW_M3UA_CT { var M3UA_RecvFrom rx; - timer T := 5.0; + timer T := timeout_val; T.start; alt { [] M3UA[idx].receive(t_M3UA_RecvFrom(msg)) { setverdict(pass); } + [answer_beat] as_m3ua_beat_answer(idx); [] M3UA[idx].receive(t_M3UA_RecvFrom(?)) -> value rx { Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unexpected M3UA[", idx, "] ", rx, @@ -315,6 +326,7 @@ }
friend function f_init_m3ua(boolean ignore_ssnm := true, + boolean answer_beat := true, template (omit) M3uaConfigs m3ua_configs := omit)
runs on RAW_M3UA_CT { @@ -332,6 +344,9 @@ if (not g_m3ua_configs[i].is_server) { map(self:M3UA[i], system:M3UA_CODEC_PT); } + if (answer_beat) { + activate(as_m3ua_beat_answer(i)); + } }
activate(as_m3ua_sctp());