| /////////////////////////////////////////////////////////////////////////////// |
| // |
| // Copyright (c) 2000-2019 Ericsson Telecom AB |
| // |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v2.0 |
| // which accompanies this distribution, and is available at |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html |
| /////////////////////////////////////////////////////////////////////////////// |
| // File: EPTF_LwM2M_Tests.ttcn |
| // Description: |
| // Rev: R1A |
| // Prodnr: CNL 113 859 |
| // Updated: 2019-08-27 |
| // Contact: http://ttcn.ericsson.se |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: EPTF_LwM2M_Tests |
| // |
| // Purpose: |
| // This module contains the component tests for the EPTF COAP Applib |
| // |
| // Module Parameters: |
| // tsp_SUT_localHost - *charstring* - Hostname of the tested LwM2M entity |
| // tsp_SUT_localPort - *integer* - Port number of the tested LwM2M entity |
| // tsp_SUT_remoteHost - *charstring* - Hostname of the tester component |
| // tsp_SUT_remotePort - *integer* - Port number of the tester component |
| // tsp_Leshan_host - *charstring* - Hostname of the Leshan server used as SUT |
| // tsp_Leshan_coapPort - *integer* - Port number (unencyprted) of the Leshan server used as SUT |
| // tsp_Leshan_coapsPort - *integer* - Port number (DTLS) of the Leshan server used as SUT |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_LwM2M_Tests |
| { |
| import from EPTF_MBT_LGen_Definitions all; |
| import from EPTF_MBT_LGen_Functions all; |
| import from EPTF_COAP_LGen_Definitions all; |
| import from EPTF_COAP_LGen_Functions all; |
| import from EPTF_COAP_LocalTransport_Definitions all; |
| import from EPTF_COAP_LocalTransport_Functions all; |
| import from EPTF_LwM2M_LGen_Definitions all; |
| import from EPTF_LwM2M_LGen_Functions all; |
| import from EPTF_LwM2M_CoapApplibTransport_Definitions all; |
| import from EPTF_LwM2M_CoapApplibTransport_Functions all; |
| import from EPTF_LwM2M_Object_Definitions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from CoAP_Types all; |
| import from LightweightM2M_Types all; |
| import from LWM2M_TLV_Types all; |
| import from LWM2M_TLV_EncDec all; |
| import from LWM2M_JSON_Types all; |
| import from LWM2M_JSON_EncDec all; |
| import from IoT_FT_Framework_Definitions all; |
| import from IoT_FT_Framework_Functions all; |
| import from IFW_CoAP_Peer_Definitions all; |
| import from IFW_CoAP_Peer_TestSteps all; |
| import from EPTF_COAP_Transport_Definitions all; |
| |
| modulepar charstring tsp_SUT_localHost := "127.0.0.1"; |
| modulepar integer tsp_SUT_localPort := 31111; |
| modulepar charstring tsp_SUT_remoteHost := "127.0.0.1"; |
| modulepar integer tsp_SUT_remotePort := 5683; |
| |
| modulepar charstring tsp_Leshan_host := "127.0.0.1"; |
| modulepar integer tsp_Leshan_coapPort := 5683; |
| modulepar integer tsp_Leshan_coapsPort := 5684; |
| |
| // SUT: LwM2M LGen |
| type component LWM2M_Applib_CT extends |
| EPTF_MBT_LGen_CT, |
| EPTF_COAP_LGen_CT, EPTF_COAP_LocalTransport_CT , |
| EPTF_LwM2M_LGen_CT, EPTF_LwM2M_CoapApplibTransport_CT |
| {} |
| |
| // Tester_CT |
| type component LWM2M_FSM_CT extends EPTF_MBT_Tester_CT, IFW_MAIN_CT {} |
| |
| function f_LWM2M_Tests_begin(in boolean p_useDTLS := false) runs on LWM2M_FSM_CT |
| { |
| log(%definitionId, " started"); |
| setverdict(pass); |
| |
| f_EPTF_Base_init_CT("mtc"); |
| |
| log(%definitionId, " Creating SUT"); |
| |
| var LWM2M_Applib_CT vc_sut := LWM2M_Applib_CT.create; |
| connect(self:EPTF_MBT_TESTER_PCO, vc_sut:EPTF_MBT_PCO); |
| vc_sut.start(f_LWM2M_Applib_behavior(p_useDTLS)); |
| EPTF_MBT_TESTER_PCO.receive(EPTF_MBT_CommandResponse:?) from vc_sut; |
| |
| EPTF_MBT_TESTER_PCO.send(EPTF_MBT_ConfigRequest: |
| { |
| entityGroupName := "SUT_EntityType", |
| noEntities := 1, |
| behaviors := {c_EPTF_MBT_myBName, c_COAP_behaviorType, c_LwM2M_behaviorType}, |
| fsmName := "FSM_MBT" |
| } |
| ) to vc_sut; |
| EPTF_MBT_TESTER_PCO.receive(EPTF_MBT_ConfigResponse:?) from vc_sut; |
| |
| log(%definitionId, " SUT ready"); |
| |
| log(%definitionId, " finished"); |
| } |
| |
| function f_LWM2M_Tests_end() runs on LWM2M_FSM_CT |
| { |
| log("### MAIN: END TESTCASE started"); |
| |
| f_EPTF_Base_stopAll(none, true); |
| |
| log("### MAIN: END TESTCASE finished"); |
| } |
| |
| function f_handleVerdict(in boolean p_verdict) |
| { |
| if (p_verdict) { setverdict(pass) } |
| else { action("Setting verdict to fail"); setverdict(fail) } |
| } |
| |
| function f_LWM2M_Applib_behavior(in boolean p_useDTLS := false) runs on LWM2M_Applib_CT |
| { |
| var charstring vl_selfName := "SUT_LGen"; |
| |
| // Init |
| f_EPTF_MBT_init(vl_selfName,0, "SUT_"); |
| |
| ////////////////////// |
| // COAP applib init |
| |
| f_EPTF_COAP_LGen_init(vl_selfName); |
| f_EPTF_COAP_LocalTransport_init(); |
| |
| vf_EPTF_COAP_Transport_send := refers(f_EPTF_COAP_LocalTransport_send); |
| vf_EPTF_COAP_Transport_receiveMessage := refers(f_EPTF_COAP_LGen_receiveMessage); |
| vf_EPTF_COAP_Transport_receiveEvent := refers(f_EPTF_COAP_LGen_receiveEvent); |
| vf_EPTF_COAP_Transport_apiRequest := refers(f_EPTF_COAP_LocalTransport_transportApiRequest); |
| vf_EPTF_COAP_Transport_apiResponse := refers(f_EPTF_COAP_LGen_transportApiResponse); |
| |
| ////////////////////// |
| // LWM2M applib init |
| |
| f_EPTF_LwM2M_LGen_init(vl_selfName); |
| f_EPTF_LwM2M_CoapApplibTransport_init(vl_selfName); |
| |
| vf_COAP_msgReceived := refers(f_EPTF_LwM2M_CoapApplibTransport_messageReceived); |
| vf_COAP_eventIndication := refers(f_EPTF_LwM2M_CoapApplibTransport_eventIndication); |
| vf_EPTF_LwM2M_Transport_send := refers(f_EPTF_LwM2M_CoapApplibTransport_send); |
| vf_EPTF_LwM2M_Transport_receiveMessage := refers(f_EPTF_LwM2M_LGen_receiveMessage); |
| vf_EPTF_LwM2M_Transport_receiveEvent := refers(f_EPTF_LwM2M_LGen_receiveEvent); |
| |
| var integer vl_addrIdx; |
| var EPTF_COAP_Transport vl_proto := { ip := { udp := {} } }; |
| |
| if (p_useDTLS) { |
| vl_proto := { ip := { dtls := { udp := {} } } }; |
| } |
| |
| f_EPTF_COAP_transportEndpointDB_add({ socket := {tsp_SUT_localHost, tsp_SUT_localPort}, proto := vl_proto }, vl_addrIdx); |
| f_EPTF_COAP_transportEndpointDB_add({ socket := {tsp_SUT_remoteHost, tsp_SUT_remotePort}, proto := vl_proto }, vl_addrIdx); |
| f_EPTF_COAP_transportEndpointDB_add({ socket := {tsp_Leshan_host, tsp_Leshan_coapPort}, proto := vl_proto }, vl_addrIdx); |
| f_EPTF_COAP_transportEndpointDB_add({ socket := {tsp_Leshan_host, tsp_Leshan_coapsPort}, proto := vl_proto }, vl_addrIdx); |
| |
| var integer v_tempIdx; |
| v_tempIdx := f_EPTF_LwM2M_TemplateDB_add({id:= "t_LWM2M_register", msg:=valueof(t_LWM2M_register)}); |
| v_tempIdx := f_EPTF_LwM2M_TemplateDB_add({id:= "t_LWM2M_update", msg:=valueof(t_LWM2M_update)}); |
| v_tempIdx := f_EPTF_LwM2M_TemplateDB_add({id:= "t_LWM2M_deregister", msg:=valueof(t_LWM2M_deregister)}); |
| v_tempIdx := f_EPTF_LwM2M_TemplateDB_add({id:= "t_LWM2M_register_psk", msg:=valueof(t_LWM2M_register_psk)}); |
| |
| f_EPTF_MBT_initLGenFsm(null, null); |
| EPTF_MBT_PCO.send(EPTF_MBT_CommandResponse:{ ready := {}}) to mtc; |
| |
| // Loop |
| f_EPTF_Base_wait4Shutdown(); |
| } |
| |
| template EPTF_MBT_LGen_Definitions.FsmAddr t_addr(integer eIdx, template integer fIdx := 0) := |
| { |
| entityGroupName := "SUT_EntityType", |
| eIdx := eIdx, |
| fIdx := fIdx |
| } |
| |
| function f_delay(in float p_time) |
| { |
| timer t:= p_time; |
| t.start; |
| t.timeout; |
| } |
| |
| |
| template LWM2M_PDU t_LWM2M_register := |
| { |
| Register := |
| { |
| endpointClientName := "eantwuh_SimDev", |
| lifetime := 30, |
| version := omit, |
| bindingMode := U, |
| smsNumber := omit, |
| objectsAndObjectInstances := {} |
| } |
| } |
| |
| template LWM2M_PDU t_LWM2M_register_psk := |
| { |
| Register := |
| { |
| endpointClientName := "client1", |
| lifetime := 30, |
| version := omit, |
| bindingMode := U, |
| smsNumber := omit, |
| objectsAndObjectInstances := {} |
| } |
| } |
| |
| template LWM2M_PDU t_LWM2M_update := |
| { |
| Update := |
| { |
| location := {}, |
| lifetime := 30, |
| bindingMode := U, |
| smsNumber := omit, |
| objectsAndObjectInstances := {} |
| } |
| } |
| |
| template LWM2M_PDU t_LWM2M_deregister := |
| { |
| Deregister := |
| { |
| location := {} |
| } |
| } |
| |
| const integer c_localAddr := 0; |
| const integer c_remoteAddr := 1; |
| const integer c_LeshanCoapAddr := 2; |
| const integer c_LeshanCoapsAddr := 3; |
| |
| const integer c_t_Register := 0; |
| const integer c_t_Update := 1; |
| const integer c_t_Deregister := 2; |
| const integer c_t_Register_psk := 3; |
| |
| const integer c_psk_identityIdx := 0; |
| |
| template CoAP_ReqResp tr_COAP(Code p_code) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := ?, |
| code := p_code, |
| message_id := ? |
| }, |
| token := ?, |
| options := *, |
| payload := * |
| } |
| |
| template CoAP_ReqResp tr_COAP_payload(Code p_code, template octetstring p_payload) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := ?, |
| code := p_code, |
| message_id := ? |
| }, |
| token := ?, |
| options := *, |
| payload := p_payload |
| } |
| |
| template CoAP_ReqResp t_COAP_registered := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := ACKNOWLEDGEMENT, |
| code := RESPONSE_CODE_Created, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { location_path := "rd" }, |
| { location_path := "unique" } |
| }, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_COAP_deregistered := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := ACKNOWLEDGEMENT, |
| code := RESPONSE_CODE_Deleted, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := {}, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_COAP_read_resource_3303_0_5700(in integer p_accept) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_GET, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "3303" }, |
| { uri_path := "0" }, |
| { uri_path := "5700" }, |
| { accept := p_accept } |
| }, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_COAP_read_resource_5_0_3(in integer p_accept) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_GET, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "5" }, |
| { uri_path := "0" }, |
| { uri_path := "3" }, |
| { accept := p_accept } |
| }, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_COAP_read_resource_1_0_7(in integer p_accept) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_GET, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "1" }, |
| { uri_path := "0" }, |
| { uri_path := "7" }, |
| { accept := p_accept } |
| }, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_COAP_read_object_instance(in integer p_accept) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_GET, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "5" }, |
| { uri_path := "0" }, |
| { accept := p_accept } |
| }, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_COAP_read_object(in integer p_accept) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_GET, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "5" }, |
| { accept := p_accept } |
| }, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_COAP_write_3305_0_5806(integer p_format, octetstring p_payload) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_PUT, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "3305" }, |
| { uri_path := "0" }, |
| { uri_path := "5806" }, |
| { content_format := p_format } |
| }, |
| payload := p_payload |
| } |
| |
| template CoAP_ReqResp t_COAP_write_1_0_1(integer p_format, octetstring p_payload) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_PUT, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "1" }, |
| { uri_path := "0" }, |
| { uri_path := "1" }, |
| { content_format := p_format } |
| }, |
| payload := p_payload |
| } |
| |
| template CoAP_ReqResp t_COAP_write_1_0_7(integer p_format, octetstring p_payload) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_PUT, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "1" }, |
| { uri_path := "0" }, |
| { uri_path := "7" }, |
| { content_format := p_format } |
| }, |
| payload := p_payload |
| } |
| |
| template CoAP_ReqResp t_COAP_execute := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_POST, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "3303" }, |
| { uri_path := "0" }, |
| { uri_path := "5605" }, |
| { accept := 11542 } |
| }, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_COAP_observe := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_GET, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { observe := 0 }, |
| { uri_path := "3303" }, |
| { uri_path := "0" }, |
| { uri_path := "5700" }, |
| { accept := 11542 } |
| }, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_CON_PUT_Block1_FwUg_num0 := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := { class := 0, detail := 3 }, |
| message_id := 42919 |
| }, |
| token := '088042E55D354B17'O, |
| options := |
| { |
| { uri_path := "5" }, |
| { uri_path := "0" }, |
| { uri_path := "0" }, |
| { content_format := 11542 }, |
| { block1 := { num := 0, m := true, szx := 5 } }, |
| { size1 := 1889 } |
| }, |
| payload := 'D000075D2E8ADE9A2A6CBA6768968AEC8AD6A67AD7289EC79CB5EB6EADA762A62B1C8A781E962B4C6AEAE2B2D8A772276E9ED9A296282E95AB1E76F7ACB626EE96E99EB2D6E26DE9DDBA6AAE8AC36E9656A29EC6A989E9EC7A6A5EADD8A09E2B2C8A6A1D8A87AD8A6A5EADD89EB677AAB9E4AEB297A7762B2C7AEB5DA25A2B76E885BAC71E8A785E9DDADEAE2B5DA25A2B328ADB89AB6EAE98ACB5E9A9BAC96E72DBAC9EE96569EB5F7AE8226AD7A58AD36E9DC7AB6ADBAB9DA7A57A27DE9DDBE2B5A7A2A6CBA6BE2B5A79E95E89F7A776B8689DCBAC7ACB5279D96E72DBAC6E56A7762B5E95E89F7A774F7A595E9ED7ACAAE79EB5CBABB2EB1DA25A2B328ADB8A7BA595A99A8276AD7A6A6EB2779C6AE72DA2BA6569C7AB6AD9A89658ACB22B5A99EB6B8ACBAC0AB6ACBAD99EB6EB1CA27B1E72D7ADBABB2896589C8ADB9D8A79EE9DC69D8A09E2B2C8A68EEB2DA157ACB626EE96E9A275A71CBA6B1A9DDBA2AAE8AC9A895EB2D89EB6EAE98AC0AB6AC89A72E962B2DA2BB68ADEB9EC6F6AB8AEB28AE76AB79279DB1A822B6D8ACA68AEDB62B68AE7BA77229EF7A189CBA56A66A09DA6E26DE9DDBA6B22B5A99EB44B626A69686E8AED8ACB1E99A72589B7ABA1FAE29E08A595A8A6A5EADD89EB42ADAB2779CA6EAEEB2789B8407A779A9EEB5E7DF89C8ADBAB6AB72E3EB69EB1E9EDBDE96F7A58ADAAE8AC6A7B5E7AE8AC9A'O |
| } |
| |
| template CoAP_ReqResp t_CON_PUT_Block1_FwUg_num1 := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := { class := 0, detail := 3 }, |
| message_id := 42920 |
| }, |
| token := '088042E55D354B17'O, |
| options := |
| { |
| { uri_path := "5" }, |
| { uri_path := "0" }, |
| { uri_path := "0" }, |
| { content_format := 11542 }, |
| { block1 := { num := 1, m := true, szx := 5 } } |
| }, |
| payload := '876995A71EADAB42ADAB2D7A6A6EB2F8AF7ABADA99AB2C6ABBADAEE9AD8A772276E9ED7ABA2CB2875A95EB22750BA2B2AB9E7AE8AC9A8769BABBACAAE8AC7A78A6A6E96F8A76ABBAD75AA626EEB268AC71E95EAE2B2AB9E35A9AABA2B2579CB6EB2F7A576E8AE96DAE27227AC95AA2B79EB54B5DBA295EA1CA269A87689E89DEAE8B2779C89A72E962B229ED7AB76E9ADA2BB68AC2ADAB2779C7DAB9C89BBAC95EA05BAC71EA6569C7AB6AD95AA2B79EB68762A27A27BEE969BAD6AD7AC7A68A7B5EADDBA689D42E8ACAAE7A9A2BB6D8ADA2BBA595A99CA2BA5EAE569CBACB22B5A99EB666B18A6BAC9EE9656AD7A6A6EB2C8AD6A67AD0EE8AC7289DD8A67A7B6E9A78AC96C8AD6A67AD7289DD8A67A7B6E99FAE29E08A595A7626A67A58ADA68B2E7AB79AADCBAC8AD6A67ADB5E9A9A2BB1AA627A7B1E99EB666ACB1A4AEB297A7762B2C7A789B85E9E29AF8AF7ABADA7AE99AC629AEB2C79D69C72E9AC6A79E89EDA2BB68AD57ACB626EE96E9A29DEAE8B1CBABB2EB2E9656A6728AE97AB9E26E1BDE95CA27BDA9658AC96282E95A12D89A9A66B18A6BACB2896589C8ADB9D8A77ACB5F8A789BBAC79F7E2722B6EACC6AEAE2B1EB9B95A9DD8AD99AB2C69279DA68AED6A78AC9629E78AC969A2CB9EADE7AEBDAAE2BAC9A27DAB9C89BBAC36E9656AE96DAE27227ACBDAAE2BAC99A82769AA6E96F8A76AB96282E95A9A8965'O |
| } |
| |
| template CoAP_ReqResp t_CON_PUT_Block1_FwUg_num2 := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := { class := 0, detail := 3 }, |
| message_id := 42921 |
| }, |
| token := '088042E55D354B17'O, |
| options := { |
| { uri_path := "5" }, |
| { uri_path := "0" }, |
| { uri_path := "0" }, |
| { content_format := 11542 }, |
| { block1 := { num := 2, m := true, szx := 5 } } |
| }, |
| payload := '8AC7DA722962B22B05BAC71EBDE86272E95A99AC629AEB229A97AB7627AD49E76E9656A6728AE97AB8A7B5EADDBA67ABA2C7AE8AC9A876E9656A6728AE97AB31ABAB8ACAAE8ACA6E96F8A76AB7ACB6C79DA2B9DAADE95EA089DEBAD7A6A68AE57A831ABAB8AC69C72E9AC6A795E72DBAC89D6AE82E7A29ED7AB76E99E81EB5E7DF89C8ADBAB99ABAB8AC9686E8AED8AC3E16AC7A596EB1A962AAE6A6A6E96F8A76ABBDE86272E95A4AEB297A7762B2C79F69C8A58AC8AC8A6A5EADD89EB5ABA0B9EB22B5A99EB5A962AAE7AD562BDA9AEB2985AADEB6B69EB678AC89E81EB66A257ACB6278D6A699A82769EAE8B2C7A6A5EAEF7A57A07ACB5AB2779CBDEB2D89BBA5BA67AE76E8889ED7A07ABB2EB1C8A98AD9EE9DC9DE71CA27B1EAAE6AD96E72DBAC31A79C7A76ACB6EAE98AC99A8276A269CBA58ACBADBAB9DA8A77289EC7AAB9AB5F7AE8226AD76E88C6AEAE2B2ABA2B1EC6F8AD69E8A9B2E99CBABB2EB2985AADEB6B6957ACB626EE96E99AB6EAE98AC89DBDE962B617A776B7AB8AD7DEAE67A7B6E98CA2B6E2AE1A2772EB1CA269A876899AB2C6889E9A2BB6D8ADA2B95A72EB2EB5B89B7A776E99A71CBA6B1A9D4B67A279626DEAE8B1E7657A89A895EB2D89E7289EF6A5962B10BA2B2AB9E6E26DE9DDBA6B5E965BAC89DAAE6A67289EC7AAB9AB69A2BB5A36E9656A58A0BA56AB8ACBACB2EB1C8A98ADBAD99ABAB8'O |
| } |
| |
| template CoAP_ReqResp t_CON_PUT_Block1_FwUg_num3 := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := { class := 0, detail := 3 }, |
| message_id := 42922 |
| }, |
| token := '088042E55D354B17'O, |
| options := |
| { |
| { uri_path := "5" }, |
| { uri_path := "0" }, |
| { uri_path := "0" }, |
| { content_format := 11542 }, |
| { block1 := { num := 3, m := false, szx := 5 } } |
| }, |
| payload := 'ACB22B5A99EB5D8A09E2B2C8A6AEEB6BBA6B6EAE98AC328ADB89EB9E962B5A95E72DBACA68B2E7AB79E95E99E9EDBA67AEB1E767BA7703A2779CBEE969BAD6AD79A962AAE6A699A8276AF7A58A6A5EADD89EB40962AAE6A6B1A822B6D8AC7A58ADB1E75FAE29E08A595A7289EC7AAB9AB4FADA7AC7A7B666A57ACB9A75A7A78A6B5E9A9A2B9A28A7B5EADDBA6AEEB6BBA6A5E9657A7B5EB2AB9E9A2A6E96F8A76AB0AEADA6E2B6EAE56A8ADE7AD76272DBA67AE8AC9A874DBA595A89D9A89658AC95A72EB229E985AADEB6B69DA25A2B562BDA9AEB27A27AEEB6BBA69626DEAE8328ADB8A29DD89A99F7AE8226ADBE2BDEAEB6A589B7ABA1A7229ED7AB76E99D89A98D6A6A68AEDB62B68AEC7A67A07AD9A895EB2D89EB629DC89DBA7B489EF8AD69E8A6A5EADD89EB6688EADC8AF6AB8AEB276ADA2AB9EA5E9DAB626EEB1EB666A09E2B1D8ACA5AAEDBAB89E9ED9A89ED7AC9DAB1C7ADBABAE276272E96EB26BA'O |
| } |
| |
| template CoAP_ReqResp t_RST_Empty := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := RESET, |
| code := EMPTY_MESSAGE, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := omit, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp t_CON_PUT_Block1(template BlockOption p_block1) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := CONFIRMABLE, |
| code := METHOD_PUT, |
| message_id := 0 |
| }, |
| token := ''O, |
| options := |
| { |
| { uri_path := "5" }, |
| { uri_path := "0" }, |
| { uri_path := "0" }, |
| { content_format := 11542 }, |
| { block1 := p_block1 }, |
| { size1 := 8863 } |
| }, |
| payload := 'D000229B504B03041400000008008DA0A64E479244B258010000F0040000130000005B436F6E74656E745F54797065735D2E786D6CAD944D4EC3301085F79C22F216256E5920849A7641610995280730F6A4B1EAD89667FA777B26690B088940D56E6245F67BDFF879ECD164DBB86C0D096DF0A51816039181D7C158BF28C5DBFC29BF131992F246B9E0A1143B4031195F8DE6BB0898B1D863296AA2782F25EA1A1A854588E079A60AA951C4BF6921A3D24BB500793318DC4A1D3C81A79C5A0F311EBD303F5903D94C257A560D63E4D6496237D87F8705FB89EC612F6CD9A550313AAB1571E172EDCD0F6A1EAACA6A3041AF1A96149DCD75EB227F0522ED1CE0D9288C0994C11A801A57EC4D8FE429546AE5287BDCB2FB3EF3040E4FE31DC22C58D9ADC1DAC63E42FF867ED7ADCF0C82F5D3A436DC4A3DA16F425ABE87B0BC74ECED5834CAFABE4367F12C858892516717006D72064C1ED91212D9AF63EF65EB90E074F8B1095AF53F8987B4BB685076C3F0C2B17FFAFF75D56A95C0BC52E2E6B8F88DFBEE7DAC43760FD6F803504B03041400000008008DA0A64E17B63738E90000004B0200000B0000005F72656C732F2E72656C73AD92CD6AC3300C80EF7B0AA37BA3B48531469D5ECAA0B732B207D06CE5872496B1BD2D7DFB7987B105BAD2C38E96A54F9F8476FB791AD53B87D88BD3B02E4A50EC8CD8DEB51A5EEAA7D5'O |
| } |
| |
| template CoAP_ReqResp tr_Changed_withBlock1(Type p_msgType, template BlockOption p_block1) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := p_msgType, |
| code := RESPONSE_CODE_Changed, |
| message_id := ? |
| }, |
| token := ?, |
| options := |
| { |
| { block1 := p_block1 } |
| }, |
| payload := omit |
| } |
| |
| template CoAP_ReqResp tr_Continue_withBlock1(Type p_msgType, template BlockOption p_block1) := |
| { |
| header := |
| { |
| version := 1, |
| msg_type := p_msgType, |
| code := { class := 2, detail := 31}, |
| message_id := ? |
| }, |
| token := ?, |
| options := |
| { |
| { block1 := p_block1 } |
| }, |
| payload := omit |
| } |
| |
| function f_initialization(in integer p_remoteAddr := c_remoteAddr) runs on LWM2M_FSM_CT |
| { |
| f_MBT_execute(c_COAP_stepName_init, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_COAP_stepName_setLocalAddress, valueof(t_addr(0, 0)), {c_localAddr}, false); |
| f_MBT_execute(c_COAP_stepName_setRemoteAddress_byIntIdx, valueof(t_addr(0, 0)), {p_remoteAddr}, false); |
| f_MBT_execute(c_COAP_stepName_reportCoapEventForEntity, valueof(t_addr(0, 0)), {c_COAP_stepParam_false}, false); |
| |
| f_MBT_execute(c_LwM2M_stepName_createDevice, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_createObject, valueof(t_addr(0, 0)), {c_LwM2M_Server_obj_id}, false); |
| f_MBT_execute(c_LwM2M_stepName_createObjectInstance, valueof(t_addr(0, 0)), {c_LwM2M_Server_obj_id}, false); |
| f_MBT_execute(c_LwM2M_stepName_createObject, valueof(t_addr(0, 0)), {c_LwM2M_FirmwareUpdate_obj_id}, false); |
| f_MBT_execute(c_LwM2M_stepName_createObjectInstance, valueof(t_addr(0, 0)), {c_LwM2M_FirmwareUpdate_obj_id}, false); |
| f_MBT_execute(c_LwM2M_stepName_createObject, valueof(t_addr(0, 0)), {c_LwM2M_Temperature_obj_id}, false); |
| f_MBT_execute(c_LwM2M_stepName_createObjectInstance, valueof(t_addr(0, 0)), {c_LwM2M_Temperature_obj_id}, false); |
| f_MBT_execute(c_LwM2M_stepName_createObject, valueof(t_addr(0, 0)), {c_LwM2M_PowerMeasurement_obj_id}, false); |
| f_MBT_execute(c_LwM2M_stepName_createObjectInstance, valueof(t_addr(0, 0)), {c_LwM2M_PowerMeasurement_obj_id}, false); |
| |
| // content formats: text, senml json, lwm2m json: |
| f_MBT_execute(c_LwM2M_stepName_setContentFormats, valueof(t_addr(0, 0)), {0, 110, 11543}, false); |
| } |
| |
| function f_registration(integer peer) runs on LWM2M_FSM_CT |
| { |
| f_MBT_execute(c_LwM2M_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Register}, false); |
| f_MBT_execute(c_LwM2M_stepName_send, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(METHOD_POST))); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer,valueof(t_COAP_registered), USE_LAST_RECEIVED_MID, USE_LAST_RECEIVED_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, valueof(c_LwM2M_eventName(201)), valueof(t_addr(0, 0)), 3.0)); |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, valueof(c_LwM2M_eventName_2xx), valueof(t_addr(0, 0)), 3.0)); |
| } |
| |
| function f_registration_againstLeshan(in integer p_t_register := c_t_Register) runs on LWM2M_FSM_CT |
| { |
| f_MBT_execute(c_LwM2M_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {p_t_register}, false); |
| f_MBT_execute(c_LwM2M_stepName_send, valueof(t_addr(0, 0)), {}, false); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, valueof(c_LwM2M_eventName(201)), valueof(t_addr(0, 0)), 3.0)); |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, valueof(c_LwM2M_eventName_2xx), valueof(t_addr(0, 0)), 3.0)); |
| } |
| |
| function f_deregistration(integer peer) runs on LWM2M_FSM_CT |
| { |
| f_MBT_execute(c_LwM2M_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Deregister}, false); |
| f_MBT_execute(c_LwM2M_stepName_send, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(METHOD_DELETE))); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer,valueof(t_COAP_deregistered), USE_LAST_RECEIVED_MID, USE_LAST_RECEIVED_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, valueof(c_LwM2M_eventName(202)), valueof(t_addr(0, 0)), 3.0)); |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, valueof(c_LwM2M_eventName_2xx), valueof(t_addr(0, 0)), 3.0)); |
| } |
| |
| function f_deregistration_againstLeshan() runs on LWM2M_FSM_CT |
| { |
| f_MBT_execute(c_LwM2M_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Deregister}, false); |
| f_MBT_execute(c_LwM2M_stepName_send, valueof(t_addr(0, 0)), {}, false); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, valueof(c_LwM2M_eventName(202)), valueof(t_addr(0, 0)), 3.0)); |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, valueof(c_LwM2M_eventName_2xx), valueof(t_addr(0, 0)), 3.0)); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_initialization |
| // |
| // Purpose: |
| // Testcase for setting up a LWM2M device |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_initialization.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_initialization.jpg |
| * FSM -> Applib: c_COAP_stepName_init() |
| * FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr) |
| * FSM -> Applib: c_COAP_stepName_setRemoteAddress_byIntIdx(c_remoteAddr) |
| * FSM -> Applib: c_COAP_stepName_reportCoapEventForEntity(c_COAP_stepParam_false) |
| * FSM -> Applib: c_LwM2M_stepName_createDevice |
| * FSM -> Applib: c_LwM2M_stepName_createObject(c_LwM2M_Temperature_obj_id) |
| * FSM -> Applib: c_LwM2M_stepName_createObjectInstance(c_LwM2M_Temperature_obj_id) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_initialization() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_registration |
| // |
| // Purpose: |
| // Testcase for registering an LWM2M device |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_registration.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_registration.jpg |
| * ref over Applib, Peer: tc_initialization |
| * FSM -> Applib: c_LwM2M_stepName_loadTemplate_byIntIdx(c_t_Register) |
| * FSM -> Applib: c_LwM2M_stepName_send() |
| * Peer <- Applib: CON-POST |
| * Peer -> Applib: ACK-registered with location /rd/unique |
| * FSM <- Applib: c_LwM2M_eventName(201) |
| * FSM <- Applib: c_LwM2M_eventName_2xx |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_registration() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| |
| f_registration(peer); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_registration_dtls.jpg |
| * ref over Applib, Peer: tc_initialization |
| * FSM -> Applib: c_LwM2M_stepName_loadTemplate_byIntIdx(c_t_Register) |
| * FSM -> Applib: c_LwM2M_stepName_send() |
| * Peer <- Applib: DTLS establishment |
| * Peer -> Applib: DTLS established |
| * Peer <- Applib: CON-POST |
| * Peer -> Applib: ACK-registered with location /rd/unique |
| * FSM <- Applib: c_LwM2M_eventName(201) |
| * FSM <- Applib: c_LwM2M_eventName_2xx |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| /* |
| testcase tc_registration_dtls() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(p_useDTLS := true); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| var CoapContext v_ctx; |
| f_IFW_CoapPeer_getContext(peer, v_ctx); |
| v_ctx.listeningProtocol := { dtls := { udp := {} } }; |
| f_IFW_CoapPeer_setContext(peer, v_ctx); |
| |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| |
| f_registration(peer); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| */ |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_deregistration |
| // |
| // Purpose: |
| // Testcase for registering and deregistering an LWM2M device |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_deregistration.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_deregistration.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * FSM -> Applib: c_LwM2M_stepName_loadTemplate_byIntIdx(c_t_Deregister) |
| * FSM -> Applib: c_LwM2M_stepName_send() |
| * Peer <- Applib: CON-DELETE |
| * Peer -> Applib: ACK-deregistered |
| * FSM <- Applib: c_LwM2M_eventName(202) |
| * FSM <- Applib: c_LwM2M_eventName_2xx |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_deregistration() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| f_deregistration(peer); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_resource_float_using_text |
| // |
| // Purpose: |
| // Testcase for reading a float resource value with LwM2M JSON encoding |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_resource_float_using_text.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_resource_float_using_text.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 3303/0/5700 (plain/text) |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content (float, plain/text) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_resource_float_using_text() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_resource_3303_0_5700(0)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_resource_float_using_lwm2m_json |
| // |
| // Purpose: |
| // Testcase for reading a float resource value with LwM2M JSON encoding |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_resource_float_using_lwm2m_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_resource_float_using_lwm2m_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 3303/0/5700 (LwM2M JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content (float, LwM2M JSON) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_resource_float_using_lwm2m_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_resource_3303_0_5700(11543)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_resource_float_using_senml_json |
| // |
| // Purpose: |
| // Testcase for reading a float resource value with SenML JSON encoding |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_resource_float_using_senml_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_resource_float_using_senml_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 3303/0/5700 (SenML JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content (float, SenML JSON) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_resource_float_using_senml_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_resource_3303_0_5700(110)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_resource_int_using_text |
| // |
| // Purpose: |
| // Testcase for reading an integer resource value with text encoding |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_resource_int_using_text.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_resource_int_using_text.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 5/0/3 (plain/text) |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content (int, plain/text) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_resource_int_using_text() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_resource_5_0_3(0)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, char2oct("0")))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_resource_int_using_lwm2m_json |
| // |
| // Purpose: |
| // Testcase for reading an integer resource value with lwm2m json encoding |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_resource_int_using_lwm2m_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_resource_int_using_lwm2m_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 5/0/3 (LwM2M JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content (int, LwM2M JSON) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_resource_int_using_lwm2m_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_resource_5_0_3(11543)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_resource_int_using_senml_json |
| // |
| // Purpose: |
| // Testcase for reading an integer resource value with SenML json encoding |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_resource_int_using_senml_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_resource_int_using_senml_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 5/0/3 (SenML JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content (int, SenML JSON) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_resource_int_using_senml_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_resource_5_0_3(110)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_resource_string_using_text |
| // |
| // Purpose: |
| // Testcase for reading a string resource value with text/plain encoding |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_resource_string_using_text.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_resource_string_using_text.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 1/0/7 (text plain) |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content (string, text plain) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_resource_string_using_text() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_resource_1_0_7(0)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Content))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_resource_string_lwm2m_json |
| // |
| // Purpose: |
| // Testcase for reading a string resource value with LwM2M JSON encoding |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_resource_string_lwm2m_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_resource_string_lwm2m_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 1/0/7 (LwM2M JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content (string, LwM2M JSON) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_resource_string_lwm2m_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_resource_1_0_7(11543)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_resource_string_senlm_json |
| // |
| // Purpose: |
| // Testcase for reading a string resource value with SenML JSON encoding |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_resource_string_senlm_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_resource_string_senlm_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 1/0/7 (SenML JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content (string, SenML JSON) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_resource_string_senlm_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_resource_1_0_7(110)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_float_using_text |
| // |
| // Purpose: |
| // Testcase for writing a float resource value using plain/text |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_float_using_text.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_float_using_text.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP PUT 3305/0/5806 36.2 (text) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_float_using_text() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_write_3305_0_5806( |
| 0, |
| char2oct("36.2") |
| )), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_float_using_lwm2m_json |
| // |
| // Purpose: |
| // Testcase for writing a float resource value using LwM2M JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_float_using_lwm2m_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_float_using_lwm2m_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP PUT 3305/0/5806 36.2 (LwM2M JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_float_using_lwm2m_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_write_3305_0_5806( |
| 11543, |
| char2oct("{\"e\":[ {\"n\":\"\", \"v\": 36.2 } ] }") |
| )), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_float_using_senml_json |
| // |
| // Purpose: |
| // Testcase for writing a float resource value using SenML JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_float_using_senml_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_float_using_senml_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP PUT 3305/0/5806 36.2 (SenML JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_float_using_senml_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_write_3305_0_5806( |
| 110, |
| char2oct("[{\"n\":\"/3305/0/5806\", \"v\": 36.2 } ] }") |
| )), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_int_using_text |
| // |
| // Purpose: |
| // Testcase for writing an integer resource value using plain/text |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_int_using_text.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_int_using_text.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP PUT 1/0/1 60 (text) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_int_using_text() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_write_1_0_1( |
| 0, |
| char2oct("60") |
| )), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_int_using_lwm2m_json |
| // |
| // Purpose: |
| // Testcase for writing an int resource value using LwM2M JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_int_using_lwm2m_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_int_using_lwm2m_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP PUT 1/0/1 60 (LwM2M JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_int_using_lwm2m_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_write_1_0_1( |
| 11543, |
| char2oct("{\"e\":[ {\"n\":\"\", \"v\": 60 } ] }") |
| )), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_int_using_senml_json |
| // |
| // Purpose: |
| // Testcase for writing an int resource value using SenML JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_int_using_senml_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_int_using_senml_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP PUT 1/0/1 60 (SenML JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_int_using_senml_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_write_1_0_1( |
| 110, |
| char2oct("[{\"n\":\"/1/0/1\", \"v\": 60 } ] }") |
| )), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_string_using_text |
| // |
| // Purpose: |
| // Testcase for writing a string resource value using plain/text |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_string_using_text.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_string_using_text.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP PUT 1/0/7 UQ (text) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_string_using_text() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_write_1_0_7( |
| 0, |
| char2oct("UQ") |
| )), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_string_using_lwm2m_json |
| // |
| // Purpose: |
| // Testcase for writing a string resource value using LwM2M JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_string_using_lwm2m_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_string_using_lwm2m_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP PUT 1/0/7 UQ (LwM2M JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_string_using_lwm2m_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_write_1_0_7( |
| 11543, |
| char2oct("{\"e\":[ {\"n\":\"\", \"sv\": \"UQ\" } ] }") |
| )), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_string_using_senml_json |
| // |
| // Purpose: |
| // Testcase for writing a string resource value using SenML JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_string_using_senml_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_string_using_senml_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP PUT 1/0/7 UQ (SenML JSON) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_string_using_senml_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_write_1_0_7( |
| 110, |
| char2oct("[{\"n\":\"/1/0/7\", \"vs\": \"UQ\" } ] }") |
| )), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_execute_resource |
| // |
| // Purpose: |
| // Testcase for writing a resource value |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_execute_resource.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_execute_resource.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP POST 3303/0/5605 (Reset min max values executable resource) |
| * FSM <- Applib: c_LwM2M_eventName_Execute |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleExecuteRequest |
| * Peer <- Applib: COAP Response 204 changed |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_execute_resource() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_execute), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Execute, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleExecuteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Changed))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_object_instance_using_lwm2m_json |
| // |
| // Purpose: |
| // Testcase for reading an object instance using LwM2M JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_object_instance_using_lwm2m_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_object_instance_using_lwm2m_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 5/0 |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_object_instance_using_lwm2m_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_object_instance(11543)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_object_instance_using_senml_json |
| // |
| // Purpose: |
| // Testcase for reading an object instance using SenML JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_object_instance_using_senml_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_object_instance_using_senml_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 5/0 |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_object_instance_using_senml_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_object_instance(110)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_object_using_lwm2m_json |
| // |
| // Purpose: |
| // Testcase for reading an object using LwM2M JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_object_using_lwm2m_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_object_using_lwm2m_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET /5 |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_object_using_lwm2m_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_object(11543)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_read_object_using_senml_json |
| // |
| // Purpose: |
| // Testcase for reading an object using SenML JSON |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_read_object_using_senml_json.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_read_object_using_senml_json.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET /5 |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP 205 content |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_read_object_using_senml_json() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_read_object(110)), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP_payload(RESPONSE_CODE_Content, ?))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_observe_subscription |
| // |
| // Purpose: |
| // Testcase for subscribing to a resource value |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_observe_subscription.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_observe_subscription.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 3303/0/5700 Observe:0 |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP Content |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_observe_subscription() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_observe), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Content))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_observe_notification |
| // |
| // Purpose: |
| // Testcase for sending notification for an observed resource |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_observe_notification.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_observe_notification.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 3303/0/5700 Observe:0 |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP Content with Observe |
| * FSM -> Applib: c_LwM2M_stepName_sendNotificationForObservedResources |
| * Peer <- Applib: COAP Content with Observe |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_observe_notification() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_observe), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Content))); |
| |
| f_MBT_execute(c_LwM2M_stepName_sendNotificationForObservedResources, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Content))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_observe_unsubscribe |
| // |
| // Purpose: |
| // Testcase for unsubscribing from a resource value |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_observe_unsubscribe.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_observe_unsubscribe.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * Peer -> Applib: COAP GET 3303/0/5700 Observe:0 |
| * FSM <- Applib: c_LwM2M_eventName_Read |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleReadRequest |
| * Peer <- Applib: COAP Content with Observe |
| * FSM -> Applib: c_LwM2M_stepName_sendNotificationForObservedResources |
| * Peer <- Applib: COAP Content with Observe |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_observe_unsubscribe() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_COAP_observe), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Read, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleReadRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Content))); |
| |
| f_MBT_execute(c_LwM2M_stepName_sendNotificationForObservedResources, valueof(t_addr(0, 0)), {}, false); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_COAP(RESPONSE_CODE_Content))); |
| |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_RST_Empty), USE_LAST_RECEIVED_MID, USE_GIVEN_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_resourceNotObservedIndication, t_addr(0, ?), 3.0)); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_regDereg_againstLeshan |
| // |
| // Purpose: |
| // Testcase for registering and then deregistering an LWM2M device using an external Leshan LwM2M server |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_regDereg_againstLeshan.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_regDereg_againstLeshan.jpg |
| * ref over Applib, Peer: tc_initialization(c_LeshanCoapAddr) |
| * FSM -> Applib: c_LwM2M_stepName_loadTemplate_byIntIdx(c_t_Register) |
| * FSM -> Applib: c_LwM2M_stepName_send() |
| * Leshan <- Applib: LWM2M Register |
| * Leshan -> Applib: 201 Created |
| * FSM <- Applib: c_LwM2M_eventName(201) |
| * FSM <- Applib: c_LwM2M_eventName_2xx |
| * FSM -> Applib: c_LwM2M_stepName_loadTemplate_byIntIdx(c_t_Deregister) |
| * FSM -> Applib: c_LwM2M_stepName_send() |
| * Leshan <- Applib: LWM2M Deregister |
| * Leshan -> Applib: 204 Deleted |
| * FSM <- Applib: c_LwM2M_eventName(202) |
| * FSM <- Applib: c_LwM2M_eventName_2xx |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_regDereg_againstLeshan() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| f_initialization(c_LeshanCoapAddr); |
| |
| f_registration_againstLeshan(); |
| |
| f_deregistration_againstLeshan(); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_regDereg_againstLeshan.jpg |
| * ref over Applib, Peer: tc_initialization(c_LeshanCoapsAddr) |
| * Leshan <- Applib: DTLS hello |
| * Leshan -> Applib: DTLS established |
| * FSM -> Applib: c_LwM2M_stepName_loadTemplate_byIntIdx(c_t_Register) |
| * FSM -> Applib: c_LwM2M_stepName_send() |
| * Leshan <- Applib: LWM2M Register |
| * Leshan -> Applib: 201 Created |
| * FSM <- Applib: c_LwM2M_eventName(201) |
| * FSM <- Applib: c_LwM2M_eventName_2xx |
| * FSM -> Applib: c_LwM2M_stepName_loadTemplate_byIntIdx(c_t_Deregister) |
| * FSM -> Applib: c_LwM2M_stepName_send() |
| * Leshan <- Applib: LWM2M Deregister |
| * Leshan -> Applib: 204 Deleted |
| * FSM <- Applib: c_LwM2M_eventName(202) |
| * FSM <- Applib: c_LwM2M_eventName_2xx |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| /* |
| testcase tc_regDereg_againstLeshan_dtls() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(p_useDTLS := true); |
| |
| f_initialization(c_LeshanCoapsAddr); |
| |
| f_MBT_execute(c_COAP_stepName_startDTLS, valueof(t_addr(0, 0)), {}, false); |
| f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_transportSucc, valueof(t_addr(0, 0)), 3.0)); |
| |
| f_registration_againstLeshan(); |
| |
| f_deregistration_againstLeshan(); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| */ |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_regDereg_againstLeshan_psk |
| // |
| // Purpose: |
| // Testcase for registering and then deregistering an LWM2M device using an external Leshan LwM2M server (DTLS PSK transport) |
| // |
| // Configuration: |
| // - Leshan must be configured with identity and key according to <tsp_EPTF_COAP_LGen_psks>[0] |
| // - Default identity: "client01" |
| // - Default key: "01020304" |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_regDereg_againstLeshan_psk.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_regDereg_againstLeshan_psk.jpg |
| * ref over Applib, Peer: tc_initialization(c_LeshanCoapsAddr) |
| * FSM -> Applib: c_COAP_stepName_startDTLS_byIntIdx(c_psk_identityIdx) |
| * Leshan <- Applib: DTLS hello (PSK) |
| * Leshan -> Applib: DTLS established (PSDK) |
| * FSM -> Applib: c_LwM2M_stepName_loadTemplate_byIntIdx(c_t_Register_psk) |
| * FSM -> Applib: c_LwM2M_stepName_send() |
| * Leshan <- Applib: LWM2M Register |
| * Leshan -> Applib: 201 Created |
| * FSM <- Applib: c_LwM2M_eventName(201) |
| * FSM <- Applib: c_LwM2M_eventName_2xx |
| * FSM -> Applib: c_LwM2M_stepName_loadTemplate_byIntIdx(c_t_Deregister) |
| * FSM -> Applib: c_LwM2M_stepName_send() |
| * Leshan <- Applib: LWM2M Deregister |
| * Leshan -> Applib: 204 Deleted |
| * FSM <- Applib: c_LwM2M_eventName(202) |
| * FSM <- Applib: c_LwM2M_eventName_2xx |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_regDereg_againstLeshan_psk() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(p_useDTLS := true); |
| |
| f_initialization(c_LeshanCoapsAddr); |
| |
| f_MBT_execute(c_COAP_stepName_startDTLS_byIntIdx, valueof(t_addr(0, 0)), {c_psk_identityIdx}, false); |
| |
| f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_transportSucc, valueof(t_addr(0, 0)), 3.0)); |
| |
| f_registration_againstLeshan(c_t_Register_psk); |
| |
| f_deregistration_againstLeshan(); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /* |
| SUT: Block1 server |
| - recv: Write (block1) stateless, succ |
| - recv: Write (block1) atomic, succ (content indication via fcb COAPapplib -> LWM2Mapplib) |
| ? recv: Write (block1) atomic, unsucc |
| */ |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_block1_stateless_succ |
| // |
| // Purpose: |
| // Testcase for writing a resource value using statless block1 |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_block1_stateless_succ.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_block1_stateless_succ.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * FSM -> Applib: c_LwM2M_stepName_setBlock1Handling_stateless |
| * Peer -> Applib: CON-PUT /5/0/5 with Block1:({num=0, m=true, szx=5}), size1:8863 |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * FSM <- Applib: c_LwM2M_eventName_WriteFWPackage |
| * Peer <- Applib: ACK-204OK with with Block1:({num=0, m=false, szx=5}) |
| * Peer -> Applib: CON-PUT /5/0/5 with Block1:({num=1, m=true, szx=5}) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * FSM <- Applib: c_LwM2M_eventName_WriteFWPackage |
| * Peer <- Applib: ACK-204OK with with Block1:({num=1, m=false, szx=5}) |
| * Peer -> Applib: CON-PUT /5/0/5 with Block1:({num=2, m=false, szx=5}) |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * FSM <- Applib: c_LwM2M_eventName_WriteFWPackage |
| * Peer <- Applib: ACK-204OK with with Block1:({num=2, m=false, szx=5}) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_block1_stateless_succ() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_MBT_execute(c_LwM2M_stepName_setBlock1Handling_stateless, valueof(t_addr(0, 0)), {}, false); |
| |
| // Block1 num=0 (first) |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_PUT_Block1({ num := 0, m := true, szx := 5 })), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_WriteFWPackage, t_addr(0, ?), 3.0)); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Changed_withBlock1(ACKNOWLEDGEMENT, {num:=0, m:=false, szx:=5}))); |
| |
| // Block1 num=1 |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_PUT_Block1({ num := 1, m := true, szx := 5 })), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_WriteFWPackage, t_addr(0, ?), 3.0)); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Changed_withBlock1(ACKNOWLEDGEMENT, {num:=1, m:=false, szx:=5}))); |
| |
| // Block1 num=2 (last) |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_PUT_Block1({ num := 2, m := false, szx := 5 })), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_WriteFWPackage, t_addr(0, ?), 3.0)); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Changed_withBlock1(ACKNOWLEDGEMENT, {num:=2, m:=false, szx:=5}))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Testcase: tc_write_resource_block1_atomic_succ |
| // |
| // Purpose: |
| // Testcase for writing a resource value using atomic block1 |
| // |
| // Action: |
| // (see EPTF_LwM2M_Tests.tc_write_resource_block1_atomic_succ.jpg) |
| /////////////////////////////////////////////////////////// |
| /***************************************************************** |
| * @startuml EPTF_LwM2M_Tests.tc_write_resource_block1_atomic_succ.jpg |
| * ref over Applib, Peer: tc_initialization |
| * ref over Applib, Peer: tc_registration |
| * FSM -> Applib: c_LwM2M_stepName_setBlock1Handling_atomic |
| * Peer -> Applib: CON-PUT /5/0/0 with Block1:({num=0, m=true, szx=5}), size1:1889 |
| * FSM <- Applib: c_LwM2M_eventName_Write |
| * FSM -> Applib: c_COAP_stepName_handleRequest |
| * FSM -> Applib: c_LwM2M_stepName_handleWriteRequest |
| * FSM <- Applib: c_LwM2M_eventName_WriteFWPackage |
| * Peer <- Applib: ACK-204OK with with Block1:({num=0, m=true, szx=5}) |
| * Peer -> Applib: CON-PUT /5/0/0 with Block1:({num=1, m=true, szx=5}) |
| * Peer <- Applib: ACK-204OK with with Block1:({num=1, m=true, szx=5}) |
| * Peer -> Applib: CON-PUT /5/0/0 with Block1:({num=2, m=false, szx=5}) |
| * FSM <- Applib: c_LwM2M_eventName_atomicBlock1Finished |
| * Peer <- Applib: ACK-204OK with with Block1:({num=2, m=false, szx=5}) |
| * FSM -> Applib: c_COAP_stepName_cleanUp() |
| * @enduml |
| ******************************************************************/ |
| testcase tc_write_resource_block1_atomic_succ() runs on LWM2M_FSM_CT |
| { |
| f_LWM2M_Tests_begin(); |
| |
| var integer peer := f_IFW_addComponent(COAP_PEER, "tester"); |
| f_IFW_CoapPeer_setRemote(peer, "sut"); |
| f_IFW_initComponents(); |
| |
| f_initialization(); |
| f_registration(peer); |
| |
| f_MBT_execute(c_LwM2M_stepName_setBlock1Handling_atomic, valueof(t_addr(0, 0)), {}, false); |
| |
| // Block1 num=0 (first) |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_PUT_Block1_FwUg_num0), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_Write, t_addr(0, ?), 3.0)); |
| f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false); |
| f_MBT_execute(c_LwM2M_stepName_handleWriteRequest, valueof(t_addr(0, 0)), {}, false); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_WriteFWPackage, t_addr(0, ?), 3.0)); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Continue_withBlock1(ACKNOWLEDGEMENT, {num:=0, m:= true, szx:=5}))); |
| |
| // Block1 num=1 |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_PUT_Block1_FwUg_num1), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Continue_withBlock1(ACKNOWLEDGEMENT, {num:=1, m:=true, szx:=5}))); |
| |
| // Block1 num=2 |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_PUT_Block1_FwUg_num2), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Continue_withBlock1(ACKNOWLEDGEMENT, {num:=2, m:=true, szx:=5}))); |
| |
| // Block1 num=3 (last) |
| f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_PUT_Block1_FwUg_num3), GENERATE_NEW_MID, GENERATE_NEW_TOKEN); |
| f_IFW_CoapPeer_send(peer); |
| |
| f_handleVerdict(f_MBT_waitFor(c_LwM2M_behaviorType, c_LwM2M_eventName_atomicBlock1Finished, t_addr(0, ?), 3.0)); |
| |
| f_IFW_CoapPeer_receive(peer); |
| f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Changed_withBlock1(ACKNOWLEDGEMENT, {num:=3, m:=false, szx:=5}))); |
| |
| f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false); |
| |
| f_LWM2M_Tests_end(); |
| } |
| |
| testcase tc_tlv_decoding_string() runs on LWM2M_FSM_CT |
| { |
| var octetstring v_oct := |
| 'C801D568747470733A2F2F6D65617339756B37766F706966656C686E2E626C6F622E636F72652E77696E646F77732E6E65742F6677732F34313137383832392D333634312D343234372D623637352D3739393934643666316639313F73763D323031362D30352D33312673723D63267369673D43475833253246415A79786B66675A79474970716D474161595763526D436B5563476A4A42446A377138314F342533442673743D323031382D31302D30325430303A30303A30305A2673653D323031382D31302D30345430303A30303A30305A2673703D72'O; |
| |
| var LWM2M_TLV_Resources v_tlv_resources := {}; |
| v_tlv_resources := f_dec_LwM2M_TLV_Resources(v_oct); |
| log("v_tlv_resources: ", v_tlv_resources); |
| |
| var LwM2M_Resource_List v_resources := {} |
| v_resources := f_LwM2M_TLV_Resources_toResources(v_tlv_resources, {"5","0","1"}); |
| |
| log("decoded resources", v_resources); |
| |
| if (match(v_resources[0], t_lwm2m_str_resource(5,0,1))) |
| { setverdict(pass) } |
| else { setverdict(fail)} |
| } |
| |
| template LwM2M_Resource t_lwm2m_str_resource(integer p_obj, integer p_inst, integer p_id) := |
| { id := p_id, objId := p_obj, objInstId := p_inst, observed := ?, dataSample := omit, spec :=?, contentFormat := *, val := { strValue := ? } } |
| |
| testcase tc_encdec_LwM2M_JSON_Resources_to_oct() runs on LWM2M_FSM_CT |
| { |
| log("data: ",t_lwm2m_json_resources); |
| |
| var octetstring v_encoded := f_enc_LwM2M_JSON_Resources(valueof(t_lwm2m_json_resources)); |
| |
| log("encoded: ", oct2char(v_encoded), "\n", v_encoded); |
| |
| var LwM2M_JSON_Resources v_decoded := f_dec_LwM2M_JSON_Resources(v_encoded); |
| |
| if (match(v_decoded, t_lwm2m_json_resources)) { setverdict(pass)} |
| else { setverdict(fail) } |
| } |
| |
| template LwM2M_JSON_Resources t_lwm2m_json_resources := |
| { |
| bn := "/", |
| e := { |
| { n := "1", v := omit, bv := omit, sv := "sg", ov := omit }, |
| { n := "7/1", v := omit, bv := true, sv := omit, ov := omit }, |
| { n := "11/0/1", v := { f := 4.0 }, bv := omit, sv := omit, ov := omit }, |
| { n := "14/0/1", v := { i := 5 }, bv := omit, sv := omit, ov := omit }, |
| { n := "14/0/1", v := omit, bv := omit, sv := omit, ov := "01020304" } |
| } |
| } |
| |
| testcase tc_encdec_SenML_JSON_Resources_to_oct() runs on LWM2M_FSM_CT |
| { |
| log("data: ", t_senml_json_resources); |
| |
| var octetstring v_encoded := f_enc_SenML_JSON_Resources(valueof(t_senml_json_resources)); |
| |
| log("encoded: ", oct2char(v_encoded), "\n", v_encoded); |
| |
| var SenML_JSON_Resources v_decoded := f_dec_SenML_JSON_Resources(v_encoded); |
| |
| if (match(v_decoded, t_senml_json_resources)) { setverdict(pass)} |
| else { setverdict(fail) } |
| } |
| |
| template SenML_JSON_Resources t_senml_json_resources := |
| { |
| { bn := "/4/0", n := "1", v := omit, vb := omit, vs := "sg", vd := omit }, |
| { bn := omit, n := "2", v := omit, vb := true, vs := omit, vd := omit }, |
| { bn := omit, n := "11", v := { f := 4.0 }, vb := omit, vs := omit, vd := omit }, |
| { bn := omit, n := "14", v := { i := 4 }, vb := omit, vs := omit, vd := omit }, |
| { bn := omit, n := "15", v := omit, vb := omit, vs := omit, vd := "01020304" } |
| } |
| |
| testcase tc_encdec_LwM2M_Resources_to_oct_using_LwM2M_JSON() runs on LWM2M_FSM_CT |
| { |
| log("resources: ", t_lwm2m_resources); |
| |
| var octetstring v_encoded := f_enc_LwM2M_Resources_to_LwM2M_JSON(valueof(t_lwm2m_resources)); |
| |
| log("encoded: ", oct2char(v_encoded), "\n", v_encoded); |
| |
| var LwM2M_Resource_List v_decoded := {}; |
| |
| f_dec_LwM2M_Resources_from_LwM2M_JSON(v_encoded, v_decoded); |
| |
| log("decoded: ", v_decoded); |
| |
| if (match(v_decoded, t_lwm2m_resources)) { setverdict(pass)} |
| else { setverdict(fail) } |
| } |
| |
| testcase tc_encdec_LwM2M_Resources_to_oct_using_SenML_JSON() runs on LWM2M_FSM_CT |
| { |
| log("resources: ", t_lwm2m_resources); |
| |
| var octetstring v_encoded := f_enc_LwM2M_Resources_to_SenML_JSON(valueof(t_lwm2m_resources)); |
| |
| log("encoded: ", oct2char(v_encoded), "\n", v_encoded); |
| |
| var LwM2M_Resource_List v_decoded := {}; |
| |
| f_dec_LwM2M_Resources_from_SenML_JSON(v_encoded, v_decoded); |
| |
| log("decoded: ", v_decoded); |
| |
| if (match(v_decoded, t_lwm2m_resources)) { setverdict(pass)} |
| else { setverdict(fail) } |
| } |
| |
| template LwM2M_Resource_List t_lwm2m_resources := |
| { |
| t_LwM2M_Resource_init(1,0,1,{ strValue := "sg" }), |
| t_LwM2M_Resource_init(1,0,2,{ boolValue := true }), |
| t_LwM2M_Resource_init(1,0,3,{ floatValue := 4.0 }), |
| t_LwM2M_Resource_init(1,0,4,{ intValue := 5 }), |
| t_LwM2M_Resource_init(1,0,5,{ opaqueValue := '01020304'O }) |
| } |
| |
| control |
| { |
| execute(tc_tlv_decoding_string()); |
| execute(tc_encdec_LwM2M_JSON_Resources_to_oct()); |
| execute(tc_encdec_SenML_JSON_Resources_to_oct()); |
| execute(tc_encdec_LwM2M_Resources_to_oct_using_LwM2M_JSON()); |
| execute(tc_encdec_LwM2M_Resources_to_oct_using_SenML_JSON()); |
| |
| execute(tc_initialization()); |
| execute(tc_registration()); |
| execute(tc_deregistration()); |
| |
| execute(tc_read_resource_float_using_text()); |
| execute(tc_read_resource_float_using_lwm2m_json()); |
| execute(tc_read_resource_float_using_senml_json()); |
| execute(tc_read_resource_int_using_text()); |
| execute(tc_read_resource_int_using_lwm2m_json()); |
| execute(tc_read_resource_int_using_senml_json()); |
| execute(tc_read_resource_string_using_text()); |
| execute(tc_read_resource_string_lwm2m_json()); |
| execute(tc_read_resource_string_senlm_json()); |
| execute(tc_read_object_instance_using_lwm2m_json()); |
| execute(tc_read_object_instance_using_senml_json()); |
| execute(tc_read_object_using_lwm2m_json()); |
| execute(tc_read_object_using_senml_json()); |
| |
| execute(tc_write_resource_float_using_text()); |
| execute(tc_write_resource_float_using_lwm2m_json()); |
| execute(tc_write_resource_float_using_senml_json()); |
| execute(tc_write_resource_int_using_text()); |
| execute(tc_write_resource_int_using_lwm2m_json()); |
| execute(tc_write_resource_int_using_senml_json()); |
| execute(tc_write_resource_string_using_text()); |
| execute(tc_write_resource_string_using_lwm2m_json()); |
| execute(tc_write_resource_string_using_senml_json()); |
| execute(tc_write_resource_block1_stateless_succ()); |
| execute(tc_write_resource_block1_atomic_succ()); |
| |
| execute(tc_execute_resource()); |
| |
| execute(tc_observe_subscription()); |
| execute(tc_observe_notification()); |
| execute(tc_observe_unsubscribe()); |
| } |
| } |