Fixing TC_CSE_REG_CRE_005 (not finalized)

Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent f65ee97b
......@@ -1935,8 +1935,8 @@ module OneM2M_Functions {
v_myResource.remoteCSE.resourceName := "remoteCSE" & int2str(v_resourceIndex);
}
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.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";
......@@ -2046,6 +2046,7 @@ module OneM2M_Functions {
var PrimitiveContent v_localResource;
var integer vc_localResourceIndex := -1;
var integer v_parentResourceIndex := -1;
var MsgIn v_request;
var ResponsePrimitive v_response;
var integer v_localResourceIndex := -1;
......@@ -2053,15 +2054,23 @@ module OneM2M_Functions {
[] mccPortIn.receive(mw_request(mw_create())) -> value v_request {
log(__SCOPE__&": WARNING: Unexpected CREATE message received");
tc_ac.stop;
v_localResource := f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, vc_cSEBaseIndex, v_request.primitive.requestPrimitive.resourceType);//TODO Get index from v_request.primitive.requestPrimitive.to_
vc_localResourceIndex := f_setLocalResource(v_localResource, v_request.primitive.requestPrimitive.resourceType, vc_cSEBaseIndex);
v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
v_parentResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_);
if(v_parentResourceIndex == -1) {
log(__SCOPE__&": ERROR: Target resource not found");
v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier));
} else {
v_localResource := f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, vc_cSEBaseIndex, v_request.primitive.requestPrimitive.resourceType);//TODO Get index from v_request.primitive.requestPrimitive.to_
vc_localResourceIndex := f_setLocalResource(v_localResource, v_request.primitive.requestPrimitive.resourceType, vc_cSEBaseIndex);
v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
v_response.primitiveContent := vc_localResourcesList[vc_localResourceIndex].resource;
}
v_response.from_ := PX_CSE1_ID;
v_response.to_ := v_request.primitive.requestPrimitive.from_;
v_response.primitiveContent := vc_localResourcesList[vc_localResourceIndex].resource;
mccPortIn.send(m_response(v_response));
tc_ac.start;
tc_ac.start(5.0);
repeat;
}
[] mccPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request {
......@@ -2083,7 +2092,7 @@ module OneM2M_Functions {
v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
mccPortIn.send(m_response(v_response));
}
tc_ac.start;
tc_ac.start(5.0);
repeat;
}
[] mccPortIn.receive(mw_request(mw_update())) -> value v_request {
......@@ -2105,7 +2114,7 @@ module OneM2M_Functions {
v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
mccPortIn.send(m_response(v_response));
}
tc_ac.start;
tc_ac.start(5.0);
repeat;
}
[] mccPortIn.receive (mw_request(?)){
......@@ -2827,7 +2836,7 @@ module OneM2M_Functions {
log("Hierarchical method: " & v_cleanedURI);
for(i:=0; i < lengthof(vc_localResourcesList); i := i+1){
if(match(f_getResourceName(vc_localResourcesList[i].resource), v_cleanedURI)){
if(v_cleanedURI == f_getResourceName(vc_localResourcesList[i].resource)){
v_resourceIndex := i;
break;
}
......@@ -2837,7 +2846,7 @@ module OneM2M_Functions {
log("Non Hierarchical method: " & v_cleanedURI);
for(i:=0; i < lengthof(vc_localResourcesList); i := i+1){
if(match(f_getResourceId(vc_localResourcesList[i].resource), v_cleanedURI)){
if(v_cleanedURI == f_getResourceId(vc_localResourcesList[i].resource)){
v_resourceIndex := i;
break;
}
......@@ -2846,10 +2855,11 @@ module OneM2M_Functions {
log("Resource index found: " & int2str(v_resourceIndex));
//Try CSEBase
if(v_resourceIndex == -1) {
if(match(f_getResourceName(vc_localResourcesList[vc_cSEBaseIndex].resource), v_cleanedURI)) {
if(v_cleanedURI == f_getResourceName(vc_localResourcesList[vc_cSEBaseIndex].resource)) {
v_resourceIndex := vc_cSEBaseIndex;
}
}
log("Resource index found: " & int2str(v_resourceIndex));
return v_resourceIndex;
}
......@@ -2929,13 +2939,13 @@ module OneM2M_Functions {
if(p_primitiveScope == e_cseRelative) {
if(p_addressingMethod == e_nonHierarchical) {
if(p_targetResourceIndex == -1) {
if(p_targetResourceIndex == 0) {
return PX_CSE1_RESOURCE_ID;
} else {
return f_getResourceId(vc_localResourcesList[p_targetResourceIndex].resource);
}
} else {
if(p_targetResourceIndex == -1) {
if(p_targetResourceIndex == 0) {
return PX_CSE1_NAME;
} else {
v_resourceAddress := f_getLocalResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource);
......@@ -2945,14 +2955,14 @@ module OneM2M_Functions {
} else if (p_primitiveScope == e_spRelative) {
if(p_addressingMethod == e_nonHierarchical) {
if(p_targetResourceIndex == -1) {
if(p_targetResourceIndex == 0) {
return PX_CSE1_ID & "/" & PX_CSE1_RESOURCE_ID;
} else {
v_resourceAddress := PX_CSE1_ID & "/" & f_getResourceId(vc_localResourcesList[p_targetResourceIndex].resource);
return v_resourceAddress;
}
} else {
if(p_targetResourceIndex == -1) {
if(p_targetResourceIndex == 0) {
return PX_CSE1_ID & "/" & PX_CSE1_NAME;
} else {
v_resourceAddress := f_getLocalResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource);
......@@ -2961,14 +2971,14 @@ module OneM2M_Functions {
}
} else if (p_primitiveScope == e_absolute) {
if(p_addressingMethod == e_nonHierarchical) {
if(p_targetResourceIndex == -1) {
if(p_targetResourceIndex == 0) {
return PX_SP1_ID & PX_CSE1_ID;
} else {
v_resourceAddress := f_getLocalResourceAddress(-, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceId(vc_localResourcesList[p_targetResourceIndex].resource);
return v_resourceAddress;
}
} else {
if(p_targetResourceIndex == -1) {
if(p_targetResourceIndex == 0) {
return PX_SP1_ID & PX_CSE1_ID & "/" & PX_CSE1_NAME;
} else {
v_resourceAddress := f_getLocalResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource);
......
......@@ -585,7 +585,7 @@ module OneM2M_Templates {
/**
* @desc Reception template for CREATE AEAnnc
*/
template RequestPrimitive mw_createAEAnnc(template (omit) XSD.ID p_from := omit, template (omit) XSD.ID p_to := omit, template AcpType p_accessControlPolicyIds := ?, template XSD.AnyURI p_link := ?) modifies mw_create := {
template RequestPrimitive mw_createAEAnnc(template XSD.ID p_from := ?, template XSD.ID p_to := ?, template AcpType p_accessControlPolicyIds := ?, template XSD.AnyURI p_link := ?) modifies mw_create := {
resourceType := int10002,
primitiveContent := {aEAnnc := mw_contentCreateAEAnnc({"Credential-ID:None"}, p_accessControlPolicyIds)}
};
......
......@@ -562,7 +562,7 @@ module OneM2M_Testcases_CSE_Release_1 {
*/
testcase TC_CSE_REG_CRE_005() runs on InCseSimu system CseSystem {
var RequestPrimitive v_request;
var template RequestPrimitive v_request;
var integer v_cseBaseIndex := -1;
var ResourceType v_resourceType := int2;
......@@ -577,16 +577,23 @@ module OneM2M_Testcases_CSE_Release_1 {
//Test Body
vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, -, "S", omit)));
vc_ae1.done;
v_request := mw_createAEAnnc(PX_CSE_ID & "/S", -, -, -);
v_request.primitiveContent.aEAnnc.app_ID := PX_APP_ID;
tc_ac.start;
alt{
[] mccPortIn.receive(mw_request(mw_createAEAnnc(PX_CSE_ID, f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", -))){
[] mccPortIn.receive(mw_request(v_request)){
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": AE creation redirected.");
}
[] mccPortIn.receive(mw_request(mw_createAEAnnc(PX_CSE_ID, f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", -))){
[] mccPortIn.receive(mw_request(mw_createAEAnnc())){
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": AE creation redirected.");
setverdict(fail, __SCOPE__ & ": AE creation redirected but wrong parameters");
}
[] mccPortIn.receive(mw_request(?)){
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Unexpected message received");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating AE");
......@@ -675,7 +682,7 @@ module OneM2M_Testcases_CSE_Release_1 {
mcaPort.send(m_request(f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S"),-1)));
vc_cse1.start(f_cse_resourceAnnouncementHandler());
vc_cse1.start(f_cse_announcementProcedure_createHandler());
vc_cse1.done;
//Test Body
......@@ -793,7 +800,7 @@ module OneM2M_Testcases_CSE_Release_1 {
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
//Create AEAnnc
v_aeAnncIndex := f_cse_announceResource(int2, m_createAEAnnc(-, PX_CSE1_ID & "/" & "S", PX_APP_ID, PX_CSE1_ID & "/" & "S"));
v_aeAnncIndex := f_cse_announcementProcedure_announceResource(int2, m_createAEAnnc(-, PX_CSE1_ID & "/" & "S", PX_APP_ID, PX_CSE1_ID & "/" & "S"));
//Update AEAnnc to simulate deregistration of AE
v_request := f_getUpdateRequestPrimitive(f_getAnnouncedResourceType(int2),v_aeAnncIndex, valueof(m_updateAEAnncBase));//TODO
......@@ -861,7 +868,7 @@ module OneM2M_Testcases_CSE_Release_1 {
v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S-AE-ID-STEM"));
vc_cse1.start(f_cse_resourceAnnouncementHandler());
vc_cse1.start(f_cse_announcementProcedure_createHandler());
vc_cse1.done;
//TODO Deregister
......@@ -872,7 +879,7 @@ module OneM2M_Testcases_CSE_Release_1 {
//Test Body
f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, f_getResourceId(vc_resourcesList[v_aeIndex].resource)));
vc_cse1.start(f_cse_resourceAnnouncementHandler(mw_createAEAnnc(PX_CSE_ID, -, -, -)));
vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(PX_CSE_ID, -, -, -)));
vc_cse1.done;
tc_ac.start;
......@@ -1294,7 +1301,7 @@ module OneM2M_Testcases_CSE_Release_1 {
}
}
vc_cse1.start(f_cse_notifyProcedure_updateHandler());
vc_cse1.start(f_cse_announcementProcedure_updateHandler());
vc_cse1.done;
//Test body
......
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