laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36603?usp=email )

 (

6 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: HTTP_Adapter: put HTTP config options into a record
......................................................................

HTTP_Adapter: put HTTP config options into a record

The function f_http_init currently takes only two config options. For the
moment this is not a problem, but the amount of additional options may grow
in the future. So let's put the options in a record to have them separate.

Change-Id: I4c1c204ea38d76d5fdd7e539d56ca2bf9f693d7d
Related: SYS#6824
---
M cbc/CBC_Tests.ttcn
M library/HTTP_Adapter.ttcn
M remsim/RemsimServer_Tests.ttcn
3 files changed, 36 insertions(+), 9 deletions(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/cbc/CBC_Tests.ttcn b/cbc/CBC_Tests.ttcn
index 2f1ad7f..57f4d9e 100644
--- a/cbc/CBC_Tests.ttcn
+++ b/cbc/CBC_Tests.ttcn
@@ -187,7 +187,12 @@
 }

 private function f_init(integer num_bsc := 0, integer num_mme := 0) runs on 
test_CT {
-       f_http_init(mp_cbc_host, mp_cbc_ecbe_port);
+       var HTTP_Adapter_Params http_adapter_pars;
+       http_adapter_pars := {
+               http_host := mp_cbc_host,
+               http_port := mp_cbc_ecbe_port
+       };
+       f_http_init(http_adapter_pars);

        g_num_bsc := num_bsc;
        for (var integer i := 0; i < g_num_bsc; i := i + 1) {
diff --git a/library/HTTP_Adapter.ttcn b/library/HTTP_Adapter.ttcn
index 9ad1e4a..c06aa38 100644
--- a/library/HTTP_Adapter.ttcn
+++ b/library/HTTP_Adapter.ttcn
@@ -19,14 +19,17 @@

 type component http_CT {
        port HTTPmsg_PT HTTP;
-       var charstring g_http_host;
-       var integer g_http_port;
+       var HTTP_Adapter_Params g_pars;
 };

-function f_http_init(charstring host, integer http_port) runs on http_CT {
+type record HTTP_Adapter_Params {
+       charstring http_host,
+       integer http_port
+};
+
+function f_http_init(HTTP_Adapter_Params pars) runs on http_CT {
        map(self:HTTP, system:HTTP);
-       g_http_host := host;
-       g_http_port := http_port;
+       g_pars := pars;
 }

 template (value) Connect ts_HTTP_Connect(template (value) charstring hostname,
@@ -125,9 +128,9 @@
 function f_http_tx_request(charstring url, charstring method := "GET", 
template charstring body := omit,
                           HeaderLines custom_hdr := { })
 runs on http_CT {
-       HTTP.send(ts_HTTP_Connect(g_http_host, g_http_port));
+       HTTP.send(ts_HTTP_Connect(g_pars.http_host, g_pars.http_port));
        HTTP.receive(Connect_result:?);
-       HTTP.send(ts_HTTP_Req(url, method, body, host := g_http_host & ":" & 
int2str(g_http_port), custom_hdr := custom_hdr));
+       HTTP.send(ts_HTTP_Req(url, method, body, host := g_pars.http_host & ":" 
& int2str(g_pars.http_port), custom_hdr := custom_hdr));
 }

 function f_http_rx_response(template HTTPMessage exp := tr_HTTP_Resp2xx, float 
tout := 2.0)
diff --git a/remsim/RemsimServer_Tests.ttcn b/remsim/RemsimServer_Tests.ttcn
index 6d2b27d..94529b2 100644
--- a/remsim/RemsimServer_Tests.ttcn
+++ b/remsim/RemsimServer_Tests.ttcn
@@ -68,7 +68,12 @@


 function f_rsres_init() runs on http_CT {
-       f_http_init(mp_server_ip, mp_rsres_port);
+       var HTTP_Adapter_Params http_adapter_pars;
+       http_adapter_pars := {
+               http_host := mp_server_ip,
+               http_port := mp_rsres_port
+       };
+       f_http_init(http_adapter_pars);
        f_rsres_post_reset();
 }


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36603?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4c1c204ea38d76d5fdd7e539d56ca2bf9f693d7d
Gerrit-Change-Number: 36603
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to