DIAMETER_Emulation: Notify user of CapabilityExchange
During start of the test case, we must wait until the IUT has
established a DIAMETER/SCTP connection to the testsuite. Implement
this by means of a message on the DIAMETER_UNIT port and an associated
helper function.
Change-Id: I95434307efc67025ee6d373561f6d22398f959c5
diff --git a/library/DIAMETER_Emulation.ttcn b/library/DIAMETER_Emulation.ttcn
index cff4d63..f7a0f88 100644
--- a/library/DIAMETER_Emulation.ttcn
+++ b/library/DIAMETER_Emulation.ttcn
@@ -37,6 +37,12 @@
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 @@
/* 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 @@
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 @@
}
+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;
+ }
+ }
+}
+
+
}