Skip to content
Snippets Groups Projects
Commit 40db3605 authored by Pramod Kulkarni's avatar Pramod Kulkarni
Browse files

Merge branch 'STF531-REG-TCs' of https://git.onem2m.org/TST/ATS into STF531-REG-TCs

parents e5a9c9aa a065939d
No related branches found
No related tags found
1 merge request!24STF531 REG TCs
...@@ -1465,6 +1465,8 @@ module OneM2M_Functions { ...@@ -1465,6 +1465,8 @@ module OneM2M_Functions {
var MsgIn v_response; var MsgIn v_response;
var RequestPrimitive v_request; var RequestPrimitive v_request;
var integer v_resourceIndex := -1; var integer v_resourceIndex := -1;
var integer v_localResourceIndex := -1;
var PrimitiveContent v_remoteCSEResource;
v_request := f_getCreateRequestPrimitive(int16, p_requestPrimitive, -1); v_request := f_getCreateRequestPrimitive(int16, p_requestPrimitive, -1);
...@@ -1476,6 +1478,8 @@ module OneM2M_Functions { ...@@ -1476,6 +1478,8 @@ module OneM2M_Functions {
setverdict(pass, __SCOPE__&":INFO: Resource type RemoteCSE created successfuly"); setverdict(pass, __SCOPE__&":INFO: Resource type RemoteCSE created successfuly");
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive); f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16, -1); v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16, -1);
v_remoteCSEResource := f_cse_generateLocalResource(v_response.primitive.responsePrimitive.primitiveContent, 1, int16);
v_localResourceIndex := f_setLocalResource(v_remoteCSEResource, int16, -1);
} }
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) { [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop; tc_ac.stop;
...@@ -1506,6 +1510,7 @@ module OneM2M_Functions { ...@@ -1506,6 +1510,7 @@ module OneM2M_Functions {
var MsgIn v_request; var MsgIn v_request;
var ResponsePrimitive v_response; var ResponsePrimitive v_response;
var PrimitiveContent v_remoteCSEResource; var PrimitiveContent v_remoteCSEResource;
var integer v_localResourceIndex := -1;
var integer v_resourceIndex := -1; var integer v_resourceIndex := -1;
tc_ac.start; tc_ac.start;
...@@ -1513,7 +1518,11 @@ module OneM2M_Functions { ...@@ -1513,7 +1518,11 @@ module OneM2M_Functions {
[] mccPortIn.receive(mw_request(p_requestPrimitive)) -> value v_request { [] mccPortIn.receive(mw_request(p_requestPrimitive)) -> value v_request {
tc_ac.stop; tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type RemoteCSE created successfuly"); setverdict(pass, __SCOPE__&":INFO: Resource type RemoteCSE created successfuly");
v_resourceIndex := f_cse_createLocalResource(v_request.primitive.requestPrimitive.primitiveContent, 1, int16, v_remoteCSEResource);//TODO Get index from v_request.primitive.requestPrimitive.to_ v_remoteCSEResource := f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, 1, int16);//TODO Get index from v_request.primitive.requestPrimitive.to_
v_localResourceIndex := f_setLocalResource(v_remoteCSEResource, int16, -1);
v_resourceIndex := f_setResource(v_request.primitive.responsePrimitive.primitiveContent, int16, -1);
} }
[] mccPortIn.receive { [] mccPortIn.receive {
tc_ac.stop; tc_ac.stop;
...@@ -1584,44 +1593,43 @@ module OneM2M_Functions { ...@@ -1584,44 +1593,43 @@ module OneM2M_Functions {
* @param p_modifiedResource Assigned and/or modified fields * @param p_modifiedResource Assigned and/or modified fields
* @return Internal resource index of the saved resource or -1 * @return Internal resource index of the saved resource or -1
*/ */
function f_cse_createLocalResource(in PrimitiveContent p_resource, in integer p_parentIndex, in ResourceType p_resourceType, out PrimitiveContent p_myResource) runs on CseSimu return integer { function f_cse_generateLocalResource(in PrimitiveContent p_resource, in integer p_parentIndex, in ResourceType p_resourceType) runs on CseSimu return PrimitiveContent {
var integer v_resourceIndex := lengthof(vc_resourcesList); var integer v_resourceIndex := lengthof(vc_localResourcesList);
var PrimitiveContent v_myResource;
// TODO To review the code (use of indexes, generation of value for certain attributes, etc..) // TODO To review the code (use of indexes, generation of value for certain attributes, etc..)
if(p_resourceType == int16 and ispresent(p_resource)) { if(p_resourceType == int16 and ispresent(p_resource)) {
if(ischosen(p_resource.remoteCSE)){ if(ischosen(p_resource.remoteCSE)){
p_myResource.remoteCSE := p_resource.remoteCSE; v_myResource.remoteCSE := p_resource.remoteCSE;
if(not(ispresent(p_resource.remoteCSE.resourceName))) { if(not(ispresent(p_resource.remoteCSE.resourceName))) {
p_myResource.remoteCSE.resourceName := "remoteCSE" & int2char(v_resourceIndex); v_myResource.remoteCSE.resourceName := "remoteCSE" & int2char(v_resourceIndex);
} }
p_myResource.remoteCSE.resourceType := p_resourceType; v_myResource.remoteCSE.resourceType := p_resourceType;
p_myResource.remoteCSE.resourceID := "remoteCSE" & int2char(v_resourceIndex); v_myResource.remoteCSE.resourceID := "remoteCSE" & int2char(v_resourceIndex);
p_myResource.remoteCSE.parentID := f_getResourceId(vc_resourcesList[p_parentIndex].resource); v_myResource.remoteCSE.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource);
p_myResource.remoteCSE.creationTime := fx_generateTimestamp(); v_myResource.remoteCSE.creationTime := fx_generateTimestamp();
if(not(ispresent(p_resource.remoteCSE.expirationTime))) { if(not(ispresent(p_resource.remoteCSE.expirationTime))) {
p_myResource.remoteCSE.expirationTime := "20301231T012345"; v_myResource.remoteCSE.expirationTime := "20301231T012345";
} }
p_myResource.remoteCSE.lastModifiedTime := p_myResource.remoteCSE. creationTime; v_myResource.remoteCSE.lastModifiedTime := v_myResource.remoteCSE. creationTime;
p_myResource.remoteCSE.announceTo := omit; v_myResource.remoteCSE.announceTo := omit;
p_myResource.remoteCSE.announcedAttribute := omit; v_myResource.remoteCSE.announcedAttribute := omit;
if(not(ispresent(p_resource.remoteCSE.pointOfAccess))) { if(not(ispresent(p_resource.remoteCSE.pointOfAccess))) {
//TODO Create a pollingChannel resource //TODO Create a pollingChannel resource
p_myResource.remoteCSE.pointOfAccess := omit; v_myResource.remoteCSE.pointOfAccess := omit;
} }
if(vc_resourcesList[v_resourceIndex].resourceType == int5) { if(vc_localResourcesList[v_resourceIndex].resourceType == int5) {
p_myResource.remoteCSE.m2M_Ext_ID := omit; v_myResource.remoteCSE.m2M_Ext_ID := omit;
p_myResource.remoteCSE.trigger_Recipient_ID:= omit; v_myResource.remoteCSE.trigger_Recipient_ID:= omit;
} }
p_myResource.remoteCSE.nodeLink := omit; v_myResource.remoteCSE.nodeLink := omit;
return f_setResource(p_myResource, p_resourceType, p_parentIndex, false);
} }
} }
return v_resourceIndex; return v_myResource;
}//End of function }//End of function
...@@ -2364,6 +2372,27 @@ module OneM2M_Functions { ...@@ -2364,6 +2372,27 @@ module OneM2M_Functions {
} }
/**
* @desc Saving of a local resource and its parent index in the internal resource list
* @param p_resource Resource to be saved
* @param p_parentIndex Parent index of resource to be saved
* @return Internal resource index of the saved resource
* @verdict
*/
function f_setLocalResource(PrimitiveContent p_resource, ResourceType p_resourceType, integer p_parentIndex := -1) runs on CseSimu return integer {
var integer v_newIndex := -1;
if(isbound(vc_localResourcesList)) {
vc_localResourcesList[lengthof(vc_localResourcesList)] := {p_parentIndex, p_resourceType, p_resource};
} else {
vc_localResourcesList[0] := {p_parentIndex, p_resourceType, p_resource};
}
v_newIndex := lengthof(vc_localResourcesList)-1;
return v_newIndex;
}
/** /**
* @desc Set Acpid into the requestPrimitive * @desc Set Acpid into the requestPrimitive
* @param p_requestPrimitive RequestPrimitive to be modified * @param p_requestPrimitive RequestPrimitive to be modified
......
...@@ -62,6 +62,7 @@ module OneM2M_TestSystem { ...@@ -62,6 +62,7 @@ module OneM2M_TestSystem {
port OneM2MPort mccPortIn; port OneM2MPort mccPortIn;
//global variables //global variables
var MyResourcesList vc_localResourcesList;
var AeSimu vc_aeSimu;//For CF02 when CseSimu is master var AeSimu vc_aeSimu;//For CF02 when CseSimu is master
var integer vc_remoteCseIndex; var integer vc_remoteCseIndex;
var MsgIn vc_request; var MsgIn vc_request;
......
...@@ -1764,16 +1764,31 @@ module OneM2M_Testcases_CSE { ...@@ -1764,16 +1764,31 @@ module OneM2M_Testcases_CSE {
} }
/*testcase TC_CSE_REG_CRE_034_RN() runs on Tester system CseSystem {
//Local variables
var RequestPrimitive v_request;
var PrimitiveContent v_contentResponse;
p_request := valueof(m_createRemoteCSEBase);
p_request.primitiveContent.remoteCSE.cseType := int2; //MN_CSE
p_request.primitiveContent.remoteCSE.resourceName := c_defaultRemoteCSEResourceName;
p_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
p_contentResponse.remoteCSE.cseType := int2; //MN_CSE
p_contentResponse.remoteCSE.resourceName := c_defaultRemoteCSEResourceName;
f_CSE_REG_CRE_034(p_request, p_contentResponse);
}*/
/** /**
* @desc Check that IUT accepts a CSE registration request with OPTIONAL_ATTRIBUTE attribute * @desc Check that IUT accepts a CSE registration request with OPTIONAL_ATTRIBUTE attribute
* *
*/ */
/*testcase TC_CSE_REG_CRE_034() runs on CseSimu system CseSystem { function f_CSE_REG_CRE_034(RequestPrimitive p_request, PrimitiveContent p_contentResponse) runs on CseSimu{ //system CseSystem {
//Local variables //Local variables
var MsgIn v_response;
var RequestPrimitive v_request;
var ResourceType v_resourceType := int16; //remoteCSE var ResourceType v_resourceType := int16; //remoteCSE
var template PrimitiveContent v_contentResponse;
// Test control // Test control
// Test component configuration // Test component configuration
...@@ -1782,35 +1797,10 @@ module OneM2M_Testcases_CSE { ...@@ -1782,35 +1797,10 @@ module OneM2M_Testcases_CSE {
// Test adapter configuration // Test adapter configuration
// Preamble // Preamble
v_request := valueof(m_createRemoteCSEBase);
v_request.primitiveContent.remoteCSE.cseType := int2; //MN_CSE
v_request.primitiveContent.remoteCSE.resourceName := c_defaultRemoteCSEResourceName;
vc_remoteCseIndex := f_cse_registerRemoteCse(v_request);
v_contentResponse.container := mw_contentRemoteCSEBase;
//Test Body //Test Body
v_request := valueof(m_delete(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(-1, false))); vc_remoteCseIndex := f_cse_registerRemoteCse(p_request, p_contentResponse);
mccPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitive(int2002))) {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Deletion of <remoteCSE> resource has been accepted");
}
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while deleting <remoteCSE> resource");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
}
}
// Postamble // Postamble
f_cse_postamble_deleteResourcesCSE(); f_cse_postamble_deleteResourcesCSE();
...@@ -1818,7 +1808,7 @@ module OneM2M_Testcases_CSE { ...@@ -1818,7 +1808,7 @@ module OneM2M_Testcases_CSE {
// Tear down // Tear down
f_cf04Down(); f_cf04Down();
}//end TC_CSE_REG_CRE_034*/ }//end TC_CSE_REG_CRE_034
} //end group Create } //end group Create
...@@ -2947,14 +2937,12 @@ module OneM2M_Testcases_CSE { ...@@ -2947,14 +2937,12 @@ module OneM2M_Testcases_CSE {
}//end TC_CSE_REG_DEL_001 }//end TC_CSE_REG_DEL_001
/** /**
* @desc Check that the IUT accepts an delete request of <remoteCSE> resource. * @desc Check that IUT accepts a <remoteCSE> delete request on TARGET_REMOTE_CSE_ADDRESS, and deletes the <remoteCSE> resource
* *
*/ */
testcase TC_CSE_REG_DEL_002() runs on CseSimu system CseSystem { testcase TC_CSE_REG_DEL_002() runs on CseSimu system CseSystem {
//Local variables //Local variables
var MsgIn v_response;
var RequestPrimitive v_request; var RequestPrimitive v_request;
var ResourceType v_resourceType := int16; //remoteCSE
// Test control // Test control
// Test component configuration // Test component configuration
...@@ -2963,10 +2951,10 @@ module OneM2M_Testcases_CSE { ...@@ -2963,10 +2951,10 @@ module OneM2M_Testcases_CSE {
// Test adapter configuration // Test adapter configuration
// Preamble // Preamble
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase);
// Test Body // Test Body
v_request := valueof(m_delete(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(-1, false))); v_request := valueof(m_delete(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex)));
mccPort.send(m_request(v_request)); mccPort.send(m_request(v_request));
tc_ac.start; tc_ac.start;
...@@ -2988,6 +2976,13 @@ module OneM2M_Testcases_CSE { ...@@ -2988,6 +2976,13 @@ module OneM2M_Testcases_CSE {
} }
} }
// Check if the resource has been deleted or not
if(f_cse_isResourcePresent(vc_remoteCseIndex)) {
setverdict(fail, __SCOPE__ & ":INFO: Resource not deleted");
} else {
setverdict(pass, __SCOPE__ & ":INFO: Resource deleted");
}
// Postamble // Postamble
f_cse_postamble_deleteResourcesCSE(); f_cse_postamble_deleteResourcesCSE();
...@@ -3016,7 +3011,7 @@ module OneM2M_Testcases_CSE { ...@@ -3016,7 +3011,7 @@ module OneM2M_Testcases_CSE {
v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
// Test Body // Test Body
v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator())); v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)));
mcaPort.send(m_request(v_request)); mcaPort.send(m_request(v_request));
tc_ac.start; tc_ac.start;
...@@ -3086,61 +3081,6 @@ module OneM2M_Testcases_CSE { ...@@ -3086,61 +3081,6 @@ module OneM2M_Testcases_CSE {
}//end TC_CSE_REG_DEL_004 }//end TC_CSE_REG_DEL_004
/**
* @desc Check that IUT accepts a <remoteCSE> delete request on TARGET_REMOTE_CSE_ADDRESS, and deletes the <remoteCSE> resource
*
*/
testcase TC_CSE_REG_DEL_005() runs on CseSimu system CseSystem {
//Local variables
var RequestPrimitive v_request;
// Test control
// Test component configuration
f_cf04Up();
// Test adapter configuration
// Preamble
vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase);
// Test Body
v_request := valueof(m_delete(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(-1, false)));
mccPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitive(int2002))) {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Deletion of <remoteCSE> resource has been accepted");
}
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while deleting <remoteCSE> resource");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
}
}
// Check if the resource has been deleted or not
if(f_cse_isResourcePresent(vc_remoteCseIndex)) {
setverdict(fail, __SCOPE__ & ":INFO: Resource not deleted");
} else {
setverdict(pass, __SCOPE__ & ":INFO: Resource deleted");
}
// Postamble
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf04Down();
}//end TC_CSE_REG_DEL_005
}// end group Delete }// end group Delete
}//end Registration }//end Registration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment