jolly has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42965?usp=email )
Change subject: Add close function to HTTP_Server_Emulation ......................................................................
Add close function to HTTP_Server_Emulation
If we want to simulate a broken HTTP request towards the client, we may wait until the client times out. This results in closing the TCP connection by the client. It then results in failure of the SSL connection at Titan's Abstract_Socket component. The TTCN3-tests fails.
One solution is to actively close the connection via a close function. The client will not wait for the timeout. The Abstact_Socket will then not receive any failure. The test runs faster.
Related: SYS#8101 Change-Id: Id09976800c7498a7173b5d8911fe545504cfa266 --- M eim/eIM_Tests.ttcn M ipad/IPAd_Tests.ttcn M library/HTTP_Server_Emulation.ttcn 3 files changed, 18 insertions(+), 5 deletions(-)
Approvals: osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn index 21da52b..9aa0a61 100644 --- a/eim/eIM_Tests.ttcn +++ b/eim/eIM_Tests.ttcn @@ -172,7 +172,7 @@
T.start; alt { - [] HTTP_SRV[0].receive({ request := ? }) -> value es9p_req { + [] HTTP_SRV[0].receive(HTTPMessage:{ request := ? }) -> value es9p_req { dec_RemoteProfileProvisioningRequest_from_JSON(es9p_req.request.body, request); } [] T.timeout { diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn index ce744d0..7044217 100644 --- a/ipad/IPAd_Tests.ttcn +++ b/ipad/IPAd_Tests.ttcn @@ -352,7 +352,7 @@
T.start; alt { - [] HTTP_SRV[0].receive({ request_binary := ? }) -> value esipa_req_encoded { + [] HTTP_SRV[0].receive(HTTPMessage:{ request_binary := ? }) -> value esipa_req_encoded { esipa_req := dec_EsipaMessageFromIpaToEim(esipa_req_encoded.request_binary.body); if (not istemplatekind(expected_esipa_req, "omit")) { if (not match(valueof(esipa_req), expected_esipa_req)) { diff --git a/library/HTTP_Server_Emulation.ttcn b/library/HTTP_Server_Emulation.ttcn index 9270ccb..73a93bc 100644 --- a/library/HTTP_Server_Emulation.ttcn +++ b/library/HTTP_Server_Emulation.ttcn @@ -33,9 +33,9 @@ port HTTPmsg_PT HTTP_server_port;
/* Communication with Clients */ - port HTTP_SRV_PT CLIENT; - port HTTP_SRV_PROC_PT CLIENT_PROC; - port HTTP_SRV_PT CLIENT_DEFAULT; + port HTTP_CLNT_PT CLIENT; + port HTTP_CLNT_PROC_PT CLIENT_PROC; + port HTTP_CLNT_PT CLIENT_DEFAULT;
/* Configuration by the user */ var HttpServerEmulationCfg g_http_cfg; @@ -102,6 +102,9 @@ [] CLIENT.receive(HTTPMessage:?) -> value send_resp_value sender vc_conn { HTTP_server_port.send(send_resp_value); } + [] CLIENT.receive(Close:?) -> sender vc_conn { + HTTP_server_port.send(close); + } [] HTTP_server_port.receive(half_close) { HTTP_server_port.send(close); } @@ -120,6 +123,12 @@ ***********************************************************************/ type port HTTP_SRV_PT message { inout HTTPMessage; + out Close; +} with { extension "internal" }; + +type port HTTP_CLNT_PT message { + inout HTTPMessage; + in Close; } with { extension "internal" };
signature HTTPEM_register(); @@ -128,6 +137,10 @@ inout HTTPEM_register; } with { extension "internal" };
+type port HTTP_CLNT_PROC_PT procedure { + inout HTTPEM_register; +} with { extension "internal" }; +
/*********************************************************************** * Client Component