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

Review of f_CSE_ANNC_CRE_005_CseSimu


Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent 6f6be87b
......@@ -1128,6 +1128,51 @@ module OneM2M_Functions {
}// end f_cse_updateResource
/**
* @desc Message exchange for the update of a resource
* @param p_resourceType Resource type of the resource to be created
* @param p_requestPrimitive UPDATE request primitive to be used
* @param p_resourceIndex Internal resource index which indicates the resource to be updated
* @verdict
*/
function f_cse_updateResourceHandler(integer p_resourceIndex, template RequestPrimitive p_request) runs on CseSimu {
var integer v_targetResourceIndex := -1;
var ResponsePrimitive v_response;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(p_request)) -> value vc_request {
tc_ac.stop;
v_targetResourceIndex := f_getResourceIndex(vc_request.primitive.requestPrimitive.to_);
if(v_targetResourceIndex == p_resourceIndex) {
setverdict(pass, __SCOPE__&":INFO: Resource updated successfuly");
v_response := valueof(m_responsePrimitive(int2004,vc_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := vc_localResourcesList[vc_cSEBaseIndex].resource.cSEBase.cSE_ID;
v_response.to_ := vc_request.primitive.requestPrimitive.from_;
f_updateLocalResource(v_targetResourceIndex, vc_request.primitive.requestPrimitive.primitiveContent);
v_response.primitiveContent := vc_localResourcesList[v_targetResourceIndex].resource;
} else {
setverdict(inconc, __SCOPE__&":INFO: Unexpected resource update");
log(__SCOPE__&": ERROR: Resource Index not valid");
v_response := valueof(m_responsePrimitive(int4004,vc_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := PX_CSE1_ID;
v_response.to_ := vc_request.primitive.requestPrimitive.from_;
}
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while updating resource");
}
}
f_checkCseSimuStatus();
}// end f_cse_updateResourceHandler
/**
* @desc Message exchange for the retrieval of a resource
* @param p_resourceIndex Resource index of the resource to be retrieved
......@@ -1888,7 +1933,7 @@ module OneM2M_Functions {
* @param p_expectedResourceIndex Expected target parent resource of the announcemnet
* @verdict
*/
function f_cse_announcementProcedure_createHandler(template RequestPrimitive p_requestprimitive := ?, in ResponseStatusCode p_responseStatusCode := int2001, template(omit) integer p_expectedResourceIndex := omit) runs on CseSimu {
function f_cse_announcementProcedure_createHandler(template RequestPrimitive p_requestprimitive := ?, in ResponseStatusCode p_responseStatusCode := int2001, template(omit) integer p_expectedResourceIndex := omit) runs on CseSimu return integer{
// Local variables
var MsgIn v_request;
var integer v_parentIndex := vc_localRemoteCseIndex;
......@@ -1915,7 +1960,7 @@ module OneM2M_Functions {
v_announcedResourceIndex := f_setLocalResource(v_announcedResource, v_request.primitive.requestPrimitive.resourceType, v_parentIndex);
if(isvalue(p_expectedResourceIndex)){
if(p_expectedResourceIndex == v_parentIndex){
if(valueof(p_expectedResourceIndex) == v_parentIndex){
setverdict(pass, __SCOPE__ & ":INFO: Announcement Parent Resource Address matched");
v_responsePrimitive := valueof(m_responsePrimitive(p_responseStatusCode,v_request.primitive.requestPrimitive.requestIdentifier));
v_responsePrimitive.primitiveContent := vc_localResourcesList[p_expectedResourceIndex].resource;
......@@ -1943,6 +1988,8 @@ module OneM2M_Functions {
}
f_checkCseSimuStatus();
return v_announcedResourceIndex;
} //end f_cse_announcementProcedure_createHandler
......@@ -2466,7 +2513,7 @@ module OneM2M_Functions {
}
v_myResource.contentInstance.stateTag := 0;
v_myResource.contentInstance.contentSize := lengthof(v_myResource.contentInstance.content);
v_myResource.contentInstance.content := p_resource.contentInstance.content;
v_myResource.contentInstance.content := valueof(p_resource.contentInstance.content);
}
}
......@@ -2494,7 +2541,7 @@ module OneM2M_Functions {
vc_localResourcesList[p_localResourceIndex].resource.remoteCSE.labels := p_resource.remoteCSE.labels;
}
if(ispresent(p_resource.remoteCSE.announceTo)) {
vc_localResourcesList[p_localResourceIndex].resource.remoteCSE.announceTo := p_resource.remoteCSE.announceTo;
vc_localResourcesList[p_localResourceIndex].resource.remoteCSE.announceTo := {p_resource.remoteCSE.announceTo[0] & "/" & vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.resourceID & "Annc"};
}
if(ispresent(p_resource.remoteCSE.announcedAttribute)) {
vc_localResourcesList[p_localResourceIndex].resource.remoteCSE.announcedAttribute := p_resource.remoteCSE.announcedAttribute;
......@@ -3987,9 +4034,9 @@ module OneM2M_Functions {
* @param MsgOut MsgOut primitive
*/
function f_getMsgOutPrimitive(MsgOut p_msgOut) runs on Tester return MsgOut {
function f_getMsgOutPrimitive(template MsgOut p_msgOut) runs on Tester return MsgOut {
p_msgOut.protocolBinding := vc_protocolBinding;
return p_msgOut;
return valueof(p_msgOut);
}
function f_sendUtPrimitive(template UtTriggerPrimitive p_utRequest, in universal charstring p_action) runs on Tester {
......@@ -4448,6 +4495,23 @@ module OneM2M_Functions {
}
return v_month;
} // end f_getMonth
/**
* @desc Retrieve Time from a given timestamp
* @param p_timestamp Given timestamp
* @return Time
*/
function f_getTime(charstring p_timestamp) runs on Tester return integer {
var charstring v_time := "";
var integer i;
for(i := 9; i <= 14; i := i+1){
v_time := v_time & p_timestamp[i];
}
return str2int(v_time);
} // end f_getYear
/**
......
......@@ -16,9 +16,8 @@ module OneM2M_Templates {
import from XSD all;
import from OneM2M_Types all;
import from OneM2M_TypesAndValues all;
//import from OneM2M_AdditionalTypes all;
import from OneM2M_Pixits all;
import from OneM2M_Functions all;
import from OneM2M_Functions all;
/**
......@@ -586,7 +585,15 @@ module OneM2M_Templates {
requestIdentifier := "m_updateRemoteCSEBase",
primitiveContent := {remoteCSE := m_contentUpdateRemoteCSE}
}
/**
* @desc Reception template for update remoteCSE resource
*/
template RequestPrimitive mw_updateRemoteCSE(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_update := {
resourceType := int16,
primitiveContent:= {remoteCSE := ?}
};
template (value) RequestPrimitive m_updateAEAnncBase modifies m_update:= {
requestIdentifier := testcasename() & "-m_updateAEAnnc",
resourceType := int10002,
......
......@@ -394,7 +394,8 @@ module OneM2M_PermutationFunctions {
f_cf03Up();
//Send Trigger Mesf_generateLocalResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
//Send Trigger Message
v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger, e_hierarchical, p_primitiveScope);
f_sendUtPrimitive(v_utRequest,v_action);
......@@ -501,7 +502,8 @@ module OneM2M_PermutationFunctions {
//Test component configuration
f_cf03Up();
//send triggeringf_generateLocalResourcelocalResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
//send triggering message
v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
v_containerIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_containerIndex, -, -);
p_request.to_ := p_utRequest.requestPrimitive.to_;
......@@ -599,7 +601,8 @@ module OneM2M_PermutationFunctions {
//Preamble
//Send Trf_generateLocalResourcelResource := f_ae_generateLocalResource(valueof(m_primitiveContentAe(m_contentCreateAe(omit, omit, omit, omit))), vc_cSEBaseIndex, int2);
//Send Triggering message
v_localResource := f_generateLocalResource(valueof(m_primitiveContentAe(m_contentCreateAe(omit, omit, omit, omit))), vc_cSEBaseIndex, int2);
v_resourceIndex := f_setLocalResource(v_localResource, int2, vc_cSEBaseIndex);
p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex);
f_sendUtPrimitive(p_utRequest,p_action);
......@@ -640,7 +643,8 @@ module OneM2M_PermutationFunctions {
//Test component configuration
f_cf03Up();
//send triggering f_generateLocalResourceocalResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
//send triggering message
v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex);
f_sendUtPrimitive(p_utRequest,p_action);
......@@ -690,7 +694,8 @@ module OneM2M_PermutationFunctions {
//Test component configuration
f_cf03Up();
//send triggerinf_generateLocalResource_localResource := f_ae_generateLocalResource(valueof(p_primitiveContent), vc_cSEBaseIndex, p_resourceType);
//send triggering message
v_localResource := f_generateLocalResource(valueof(p_primitiveContent), vc_cSEBaseIndex, p_resourceType);
v_resourceIndex := f_setLocalResource(v_localResource, p_resourceType, vc_cSEBaseIndex);
v_utRequest := m_utRetrieve(f_getLocalResourceAddress(v_resourceIndex));
f_sendUtPrimitive(v_utRequest,p_action);
......@@ -7286,7 +7291,7 @@ module OneM2M_PermutationFunctions {
tc_ac.stop;
setverdict(pass, __SCOPE__, ": Resource " & int2str(enum2int(p_resourceType)) & " created successfully");
if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.contentInstance.announceTo)) {
if(v_response.primitive.responsePrimitive.primitiveContent.contentInstance.announceTo != {}) {
if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.contentInstance.announceTo) != 0) {
setverdict(fail, __SCOPE__, ": Resource " & int2str(enum2int(p_resourceType)) & " contains the attribute announceTo");
}
}
......@@ -7333,7 +7338,7 @@ module OneM2M_PermutationFunctions {
//Preamble
v_ae1.start(f_cse_createResource(int2,v_create));
f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));
v_aEAnncIndex := f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));
v_ae1.done;
v_aeIndex := f_getLatestResourceIndex(v_ae1);
......@@ -7341,7 +7346,7 @@ module OneM2M_PermutationFunctions {
// Test Body
v_ae1.start(f_cse_createResource(p_resourceType,p_requestCreatePrimitive, v_aeIndex));
f_cse_announcementProcedure_createHandler(p_createRequestAnnc);
f_cse_announcementProcedure_createHandler(p_createRequestAnnc, -, v_aEAnncIndex);
v_ae1.done;
......@@ -7364,8 +7369,7 @@ module OneM2M_PermutationFunctions {
var ResponsePrimitive v_responsePrimitive;
var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1);
v_create.primitiveContent.container.announceTo := {PX_CSE1_ID};
// Test control
// Test component configuration
......@@ -7373,34 +7377,23 @@ module OneM2M_PermutationFunctions {
// Test adapter configuration
// Register the CSE
f_cse_registerRemoteCse(m_createRemoteCSEBase);
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
//Preamble
v_ae1.start(f_cse_createResource(int2,v_create));
f_cse_announcementProcedure_createHandler(mw_createRemoteCSEAnnc(-, -, -));
v_ae1.done;
v_aeIndex := f_getLatestResourceIndex(v_ae1);
// Test Body
v_ae1.start(f_cse_sendCreateRequestPrimitive(p_resourceType,p_requestCreatePrimitive, v_parentIndex));
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(p_createRequestAnnc)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ":INFO: CREATE REQUEST received");
if(match(v_request.primitive.requestPrimitive.to_, f_getLocalResourceAddress(v_aEAnncIndex, e_hierarchical, e_spRelative)) or
match(v_request.primitive.requestPrimitive.to_, f_getLocalResourceAddress(v_aEAnncIndex, e_nonHierarchical, e_spRelative))) {
setverdict(pass, __SCOPE__ & ":matching ANNC_PARENT_RESOURCE_ADDRESS");
} else {
setverdict(fail, __SCOPE__ & ":mis-matching ANNC_PARENT_RESOURCE_ADDRESS");
}
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ":ERROR: No CREATE REQUEST received");
}
}
v_ae1.start(f_cse_createResource(p_resourceType,p_requestCreatePrimitive, v_aeIndex));
//IUT shall announce itself by updating announceTo attribute of its remoteCSE on its registrar (CSE1)
f_cse_updateResourceHandler(vc_localRemoteCseIndex, mw_updateRemoteCSE);
//IUT shall then create the announced resource on its remoteCSEAnnc as indicated in the announceTo attribute returned by its registrar (CSE1)
p_createRequestAnnc.to_ := vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.announceTo[0];
f_cse_announcementProcedure_createHandler(p_createRequestAnnc, -);
v_ae1.done;
......
......@@ -506,7 +506,7 @@ module OneM2M_Testcases_CSE_Release_2 {
//Local variables
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
var ResponsePrimitive v_responsePrimitive;
var RequestPrimitive v_createAEAnnc := m_createAEAnnc(omit, omit, omit, PX_CSE1_ID);
var RequestPrimitive v_createAEAnnc := valueof(m_createAEAnnc(omit, omit, omit, PX_CSE1_ID));
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
v_createRequest.primitiveContent.timeSeries.resourceName := omit;
......@@ -524,7 +524,7 @@ module OneM2M_Testcases_CSE_Release_2 {
//Local variables
var template RequestPrimitive v_createRequest := m_createContainerBase;
var ResponsePrimitive v_responsePrimitive;
var RequestPrimitive v_createAEAnnc := m_createAEAnnc(omit, omit, omit, PX_CSE1_ID);
var RequestPrimitive v_createAEAnnc := valueof(m_createAEAnnc(omit, omit, omit, PX_CSE1_ID));
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
 
v_createRequest.primitiveContent.container.resourceName := omit;
......@@ -543,7 +543,7 @@ module OneM2M_Testcases_CSE_Release_2 {
// Local variables
var template RequestPrimitive v_createRequest := m_createGroupBase;
var ResponsePrimitive v_responsePrimitive;
var RequestPrimitive v_createAEAnnc := m_createAEAnnc(omit, omit, omit, PX_CSE1_ID);
var RequestPrimitive v_createAEAnnc := valueof(m_createAEAnnc(omit, omit, omit, PX_CSE1_ID));
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
 
v_createRequest.primitiveContent.group_.resourceName := omit;
......@@ -561,7 +561,7 @@ module OneM2M_Testcases_CSE_Release_2 {
// Local variables
var template RequestPrimitive v_createRequest := m_createAcpBase;
var ResponsePrimitive v_responsePrimitive;
var RequestPrimitive v_createAEAnnc := m_createAEAnnc(omit, omit, omit, PX_CSE1_ID);
var RequestPrimitive v_createAEAnnc := valueof(m_createAEAnnc(omit, omit, omit, PX_CSE1_ID));
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
 
v_createRequest.primitiveContent.accessControlPolicy.resourceName := omit;
......@@ -767,7 +767,7 @@ module OneM2M_Testcases_CSE_Release_2 {
// Local variables
var template RequestPrimitive v_createRequest := m_createTimeSeriesBase;
var ResponsePrimitive v_responsePrimitive;
var RequestPrimitive v_createAEAnnc := m_createAEAnnc(omit, omit, omit, PX_CSE1_ID);
var RequestPrimitive v_createAEAnnc := valueof(m_createAEAnnc(omit, omit, omit, PX_CSE1_ID));
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
 
v_createRequest.primitiveContent.timeSeries.resourceName := omit;
......@@ -12928,7 +12928,7 @@ module OneM2M_Testcases_CSE_Release_2 {
setverdict(inconc, __SCOPE__ & ": missingDataList attribute not present");
} else {
if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList.alt_)) {
if(v_missingDataPointTimestamp < v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList.alt_[0]) {
if(f_getTime(v_missingDataPointTimestamp) < f_getTime(v_response.primitive.responsePrimitive.primitiveContent.timeSeries.missingDataList.alt_[0])) {
setverdict(pass, __SCOPE__ & ": missingData point inserted in missingDataList");
} else {
setverdict(fail, __SCOPE__ & ": missingData point not inserted in missingDataList");
......@@ -12998,7 +12998,7 @@ module OneM2M_Testcases_CSE_Release_2 {
var XSD.NonNegativeInteger v_missingDataPointNumber := 1;
var template PrimitiveContent v_contentNotification := {timeSeries := mw_contentTimeSeries(?,v_missingDataPointNumber)};
v_eventNotificationCriteria.missingData := valueof(m_missingData(v_missingDataPointNumber, "1000"));
v_eventNotificationCriteria.missingData := valueof(m_missingData(v_missingDataPointNumber, "P60"));
 
// Test control
 
......
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