Commit e3ff8d1f authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

TC_CSE_PCH_004 corrected


Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent c3053e97
......@@ -930,6 +930,60 @@ module OneM2M_Functions {
return v_resourceIndex;
}
/**
* @desc Creation of a local resource
* @param p_resourceType Resource type of the resource to be created
* @param p_requestPrimitive CREATE request primitive for the resource to be created
* @param p_parentIndex Internal resource index which indicates the parent of the resource to be created
* @return Internal resource index of the created resource
* @verdict
*/
function f_cse_createLocalResource(template UtTriggerPrimitive p_utRequest := m_utCreate, charstring p_action) runs on CseSimu return integer {
var ResponsePrimitive v_response;
var integer v_parentResourceIndex := -1;
var integer v_localResourceIndex := -1;
var PrimitiveContent v_localResource;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
f_sendUtPrimitive(p_utRequest, p_action);
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(mw_create(?,?))) -> value vc_request {
tc_ac.stop;
v_parentResourceIndex := f_getResourceIndex(vc_request.primitive.requestPrimitive.to_);
if(v_parentResourceIndex == -1) {
log(__SCOPE__&": ERROR: Target resource not found");
v_response := valueof(m_responsePrimitive(int4004,vc_request.primitive.requestPrimitive.requestIdentifier));
} else {
v_localResource := f_cse_generateLocalResource(vc_request.primitive.requestPrimitive.primitiveContent, v_parentResourceIndex, vc_request.primitive.requestPrimitive.resourceType);
v_localResourceIndex := f_setLocalResource(v_localResource, vc_request.primitive.requestPrimitive.resourceType, v_parentResourceIndex);
v_response := valueof(m_responsePrimitive(int2001,vc_request.primitive.requestPrimitive.requestIdentifier));
v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
}
v_response.from_ := PX_CSE1_ID;
v_response.to_ := vc_request.primitive.requestPrimitive.from_;
mccPortIn.send(m_response(v_response));
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: Container create request not received");
stop;
}
}
f_checkCseSimuStatus();
return v_localResourceIndex;
}
/**
* @desc Creation of a resource
......
......@@ -1089,6 +1089,12 @@ module OneM2M_Templates {
primitiveContent := {pollingChannel := m_contentCreatePollingChannel ()}
};
template RequestPrimitive mw_createPollingChannel(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
to_ := p_to,
from_ := p_from,
primitiveContent := {pollingChannel := mw_contentCreatePollingChannel}
};
/**
* @desc Base CREATE request primitive for Schedule resource
*/
......@@ -1956,6 +1962,22 @@ module OneM2M_Templates {
expirationTime := omit//O
};
/**
* @desc Base reception template of primitiveContent for CREATE operation for PollingChannel resource
* @param p_accessControlPolicyIds ACP IDs for the PollingChannel
* @param p_name Resource name
*/
template PollingChannel_optional mw_contentCreatePollingChannel := {
resourceName := *,//O
resourceType := omit,//NP
resourceID := omit,//NP
parentID := omit,//NP
creationTime := omit,//NP
lastModifiedTime := omit,//NP
labels := *,//O
expirationTime := *//O
};
/**
* @desc Base primitiveContent for CREATE operation for Schedule resource
* @param p_scheduleElement Schedule
......
......@@ -46,6 +46,7 @@ module OneM2M_TypesAndValues {
const XSD.ID c_resourceShortNameLatest := "la"; //<latest>
const XSD.ID c_resourceShortNameOldest := "ol"; //<oldest>
const XSD.ID c_resourceShortNameFanOutPoint := "fopt"; //<fanOutPoint>
const XSD.ID c_resourceShortNamePollingChannelUri := "pcu"; //<pollingChannelUri>
//AccessControlOperations
const XSD.Integer c_C := 1;
......
......@@ -8821,69 +8821,70 @@ module OneM2M_Testcases_CSE_Release_2 {
function f_CSE_PCH_004() runs on CseSimu {
//Local variables
var integer v_cseIndex := -1;
var integer v_resourceIndex := -1;
var MsgIn v_request;
var ResponsePrimitive v_response;
var template UtTriggerPrimitive v_utRequest1 := m_utCreatePollingChannel;
var template UtTriggerPrimitive v_utRequest2;
var charstring v_action1 := "Please, send a Polling Channel request";
var charstring v_action2 := "Please, send a Retrieve Polling Channel request";
var RequestPrimitive v_requestNotify;
var integer v_localResourceIndex := -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_utCreatePollingChannel;
var template UtTriggerPrimitive v_utRequest2;
var charstring v_action1 := "Please, send a Polling Channel CREATE request";
var charstring v_action2 := "Please, send a Polling request (Retrieve PollingChannelURI request)";
var RequestPrimitive v_requestNotify;
//Test control
//Test control
// Test component configuration
f_cf02UpCseSimuMaster();
// Test component configuration
f_cf02UpCseSimuMaster();
// Test adapter configuration
// Test adapter configuration
// Preamble
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
// Preamble
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
//send triggering primitive to SUT
f_sendUtPrimitive(v_utRequest1,v_action1);
//send triggering primitive to SUT
v_localResourceIndex := f_cse_createLocalResource(v_utRequest1,v_action1);
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(m_createPollingChannelBase)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type Polling Channel created successfuly");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type Polling Channel");
}
}
//Check that the created resource is a PollingChannel
if(not(vc_localResourcesList[v_localResourceIndex].resourceType == int15)) {
setverdict(inconc, __SCOPE__&":INFO: Polling Channel resource not creaded");
f_checkCseSimuStatus();
}
v_utRequest2 := m_utRetrievePollingChannel(f_getResourceAddress(v_cseIndex));
//send triggering primitive to SUT
//Trigger IUT for sending a polling request (req1)
v_utRequest2 := valueof(m_utRetrievePollingChannel(f_getLocalResourceAddress(v_localResourceIndex) & "\" & c_resourceShortNamePollingChannelUri));
f_sendUtPrimitive(v_utRequest2,v_action2);
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(m_retrievePollingRequest(f_getResourceAddress(v_cseIndex), f_getOriginator(v_cseIndex)))) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type Polling Channel retrieved successfuly");
v_response := valueof(m_responsePrimitive(int2000,v_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := PX_CSE1_ID;
v_response.to_ := v_request.primitive.requestPrimitive.from_;
mccPortIn.send(m_response(v_response));
[] mccPortIn.receive(mw_request(mw_retrieve(f_getResourceAddress(v_localResourceIndex) & "\" & 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_getResourceAddress(vc_remoteCseIndex)));
v_response_rsp1.primitiveContent := { requestPrimitive := v_request_req2 };
mccPortIn.send(m_response(v_response_rsp1));
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type Polling Channel");
}
}
v_requestNotify := valueof(m_notify(f_getResourceAddress(v_cseIndex)));
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(v_requestNotify)) -> value v_request {
[] mccPortIn.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value v_request_req3 {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": NOTIFY request received");
//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 answer while expecting NOTIFY request");
setverdict(fail, __SCOPE__ & ": No message while expecting NOTIFY request");
}
}
......
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