laforge submitted this change.
HTTP_Server_Emulation: allow multiple HTTP server ports
At the moment the HTTP_Server_Emulation component can only provide
a single HTTP server. Let's extend it so that it can provide multiple
HTTP server.
Related: SYS#7339
Change-Id: I11df9df5c3041f977b458835e923c74abe3bba7b
---
M eim/eIM_Tests.ttcn
M ipad/IPAd_Tests.ttcn
M library/HTTP_Server_Emulation.ttcn
3 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn
index da5d571..5dcbdab 100644
--- a/eim/eIM_Tests.ttcn
+++ b/eim/eIM_Tests.ttcn
@@ -108,8 +108,8 @@
/* connect ES9+/HTTP-server ports */
if (isbound(vc_HTTP)) {
- connect(vc_conn:HTTP_SRV, vc_HTTP:CLIENT);
- connect(vc_conn:HTTP_SRV_PROC, vc_HTTP:CLIENT_PROC);
+ connect(vc_conn:HTTP_SRV[0], vc_HTTP:CLIENT);
+ connect(vc_conn:HTTP_SRV_PROC[0], vc_HTTP:CLIENT_PROC);
}
vc_conn.start(f_init_handler(fn, id, pars));
@@ -172,7 +172,7 @@
T.start;
alt {
- [] HTTP_SRV.receive({ request := ? }) -> value es9p_req {
+ [] HTTP_SRV[0].receive({ request := ? }) -> value es9p_req {
dec_RemoteProfileProvisioningRequest_from_JSON(es9p_req.request.body, request);
}
[] T.timeout {
@@ -187,7 +187,7 @@
private function f_es9p_send(RemoteProfileProvisioningResponse es9p_res) runs on eIM_ConnHdlr {
var charstring es9p_res_json;
enc_RemoteProfileProvisioningResponse_to_JSON(es9p_res, es9p_res_json);
- HTTP_SRV.send(ts_http_resp(es9p_res_json));
+ HTTP_SRV[0].send(ts_http_resp(es9p_res_json));
}
/* Perform Es9p HTTP request/response cycle */
diff --git a/ipad/IPAd_Tests.ttcn b/ipad/IPAd_Tests.ttcn
index 04e4b1d..c8f3928 100644
--- a/ipad/IPAd_Tests.ttcn
+++ b/ipad/IPAd_Tests.ttcn
@@ -134,8 +134,8 @@
vc_conn := IPAd_ConnHdlr.create(id);
if (isbound(vc_HTTP)) {
- connect(vc_conn:HTTP_SRV, vc_HTTP:CLIENT);
- connect(vc_conn:HTTP_SRV_PROC, vc_HTTP:CLIENT_PROC);
+ connect(vc_conn:HTTP_SRV[0], vc_HTTP:CLIENT);
+ connect(vc_conn:HTTP_SRV_PROC[0], vc_HTTP:CLIENT_PROC);
}
vc_conn.start(f_init_handler(fn, id, pars));
@@ -352,7 +352,7 @@
T.start;
alt {
- [] HTTP_SRV.receive({ request_binary := ? }) -> value esipa_req_encoded {
+ [] HTTP_SRV[0].receive({ 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)) {
@@ -372,7 +372,7 @@
private function f_esipa_send(EsipaMessageFromEimToIpa esipa_res) runs on IPAd_ConnHdlr {
var octetstring esipa_res_encoded;
esipa_res_encoded := enc_EsipaMessageFromEimToIpa(esipa_res);
- HTTP_SRV.send(ts_http_resp(esipa_res_encoded));
+ HTTP_SRV[0].send(ts_http_resp(esipa_res_encoded));
}
/* Perform one ESipa HTTP request/response cycle */
@@ -392,7 +392,7 @@
var EsipaMessageFromIpaToEim esipa_req;
esipa_req := f_esipa_receive(expected_esipa_req);
- HTTP_SRV.send(ts_http_resp(''O));
+ HTTP_SRV[0].send(ts_http_resp(''O));
return esipa_req;
}
diff --git a/library/HTTP_Server_Emulation.ttcn b/library/HTTP_Server_Emulation.ttcn
index 16d142d..9270ccb 100644
--- a/library/HTTP_Server_Emulation.ttcn
+++ b/library/HTTP_Server_Emulation.ttcn
@@ -134,13 +134,16 @@
***********************************************************************/
type component HTTP_ConnHdlr {
- port HTTP_SRV_PT HTTP_SRV;
- port HTTP_SRV_PROC_PT HTTP_SRV_PROC;
+ /* These ports are not connected to anything in this component, they
+ * serve as connection points for the component that extends this
+ * coponent. */
+ port HTTP_SRV_PT HTTP_SRV[16];
+ port HTTP_SRV_PROC_PT HTTP_SRV_PROC[16];
};
-function f_http_register() runs on HTTP_ConnHdlr {
- HTTP_SRV_PROC.call(HTTPEM_register:{}) {
- [] HTTP_SRV_PROC.getreply(HTTPEM_register:{});
+function f_http_register(integer id := 0) runs on HTTP_ConnHdlr {
+ HTTP_SRV_PROC[id].call(HTTPEM_register:{}) {
+ [] HTTP_SRV_PROC[id].getreply(HTTPEM_register:{});
}
}
To view, visit change 39733. To unsubscribe, or for help writing mail filters, visit settings.