diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 1a88f7b6cb64c14e378011cee86412c87074c878..559a9675401b8133a5fd7420f1d6019e3460a5cc 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -621,6 +621,23 @@ module OneM2M_Functions { } // End of function f_cf07Up + /** + @desc Ports mapping and default behaviour activation for Config 1 + */ + function f_cf01UpT8() runs on ScefSimu system ScefSystem { + + // Variables + + //Initialization of component variables + vc_scefSimuDesc := PX_T8_SCEF; + + // Map + map(self:mcnPort, system:mcnPort) param (vc_scefSimuDesc.mcnPort); + map(self:acPort, system:acPort); + + activate(a_default()); + } // end f_cf01UpT8 + /** * @desc Ports unmapping */ @@ -784,6 +801,12 @@ module OneM2M_Functions { } // End of function f_cfDown + function f_cf01DownT8() runs on ScefSimu system ScefSystem { + deactivate; + unmap(self:mcnPort, system:mcnPort); + unmap(self:acPort, system:acPort); + } // end f_cf01DownT8 + }//end group configFunctions group InfoPortCommunication { diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn index b8d678351797d9840e533a2f7e8bcfd79358999f..bb2c50a9166c1b0c71d00e5e264d3e7f280b3b35 100644 --- a/LibOneM2M/OneM2M_Pixits.ttcn +++ b/LibOneM2M/OneM2M_Pixits.ttcn @@ -393,12 +393,53 @@ module OneM2M_Pixits { serialization := "xml" } }; - + + modulepar ScefSimuComponentDesc PX_T8_SCEF := { + cseName := "t8_cseName", + cseId := "t8_cseId", + cseResourceId := "t8_cseResourceId", + spId := "t8_spId", + mcnPort := { + t8PortDesc := { + binding := { + httpBindingDesc := { + bindingProtocol := e_http, + bindingDesc := { + tsAddress := "127.0.0.1", + remotePort := 30180, + localPort := omit, + sutAddress := "127.0.0.1", + useTls := false + } + } + }, + serialization := "json" + } + }, + mcnPortIn := { + t8PortDesc := { + binding := { + httpBindingDesc := { + bindingProtocol := e_http, + bindingDesc := { + tsAddress := "127.0.0.1", + remotePort := 30180, // SUT HTTP port + localPort := 30181, + sutAddress := "127.0.0.1", + useTls := false + } + } + }, + serialization := "json" + } + } + }; + /** * @desc Simulated Ontology Server IP address and listening port */ modulepar UrlDesc PX_TS_ONTOLOGY_SERVER := { url := "http://127.0.0.1:80/" }; - + } group ExecutionParameters { @@ -435,6 +476,7 @@ module OneM2M_Pixits { modulepar Labels PX_LABELS := {"VALUE_1"}; modulepar boolean PX_IS_LOC_CONTAINER := false;//default //set it to true when the container is created to store location information + modulepar charstring PX_T8_API_ROOT := "127.0.0.1:30180"; } // end of module diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 620e538982dfe137a75c37d28dc95d0a86ec4497..0f268b0d1729eb6e5a2cb044e01f98c7c66a380f 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -18,6 +18,8 @@ module OneM2M_Templates { import from OneM2M_TypesAndValues all; import from OneM2M_Pixits all; import from OneM2M_Functions all; + + import from OneM2M_Types_3GPP_T8 all; /* Templates */ @@ -8547,6 +8549,203 @@ module OneM2M_Templates { }, forcedFields := omit }; - } - + } + + group t8_primitives { + + template (value) T8Primitive m_t8Request( + in template (value) T8Request p_t8Request + ) := { + t8Request := p_t8Request + } // End of template m_t8Request + + template (present) T8Primitive mw_t8Request( + in template (present) T8Request p_t8Request := ? + ) := { + t8Request := p_t8Request + } // End of template mw_t8Request + + template (value) T8Primitive m_t8Response( + in template (value) T8Response p_t8Response + ) := { + t8Response := p_t8Response + } // End of template m_t8Response + + template (present) T8Primitive mw_t8Response( + in template (present) T8Response p_t8Response := ? + ) := { + t8Response := p_t8Response + } // End of template mw_t8Response + + template (omit) OneM2M_Types_3GPP_T8.URI m_uri_3gpp_nidd( + in charstring p_apiRoot := "/", + in template (omit) charstring p_apiSpecificSuffixes := omit, + in template (omit) OneM2M_Types_3GPP_T8.URI.queryParameters p_queryParameters := omit + ) := { + apiRoot := p_apiRoot, + apiName := "3gpp-nidd", + apiVersion := "v1", + apiSpecificSuffixes := p_apiSpecificSuffixes, + queryParameters := p_queryParameters + } // End of template m_uri_3gpp_nidd + + } // End of group t8_primitives + + group t8_request { + + template (omit) T8Request m_t8_request_get( + in template (value) OneM2M_Types_3GPP_T8.URI p_resourceUri, + in template (value) RequestHeaders p_requestHeaders, + in template (omit) RequestBody p_requestBody := omit + ) := { + resourceMethod := GET, + resourceUri := p_resourceUri, + requestHeaders := p_requestHeaders, + requestBody := p_requestBody + } // End of template m_t8_request_get + + template (omit) T8Request m_t8_request_post( + in template (value) OneM2M_Types_3GPP_T8.URI p_resourceUri, + in template (value) RequestHeaders p_requestHeaders, + in template (omit) RequestBody p_requestBody := omit + ) modifies m_t8_request_get := { + resourceMethod := POST + } // End of template m_t8_request_post + + template (omit) T8Request m_t8_request_delete( + in template (value) OneM2M_Types_3GPP_T8.URI p_resourceUri, + in template (value) RequestHeaders p_requestHeaders, + in template (omit) RequestBody p_requestBody := omit + ) modifies m_t8_request_get := { + resourceMethod := DELETE + } // End of template m_t8_request_delete + + template (omit) T8Request m_t8_request_patch( + in template (value) OneM2M_Types_3GPP_T8.URI p_resourceUri, + in template (value) RequestHeaders p_requestHeaders, + in template (omit) RequestBody p_requestBody := omit + ) modifies m_t8_request_get := { + resourceMethod := PATCH + } // End of template m_t8_request_patch + + template (omit) T8Request m_t8_request_put( + in template (value) OneM2M_Types_3GPP_T8.URI p_resourceUri, + in template (value) RequestHeaders p_requestHeaders, + in template (omit) RequestBody p_requestBody := omit + ) modifies m_t8_request_get := { + resourceMethod := PUT + } // End of template m_t8_request_put + + template (value) RequestBody m_request_body_niddConfiguration( + in template (value) NiddConfiguration p_niddConfiguration + ) := { + individualNiddConfiguration := p_niddConfiguration + } // End of template m_request_body_niddConfiguration + + template (value) NiddConfiguration m_niddConfiguration := { + self_ := "self_value", + supportedFeatures := Notification_test_event, + mtcProviderId := "mtcProviderId_value", + externalId := "externalId_value", + msisdn := "msisdn_value", + externalGroupId := "externalGroupId_value", + duration_ := omit, + reliableDataService := omit, + rdsPorts := omit, + pdnEstablishmentOptions := omit, + notificationDestination := "/", + requestTestNotification := omit, + websockNotifConfig := omit, + maximumPacketSize := omit, + niddDownlinkDataTransfers := omit, + status := ACTIVE + } // End of template m_niddConfiguration + + template NiddConfiguration mw_niddConfiguration( + template (present) Link p_notificationDestination := ? + ) := { + self_ := *, + supportedFeatures := *, + mtcProviderId := *, + externalId := *, + msisdn := *, + externalGroupId := *, + duration_ := *, + reliableDataService := *, + rdsPorts := *, + pdnEstablishmentOptions := *, + notificationDestination := p_notificationDestination, + requestTestNotification := *, + websockNotifConfig := *, + maximumPacketSize := *, + niddDownlinkDataTransfers := *, + status := * + } // End of template mw_niddConfiguration + + } // End of group t8_request + + group t8_response { + + template T8Response mw_t8_response_200_ok( + in template (present) ResponseHeaders p_responseHeaders := ?, + in template ResponseBody p_responseBody := * + ) := { + responseCode := 200, + responseHeaders := p_responseHeaders, + responseBody := p_responseBody + } // End of template mw_t8_response_200_ok + + template T8Response mw_t8_response_201_created( + in template (present) ResponseHeaders p_responseHeaders := ?, + in template ResponseBody p_responseBody := * + ) modifies mw_t8_response_200_ok := { + responseCode := 201 + } // End of template mw_t8_response_201_ok + + template T8Response mw_t8_response_204_no_content( + in template (present) ResponseHeaders p_responseHeaders := ?, + in template ResponseBody p_responseBody := * + ) modifies mw_t8_response_200_ok := { + responseCode := 204, + responseBody := omit + } // End of template mw_t8_response_204_no_content + + template T8Response mw_t8_response_ko( + in template (present) ResponseHeaders p_responseHeaders := ?, + in template ProblemDetails p_problemDetails := ? + ) := { + responseCode := ?, + responseHeaders := p_responseHeaders, + responseBody := { problemDetails := p_problemDetails } + } // End of template mw_t8_response_ko + + template T8Response mw_t8_response_404_not_found( + in template (present) ResponseHeaders p_responseHeaders := ?, + in template ProblemDetails p_problemDetails := ? + ) modifies mw_t8_response_ko := { + responseCode := 404 + } // End of template mw_t8_response_404_not_found + + + + template (present) ResponseBody mw_response_body_niddConfigurations( + template (present) NiddConfigurations p_niddConfigurations := ? + ) := { + niddConfigurations := p_niddConfigurations + } // End of template mw_response_body_niddConfigurations + + template (present) ResponseBody mw_response_body_individualNiddConfiguration( + template (present) NiddConfiguration p_individualNiddConfiguration := ? + ) := { + individualNiddConfiguration := p_individualNiddConfiguration + } // End of template mw_response_body_individualNiddConfiguration + + template (present) ResponseBody mw_response_body_problem_details( + template (present) ProblemDetails p_problemDetails := ? + ) := { + problemDetails := p_problemDetails + } // End of template mw_response_body_problem_details + + } // End of group t8_response + } // end of module diff --git a/LibOneM2M/OneM2M_Types_3GPP_T8.ttcn b/LibOneM2M/OneM2M_Types_3GPP_T8.ttcn index fcd698aaf7b3c8fe77eb6ce52f750ebb1ee49f92..41c87364a70760f07bfeab41f1009e56d0400872 100644 --- a/LibOneM2M/OneM2M_Types_3GPP_T8.ttcn +++ b/LibOneM2M/OneM2M_Types_3GPP_T8.ttcn @@ -25,78 +25,92 @@ import from OneM2M_TypesAndValues {type Resource_2; type ResourceTypeList_1; typ * ************************************************** */ - /** - * @desc Type for the oneM2M primitives exchange - * @member primitive oneM2M primitive - */ - type union T8Primitive { - T8Request t8Request, - T8Response t8Response - } - - /** - * @desc Type for the oneM2M primitives exchange - * @member primitive oneM2M primitive - */ - type record T8Request { - ResourceMethod resourceMethod, - URI resourceUri, - RequestHeaders requestheaders optional, - RequestBody requestBody optional - } - - /** - * @desc Type for the oneM2M primitives exchange - * @member primitive oneM2M primitive - */ - type record T8Response { - ResponseCode responseCode, - ResponseHeaders responseHeaders optional, - ResponseBody body optional - } - - type enumerated ResourceMethod { - GET (0), - PUT (1), - POST (2), - DELETE (3), - PATCH (4) - } - - type record of Header RequestHeaders; - - type record of Header ResponseHeaders; - - type record Header { - charstring header_name, - charstring header_value optional - } - - type Body RequestBody ( {individualNiddConfiguration:=?}, - {individualNiddDownlinkDataDelivery:=?}, - {individualDeviceTriggeringTransaction:=?}, - {deviceTriggeringDeliveryReportNotification:=?}); + group t8_http_restfull_api { + + /** + * @desc Type for the oneM2M primitives exchange + * @member primitive oneM2M primitive + */ + type union T8Primitive { + T8Request t8Request, + T8Response t8Response + } - type Body ResponseBody; + /** + * @desc Type for the oneM2M primitives exchange + * @member primitive oneM2M primitive + */ + type record T8Request { + ResourceMethod resourceMethod, + URI resourceUri, + RequestHeaders requestHeaders optional, + RequestBody requestBody optional + } + + /** + * @desc Type for the oneM2M primitives exchange + * @member primitive oneM2M primitive + */ + type record T8Response { + ResponseCode responseCode, + ResponseHeaders responseHeaders optional, + ResponseBody responseBody optional + } + + type enumerated ResourceMethod { + GET (0), + PUT (1), + POST (2), + DELETE (3), + PATCH (4) + } + + type record of Header RequestHeaders; + + type record of Header ResponseHeaders; + + type record Header { + charstring header_name, + charstring header_value optional + } + + type Body RequestBody ( {individualNiddConfiguration:=?}, + {individualNiddDownlinkDataDelivery:=?}, + {individualDeviceTriggeringTransaction:=?}, + {deviceTriggeringDeliveryReportNotification:=?}); + + type Body ResponseBody; + + type union Body { + Acknowledgement acknowledgement, + //NIDD group + //NiddConfiguration + //NiddDownlinkDataTransfer + //NiddUplinkDataNotification + NiddConfigurations niddConfigurations, + NiddConfiguration individualNiddConfiguration, + NiddDownlinkDataTransfers niddDownlinkDataDeliveries, + NiddDownlinkDataTransfer individualNiddDownlinkDataDelivery, + NiddDownlinkDataDeliveryFailure niddDownlinkDataDeliveryFailure, + //DeviceTrigger + DeviceTriggerings deviceTriggeringTransactions, + DeviceTriggering individualDeviceTriggeringTransaction, + DeviceTriggeringDeliveryReportNotification deviceTriggeringDeliveryReportNotification, + ProblemDetails problemDetails + } - type union Body { - Acknowledgement acknowledgement, - //NIDD group - //NiddConfiguration - //NiddDownlinkDataTransfer - //NiddUplinkDataNotification - NiddConfigurations niddConfigurations, - NiddConfiguration individualNiddConfiguration, - NiddDownlinkDataTransfers niddDownlinkDataDeliveries, - NiddDownlinkDataTransfer individualNiddDownlinkDataDelivery, - NiddDownlinkDataDeliveryFailure niddDownlinkDataDeliveryFailure, - //DeviceTrigger - DeviceTriggerings deviceTriggeringTransactions, - DeviceTriggering individualDeviceTriggeringTransaction, - DeviceTriggeringDeliveryReportNotification deviceTriggeringDeliveryReportNotification - } - - type integer ResponseCode (200,201,204,400,401,403,404,406,411,413,415,429,500,503); + type record URI { // FIXME Not really need and not defined in YAML files. To be removed + charstring apiRoot, + charstring apiName ("3gpp-nidd", "3gpp-device-triggering"), + charstring apiVersion ("v1"), + charstring apiSpecificSuffixes optional, + record of charstring queryParameters optional + } + + type integer ResponseCode (200,201,204,400,401,403,404,406,411,413,415,429,500,503); + } with { + encode "T8_HTTP" + } // End of group t8_http_restfull_api group NIDD_API { @@ -192,11 +206,11 @@ import from OneM2M_TypesAndValues {type Resource_2; type ResourceTypeList_1; typ } type record ProblemDetails { - URI type_ optional, + charstring type_ optional, charstring title optional, integer status optional, charstring detail optional, - URI instance optional, + charstring instance optional, charstring cause optional, InvalidParams invalidParams optional } @@ -220,14 +234,6 @@ import from OneM2M_TypesAndValues {type Resource_2; type ResourceTypeList_1; typ boolean requestWebsocketUri optional } - type record URI { - charstring apiRoot, - charstring apiName ("3gpp-nidd", "3gpp-device-triggering"), - charstring apiVersion ("v1"), - charstring apiSpecificSuffixes optional, - record of charstring queryParameters optional - } - type record RdsPort { Port portUE, Port portSCEF diff --git a/OneM2M_Testcases_CSE_Release_3.ttcn b/OneM2M_Testcases_CSE_Release_3.ttcn index 61ce1653479980f7c87bf6c5966104489fca8b30..2eb18c29b85643970802924d34b2fc3571ecc121 100644 --- a/OneM2M_Testcases_CSE_Release_3.ttcn +++ b/OneM2M_Testcases_CSE_Release_3.ttcn @@ -24,6 +24,8 @@ module OneM2M_Testcases_CSE_Release_3 { import from LibCommon_Time all; import from XSD all; + import from OneM2M_Types_3GPP_T8 all; + //Demos used for validation purposes group oneM2M_demos { @@ -16751,6 +16753,363 @@ module OneM2M_Testcases_CSE_Release_3 { } // end of group Delete }// end group Semantic + + group t8_scef_tests { // FIXME To be removed, for Test System debug purpose + + // GET all confgurations from an SCEF + testcase TC_CSE_3GPP_SCEF_T8_001() runs on ScefSimu system ScefSystem { + f_cf01UpT8(); + + mcnPort.send( + m_t8Request( + m_t8_request_get( + m_uri_3gpp_nidd(PX_T8_API_ROOT, "scs_as_id_01/configurations"), + { + { "Host", vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.sutAddress & ":" & int2str(vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.remotePort) }, + { "User-Agent", "oneM2M Test Adapter - TTF001" }, + { "Accept", "*/*" }, + { "ContentType", "application/json" }, + { "Connection", "keep-alive" } + } + ))); + tc_ac.start; + alt { + [] mcnPort.receive(mw_t8Response(mw_t8_response_200_ok(-, mw_response_body_niddConfigurations(?/*{m_niddConfiguration}*/)))) { + tc_ac.stop; + setverdict(pass); + } + [] mcnPort.receive(mw_t8Response) { + tc_ac.stop; + setverdict(fail); + } + [] tc_ac.timeout { + setverdict(inconc); + } + } // End of 'alt' statement + + f_cf01DownT8(); + } + + // GET a specifc confguration from an SCEF + testcase TC_CSE_3GPP_SCEF_T8_002() runs on ScefSimu system ScefSystem { + f_cf01UpT8(); + + mcnPort.send( + m_t8Request( + m_t8_request_get( + m_uri_3gpp_nidd(PX_T8_API_ROOT, "scs_as_id_01/configurations/cf_001"), + { + { "Host", vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.sutAddress & ":" & int2str(vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.remotePort) }, + { "User-Agent", "oneM2M Test Adapter - TTF001" }, + { "Accept", "*/*" }, + { "ContentType", "application/json" }, + { "Connection", "keep-alive" } + } + ))); + tc_ac.start; + alt { + [] mcnPort.receive(mw_t8Response(mw_t8_response_200_ok(-, mw_response_body_individualNiddConfiguration))) { + tc_ac.stop; + setverdict(pass); + } + [] mcnPort.receive(mw_t8Response) { + tc_ac.stop; + setverdict(fail); + } + [] tc_ac.timeout { + setverdict(inconc); + } + } // End of 'alt' statement + + f_cf01DownT8(); + } + + // POST create a new Nidd confguration for an SCEF + testcase TC_CSE_3GPP_SCEF_T8_003() runs on ScefSimu system ScefSystem { + var T8Primitive v_response; + + f_cf01UpT8(); + + mcnPort.send( + m_t8Request( + m_t8_request_post( + m_uri_3gpp_nidd(PX_T8_API_ROOT, "scs_as_id_01/configurations"), + { + { "Host", vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.sutAddress & ":" & int2str(vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.remotePort) }, + { "User-Agent", "oneM2M Test Adapter - TTF001" }, + { "Accept", "*/*" }, + { "ContentType", "application/json" }, + { "Connection", "keep-alive" } + }, + m_request_body_niddConfiguration(m_niddConfiguration) + ))); + tc_ac.start; + alt { + [] mcnPort.receive(mw_t8Response(mw_t8_response_201_created(-, mw_response_body_individualNiddConfiguration))) -> value v_response { + var charstring v_location; + + tc_ac.stop; + // Check presence of Location HTTP header + for (var integer i := 0; i < lengthof(v_response.t8Response.responseHeaders); i := i + 1) { + if (v_response.t8Response.responseHeaders[i].header_name == "Location") { + v_location := v_response.t8Response.responseHeaders[i].header_value; + break; + } + } // End of 'for' statement + if (isbound(v_location)) { + f_delete_nidd_configuration(v_location); + setverdict(pass); + } else { + setverdict(fail); + } + } + [] mcnPort.receive(mw_t8Response) { + tc_ac.stop; + setverdict(fail); + } + [] tc_ac.timeout { + setverdict(inconc); + } + } // End of 'alt' statement + + f_cf01DownT8(); + } + + // DELETE delete a new Nidd confguration for an SCEF + testcase TC_CSE_3GPP_SCEF_T8_004() runs on ScefSimu system ScefSystem { + var charstring v_location; + + f_cf01UpT8(); + + // Preamble + f_create_nidd_configuration(v_location); + + // Test Body + mcnPort.send( + m_t8Request( + m_t8_request_delete( + m_uri_3gpp_nidd(PX_T8_API_ROOT, "scs_as_id_01/configurations" & "/" & v_location), + { + { "Host", vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.sutAddress & ":" & int2str(vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.remotePort) }, + { "User-Agent", "oneM2M Test Adapter - TTF001" }, + { "Accept", "*/*" }, + { "ContentType", "application/json" }, + { "Connection", "keep-alive" } + } + ))); + tc_ac.start; + alt { + [] mcnPort.receive(mw_t8Response(mw_t8_response_204_no_content)) { + tc_ac.stop; + setverdict(pass); + } + [] mcnPort.receive(mw_t8Response) { + tc_ac.stop; + setverdict(fail); + } + [] tc_ac.timeout { + setverdict(inconc); + } + } // End of 'alt' statement + + f_cf01DownT8(); + } + + // DELETE delete a non existing Nidd confguration for an SCEF + testcase TC_CSE_3GPP_SCEF_T8_005() runs on ScefSimu system ScefSystem { + var charstring v_location := "unknown"; + + f_cf01UpT8(); + + // Preamble + + // Test Body + mcnPort.send( + m_t8Request( + m_t8_request_delete( + m_uri_3gpp_nidd(PX_T8_API_ROOT, "scs_as_id_01/configurations" & "/" & v_location), + { + { "Host", vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.sutAddress & ":" & int2str(vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.remotePort) }, + { "User-Agent", "oneM2M Test Adapter - TTF001" }, + { "Accept", "*/*" }, + { "ContentType", "application/json" }, + { "Connection", "keep-alive" } + } + ))); + tc_ac.start; + alt { + [] mcnPort.receive(mw_t8Response(mw_t8_response_404_not_found)) { + tc_ac.stop; + setverdict(pass); + } + [] mcnPort.receive(mw_t8Response) { + tc_ac.stop; + setverdict(fail); + } + [] tc_ac.timeout { + setverdict(inconc); + } + } // End of 'alt' statement + + f_cf01DownT8(); + } + + // PATCH update an existing Nidd conf_create_nidd_configuration(v_location);fguration for an SCEF + testcase TC_CSE_3GPP_SCEF_T8_006() runs on ScefSimu system ScefSystem { + var charstring v_location; + var NiddConfiguration v_niddConfiguration; + var T8Primitive v_response; + + f_cf01UpT8(); + + // Preambule + f_create_nidd_configuration(v_location); + f_get_nidd_configuration(v_location, v_niddConfiguration); + + // TestBody + v_niddConfiguration.notificationDestination := v_niddConfiguration.notificationDestination & "_patched"; + mcnPort.send( + m_t8Request( + m_t8_request_patch( + m_uri_3gpp_nidd(PX_T8_API_ROOT, "scs_as_id_01/configurations" & "/" & v_location), + { + { "Host", vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.sutAddress & ":" & int2str(vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.remotePort) }, + { "User-Agent", "oneM2M Test Adapter - TTF001" }, + { "Accept", "*/*" }, + { "ContentType", "application/json" }, + { "Connection", "keep-alive" } + }, + m_request_body_niddConfiguration(v_niddConfiguration) + ))); + tc_ac.start; + alt { + [] mcnPort.receive(mw_t8Response(mw_t8_response_200_ok(-, mw_response_body_individualNiddConfiguration(v_niddConfiguration)))) -> value v_response { + + tc_ac.stop; + setverdict(pass); + } + [] mcnPort.receive(mw_t8Response) { + tc_ac.stop; + setverdict(fail); + } + [] tc_ac.timeout { + setverdict(inconc); + } + } // End of 'alt' statement + + f_delete_nidd_configuration(v_location); + + f_cf01DownT8(); + } + + group nidd_functions { + + function f_create_nidd_configuration(out charstring p_location) runs on ScefSimu system ScefSystem { + var T8Primitive v_response; + + mcnPort.send( + m_t8Request( + m_t8_request_post( + m_uri_3gpp_nidd(PX_T8_API_ROOT, "scs_as_id_01/configurations"), + { + { "Host", vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.sutAddress & ":" & int2str(vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.remotePort) }, + { "User-Agent", "oneM2M Test Adapter - TTF001" }, + { "Accept", "*/*" }, + { "ContentType", "application/json" }, + { "Connection", "keep-alive" } + }, + m_request_body_niddConfiguration(m_niddConfiguration) + ))); + tc_ac.start; + alt { + [] mcnPort.receive(mw_t8Response(mw_t8_response_201_created(-, mw_response_body_individualNiddConfiguration))) -> value v_response { + + tc_ac.stop; + // Check presence of Location HTTP header + for (var integer i := 0; i < lengthof(v_response.t8Response.responseHeaders); i := i + 1) { + if (v_response.t8Response.responseHeaders[i].header_name == "Location") { + p_location := v_response.t8Response.responseHeaders[i].header_value; + break; + } + } // End of 'for' statement + if (not(isbound(p_location))) { + setverdict(fail); + } + } + [] mcnPort.receive(mw_t8Response) { + tc_ac.stop; + setverdict(fail); + } + [] tc_ac.timeout { + setverdict(inconc); + } + } // End of 'alt' statement + + } // End of function f_create_nidd_configuration + + function f_delete_nidd_configuration(in charstring p_location) runs on ScefSimu system ScefSystem { + mcnPort.send( + m_t8Request( + m_t8_request_delete( + m_uri_3gpp_nidd(PX_T8_API_ROOT, "scs_as_id_01/configurations" & "/" & p_location), + { + { "Host", vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.sutAddress & ":" & int2str(vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.remotePort) }, + { "User-Agent", "oneM2M Test Adapter - TTF001" }, + { "Accept", "*/*" }, + { "ContentType", "application/json" }, + { "Connection", "keep-alive" } + } + ))); + tc_ac.start; + alt { + [] mcnPort.receive(mw_t8Response(mw_t8_response_204_no_content)) { + tc_ac.stop; + } + [] mcnPort.receive(mw_t8Response) { + tc_ac.stop; + setverdict(fail); + } + [] tc_ac.timeout { + setverdict(inconc); + } + } // End of 'alt' statement + } // End of function f_delete_nidd_configuration + + function f_get_nidd_configuration(in charstring p_location, out NiddConfiguration p_niddConfiguration) runs on ScefSimu system ScefSystem { + var T8Primitive v_response; + + mcnPort.send( + m_t8Request( + m_t8_request_get( + m_uri_3gpp_nidd(PX_T8_API_ROOT, "scs_as_id_01/configurations" & "/" & p_location), + { + { "Host", vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.sutAddress & ":" & int2str(vc_scefSimuDesc.mcnPort.t8PortDesc.binding.httpBindingDesc.bindingDesc.remotePort) }, + { "User-Agent", "oneM2M Test Adapter - TTF001" }, + { "Accept", "*/*" }, + { "ContentType", "application/json" }, + { "Connection", "keep-alive" } + } + ))); + tc_ac.start; + alt { + [] mcnPort.receive(mw_t8Response(mw_t8_response_200_ok(-, mw_response_body_individualNiddConfiguration))) -> value v_response { + tc_ac.stop; + p_niddConfiguration := v_response.t8Response.responseBody.individualNiddConfiguration; + } + [] mcnPort.receive(mw_t8Response) { + tc_ac.stop; + setverdict(fail); + } + [] tc_ac.timeout { + setverdict(inconc); + } + } // End of 'alt' statement + + } // End of function f_get_nidd_configuration + + } // End of group nidd_functions + + } // End of group t8_scef }//end group CSE