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

Merge branch 'Release1' into master


Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parents a998027e f105adea
......@@ -936,6 +936,8 @@ module OneM2M_Functions {
*/
function f_cse_postamble_deleteResourcesCSE() runs on CseSimu {
var integer i;
var integer v_resourceIndex := -1;
var URIList v_childResourceRefs;
var XSD.ID v_resourceAddress;
var RequestPrimitive v_request;
var boolean v_deregistrationPerformed := false;
......@@ -951,15 +953,16 @@ module OneM2M_Functions {
};
for(i := lengthof(vc_resourcesIndexToBeDeleted) -1; i >=0; i := i - 1) {
if(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.remoteCSE)) {
v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i], e_nonHierarchical, e_spRelative);
v_resourceIndex := vc_resourcesIndexToBeDeleted[i];
if(ischosen(vc_resourcesList[v_resourceIndex].resource.remoteCSE)) {
v_resourceAddress := f_getResourceAddress(v_resourceIndex, e_nonHierarchical, e_spRelative);
v_deregistrationPerformed := true;
} else {
v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i]);
v_resourceAddress := f_getResourceAddress(v_resourceIndex);
}
v_request := valueof(m_delete(v_resourceAddress, f_getOriginator(vc_resourcesIndexToBeDeleted[i], vc_testSystemRole)));
v_request := valueof(m_delete(v_resourceAddress, f_getOriginator(v_resourceIndex, vc_testSystemRole)));
mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));
......@@ -979,62 +982,53 @@ module OneM2M_Functions {
}
}
//CSE Registration initiated by IUT - Test System to start CSE deregistration by:
//1) Started by Registrar (Test System)
//2) Started by Registree (IUT) by sending an UT message
if(not(v_deregistrationPerformed)) {
if(vc_localRemoteCseIndex != -1) {
//Deregistration by Registrar (Test System)
mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieveChildReferences(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex), {int16}))));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
log(__SCOPE__&":INFO: Resource retrieved successfuly");
v_resourceAddress := vc_response.primitive.responsePrimitive.primitiveContent.cSEBase.choice.childResource_list[0].base;
v_request := valueof(m_delete(v_resourceAddress, PX_CSE1_ID));
mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
log(__SCOPE__&" INFO: Resource " & v_request.to_ & " deleted");
v_deregistrationPerformed := true;
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
log(__SCOPE__&" INFO: Error while deleting resource " & v_request.to_);
}
[] tc_ac.timeout {
log(__SCOPE__&" INFO: No answer while deleting resource " & v_request.to_);
}
}
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
log(__SCOPE__&":INFO: Error while retrieving resource");
}
[] tc_ac.timeout {
log(__SCOPE__&":INFO: No answer while retrieving resource");
}
}
//1) Deregistration by Registrar (Test System)
v_childResourceRefs := f_cse_retrieveChildResourceRefs({int16}, -, f_getOriginator(vc_remoteCseIndex));
if(not(v_deregistrationPerformed)) {
//Deregistration by Registree (IUT)
//Send trigger message for deregistration
v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(vc_localRemoteCseIndex);
f_sendUtPrimitive(v_utRequest, v_action & f_getLocalResourceAddress(vc_localRemoteCseIndex));
if(v_childResourceRefs != {}) {
//v_request := valueof(m_delete(v_childResourceRefs[0], f_getOriginator(vc_remoteCseIndex)));
v_request := valueof(m_delete(v_childResourceRefs[0]));//TODO Originator super user to be replaced by CSE1_ID (line above)
mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(mw_delete(f_getLocalResourceAddress(vc_localRemoteCseIndex)))) -> value vc_request {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
f_processDeleteRequestPrimitive(vc_request.primitive.requestPrimitive);
mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
log(__SCOPE__&": INFO: Deregistration performed successfully");
log(__SCOPE__&" INFO: Resource " & v_request.to_ & " deleted");
v_deregistrationPerformed := true;
}
[] tc_ac.timeout {
log(__SCOPE__&": INFO: No deregistration performed");
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
log(__SCOPE__&" INFO: Error while deleting resource " & v_request.to_);
}
[] tc_ac.timeout {
log(__SCOPE__&" INFO: No answer while deleting resource " & v_request.to_);
}
}
}
}
if(not(v_deregistrationPerformed)) {
//Deregistration by Registree (IUT) - Send trigger message for deregistration
v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(vc_localRemoteCseIndex);
f_sendUtPrimitive(v_utRequest, v_action & f_getLocalResourceAddress(vc_localRemoteCseIndex));
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(mw_delete(f_getLocalResourceAddress(vc_localRemoteCseIndex)))) -> value vc_request {
tc_ac.stop;
f_processDeleteRequestPrimitive(vc_request.primitive.requestPrimitive);
mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
log(__SCOPE__&": INFO: Deregistration performed successfully");
}
[] tc_ac.timeout {
log(__SCOPE__&": INFO: No deregistration performed");
}
}
}
......@@ -1764,7 +1758,6 @@ module OneM2M_Functions {
function f_cse_sendCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create, integer p_parentIndex := -1) runs on AeSimu {
var RequestPrimitive v_request;
var integer v_resourceIndex := -1;
v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, p_parentIndex);
......@@ -2411,6 +2404,38 @@ module OneM2M_Functions {
}//end of group AnnouncementFunctions
/**
* @desc Message exchange for the retrieval of a child resource refs
* @param p_resourceType ResourceType of children of the resource to be retrieved
* @param p_resourceIndex Resource index of the resource to be retrieved
* @return PrimitiveContent parameter of the RETRIEVE response
* @verdict
*/
function f_cse_retrieveChildResourceRefs(template(omit) ResourceTypeList p_resourceTypeList := omit, integer p_targetResourceIndex := -1, XSD.ID p_originator := PX_SUPER_CSE_ID) runs on CseSimu return URIList {
var RequestPrimitive v_requestPrimitive;
var URIList v_uriList := {};
v_requestPrimitive := valueof(m_retrieveChildResourceRefs(f_getResourceAddress(p_targetResourceIndex), p_originator));
mccPort.send(f_getMsgOutPrimitive(m_request(v_requestPrimitive)));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource retrieved successfuly");
v_uriList := vc_response.primitive.responsePrimitive.primitiveContent.uRIList;
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while retrieving resource");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while retrieving resource");
}
}
return v_uriList;
}// end f_cse_retrieveResourceChildren
/**
* @desc Check that a resource is present in the IUT (resourceId is known)
* @param p_resourceIndex Resource index
......@@ -2675,7 +2700,6 @@ module OneM2M_Functions {
}
v_myResource.remoteCSE.resourceType := p_resourceType;
v_myResource.remoteCSE.resourceID := f_resourceIdCleaner(v_myResource.remoteCSE.cSE_ID);
//v_myResource.remoteCSE.resourceID := "remoteCSE-ID" & int2str(v_resourceIndex);
v_myResource.remoteCSE.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource);
v_myResource.remoteCSE.creationTime := fx_generateTimestamp();
v_myResource.remoteCSE.creationTime := "20171231T012345";
......@@ -2699,9 +2723,9 @@ module OneM2M_Functions {
} else if (p_resourceType == int10002 and ispresent (p_resource)) { //AE Annc
if(ischosen(p_resource.aEAnnc)) {
v_myResource.aEAnnc := valueof(p_resource.aEAnnc);
v_myResource.aEAnnc.resourceName := "aEAnnc" & int2str(v_resourceIndex);
if(not(ispresent(p_resource.aEAnnc.resourceName))) {
v_myResource.aEAnnc.resourceName := "aEAnnc" & int2str(v_resourceIndex);
}
v_myResource.aEAnnc.resourceType := p_resourceType;
v_myResource.aEAnnc.resourceID := "aeA" & int2str(v_resourceIndex);
v_myResource.aEAnnc.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource);
......@@ -2711,8 +2735,9 @@ module OneM2M_Functions {
} else if (p_resourceType == int10001 and ispresent (p_resource)) { //Acp Annc
if(ischosen(p_resource.accessControlPolicyAnnc)) {
v_myResource.accessControlPolicyAnnc := valueof(p_resource.accessControlPolicyAnnc);
v_myResource.accessControlPolicyAnnc.resourceName := "accessControlPolicyAnnc" & int2str(v_resourceIndex);
if(not(ispresent(p_resource.accessControlPolicyAnnc.resourceName))) {
v_myResource.accessControlPolicyAnnc.resourceName := "accessControlPolicyAnnc" & int2str(v_resourceIndex);
}
v_myResource.accessControlPolicyAnnc.resourceType := p_resourceType;
v_myResource.accessControlPolicyAnnc.resourceID := "acpA" & int2str(v_resourceIndex);
v_myResource.accessControlPolicyAnnc.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource);
......@@ -2722,8 +2747,9 @@ module OneM2M_Functions {
} else if (p_resourceType == int10003 and ispresent (p_resource)) { //Container Annc
if(ischosen(p_resource.containerAnnc)) {
v_myResource.containerAnnc := valueof(p_resource.containerAnnc);
v_myResource.containerAnnc.resourceName := "containerAnnc" & int2str(v_resourceIndex);
if(not(ispresent(p_resource.containerAnnc.resourceName))) {
v_myResource.containerAnnc.resourceName := "containerAnnc" & int2str(v_resourceIndex);
}
v_myResource.containerAnnc.resourceType := p_resourceType;
v_myResource.containerAnnc.resourceID := "cntA" & int2str(v_resourceIndex);
v_myResource.containerAnnc.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource);
......@@ -2733,8 +2759,9 @@ module OneM2M_Functions {
} else if (p_resourceType == int10009 and ispresent (p_resource)) { //Group Annc
if(ischosen(p_resource.groupAnnc)) {
v_myResource.groupAnnc := valueof(p_resource.groupAnnc);
v_myResource.groupAnnc.resourceName := "groupAnnc" & int2str(v_resourceIndex);
if(not(ispresent(p_resource.groupAnnc.resourceName))) {
v_myResource.groupAnnc.resourceName := "groupAnnc" & int2str(v_resourceIndex);
}
v_myResource.groupAnnc.resourceType := p_resourceType;
v_myResource.groupAnnc.resourceID := "grpA" & int2str(v_resourceIndex);
v_myResource.groupAnnc.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource);
......@@ -2744,8 +2771,9 @@ module OneM2M_Functions {
} else if (p_resourceType == int10004 and ispresent (p_resource)) { //ContentInstance Annc
if(ischosen(p_resource.contentInstanceAnnc)) {
v_myResource.contentInstanceAnnc := valueof(p_resource.contentInstanceAnnc);
v_myResource.contentInstanceAnnc.resourceName := "contentInstanceAnnc" & int2str(v_resourceIndex);
if(not(ispresent(p_resource.contentInstanceAnnc.resourceName))) {
v_myResource.contentInstanceAnnc.resourceName := "contentInstanceAnnc" & int2str(v_resourceIndex);
}
v_myResource.contentInstanceAnnc.resourceType := p_resourceType;
v_myResource.contentInstanceAnnc.resourceID := "cinA" & int2str(v_resourceIndex);
v_myResource.contentInstanceAnnc.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource);
......@@ -2755,11 +2783,9 @@ module OneM2M_Functions {
} else if (p_resourceType == int1 and ispresent (p_resource)) { //Acp Resource
if(ischosen (p_resource.accessControlPolicy)){
v_myResource.accessControlPolicy := valueof(p_resource.accessControlPolicy);
if(not(ispresent(p_resource.accessControlPolicy.resourceName))) {
v_myResource.accessControlPolicy.resourceName := "accessControlPolicy" & int2str(v_resourceIndex);
}
v_myResource.accessControlPolicy.resourceType := p_resourceType;
v_myResource.accessControlPolicy.resourceID := "acp" & int2str(v_resourceIndex);
v_myResource.accessControlPolicy.parentID := f_getResourceId(vc_localResourcesList[p_parentIndex].resource);
......@@ -3084,26 +3110,10 @@ module OneM2M_Functions {
*/
function f_cse_sendResponse(in MsgIn p_requestPrimitive) runs on CseSimu {
var integer v_parentResourceIndex := -1;
var integer v_localResourceIndex := -1;
var ResponsePrimitive v_response;
var PrimitiveContent v_localResource;
v_parentResourceIndex := f_getResourceIndex(p_requestPrimitive.primitive.requestPrimitive.to_);
if(v_parentResourceIndex == -1) {
log(__SCOPE__&": ERROR: Target resource not found");
v_response := valueof(m_responsePrimitive(int4004,p_requestPrimitive.primitive.requestPrimitive.requestIdentifier));
f_processCreateRequestPrimitive(p_requestPrimitive.primitive.requestPrimitive);
} else {
v_localResource := f_generateLocalResource(p_requestPrimitive.primitive.requestPrimitive.primitiveContent, v_parentResourceIndex, p_requestPrimitive.primitive.requestPrimitive.resourceType);
v_localResourceIndex := f_setLocalResource(v_localResource, p_requestPrimitive.primitive.requestPrimitive.resourceType, v_parentResourceIndex);
v_response := valueof(m_responsePrimitive(int2001,p_requestPrimitive.primitive.requestPrimitive.requestIdentifier));
v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
}
v_response.from_ := PX_CSE1_ID;
v_response.to_ := p_requestPrimitive.primitive.requestPrimitive.from_;
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
}
......@@ -3111,15 +3121,20 @@ module OneM2M_Functions {
* @desc Receive response from the IUT
* @param p_requestPrimtive Received request primitive
*/
function f_cse_receiveResponse() runs on AeSimu {
function f_cse_receiveResponse(in RequestPrimitive p_request) runs on AeSimu {
var integer v_localResourceIndex := -1;
var integer v_resourceIndex := -1;
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Response received with positive response status code");
f_checkAttributesToBeSaved(p_request.resourceType, p_request, vc_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, p_request.resourceType);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
......@@ -3892,7 +3907,11 @@ module OneM2M_Functions {
if(vc_resourcesList[p_targetResourceIndex].parentIndex == -1) {
if(ischosen(vc_resourcesList[p_targetResourceIndex].resource.aE)) {
return vc_resourcesList[p_targetResourceIndex].resource.aE.aE_ID;
if(isvalue(vc_resourcesList[p_targetResourceIndex].resource.aE.aE_ID)) {
return vc_resourcesList[p_targetResourceIndex].resource.aE.aE_ID;
} else {
return PX_SUPER_AE_ID;
}
} else if (ischosen(vc_resourcesList[p_targetResourceIndex].resource.remoteCSE)) {
return vc_resourcesList[p_targetResourceIndex].resource.remoteCSE.cSE_ID;
} else {
......@@ -4158,7 +4177,7 @@ module OneM2M_Functions {
v_newIndex := lengthof(vc_resourcesList)-1;
if(p_resourceToBeDeleted) {
if(match(int2, p_resourceType) or match(-1, p_parentIndex)) {//If created resource is an AE or created under CSEBase, it needs to be added to the resourceToBeDeleted list
if(p_resourceType == int2 or p_parentIndex == -1) {//If created resource is an AE or created under CSEBase, it needs to be added to the resourceToBeDeleted list
vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_newIndex};
}
}
......@@ -4565,6 +4584,8 @@ module OneM2M_Functions {
f_cf02Down();
}
kill;
} else {
log(__SCOPE__, ":INFO: AeSimu status OK");
}
}
......@@ -4664,6 +4685,8 @@ module OneM2M_Functions {
f_cf02DownCseSimuMaster();
}
kill;
} else {
log(__SCOPE__, ":INFO: CseSimu status OK");
}
}
......
......@@ -133,8 +133,7 @@ module OneM2M_Templates {
* @param p_targetResourceAddress Target resource address
* @param p_originator Originator (from)
*/
template (value) RequestPrimitive m_retrieveChildReferences(XSD.ID p_targetResourceAddress, in XSD.ID p_originator, template (omit) ResourceTypeList p_resourceTypeList := omit) modifies m_retrieve := {
resultContent := int6,
template (value) RequestPrimitive m_retrieveChildResourceRefs(XSD.ID p_targetResourceAddress, in XSD.ID p_originator, template (omit) ResourceTypeList p_resourceTypeList := omit) modifies m_retrieve := {
filterCriteria := {
createdBefore := omit,
createdAfter := omit,
......@@ -150,7 +149,7 @@ module OneM2M_Templates {
sizeBelow := omit,
contentType_list := {},
attribute_list := {},
filterUsage := omit,
filterUsage := int1,
limit := omit,
semanticsFilter_list := {},
filterOperation := omit,
......
......@@ -690,9 +690,6 @@ module OneM2M_Testcases_CSE_Release_1 {
var MsgIn v_request;
var template RequestPrimitive v_requestPrimitive;
var integer v_cseBaseIndex := -1;
var ResourceType v_resourceType := int2;
var boolean v_handleResponses := false;
//Test control
......@@ -703,8 +700,7 @@ module OneM2M_Testcases_CSE_Release_1 {
vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
//Test Body
vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, -, "S", omit)));
vc_ae1.done;
vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, "S")));
v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/S", -, -, -);
v_requestPrimitive.primitiveContent.aEAnnc.app_ID := PX_APP_ID;
......@@ -714,29 +710,26 @@ module OneM2M_Testcases_CSE_Release_1 {
[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": AE creation redirected.");
v_handleResponses := true;
f_cse_sendResponse(v_request);
}
[] mccPortIn.receive(mw_request(mw_createAEAnnc())) -> value v_request {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": AE creation redirected but wrong parameters");
v_handleResponses := true;
f_cse_sendResponse(v_request);
}
[] mccPortIn.receive(mw_request(?))-> value v_request {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Unexpected message received");
v_handleResponses := true;
f_cse_sendResponse(v_request);
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating AE");
}
}
vc_ae1.done;
// Postamble
if (v_handleResponses) {
vc_ae1.start(f_cse_receiveResponse());
f_cse_sendResponse(v_request);
vc_ae1.done;
}
f_cse_postamble_deleteResourcesCSE();
// Tear down
......@@ -1869,7 +1862,10 @@ module OneM2M_Testcases_CSE_Release_1 {
}
v_response.from_ := PX_CSE1_ID;
v_response.to_ := v_request.primitive.requestPrimitive.from_;
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); }
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
tc_ac.start(10.0);
repeat;
}
[] tc_ac.timeout {
if(not(v_cseRegistered)) {
setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
......
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