Commit 0baa1748 authored by Pramod Kulkarni's avatar Pramod Kulkarni
Browse files

Implemented TP AE/PCH/001

parent fa6006a3
......@@ -2854,6 +2854,50 @@ module OneM2M_Functions {
// Error
return p_resource;
}
function f_ae_createPollingChannel(template UtTriggerPrimitive p_utRequest := m_utCreateAe) runs on CseSimu return integer {
var MsgIn v_request;
var PrimitiveContent v_modifiedResource;
var integer v_resourceIndex, v_parentIndex;
var RequestPrimitive v_rp;
var charstring v_action := "Please, create a Polling Channel resource on the Tester";
if(not(ispresent(p_utRequest.requestPrimitive.primitiveContent))) {
p_utRequest.requestPrimitive.primitiveContent.pollingChannel := m_contentCreatePollingChannel;
}
f_sendUtPrimitive(p_utRequest, v_action);
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_createPollingChannel(?,?))) -> value v_request {
tc_ac.stop;
v_rp := v_request.primitive.requestPrimitive;
v_parentIndex := f_getResourceIndex(v_rp.to_);
v_modifiedResource := f_ae_generateLocalResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType);
v_resourceIndex := f_setLocalResource(v_modifiedResource, int2, v_parentIndex);
if(v_resourceIndex != -1) {
mcaPortIn.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource)));
setverdict(pass, __SCOPE__&":INFO: Polling Channel created successfuly");
}
else {
mcaPortIn.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier)));
setverdict(inconc, __SCOPE__&":INFO: Polling Channel creation failed");
}
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: Polling Channel create request not received");
stop;
}
}
f_checkCseSimuStatus();
return v_resourceIndex;
} //end function f_ae_createPollingChannel
} // end helpingFunctions
......
......@@ -4676,9 +4676,9 @@ module OneM2M_Templates {
forcedFields := omit
};
template (value) UtTriggerPrimitive m_utRetrievePollingChannel(XSD.ID p_targetResourceAddress) modifies m_utRetrieve := {
template (value) UtTriggerPrimitive m_utRetrievePollingChannelUri(XSD.ID p_targetResourceAddress) modifies m_utRetrieve := {
requestPrimitive := {
requestIdentifier := testcasename() & "-m_utRetrievePollingChannel" & f_rnd(1, 1000000),
requestIdentifier := testcasename() & "-m_utRetrievePollingChannelUri" & f_rnd(1, 1000000),
resourceType := int15,
primitiveContent := {pollingChannel := m_contentRetrievePollingChannel}
}
......
......@@ -8298,7 +8298,7 @@ module OneM2M_PermutationFunctions {
}
//Trigger IUT for sending a polling request (req1)
v_utRequest2 := valueof(m_utRetrievePollingChannel(f_getLocalResourceAddress(v_localResourceIndex) & "/" & c_resourceShortNamePollingChannelUri));
v_utRequest2 := valueof(m_utRetrievePollingChannelUri(f_getLocalResourceAddress(v_localResourceIndex) & "/" & c_resourceShortNamePollingChannelUri));
f_sendUtPrimitive(v_utRequest2,v_action2);
tc_ac.start;
......
......@@ -2183,6 +2183,97 @@ module OneM2M_Testcases_AE_Release_1 {
}//end SUB subgroup
group Polling {
/**
* @desc Check that the IUT which performs polling sends the Notify request to <pollingChannelURI> Hosting CSE after receiving response using polling channel
*/
testcase TC_AE_PCH_001() runs on Tester system AeSystem {
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
v_cse1.start(f_AE_PCH_001());
v_cse1.done;
}
function f_AE_PCH_001() runs on CseSimu {
//Local variables
var integer v_pollingChannelIndex := -1;
var integer v_aeIndex := -1;
var MsgIn v_request_req1, v_request_req3;
var RequestPrimitive v_request_req2;
var ResponsePrimitive v_response_rsp1;
var template UtTriggerPrimitive v_utRequest1 := m_utCreateAe;
var template UtTriggerPrimitive v_utRequest2 := m_utCreatePollingChannel;
var template UtTriggerPrimitive v_utRequest3;
var charstring v_action3 := "Please, send a Polling request (Retrieve PollingChannelURI request)";
var RequestPrimitive v_requestNotify;
//Test control
// Test component configuration
f_cf03Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_ae_preamble_registerAe(v_utRequest1);
f_checkCseSimuStatus();
//Create a function to receive the Create PollingChannel and to send the response
v_pollingChannelIndex := f_ae_createPollingChannel(v_utRequest2);
f_checkCseSimuStatus();
//Trigger IUT for sending a polling request (req1)
v_utRequest3 := valueof(m_utRetrievePollingChannelUri(f_getLocalResourceAddress(v_pollingChannelIndex) & "/" & c_resourceShortNamePollingChannelUri));
f_sendUtPrimitive(v_utRequest3,v_action3);
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_retrieve(f_getLocalResourceAddress(v_pollingChannelIndex) & "/" & c_resourceShortNamePollingChannelUri))) -> value v_request_req1 {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Polling request received successfuly");
v_response_rsp1 := valueof(m_responsePrimitive(int2000,v_request_req1.primitive.requestPrimitive.requestIdentifier));
v_response_rsp1.from_ := PX_CSE1_ID;
v_response_rsp1.to_ := v_request_req1.primitive.requestPrimitive.from_;
//Put in the primitiveContent a Notify request (req2) (simulated) from another node CSE
v_request_req2 := valueof(m_notify(f_getLocalResourceAddress(v_pollingChannelIndex)));
v_response_rsp1.primitiveContent := { requestPrimitive := v_request_req2 };
mcaPortIn.send(m_response(v_response_rsp1));
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type Polling Channel");
}
}
f_checkCseSimuStatus();
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value v_request_req3 {
tc_ac.stop;
//Check that primitiveContent carries the response to req2 (resp2)
if(v_request_req3.primitive.requestPrimitive.primitiveContent.responsePrimitive.requestIdentifier == v_request_req2.requestIdentifier) {
setverdict(pass, __SCOPE__ & ": NOTIFY request received carrying response (rsp2) to the Notify request (req2)");
} else {
setverdict(fail, __SCOPE__ & ": NOTIFY request received not carryng the expected response (rsp2) to the Notify request (req2)");
}
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No message while expecting NOTIFY request");
}
}
//Postamble
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf03Down();
}
} //end group Polling
}//end group AE
......
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