blob: c86da0f6a112c32724fb74dd33b17683eeeb93d1 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2020 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_COAP_Tests.ttcn
// Description:
// Rev: R1A
// Prodnr: CNL 113 858
// Updated: 2020-03-04
// Contact: http://ttcn.ericsson.se
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_COAP_Tests
//
// Purpose:
// This module contains the component tests for the EPTF COAP Applib
//
// Module Parameters:
// tsp_SUT_localHost - *charstring* - Hostname of the tested COAP entity
// tsp_SUT_localPort - *integer* - Port number of the tested COAP entity
// tsp_SUT_remoteHost - *charstring* - Hostname of the tester component
// tsp_SUT_remotePort - *integer* - Port number of the tester component
//
///////////////////////////////////////////////////////////////
module EPTF_COAP_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_CLL_Base_Functions all;
import from CoAP_Types all;
import from IoT_FT_Framework_Definitions all;
import from IoT_FT_Framework_Functions all;
import from IFW_CoAP_Peer_TestSteps 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;
// SUT: Coap LGen
type component SUT_CT extends EPTF_MBT_LGen_CT, EPTF_COAP_LGen_CT, EPTF_COAP_LocalTransport_CT {}
// Tester_CT
type component Tester_CT extends EPTF_MBT_Tester_CT, IFW_MAIN_CT {}
function f_COAP_Tests_begin() runs on Tester_CT
{
log(%definitionId, " started");
setverdict(pass);
f_EPTF_Base_init_CT("mtc");
log(%definitionId, " Creating SUT");
var SUT_CT vc_sut := SUT_CT.create;
connect(self:EPTF_MBT_TESTER_PCO, vc_sut:EPTF_MBT_PCO);
vc_sut.start(f_SUT_behavior());
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},
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_COAP_Tests_end() runs on Tester_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 { setverdict(fail) }
}
function f_SUT_behavior() runs on SUT_CT
{
// Init
f_EPTF_MBT_init("SUT_LGen",0, "SUT_");
f_EPTF_COAP_LGen_init("SUT_LGen");
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);
var integer vl_addrIdx;
f_EPTF_COAP_transportEndpointDB_add({ socket := {tsp_SUT_localHost, tsp_SUT_localPort}, proto := { ip := { udp := {} } } }, vl_addrIdx);
f_EPTF_COAP_transportEndpointDB_add({ socket := {tsp_SUT_remoteHost, tsp_SUT_remotePort}, proto := { ip := { udp := {} } } }, vl_addrIdx);
f_EPTF_COAP_transportEndpointDB_add({ socket := {"endpointId", 0}, proto := { nidd := true } }, vl_addrIdx);
f_EPTF_COAP_transportEndpointDB_add({ socket := {"lwm2mServer", 0}, proto := { nidd := true } }, vl_addrIdx);
var integer v_tempIdx;
v_tempIdx := f_EPTF_COAP_templateDB_add({id:= "t_reg_NON_GET", msg:=valueof(t_reg_NON_GET)});
v_tempIdx := f_EPTF_COAP_templateDB_add({id:="t_reg_CON_GET", msg:=valueof(t_reg_CON_GET)});
v_tempIdx := f_EPTF_COAP_templateDB_add({id:="t_reg_Content", msg:=valueof(t_reg_Content)});
v_tempIdx := f_EPTF_COAP_templateDB_add({id:="t_reg_NotFound", msg:=valueof(t_reg_NotFound)});
v_tempIdx := f_EPTF_COAP_templateDB_add({id:="t_reg_Changed", msg:=valueof(t_reg_Changed)});
v_tempIdx := f_EPTF_COAP_templateDB_add({id:="t_reg_Continue", msg:=valueof(t_reg_Continue)});
f_EPTF_MBT_initLGenFsm(null, null);
EPTF_MBT_PCO.send(EPTF_MBT_CommandResponse:{ ready := {}}) to mtc;
// Loop
f_EPTF_Base_wait4Shutdown();
}
template CoAP_ReqResp t_reg_NON_GET :=
{
header :=
{
version := 1,
msg_type := NON_CONFIRMABLE,
code := METHOD_GET,
message_id := 0
},
token := ''O,
options :=
{
{
uri_path := "test"
}
},
payload := omit
}
template CoAP_ReqResp t_reg_CON_GET :=
{
header :=
{
version := 1,
msg_type := CONFIRMABLE,
code := METHOD_GET,
message_id := 0
},
token := ''O,
options :=
{
{
uri_path := "test"
}
},
payload := omit
}
template CoAP_ReqResp t_CON_OBSERVE :=
{
header :=
{
version := 1,
msg_type := CONFIRMABLE,
code := METHOD_GET,
message_id := 0
},
token := ''O,
options :=
{
{
uri_path := "test"
},
{
observe := 0
}
},
payload := omit
}
template CoAP_ReqResp t_CON_GET_Obs1 :=
{
header :=
{
version := 1,
msg_type := CONFIRMABLE,
code := METHOD_GET,
message_id := 0
},
token := ''O,
options :=
{
{ uri_path := "test" },
{ observe := 1 }
},
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 := "test" },
{ content_format := 11542 },
{ block1 := p_block1 },
{ size1 := 8863 }
},
payload := 'D000229B504B03041400000008008DA0A64E479244B258010000F0040000130000005B436F6E74656E745F54797065735D2E786D6CAD944D4EC3301085F79C22F216256E5920849A7641610995280730F6A4B1EAD89667FA777B26690B088940D56E6245F67BDFF879ECD164DBB86C0D096DF0A51816039181D7C158BF28C5DBFC29BF131992F246B9E0A1143B4031195F8DE6BB0898B1D863296AA2782F25EA1A1A854588E079A60AA951C4BF6921A3D24BB500793318DC4A1D3C81A79C5A0F311EBD303F5903D94C257A560D63E4D6496237D87F8705FB89EC612F6CD9A550313AAB1571E172EDCD0F6A1EAACA6A3041AF1A96149DCD75EB227F0522ED1CE0D9288C0994C11A801A57EC4D8FE429546AE5287BDCB2FB3EF3040E4FE31DC22C58D9ADC1DAC63E42FF867ED7ADCF0C82F5D3A436DC4A3DA16F425ABE87B0BC74ECED5834CAFABE4367F12C858892516717006D72064C1ED91212D9AF63EF65EB90E074F8B1095AF53F8987B4BB685076C3F0C2B17FFAFF75D56A95C0BC52E2E6B8F88DFBEE7DAC43760FD6F803504B03041400000008008DA0A64E17B63738E90000004B0200000B0000005F72656C732F2E72656C73AD92CD6AC3300C80EF7B0AA37BA3B48531469D5ECAA0B732B207D06CE5872496B1BD2D7DFB7987B105BAD2C38E96A54F9F8476FB791AD53B87D88BD3B02E4A50EC8CD8DEB51A5EEAA7D5'O
}
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_reg_Content :=
{
header :=
{
version := 1,
msg_type := NON_CONFIRMABLE,
code := RESPONSE_CODE_Content,
message_id := 0
},
token := ''O,
options :=
{
{
content_format := 0
}
},
payload := char2oct("Some payload")
}
template CoAP_ReqResp t_reg_NotFound :=
{
header :=
{
version := 1,
msg_type := NON_CONFIRMABLE,
code := RESPONSE_CODE_NotFound,
message_id := 0
},
token := ''O,
options :=
{
{
content_format := 0
}
},
payload := omit
}
template CoAP_ReqResp t_reg_Changed :=
{
header :=
{
version := 1,
msg_type := NON_CONFIRMABLE,
code := RESPONSE_CODE_Changed,
message_id := 0
},
token := ''O,
options :=
{
},
payload := omit
}
template CoAP_ReqResp t_reg_Continue :=
{
header :=
{
version := 1,
msg_type := NON_CONFIRMABLE,
code := { class := 2, detail := 31 },
message_id := 0
},
token := ''O,
options :=
{
},
payload := omit
}
template CoAP_ReqResp tr_NON_GET :=
{
header :=
{
version := 1,
msg_type := NON_CONFIRMABLE,
code := METHOD_GET,
message_id := ?
},
token := ?,
options :=
{
{
uri_path := "test"
}
},
payload := omit
}
template CoAP_ReqResp tr_CON_GET :=
{
header :=
{
version := 1,
msg_type := CONFIRMABLE,
code := METHOD_GET,
message_id := ?
},
token := ?,
options :=
{
{
uri_path := "test"
}
},
payload := omit
}
template CoAP_ReqResp t_Content(Type p_msgType) :=
{
header :=
{
version := 1,
msg_type := p_msgType,
code := RESPONSE_CODE_Content,
message_id := 0
},
token := ''O,
options :=
{
{
content_format := 0
}
},
payload := char2oct("Some payload")
}
template CoAP_ReqResp t_ACK_Empty :=
{
header :=
{
version := 1,
msg_type := ACKNOWLEDGEMENT,
code := EMPTY_MESSAGE,
message_id := 0
},
token := ''O,
options := omit,
payload := omit
}
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 tr_ACK_Empty :=
{
header :=
{
version := 1,
msg_type := ACKNOWLEDGEMENT,
code := EMPTY_MESSAGE,
message_id := ?
},
token := ''O,
options := omit,
payload := omit
}
template CoAP_ReqResp tr_Content(Type p_msgType) :=
{
header :=
{
version := 1,
msg_type := p_msgType,
code := RESPONSE_CODE_Content,
message_id := ?
},
token := ?,
options :=
{
{
content_format := 0
}
},
payload := char2oct("Some payload")
}
template CoAP_ReqResp tr_Content_withObserve(Type p_msgType, integer p_observe) :=
{
header :=
{
version := 1,
msg_type := p_msgType,
code := RESPONSE_CODE_Content,
message_id := ?
},
token := ?,
options :=
{
{
content_format := 0
},
{
observe := p_observe
}
},
payload := char2oct("Some payload")
}
template CoAP_ReqResp tr_NotFound(Type p_msgType) :=
{
header :=
{
version := 1,
msg_type := p_msgType,
code := RESPONSE_CODE_NotFound,
message_id := ?
},
token := ?,
options :=
{
{
content_format := 0
}
},
payload := omit
}
template CoAP_ReqResp tr_Incomplete(Type p_msgType) :=
{
header :=
{
version := 1,
msg_type := p_msgType,
code := { class := 4, detail := 8},
message_id := ?
},
token := ?,
options :=
{
},
payload := omit
}
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
}
template EPTF_MBT_LGen_Definitions.FsmAddr t_addr(integer eIdx, 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;
}
const integer c_localAddr := 0;
const integer c_remoteAddr := 1;
const integer c_localNiddAddr := 2;
const integer c_remoteNiddAddr := 3;
const integer c_t_NON_GET := 0;
const integer c_t_CON_GET := 1;
const integer c_t_Content := 2;
const integer c_t_NotFound := 3;
const integer c_t_Changed := 4;
const integer c_t_Continue := 5;
///////////////////////////////////////////////////////////
//
// Testcase: tc_send_NON
//
// Purpose:
// Testcase for sending out a NON request
//
// Action:
// (see EPTF_COAP_Tests.tc_send_NON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* @startuml EPTF_COAP_Tests.tc_send_NON.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_loadTemplate_byIntIdx(c_t_NON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* Peer <- Applib: NON-GET
* FSM -> Applib: c_COAP_stepName_cleanUp()
* @enduml
******************************************************************/
testcase tc_send_NON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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)), {c_remoteAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_NON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_NON_GET));
f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false);
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_send_NON_recv_NON
//
// Purpose:
// Testcase for sending out a NON request and receiving a NON answer.
//
// Action:
// (see EPTF_COAP_Tests.tc_send_NON_recv_NON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_send_NON_recv_NON.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_loadTemplate_byIntIdx(c_t_NON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* Peer <- Applib: NON-GET
* Peer -> Applib: NON-205
* FSM <- Applib: c_COAP_eventName(205)
* @enduml
******************************************************************/
testcase tc_send_NON_recv_NON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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)), {c_remoteAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_NON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_NON_GET));
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_Content(NON_CONFIRMABLE)), USE_LAST_RECEIVED_MID, USE_LAST_RECEIVED_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, valueof(c_COAP_eventName(205)), valueof(t_addr(0, 0)), 3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_send_CON
//
// Purpose:
// Testcase for sending out a CON request
//
// Action:
// (see EPTF_COAP_Tests.tc_send_CON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_send_CON.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_loadTemplate_byIntIdx(c_t_CON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* Peer <- Applib: CON-GET
* FSM -> Applib: c_COAP_stepName_cleanUp()
* @enduml
******************************************************************/
testcase tc_send_CON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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)), {c_remoteAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_CON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false);
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_retransmit_CON
//
// Purpose:
// Testcase for checking that the applib will retransmit the CON request
// in case there is now response.
//
// Action:
// (see EPTF_COAP_Tests.tc_retransmit_CON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_retransmit_CON.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_loadTemplate_byIntIdx(c_t_CON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* Peer <- Applib: CON-GET
* Peer <- Applib: CON-GET (retransmission)
* Peer <- Applib: CON-GET (retransmission)
* FSM -> Applib: c_COAP_stepName_cleanUp()
* @enduml
******************************************************************/
testcase tc_retransmit_CON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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)), {c_remoteAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_CON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false);
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_timeout_CON
//
// Purpose:
// Testcase for checking that the applib will retransmit the CON request
// in case there is now response and eventually it will report a transaction timeout.
//
// Action:
// (see EPTF_COAP_Tests.tc_timeout_CON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_timeout_CON.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_loadTemplate_byIntIdx(c_t_CON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* Peer <- Applib: CON-GET
* Peer <- Applib: CON-GET (retransmission)
* FSM <- Applib: c_COAP_eventName_trTimeout
* FSM -> Applib: c_COAP_stepName_cleanUp()
* @enduml
******************************************************************/
testcase tc_timeout_CON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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)), {c_remoteAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_CON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_trTimeout, valueof(t_addr(0, 0)), tsp_EPTF_COAP_EXCHANGE_LIFETIME+3.0));
f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false);
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_send_CON_recv_ACK
//
// Purpose:
// Testcase for checking that the applib will succesfully handle an ACK
// in response to a CON request.
//
// Action:
// (see EPTF_COAP_Tests.tc_send_CON_recv_ACK.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_send_CON_recv_ACK.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_loadTemplate_byIntIdx(c_t_CON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* Peer <- Applib: CON-GET
* Peer -> Applib: ACK-205
* FSM <- Applib: c_COAP_eventName(205)
* @enduml
******************************************************************/
testcase tc_send_CON_recv_ACK() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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)), {c_remoteAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_CON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_Content(ACKNOWLEDGEMENT)), USE_LAST_RECEIVED_MID, USE_LAST_RECEIVED_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, valueof(c_COAP_eventName(205)), valueof(t_addr(0, 0)), 3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_send_CON_retransmit_CON_recv_ACK
//
// Purpose:
// Testcase for checking that the applib will succesfully handle an ACK
// in response to a CON request even if there were some retransmissions.
//
// Action:
// (see EPTF_COAP_Tests.tc_send_CON_retransmit_CON_recv_ACK.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_send_CON_retransmit_CON_recv_ACK.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_loadTemplate_byIntIdx(c_t_CON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* Peer <- Applib: CON-GET
* Peer <- Applib: CON-GET (retransmission)
* Peer <- Applib: CON-GET (retransmission)
* Peer -> Applib: ACK-205
* FSM <- Applib: c_COAP_eventName(205)
* @enduml
******************************************************************/
testcase tc_send_CON_retransmit_CON_recv_ACK() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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)), {c_remoteAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_CON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_Content(ACKNOWLEDGEMENT)), USE_LAST_RECEIVED_MID, USE_LAST_RECEIVED_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, valueof(c_COAP_eventName(205)), valueof(t_addr(0, 0)), 3.0));
f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false);
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_send_CON_recv_emptyACK_recv_NON
//
// Purpose:
// Testcase for checking that the applib will succesfully handle an empty ACK
// in response to a CON request. And finally the payload will be received in a NON
//
// Action:
// (see EPTF_COAP_Tests.tc_send_CON_recv_emptyACK_recv_NON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_send_CON_recv_emptyACK_recv_NON.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_loadTemplate_byIntIdx(c_t_CON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* Peer <- Applib: CON-GET
* Peer -> Applib: ACK-Empty
* Peer -> Applib: NON-205
* FSM <- Applib: c_COAP_eventName(205)
* @enduml
******************************************************************/
testcase tc_send_CON_recv_emptyACK_recv_NON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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)), {c_remoteAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_CON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_ACK_Empty), USE_LAST_RECEIVED_MID, USE_GIVEN_TOKEN);
f_IFW_CoapPeer_send(peer);
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_Content(NON_CONFIRMABLE)), GENERATE_NEW_MID, USE_LAST_RECEIVED_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, valueof(c_COAP_eventName(205)), valueof(t_addr(0, 0)), 3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_send_CON_recv_emptyACK_recv_CON
//
// Purpose:
// Testcase for checking that the applib will succesfully handle an empty ACK
// in response to a CON request. And finally the payload will be received in a CON
// which must be acknowledged with an empty ACK.
//
// Action:
// (see EPTF_COAP_Tests.tc_send_CON_recv_emptyACK_recv_CON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_send_CON_recv_emptyACK_recv_CON.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_loadTemplate_byIntIdx(c_t_CON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* Peer <- Applib: CON-GET
* Peer -> Applib: ACK-Empty
* Peer -> Applib: CON-205
* Peer <- Applib: ACK-Empty
* FSM <- Applib: c_COAP_eventName(205)
* @enduml
******************************************************************/
testcase tc_send_CON_recv_emptyACK_recv_CON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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)), {c_remoteAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_CON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_CON_GET));
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_ACK_Empty), USE_LAST_RECEIVED_MID, USE_GIVEN_TOKEN);
f_IFW_CoapPeer_send(peer);
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_Content(CONFIRMABLE)), GENERATE_NEW_MID, USE_LAST_RECEIVED_TOKEN);
f_IFW_CoapPeer_send(peer);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_ACK_Empty));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, valueof(c_COAP_eventName(205)), valueof(t_addr(0, 0)), 3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_call_startListening
//
// Purpose:
// Testcase for checking that the applib can open a listening socket
// to be able to receive incoming COAP messages
//
// Action:
// (see EPTF_COAP_Tests.tc_call_startListening.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_call_startListening.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* @enduml
******************************************************************/
testcase tc_call_startListening() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_NON
//
// Purpose:
// Testcase for checking that the applib can receive a NON request
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_NON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_NON.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: NON-GET
* FSM <- Applib: c_COAP_eventName_GET
* @enduml
******************************************************************/
testcase tc_recv_NON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_NON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_NON_send_NON
//
// Purpose:
// Testcase for checking that the applib can receive a NON request
// and the answer will be sent out as a NON response
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_NON_send_NON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
*
* Testcase:
* tc_recv_NON_send_NON
*
* Description:
* Testcase for checking that the applib can receive a NON request
* and the answer will be sent out as a NON response
*
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_NON_send_NON.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: NON-GET
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: NON-Content
* @enduml
******************************************************************/
testcase tc_recv_NON_send_NON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_NON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(NON_CONFIRMABLE)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_NON_recv_Duplicate_send_NON
//
// Purpose:
// Testcase for checking that after receiving a NON request, the applib
// filters out the duplicates
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_NON_recv_Duplicate_send_NON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_NON_recv_Duplicate_send_NON.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: NON-GET
* FSM <- Applib: c_COAP_eventName_GET
* Peer -> Applib: NON-GET-duplicate
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: NON-Content
* @enduml
******************************************************************/
testcase tc_recv_NON_recv_Duplicate_send_NON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_NON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
// Tester -- NON-GET-duplicate --> SUT
f_IFW_CoapPeer_send(peer);
f_delay(0.2);
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(NON_CONFIRMABLE)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_NON_send_NON_recv_Duplicate
//
// Purpose:
// Testcase for checking that after receiving a NON request, the applib
// filters out the duplicates even after it has sent an answer.
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_NON_send_NON_recv_Duplicate.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_NON_send_NON_recv_Duplicate.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: NON-GET
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: NON-Content
* Peer -> Applib: NON-GET-duplicate
* @enduml
******************************************************************/
testcase tc_recv_NON_send_NON_recv_Duplicate() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_NON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(NON_CONFIRMABLE)));
f_IFW_CoapPeer_send(peer);
f_delay(0.2);
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_NON_send_NON_wait_lifetime_recv_no_duplicate
//
// Purpose:
// Testcase for checking that after handling a NON request, the applib
// won't filter out the duplicates after the coap transaction exxchange lifetime timer
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_NON_send_NON_wait_lifetime_recv_no_duplicate.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_NON_send_NON_wait_lifetime_recv_no_duplicate.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: NON-GET
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: NON-Content
* ...after EXCHANGE_LIFETIME...
* Peer -> Applib: NON-GET-duplicate
* FSM <- Applib: c_COAP_eventName_GET
* @enduml
******************************************************************/
testcase tc_recv_NON_send_NON_wait_lifetime_recv_no_duplicate() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_NON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(NON_CONFIRMABLE)));
f_delay(tsp_EPTF_COAP_EXCHANGE_LIFETIME+1.0);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON
//
// Purpose:
// Testcase for checking that a CON reqest can be received
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET
* FSM <- Applib: c_COAP_eventName_GET
* @enduml
******************************************************************/
testcase tc_recv_CON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_CON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_send_ACK
//
// Purpose:
// Testcase for checking that a CON request is answered with an ACK
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_send_ACK.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_send_ACK.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-Content
* @enduml
******************************************************************/
testcase tc_recv_CON_send_ACK() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_CON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(ACKNOWLEDGEMENT)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_recv_Duplicate_send_ACK
//
// Purpose:
// Testcase for checking that after a CON request is received
// duplicates are filtered out.
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_recv_Duplicate_send_ACK.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_recv_Duplicate_send_ACK.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET
* FSM <- Applib: c_COAP_eventName_GET
* Peer -> Applib: CON-GET duplicate
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-Content
* @enduml
******************************************************************/
testcase tc_recv_CON_recv_Duplicate_send_ACK() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_CON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_IFW_CoapPeer_send(peer);
f_delay(0.2);
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(ACKNOWLEDGEMENT)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_send_ACK_recv_Duplicate_retransmit_ACK
//
// Purpose:
// Testcase for checking that after a CON request is received and answered
// the CON-GET duplicates are automatically answered with the retransmission of
// the ACK answer.
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_send_ACK_recv_Duplicate_retransmit_ACK.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_send_ACK_recv_Duplicate_retransmit_ACK.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-Content
* Peer -> Applib: CON-GET duplicate
* Peer <- Applib: ACK-Content (retransmit)
* @enduml
******************************************************************/
testcase tc_recv_CON_send_ACK_recv_Duplicate_retransmit_ACK() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_CON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(ACKNOWLEDGEMENT)));
f_IFW_CoapPeer_send(peer);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(ACKNOWLEDGEMENT)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_send_emptyACK
//
// Purpose:
// Testcase for checking that a CON request can be answered with an
// empty ACK
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_send_emptyACK.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_send_emptyACK.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_sendAccept()
* Peer <- Applib: ACK-Empty
* @enduml
******************************************************************/
testcase tc_recv_CON_send_emptyACK() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
// Tester -- call init --> SUT
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);
// Tester -- call startListening --> SUT
f_MBT_execute(c_COAP_stepName_startListening, valueof(t_addr(0, 0)), {}, false);
// Tester <-- ind transportSucc -- SUT
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_transportSucc, valueof(t_addr(0, 0)), 3.0));
// Tester -- CON-GET --> SUT
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_CON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
// Tester <-- ind GET -- SUT
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
// Tester -- call sendAccept(ACK-empty) --> SUT
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_sendAccept, valueof(t_addr(0, 0)), {}, false);
// Tester <-- ACK-empty -- SUT
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_ACK_Empty));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_send_emptyACK_send_CON_recv_ACK
//
// Purpose:
// Testcase for checking that a CON request can be answered with an
// empty ACK, then the payload can be sent in a new CON transaction.
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_send_emptyACK_send_CON_recv_ACK.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_send_emptyACK_send_CON_recv_ACK.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_sendAccept()
* Peer <- Applib: ACK-Empty
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: CON-Content
* Peer -> Applib: ACK-Empty
* @enduml
******************************************************************/
testcase tc_recv_CON_send_emptyACK_send_CON_recv_ACK() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_reg_CON_GET), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_sendAccept, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_ACK_Empty));
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(CONFIRMABLE), DO_NOT_CHECK_MID));
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_ACK_Empty), USE_LAST_RECEIVED_MID, USE_LAST_RECEIVED_TOKEN);
f_IFW_CoapPeer_send(peer);
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_OBS_send_ACK_200OK
//
// Purpose:
// Testcase for checking that a a request with the Observe option
// is reported as an OBSERVE request and can be answered with a 2xx
// postivie response
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-200OK with Observe:2
* @enduml
******************************************************************/
testcase tc_recv_CON_OBS_send_ACK_200OK() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content_withObserve(ACKNOWLEDGEMENT, 2)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_OBS_send_ACK_404NotFound
//
// Purpose:
// Testcase for checking that a a request with the Observe option
// is reported as an OBSERVE request and can be answered with a 4xx
// negative response
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_404NotFound.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_404NotFound.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-404 without the Observe option
* @enduml
******************************************************************/
testcase tc_recv_CON_OBS_send_ACK_404NotFound() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_NotFound}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_NotFound(ACKNOWLEDGEMENT)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_OBS_send_emptyACK_send_CON_200OK_recv_ACK
//
// Purpose:
// Testcase for checking that a a request with the Observe option
// is reported as an OBSERVE request and can be answered with an empty
// ACK and then with a positive response eventually.
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_OBS_send_emptyACK_send_CON_200OK_recv_ACK.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_OBS_send_emptyACK_send_CON_200OK_recv_ACK.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_sendAccept()
* Peer <- Applib: ACK-Empty
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: CON-200Ok with Observe:2
* Peer -> Applib: ACK-empty
* @enduml
******************************************************************/
testcase tc_recv_CON_OBS_send_emptyACK_send_CON_200OK_recv_ACK() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_sendAccept, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_ACK_Empty));
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content_withObserve(CONFIRMABLE, 2), DO_NOT_CHECK_MID));
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_ACK_Empty), USE_LAST_RECEIVED_MID, USE_LAST_RECEIVED_TOKEN);
f_IFW_CoapPeer_send(peer);
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_OBS_send_ACK_200OK_send_Notification
//
// Purpose:
// Testcase for checking that after accepting an OBSERVE request
// it is possible to send out notifications
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-200Ok with Observe:2
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendNotification_byIntIdx(0) [/test]
* Peer <- Applib: NON-Content with Observe:3
* @enduml
******************************************************************/
testcase tc_recv_CON_OBS_send_ACK_200OK_send_Notification() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content_withObserve(ACKNOWLEDGEMENT, 2)));
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendNotification_byIntIdx, valueof(t_addr(0, 0)), {0}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content_withObserve(NON_CONFIRMABLE, 3)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers
//
// Purpose:
// Testcase for checking that it is possible to accept observe requests
// for the same resource from two separate clients and then sending notifications
// for both.
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer1 -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer1 <- Applib: ACK-200Ok with Observe:2
* Peer2 -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer2 <- Applib: ACK-200Ok with Observe:2
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendNotification_byIntIdx(0) [/test]
* Peer1 <- Applib: NON-Content with Observe:3
* Peer2 <- Applib: NON-Content with Observe:3
* @enduml
******************************************************************/
testcase tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer1 := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer1, "sut");
var integer peer2 := f_IFW_addComponent(COAP_PEER, "tester2");
f_IFW_CoapPeer_setRemote(peer2, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer1, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer1);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer1);
f_handleVerdict(f_IFW_CoapPeer_check(peer1, tr_Content_withObserve(ACKNOWLEDGEMENT, 2)));
f_IFW_CoapPeer_setMessageToSend(peer2, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer2);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer2);
f_handleVerdict(f_IFW_CoapPeer_check(peer2, tr_Content_withObserve(ACKNOWLEDGEMENT, 2)));
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendNotification_byIntIdx, valueof(t_addr(0, 0)), {0}, false);
f_IFW_CoapPeer_receive(peer1);
f_handleVerdict(f_IFW_CoapPeer_check(peer1, tr_Content_withObserve(NON_CONFIRMABLE, 3)));
f_IFW_CoapPeer_receive(peer2);
f_handleVerdict(f_IFW_CoapPeer_check(peer2, tr_Content_withObserve(NON_CONFIRMABLE, 3)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_RST
//
// Purpose:
// Testcase for checking that after accepting an OBSERVE request
// it is possible to send out notifications and the client can unsubscribe
// eventually with a RST message to the notification
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_RST.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_RST.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-200Ok with Observe:2
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendNotification_byIntIdx(0) [/test]
* Peer <- Applib: NON-Content with Observe:3
* Peer -> Applib: RST (with last MID and no token)
* FSM <- Applib: c_COAP_eventName_observeCanceled
* FSM <- Applib: c_COAP_eventName_resourceNotObservedIndication
* @enduml
******************************************************************/
testcase tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_RST() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content_withObserve(ACKNOWLEDGEMENT, 2)));
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendNotification_byIntIdx, valueof(t_addr(0, 0)), {0}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content_withObserve(NON_CONFIRMABLE, 3)));
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_COAP_behaviorType, c_COAP_eventName_observeCanceled, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_resourceNotObservedIndication, valueof(t_addr(0, -1)), 3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers_recv_RST
//
// Purpose:
// Testcase for checking that the applib can handle more than 1 observers
// and these can unsubscribe as well.
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers_recv_RST.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers_recv_RST.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer1 -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer1 <- Applib: ACK-200Ok with Observe:2
* Peer2 -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer2 <- Applib: ACK-200Ok with Observe:2
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendNotification_byIntIdx(0) [/test]
* Peer1 <- Applib: NON-Content with Observe:3
* Peer2 <- Applib: NON-Content with Observe:3
* Peer2 -> Applib: RST with last MID
* FSM <- Applib: c_COAP_eventName_observeCanceled
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendNotification_byIntIdx(0) [/test]
* Peer1 <- Applib: NON-Content with Observe:4
* Peer1 -> Applib: RST with last MID
* FSM <- Applib: c_COAP_eventName_observeCanceled
* FSM <- Applib: c_COAP_eventName_resourceNotObservedIndication
* @enduml
******************************************************************/
testcase tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers_recv_RST() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer1 := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer1, "sut");
var integer peer2 := f_IFW_addComponent(COAP_PEER, "tester2");
f_IFW_CoapPeer_setRemote(peer2, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer1, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer1);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer1);
f_handleVerdict(f_IFW_CoapPeer_check(peer1, tr_Content_withObserve(ACKNOWLEDGEMENT, 2)));
f_IFW_CoapPeer_setMessageToSend(peer2, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer2);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer2);
f_handleVerdict(f_IFW_CoapPeer_check(peer2, tr_Content_withObserve(ACKNOWLEDGEMENT, 2)));
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendNotification_byIntIdx, valueof(t_addr(0, 0)), {0}, false);
f_IFW_CoapPeer_receive(peer1);
f_handleVerdict(f_IFW_CoapPeer_check(peer1, tr_Content_withObserve(NON_CONFIRMABLE, 3)));
f_IFW_CoapPeer_receive(peer2);
f_handleVerdict(f_IFW_CoapPeer_check(peer2, tr_Content_withObserve(NON_CONFIRMABLE, 3)));
f_IFW_CoapPeer_setMessageToSend(peer2, valueof(t_RST_Empty), USE_LAST_RECEIVED_MID, USE_GIVEN_TOKEN);
f_IFW_CoapPeer_send(peer2);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_observeCanceled, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendNotification_byIntIdx, valueof(t_addr(0, 0)), {0}, false);
f_IFW_CoapPeer_receive(peer1);
f_handleVerdict(f_IFW_CoapPeer_check(peer1, tr_Content_withObserve(NON_CONFIRMABLE, 4)));
f_IFW_CoapPeer_setMessageToSend(peer1, valueof(t_RST_Empty), USE_LAST_RECEIVED_MID, USE_GIVEN_TOKEN);
f_IFW_CoapPeer_send(peer1);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_observeCanceled, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_resourceNotObservedIndication, valueof(t_addr(0, -1)), 3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_Obs1
//
// Purpose:
// Testcase for checking that after accepting an OBSERVE request
// it is possible to send out notifications and the client can unsubscribe
// eventually with am an Observe:1 option request using the resource uri path
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_Obs1.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_Obs1.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-GET with OBSERVE:0
* FSM <- Applib: c_COAP_eventName_OBSERVE
* FSM <- Applib: c_COAP_eventName_GET
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-200Ok with Observe:2
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendNotification_byIntIdx(0) [/test]
* Peer <- Applib: NON-Content with Observe:3
* Peer -> Applib: CON-GET with /test and Observe:1
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-Content with no observe option
* FSM <- Applib: c_COAP_eventName_observeCanceled
* FSM <- Applib: c_COAP_eventName_resourceNotObservedIndication
* @enduml
******************************************************************/
testcase tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_Obs1() runs on Tester_CT
{
//@startuml tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_RST
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_OBSERVE), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_OBSERVE, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content_withObserve(ACKNOWLEDGEMENT, 2)));
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendNotification_byIntIdx, valueof(t_addr(0, 0)), {0}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content_withObserve(NON_CONFIRMABLE, 3)));
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_GET_Obs1), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_GET, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Content}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_observeCanceled, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_resourceNotObservedIndication, valueof(t_addr(0, -1)), 3.0));
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Content(ACKNOWLEDGEMENT)));
f_COAP_Tests_end();
}
/*
SUT: Block1 server
- recv: CON(block1,size1), send: ACK(404), resource not found
(- recv: CON(block1,size1), send: ACK(408), num != 0)
- recv: CON(block1,size1), send: ACK(204, block1 m=false) state-less
- recv: CON(block1,size1), send: ACK(231, block1 m=true) atomic, succesful 204
- recv: CON(block1,size1), send: ACK(231, block1 m=true) atomic, not in sequence block, 408
(- recv: CON(block1,size1), send: ACK(231, block1 m=true) atomic, missing block after last block, 408)
- recv: CON(block1,size1), send: ACK(231, block1 m=true) atomic, LIFETIME timeout before next block, 408
- recv: CON(block1,size1), send: ACK(231, block1 m=true, szx smaller) atomic, smaller block size
device.blockwiseOptions:
- atomic/stateless
- szx
*/
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_block1_send_ACK_404NotFound
//
// Purpose:
// Testcase for checking that a a request with the block1 option
// is reported as an BLOCK1 request and can be answered with a 404
// negative response
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_404NotFound.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_404NotFound.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-PUT with Block1:({num=0, m=true, szx=5}), size1:8863
* FSM <- Applib: c_COAP_eventName_BLOCK1_init
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_NotFound)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-404NotFound
* @enduml
******************************************************************/
testcase tc_recv_CON_block1_send_ACK_404NotFound() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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_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_COAP_behaviorType, c_COAP_eventName_BLOCK1_block, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_init, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_NotFound}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_NotFound(ACKNOWLEDGEMENT)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_block1_send_ACK_204Changed_stateless
//
// Purpose:
// Testcase for checking that a a request with the block1 option
// is reported as an BLOCK1 request and can be answered with a 204
// postivie response to receive the BLOCK1 transfer in stateless mode
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_204Changed_stateless.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_204Changed_stateless.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-PUT with Block1:({num=0, m=true, szx=5}), size1:8863
* FSM <- Applib: c_COAP_eventName_BLOCK1_block
* FSM <- Applib: c_COAP_eventName_BLOCK1_init
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content_204)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-204OK with with Block1:({num=0, m=false, szx=5})
* Peer -> Applib: CON-PUT with Block1:({num=1, m=true, szx=5})
* FSM <- Applib: c_COAP_eventName_BLOCK1_block
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content_204)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-204OK with with Block1:({num=1, m=false, szx=5})
* Peer -> Applib: CON-PUT with Block1:({num=2, m=false, szx=5})
* FSM <- Applib: c_COAP_eventName_BLOCK1_last
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Content_204)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-204OK with with Block1:({num=2, m=false, szx=5})
* @enduml
******************************************************************/
testcase tc_recv_CON_block1_send_ACK_204Changed_stateless() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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));
// 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_COAP_behaviorType, c_COAP_eventName_BLOCK1_block, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_init, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Changed}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
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_COAP_behaviorType, c_COAP_eventName_BLOCK1_block, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Changed}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
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_COAP_behaviorType, c_COAP_eventName_BLOCK1_block, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_last, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Changed}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Changed_withBlock1(ACKNOWLEDGEMENT, {num:=2, m:=false, szx:=5})));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_block1_send_ACK_231Continue_atomic_succ
//
// Purpose:
// Testcase for checking that a a request with the block1 option
// is reported as an BLOCK1 request and can be answered with a 231
// postivie response to receive the BLOCK1 transfer in atomic mode
// The following blocks are automatically handled by the applib until
// the last block is received and the transfer is finished succesfully
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_231Continue_atomic_succ.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_231Continue_atomic_succ.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-PUT with Block1:({num=0, m=true, szx=5}), size1:8863
* FSM <- Applib: c_COAP_eventName_BLOCK1_block
* FSM <- Applib: c_COAP_eventName_BLOCK1_init
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Continue_231)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-231Continue with with Block1:({num=0, m=true, szx=5})
* Peer -> Applib: CON-PUT with Block1:({num=1, m=true, szx=5})
* Peer <- Applib: ACK-231Continue with with Block1:({num=1, m=true, szx=5})
* Peer -> Applib: CON-PUT with Block1:({num=2, m=false, szx=5})
* Peer <- Applib: ACK-204Changed with with Block1:({num=2, m=false, szx=5})
* FSM <- Applib: c_COAP_eventName_BLOCK1_atomic_succ
* @enduml
******************************************************************/
testcase tc_recv_CON_block1_send_ACK_231Continue_atomic_succ() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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));
// 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_COAP_behaviorType, c_COAP_eventName_BLOCK1_block, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_init, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Continue}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
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({ num := 1, m := true, szx := 5 })), 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 (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_COAP_behaviorType, c_COAP_eventName_BLOCK1_atomic_succ, valueof(t_addr(0, -1)), 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_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_block1_send_ACK_231Continue_atomic_fail
//
// Purpose:
// Testcase for checking that a a request with the block1 option
// is reported as an BLOCK1 request and can be answered with a 231
// postivie response to receive the BLOCK1 transfer in atomic mode
// The following blocks are automatically handled by the applib until
// the last block is received but the transfer is finished unsuccessfully
// due to not sending the second block
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_231Continue_atomic_fail.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_231Continue_atomic_fail.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-PUT with Block1:({num=0, m=true, szx=5}), size1:8863
* FSM <- Applib: c_COAP_eventName_BLOCK1_block
* FSM <- Applib: c_COAP_eventName_BLOCK1_init
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Continue_231)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-231Continue with with Block1:({num=0, m=true, szx=5})
* Peer -> Applib: CON-PUT with Block1:({num=2, m=false, szx=5})
* Peer <- Applib: ACK-408Incomplete with with Block1:({num=2, m=false, szx=5})
* FSM <- Applib: c_COAP_eventName_BLOCK1_atomic_fail
* @enduml
******************************************************************/
testcase tc_recv_CON_block1_send_ACK_231Continue_atomic_fail() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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));
// 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_COAP_behaviorType, c_COAP_eventName_BLOCK1_block, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_init, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Continue}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
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 not sent
// 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_COAP_behaviorType, c_COAP_eventName_BLOCK1_atomic_fail, valueof(t_addr(0, -1)), 3.0));
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Incomplete(ACKNOWLEDGEMENT)));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_block1_send_ACK_231Continue_atomic_timeout
//
// Purpose:
// Testcase for checking that a a request with the block1 option
// is reported as an BLOCK1 request and can be answered with a 231
// postivie response to receive the BLOCK1 transfer in atomic mode
// The following blocks are automatically handled by the applib until
// the last block is received but the transfer is finished unsuccessfully
// due to not sending the second block in time
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_231Continue_atomic_timeout.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_231Continue_atomic_timeout.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-PUT with Block1:({num=0, m=true, szx=5}), size1:8863
* FSM <- Applib: c_COAP_eventName_BLOCK1_block
* FSM <- Applib: c_COAP_eventName_BLOCK1_init
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Continue_231)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-231Continue with with Block1:({num=0, m=true, szx=5})
* ...after EXCHANGE_LIFETIME...
* FSM <- Applib: c_COAP_eventName_BLOCK1_atomic_fail
* @enduml
******************************************************************/
testcase tc_recv_CON_block1_send_ACK_231Continue_atomic_timeout() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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));
// 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_COAP_behaviorType, c_COAP_eventName_BLOCK1_block, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_init, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Continue}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
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 not sent in ECHANGE_LIFETIME
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_atomic_fail, valueof(t_addr(0, -1)), tsp_EPTF_COAP_EXCHANGE_LIFETIME+3.0));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_recv_CON_block1_send_ACK_231Continue_atomic_smaller_blocksize
//
// Purpose:
// Testcase for checking that a a request with the block1 option
// is reported as an BLOCK1 request and can be answered with a 231
// postivie response to receive the BLOCK1 transfer in atomic mode
// The following blocks are automatically handled by the applib until
// the last block is received and the transfer is finished succesfully
//
// Action:
// (see EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_231Continue_atomic_smaller_blocksize.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_recv_CON_block1_send_ACK_231Continue_atomic_succ.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setPreferredBlocksize(4)
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-PUT with Block1:({num=0, m=true, szx=5}), size1:8863
* FSM <- Applib: c_COAP_eventName_BLOCK1_block
* FSM <- Applib: c_COAP_eventName_BLOCK1_init
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Continue_231)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-231Continue with with Block1:({num=0, m=true, szx=4})
* Peer -> Applib: CON-PUT with Block1:({num=4, m=true, szx=4})
* Peer <- Applib: ACK-231Continue with with Block1:({num=4, m=true, szx=4})
* Peer -> Applib: CON-PUT with Block1:({num=5, m=false, szx=4})
* Peer <- Applib: ACK-204Changed with with Block1:({num=5, m=false, szx=4})
* FSM <- Applib: c_COAP_eventName_BLOCK1_atomic_succ
* @enduml
******************************************************************/
testcase tc_recv_CON_block1_send_ACK_231Continue_atomic_smaller_blocksize() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
f_MBT_execute(c_COAP_stepName_init, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_setPreferredBlocksize, valueof(t_addr(0, 0)), {4}, false);
f_MBT_execute(c_COAP_stepName_setLocalAddress, valueof(t_addr(0, 0)), {c_localAddr}, false);
f_MBT_execute(c_COAP_stepName_startListening, 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));
// 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_COAP_behaviorType, c_COAP_eventName_BLOCK1_block, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_init, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Continue}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Continue_withBlock1(ACKNOWLEDGEMENT, {num:=0, m:= true, szx:=4})));
// Block1 num=1
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_PUT_Block1({ num := 4, m := true, szx := 4 })), 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:=4, m:=true, szx:=4})));
// Block1 num=2 (last)
f_IFW_CoapPeer_setMessageToSend(peer, valueof(t_CON_PUT_Block1({ num := 5, m := false, szx := 4 })), GENERATE_NEW_MID, GENERATE_NEW_TOKEN);
f_IFW_CoapPeer_send(peer);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_atomic_succ, valueof(t_addr(0, -1)), 3.0));
f_IFW_CoapPeer_receive(peer);
f_handleVerdict(f_IFW_CoapPeer_check(peer, tr_Changed_withBlock1(ACKNOWLEDGEMENT, {num:=5, m:=false, szx:=4})));
f_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_block1_fwug
//
// Purpose:
// Testcase for checking that a coap block1 write to /5/0/0 package
// resource (firmware upgrade) can be handled by the coap applib
//
// Action:
// (see EPTF_COAP_Tests.tc_block1_fwug.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* Call flow:
* @startuml EPTF_COAP_Tests.tc_block1_fwug.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localAddr)
* FSM -> Applib: c_COAP_stepName_startListening()
* FSM <- Applib: c_COAP_eventName_transportSucc
* Peer -> Applib: CON-PUT with Block1:({num=0, m=true, szx=5}), size1:1889
* FSM <- Applib: c_COAP_eventName_BLOCK1_block
* FSM <- Applib: c_COAP_eventName_BLOCK1_init
* FSM -> Applib: c_COAP_stepName_handleRequest()
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_Continue_231)
* FSM -> Applib: c_COAP_stepName_sendResponse()
* Peer <- Applib: ACK-231Continue with with Block1:({num=0, m=true, szx=5})
* Peer -> Applib: CON-PUT with Block1:({num=1, m=true, szx=5})
* Peer <- Applib: ACK-231Continue with with Block1:({num=1, m=true, szx=5})
* Peer -> Applib: CON-PUT with Block1:({num=2, m=false, szx=5})
* Peer <- Applib: ACK-204Changed with with Block1:({num=2, m=false, szx=5})
* Peer -> Applib: CON-PUT with Block1:({num=3, m=false, szx=5})
* Peer <- Applib: ACK-204Changed with with Block1:({num=3, m=false, szx=5})
* FSM <- Applib: c_COAP_eventName_BLOCK1_atomic_succ
* @enduml
******************************************************************/
testcase tc_block1_fwug() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_startListening, 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));
// 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_COAP_behaviorType, c_COAP_eventName_BLOCK1_block, valueof(t_addr(0, -1)), 3.0));
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_BLOCK1_init, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_handleRequest, valueof(t_addr(0, 0)), {}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_Continue}, false);
f_MBT_execute(c_COAP_stepName_sendResponse, valueof(t_addr(0, 0)), {}, false);
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_COAP_behaviorType, c_COAP_eventName_BLOCK1_atomic_succ, valueof(t_addr(0, -1)), 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_COAP_Tests_end();
}
///////////////////////////////////////////////////////////
//
// Testcase: tc_nidd_send_NON
//
// Purpose:
// Testcase for sending out a NON request over NIDD
//
// Action:
// (see EPTF_COAP_Tests.tc_nidd_send_NON.jpg)
///////////////////////////////////////////////////////////
/*****************************************************************
* @startuml EPTF_COAP_Tests.tc_nidd_send_NON.jpg
* FSM -> Applib: c_COAP_stepName_init()
* FSM -> Applib: c_COAP_stepName_setLocalAddress(c_localNiddAddr)
* FSM -> Applib: c_COAP_stepName_setRemoteAddress_byIntIdx(c_remoteNiddAddr)
* FSM -> Applib: c_COAP_stepName_loadTemplate_byIntIdx(c_t_NON_GET)
* FSM -> Applib: c_COAP_stepName_send()
* FSM <- Applib: c_COAP_eventName_niddMessageBuffered
* FSM -> Applib: c_COAP_stepName_cleanUp()
* @enduml
******************************************************************/
testcase tc_nidd_send_NON() runs on Tester_CT
{
f_COAP_Tests_begin();
var integer peer := f_IFW_addComponent(COAP_PEER, "tester");
f_IFW_CoapPeer_setRemote(peer, "sut");
f_IFW_initComponents();
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_localNiddAddr}, false);
f_MBT_execute(c_COAP_stepName_setRemoteAddress_byIntIdx, valueof(t_addr(0, 0)), {c_remoteNiddAddr}, false);
f_MBT_execute(c_COAP_stepName_loadTemplate_byIntIdx, valueof(t_addr(0, 0)), {c_t_NON_GET}, false);
f_MBT_execute(c_COAP_stepName_send, valueof(t_addr(0, 0)), {}, false);
f_handleVerdict(f_MBT_waitFor(c_COAP_behaviorType, c_COAP_eventName_niddMessageBuffered, valueof(t_addr(0, -1)), 3.0));
f_MBT_execute(c_COAP_stepName_cleanUp, valueof(t_addr(0, 0)), {}, false);
f_COAP_Tests_end();
}
control
{
// SUT: client
execute(tc_send_NON());
execute(tc_send_NON_recv_NON());
execute(tc_send_CON());
execute(tc_retransmit_CON());
execute(tc_timeout_CON());
execute(tc_send_CON_recv_ACK());
execute(tc_send_CON_retransmit_CON_recv_ACK());
execute(tc_send_CON_recv_emptyACK_recv_NON());
execute(tc_send_CON_recv_emptyACK_recv_CON());
// SUT: server
execute(tc_call_startListening());
execute(tc_recv_NON());
execute(tc_recv_NON_send_NON());
execute(tc_recv_NON_recv_Duplicate_send_NON());
execute(tc_recv_NON_send_NON_recv_Duplicate());
execute(tc_recv_NON_send_NON_wait_lifetime_recv_no_duplicate());
execute(tc_recv_CON());
execute(tc_recv_CON_send_ACK());
execute(tc_recv_CON_recv_Duplicate_send_ACK());
execute(tc_recv_CON_send_ACK_recv_Duplicate_retransmit_ACK());
execute(tc_recv_CON_send_emptyACK());
execute(tc_recv_CON_send_emptyACK_send_CON_recv_ACK());
// SUT: Observe Server
execute(tc_recv_CON_OBS_send_ACK_200OK());
execute(tc_recv_CON_OBS_send_ACK_404NotFound());
execute(tc_recv_CON_OBS_send_emptyACK_send_CON_200OK_recv_ACK());
execute(tc_recv_CON_OBS_send_ACK_200OK_send_Notification());
execute(tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers());
execute(tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_RST());
execute(tc_recv_CON_OBS_send_ACK_200OK_send_Notification_withTwoObservers_recv_RST());
execute(tc_recv_CON_OBS_send_ACK_200OK_send_Notification_recv_Obs1());
// SUT: Block1 server
execute(tc_recv_CON_block1_send_ACK_404NotFound());
execute(tc_recv_CON_block1_send_ACK_204Changed_stateless());
execute(tc_recv_CON_block1_send_ACK_231Continue_atomic_succ());
execute(tc_recv_CON_block1_send_ACK_231Continue_atomic_fail());
execute(tc_recv_CON_block1_send_ACK_231Continue_atomic_timeout());
execute(tc_recv_CON_block1_send_ACK_231Continue_atomic_smaller_blocksize());
execute(tc_block1_fwug());
// SUT: NIDD transport
execute(tc_nidd_send_NON());
}
}