Commit 1c9895c1 authored by Pramod Kulkarni's avatar Pramod Kulkarni Committed by Miguel Angel Reina Ortega

First draft of TTCN code for TP/oneM2M/CSE/ANNC/001

parent 4a9f4142
......@@ -1736,11 +1736,15 @@ module OneM2M_Functions {
*/
function f_cse_receiveCreateRequest(in template RequestPrimitive p_requestPrimitive := ?) runs on CseSimu {
var ResponsePrimitive v_responsePrimitive;
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(p_requestPrimitive)) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: CREATE Request received successfuly");
v_responsePrimitive := f_getCreateResponsePrimitive(vc_request.primitive.requestPrimitive.resourceType, vc_request.primitive.requestPrimitive);
v_responsePrimitive.responseStatusCode := int2001;
mccPortIn.send(m_response(v_responsePrimitive));
}
[] mccPortIn.receive(mw_request(?)) {
tc_ac.stop;
......
......@@ -6176,6 +6176,85 @@ module OneM2M_PermutationFunctions {
}//end group AccessControlPolicy
}//end group Security
group Annoucement {
group Basic {
function f_CSE_ANNC_001(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template (present) RequestPrimitive p_requestAnnc, template(omit) RequestPrimitive p_requestUpdatePrimitive := omit) runs on AeSimu {
// Local variables
var MsgIn vc_response;
var RequestPrimitive v_request;
var integer v_parentIndex := -1;
var integer v_containerIndex := -1;
var ResponsePrimitive v_responsePrimitive;
// Test control
// Test component configuration
f_cf02Up();
// Test adapter configuration
//Register the CSE
vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));
vc_cse1.done;
//Preamble
v_parentIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
vc_cse1.start(f_cse_resourceAnnouncementHandler());
v_resourceIndex := f_cse_createResource(p_resourceType, m_createAEAnnc(PX_APP_ID, omit, omit));
vc_cse1.done;
// Test Body
if (ispresent (p_requestUpdatePrimitive)) {
v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_requestUpdatePrimitive);
v_responsePrimitive.responseStatusCode := int2004;
} else {
v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestCreatePrimitive, v_parentIndex);
v_responsePrimitive.responseStatusCode := int2001;
}
mcaPort.send(m_request(v_request));
vc_cse1.start(f_cse_receiveCreateRequest(p_requestAnnc));
vc_cse1.done;
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(v_responsePrimitive.responseStatusCode))) -> value vc_response {
tc_ac.stop;
if (v_responsePrimitive.responseStatusCode == int2004){
setverdict(pass, __SCOPE__, ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
} else if (v_responsePrimitive.responseStatusCode == int2001) {
setverdict(pass, __SCOPE__, ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " created successfully");
}
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__, ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__, ": Error while updating optional attribute");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__, ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
}
}
// Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf02Down();
}//end f_CSE_ANNC_001
}//end group Basic
}// end group Announcement
}//end group CSE
......
......@@ -7242,6 +7242,29 @@ module OneM2M_Testcases_CSE_Release_2 {
}//end group AccessControlPolicy
}//end group Security
group Announcement {
group Basic {
group g_CSE_ANNC_001 {
testcase TC_CSE_ANNC_001_ACP_UPD() runs on Tester system CseSystem {
// Local variables
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var template RequestPrimitive v_createRequest := m_createAcpBase;
var template RequestPrimitive v_updateRequest := m_updateAcpBase;
v_createRequest.primitiveContent.accessControlPolicy.announceTo := {f_getAnnouncementTargetPoA()};
v_ae1.start(f_CSE_ANNC_001(int1, v_createRequest, mw_createAccessControlPolicyAnnc, v_updateRequest));//AccessControlPolicy
v_ae1.done;
}
}// end group g_CSE_ANNC_001
}
}
}//end group CSE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment