pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43670?usp=email )
Change subject: HTTP2: Introduce {tr,ts}_HTTP2_pseudo_headers_{Req,Resp} ......................................................................
HTTP2: Introduce {tr,ts}_HTTP2_pseudo_headers_{Req,Resp}
The subset of pseudo headers to use are totally different in requests and responses. Provide templates for each to ease passing params and easily identifying requests and responses.
Change-Id: Ida525296d998e85ea630ea24910ded1439c977f4 --- M library/HTTP2_Server_Emulation.ttcn M library/HTTP2_Templates.ttcn M smf/SMF_Session_CT_5G.ttcn 3 files changed, 36 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/70/43670/1
diff --git a/library/HTTP2_Server_Emulation.ttcn b/library/HTTP2_Server_Emulation.ttcn index 7342f83..46b30d0 100644 --- a/library/HTTP2_Server_Emulation.ttcn +++ b/library/HTTP2_Server_Emulation.ttcn @@ -67,7 +67,7 @@ template (omit) HTTP2_Data_frame body := omit) := ts_HTTP2_Msg(conn_id, stream_id, - hb := ts_HTTP2_header_block(pseudo_headers := ts_HTTP2_pseudo_headers(status := status), + hb := ts_HTTP2_header_block(pseudo_headers := ts_HTTP2_pseudo_headers_Resp(status), headers := headers), body := body ); diff --git a/library/HTTP2_Templates.ttcn b/library/HTTP2_Templates.ttcn index b77377e..8f9601c 100644 --- a/library/HTTP2_Templates.ttcn +++ b/library/HTTP2_Templates.ttcn @@ -175,7 +175,32 @@ path := path, status := status } +template (present) HTTP2_pseudo_headers +tr_HTTP2_pseudo_headers_Req(template (present) charstring method := ?, + template (present) charstring scheme := ?, + template charstring authority := *, + template (present) charstring path := ?) := + tr_HTTP2_pseudo_headers(method, scheme, authority, path, omit); +template (value) HTTP2_pseudo_headers +ts_HTTP2_pseudo_headers_Req(template (value) charstring method := "GET", + template (value) charstring scheme := "http", + template (omit) charstring authority := omit, + template (value) charstring path := "/") := + ts_HTTP2_pseudo_headers(method, scheme, authority, path, omit); +template (present) HTTP2_pseudo_headers +tr_HTTP2_pseudo_headers_Resp(template (present) integer status := ?) := + tr_HTTP2_pseudo_headers(omit, omit, omit, omit, status);
+template (value) HTTP2_pseudo_headers +ts_HTTP2_pseudo_headers_Resp(template (value) integer status) := + ts_HTTP2_pseudo_headers(omit, omit, omit, omit, status); + +template (present) HTTP2_header_field +tr_HTTP2_header_field(template (present) charstring header_name := ?, + template charstring header_value := *) := { + header_name := header_name, + header_value := header_value +} template (value) HTTP2_header_field ts_HTTP2_header_field(template (value) charstring header_name, template (omit) charstring header_value := omit) := { diff --git a/smf/SMF_Session_CT_5G.ttcn b/smf/SMF_Session_CT_5G.ttcn index 500dac4..1e49a44 100644 --- a/smf/SMF_Session_CT_5G.ttcn +++ b/smf/SMF_Session_CT_5G.ttcn @@ -123,10 +123,10 @@
body := f_http2_encode_body_multipart_json_5gnas(sm_contexts_enc, nas_enc, boundary);
- pseudo_hdr := ts_HTTP2_pseudo_headers("POST", - "http", - mp_smf_hostname & ":" & int2str(mp_smf_sbi_port), - "/nsmf-pdusession/v1/sm-contexts"); + pseudo_hdr := ts_HTTP2_pseudo_headers_Req(method := "POST", + "http", + mp_smf_hostname & ":" & int2str(mp_smf_sbi_port), + "/nsmf-pdusession/v1/sm-contexts"); hdr_li := { ts_HTTP2_Hdr_content_type("multipart/related; boundary="" & boundary & """), ts_HTTP2_Hdr_accept("application/json,application/vnd.3gpp.ngap,application/problem+json"), @@ -293,8 +293,8 @@ var template (present) HTTP2_pseudo_headers pseudo_headers; var template HTTP2_header_list headers := *;
- pseudo_headers := tr_HTTP2_pseudo_headers(method := "GET", - path := pattern Nudm_SDM_API_PREFIX & "/imsi-" & g_pars.imsi_str & "/sm-data*"); + pseudo_headers := tr_HTTP2_pseudo_headers_Req(method := "GET", + path := pattern Nudm_SDM_API_PREFIX & "/imsi-" & g_pars.imsi_str & "/sm-data*"); hb := tr_HTTP2_header_block(pseudo_headers, headers); http2_msg := tr_HTTP2_Msg(?, ?, hb := hb, body := omit); return http2_msg; @@ -354,8 +354,8 @@ var template (present) HTTP2_pseudo_headers pseudo_headers; var template HTTP2_header_list headers := *;
- pseudo_headers := tr_HTTP2_pseudo_headers(method := "POST", - path := f_nudm_sdm_uri_imsi_prefix(g_pars.imsi_str) & "/sdm-subscriptions"); + pseudo_headers := tr_HTTP2_pseudo_headers_Req(method := "POST", + path := f_nudm_sdm_uri_imsi_prefix(g_pars.imsi_str) & "/sdm-subscriptions"); hb := tr_HTTP2_header_block(pseudo_headers, headers); http2_msg := tr_HTTP2_Msg(?, ?, hb := hb, @@ -412,8 +412,8 @@ var template (present) HTTP2_pseudo_headers pseudo_headers; var template HTTP2_header_list headers := *;
- pseudo_headers := tr_HTTP2_pseudo_headers(method := "POST", - path := Npcf_SMPolicyControl_API_PREFIX & "/sm-policies"); + pseudo_headers := tr_HTTP2_pseudo_headers_Req(method := "POST", + path := Npcf_SMPolicyControl_API_PREFIX & "/sm-policies"); hb := tr_HTTP2_header_block(pseudo_headers, headers); http2_msg := tr_HTTP2_Msg(?, ?, hb := hb,