diff --git a/library/DIAMETER_Emulation.ttcn b/library/DIAMETER_Emulation.ttcn index cff4d638b..f7a0f887f 100644 --- a/library/DIAMETER_Emulation.ttcn +++ b/library/DIAMETER_Emulation.ttcn @@ -37,6 +37,12 @@ import from Native_Functions all; type hexstring IMSI; +/* notify the recipient that a Capability Exchange happened */ +type record DiameterCapabilityExchgInd { + PDU_DIAMETER rx, + PDU_DIAMETER tx +}; + type component DIAMETER_ConnHdlr { port DIAMETER_Conn_PT DIAMETER; /* procedure based port to register for incoming connections */ @@ -50,7 +56,7 @@ type port DIAMETER_Conn_PT message { /* global test port e.g. for non-imsi/conn specific messages */ type port DIAMETER_PT message { - inout PDU_DIAMETER; + inout PDU_DIAMETER, DiameterCapabilityExchgInd; } with { extension "internal" }; @@ -319,6 +325,8 @@ function main(DIAMETEROps ops, DIAMETER_conn_parameters p, charstring id) runs o resp := ts_DIA_CEA(mrf.msg.hop_by_hop_id, mrf.msg.end_to_end_id, p.origin_host, p.origin_realm, f_inet_addr(p.local_ip), p.vendor_app_id); DIAMETER.send(t_DIAMETER_Send(g_diameter_conn_id, resp)); + /* notify our user that the CER->CEA exchange has happened */ + DIAMETER_UNIT.send(DiameterCapabilityExchgInd:{rx:=mrf.msg, tx:=valueof(resp)}); } /* DIAMETER from remote peer */ @@ -434,4 +442,23 @@ runs on DIAMETER_Emulation_CT return template PDU_DIAMETER { } +function f_diameter_wait_capability(DIAMETER_PT pt) +{ + /* Wait for the Capability Exchange with the DUT */ + timer T := 10.0; + T.start; + alt { + [] pt.receive(DiameterCapabilityExchgInd:?) {} + [] pt.receive { + setverdict(fail, "Unexpected receive waiting for DiameterCapabilityExchgInd"); + mtc.stop; + } + [] T.timeout { + setverdict(fail, "Timeout waiting for DiameterCapabilityExchgInd"); + mtc.stop; + } + } +} + + } diff --git a/mme/MME_Tests.ttcn b/mme/MME_Tests.ttcn index 05168095b..f9bcf6d2f 100644 --- a/mme/MME_Tests.ttcn +++ b/mme/MME_Tests.ttcn @@ -229,6 +229,8 @@ friend function f_init_diameter(charstring id) runs on MTC_CT { connect(vc_DIAMETER:DIAMETER_UNIT, self:DIAMETER_UNIT); connect(vc_DIAMETER:DIAMETER_PROC, self:DIAMETER_PROC); vc_DIAMETER.start(DIAMETER_Emulation.main(ops, pars, id)); + + f_diameter_wait_capability(DIAMETER_UNIT); } friend template (value) TAI ts_enb_S1AP_TAI(EnbParams enb) := {