f_ae_createResource renamed to f_ae_createLocalResource and corrections for AE resource creation +

f_cf03Up, f_cf03Down updated +
f_ae_preamble_registerAe fixed to used mcaPortIn +
f_getLocalResourceAddress corrected +
f_AE_DMR_UPD_001 updated
Signed-off-by: Miguel Angel Reina Ortega's avatarMiguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
parent b69c8f21
......@@ -178,15 +178,23 @@ module OneM2M_Functions {
function f_cf03Up() runs on CseSimu {
// Variables
var PrimitiveContent v_cSEBaseResource;
vc_config := e_cf03;
vc_testSystemRole := e_cse;
// Map
map(self:mcaPortIn, system:mcaPortIn);//TODO To be consistent, we should use mcaPortIn for AE testing
map(self:acPort, system:acPort);
map(self:utPort, system:utPort);
if(PX_UT_IMPLEMENTED) {
map(self:utPort, system:utPort);
}
activate(a_default());
activate(a_ae_cf03());
//Creation of CSEBase
v_cSEBaseResource := f_cse_generateLocalResource(-, -1, int5);
vc_cSEBaseIndex := f_setLocalResource(v_cSEBaseResource, int5, -1);
// Connect
......@@ -274,7 +282,9 @@ module OneM2M_Functions {
function f_cf03Down() runs on CseSimu {
unmap(self:mcaPortIn, system:mcaPortIn);
unmap(self:utPort, system:utPort);
if(PX_UT_IMPLEMENTED){
unmap(self:utPort, system:utPort);
}
unmap(self:acPort, system:acPort);
}
......@@ -1918,18 +1928,18 @@ module OneM2M_Functions {
tc_ac.start;
alt {
[] mcaPort.receive(mw_request(mw_createAe)) -> value v_request {
[] mcaPortIn.receive(mw_request(mw_createAe)) -> value v_request {
tc_ac.stop;
v_rp := v_request.primitive.requestPrimitive;
v_parentIndex := f_getResourceIndex(v_rp.to_);
v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource);
v_resourceIndex := f_ae_createLocalResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource);
if(v_resourceIndex != -1) {
mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource)));
mcaPortIn.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource)));
setverdict(pass, __SCOPE__&":INFO: Application registered successfuly");
}
else {
mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier)));
mcaPortIn.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier)));
setverdict(inconc, __SCOPE__&":INFO: AE registration failed");
}
}
......@@ -1973,7 +1983,7 @@ module OneM2M_Functions {
v_rp := v_request.primitive.requestPrimitive;
v_parentIndex := f_getResourceIndex(v_rp.to_);
v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource);
v_resourceIndex := f_ae_createLocalResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource);
if(v_resourceIndex != -1) {
mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource)));
setverdict(pass, __SCOPE__&":INFO: Container created successfuly");
......@@ -2007,7 +2017,7 @@ module OneM2M_Functions {
* @param p_modifiedResource Assigned and/or modified fields
* @return Internal resource index of the saved resource or -1
*/
function f_ae_createResource(in PrimitiveContent p_resource, in integer p_parentIndex, in ResourceType p_resourceType, out PrimitiveContent p_modifiedResource) runs on CseSimu return integer {
function f_ae_createLocalResource(in PrimitiveContent p_resource, in integer p_parentIndex, in ResourceType p_resourceType, out PrimitiveContent p_modifiedResource) runs on CseSimu return integer {
var integer v_resourceIndex;
......@@ -2015,28 +2025,19 @@ module OneM2M_Functions {
if(p_resourceType == int2 and ispresent(p_resource)) {
if(ischosen(p_resource.aE)){
var AE_optional v_ae := p_resource.aE;
var AE_optional v_aeModified;
v_resourceIndex := lengthof(vc_resourcesList) - 1;
v_resourceIndex := lengthof(vc_localResourcesList) - 1;
v_ae.resourceType := p_resourceType;
v_ae.parentID := int2str(p_parentIndex);
v_ae.parentID := PX_CSE1_ID;
v_ae.creationTime := fx_generateTimestamp();
v_ae.lastModifiedTime := v_ae.creationTime;
v_ae.resourceID := "ae" & int2char(v_resourceIndex);
v_ae.aE_ID := "ae" & int2char(v_resourceIndex);
v_ae.resourceName := "ae" & int2char(v_resourceIndex);
v_ae.resourceID := "ae" & int2str(v_resourceIndex);
v_ae.aE_ID := "Cae" & int2str(v_resourceIndex);
v_ae.resourceName := "ae" & int2str(v_resourceIndex);
v_aeModified.parentID := v_ae.parentID;
v_aeModified.creationTime := v_ae.creationTime;
v_aeModified.lastModifiedTime := v_ae.lastModifiedTime;
v_aeModified.resourceID := v_ae.resourceID;
v_aeModified.aE_ID := v_ae.aE_ID;
v_aeModified.resourceName := v_ae.resourceName;
p_resource.aE := v_ae;
p_modifiedResource.aE := v_aeModified;
return f_setResource(p_resource, p_resourceType, p_parentIndex, false);
p_modifiedResource.aE := v_ae;
return f_setLocalResource(p_resource, p_resourceType, p_parentIndex);
}
......@@ -2086,7 +2087,7 @@ module OneM2M_Functions {
[] mcaPort.receive(mw_request(mw_create)) -> value v_request {
v_rp := v_request.primitive.requestPrimitive;
v_parentIndex := f_getResourceIndex(v_rp.to_);
v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource);
v_resourceIndex := f_ae_createLocalResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource);
if(v_resourceIndex != -1) {
mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource)));
}
......@@ -2464,8 +2465,8 @@ module OneM2M_Functions {
* @param p_address Resource URI (can be structured/unstructured cseRelative/spRelative/absolute)
* @return Internal resource index of the given resource or -1 in case of error
*/
function f_getResourceIndex(in XSD.AnyURI p_address) return integer {
return -1; //TODO
function f_getResourceIndex(in XSD.AnyURI p_address) runs on CseSimu return integer {
return vc_cSEBaseIndex; //TODO
}
/**
......@@ -2553,7 +2554,7 @@ module OneM2M_Functions {
if(p_targetResourceIndex == -1) {
return PX_CSE1_NAME;
} else {
v_resourceAddress := f_getResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource);
v_resourceAddress := f_getLocalResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource);
return v_resourceAddress;
}
}
......@@ -2570,7 +2571,7 @@ module OneM2M_Functions {
if(p_targetResourceIndex == -1) {
return PX_CSE1_ID & "/" & PX_CSE1_NAME;
} else {
v_resourceAddress := f_getResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource);
v_resourceAddress := f_getLocalResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource);
return v_resourceAddress;
}
}
......@@ -2579,14 +2580,14 @@ module OneM2M_Functions {
if(p_targetResourceIndex == -1) {
return PX_SP1_ID & PX_CSE1_ID;
} else {
v_resourceAddress := f_getResourceAddress(-, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceId(vc_localResourcesList[p_targetResourceIndex].resource);
v_resourceAddress := f_getLocalResourceAddress(-, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceId(vc_localResourcesList[p_targetResourceIndex].resource);
return v_resourceAddress;
}
} else {
if(p_targetResourceIndex == -1) {
return PX_SP1_ID & PX_CSE1_ID & "/" & PX_CSE1_NAME;
} else {
v_resourceAddress := f_getResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource);
v_resourceAddress := f_getLocalResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource);
return v_resourceAddress;
}
}
......
......@@ -1306,90 +1306,120 @@ module OneM2M_Testcases_AE {
testcase TC_AE_DMR_UPD_001_ET() runs on CseSimu system AeSystem {
var template RequestPrimitive v_expectedUpdateRequestAe;
var charstring v_action := "Please, send a valid UPDATE Request for AE updating attribute expirationTime";
var template UtTriggerPrimitive v_utRequest := m_updateAeBase;
v_utRequest.primitiveContent.aE.expirationTime := "20301231T012345";
f_AE_DMR_UPD_001(v_utRequest, v_action);
v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest;
v_expectedUpdateRequestAe.primitiveContent.aE.expirationTime := ?;
f_AE_DMR_UPD_001(v_utRequest, v_action, v_expectedUpdateRequestAe);
}
testcase TC_AE_DMR_UPD_001_LBL() runs on CseSimu system AeSystem {
var template RequestPrimitive v_expectedUpdateRequestAe;
var template UtTriggerPrimitive v_utRequest := m_updateAeBase;
var charstring v_action := "Please, send a valid UPDATE Request for AE updating attribute labels";
v_utRequest.primitiveContent.aE.labels := {"UNINITIALIZED"};
f_AE_DMR_UPD_001(v_utRequest,v_action);
v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest;
v_expectedUpdateRequestAe.primitiveContent.aE.labels := ?;
f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe);
}
testcase TC_AE_DMR_UPD_001_APN() runs on CseSimu system AeSystem {
var template RequestPrimitive v_expectedUpdateRequestAe;
var template UtTriggerPrimitive v_utRequest := m_updateAeBase;
var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute appName";
v_utRequest.primitiveContent.aE.appName := "UNINITIALIZED";
f_AE_DMR_UPD_001(v_utRequest,v_action);
v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest;
v_expectedUpdateRequestAe.primitiveContent.aE.appName := ?;
f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe);
}
testcase TC_AE_DMR_UPD_001_POA() runs on CseSimu system AeSystem {
var template RequestPrimitive v_expectedUpdateRequestAe;
var template UtTriggerPrimitive v_utRequest := m_updateAeBase;
var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute pointOfAccess";
v_utRequest.primitiveContent.aE.pointOfAccess := {"http://127.0.0.1:1400/monitor"};
f_AE_DMR_UPD_001(v_utRequest,v_action);
v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest;
v_expectedUpdateRequestAe.primitiveContent.aE.pointOfAccess := ?;
f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe);
}
testcase TC_AE_DMR_UPD_001_OR() runs on CseSimu system AeSystem {
var template RequestPrimitive v_expectedUpdateRequestAe;
var template UtTriggerPrimitive v_utRequest := m_updateAeBase;
var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute ontologyRef";
v_utRequest.primitiveContent.aE.ontologyRef := "MyOntologyRef";
f_AE_DMR_UPD_001(v_utRequest,v_action);
v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest;
v_expectedUpdateRequestAe.primitiveContent.aE.ontologyRef := ?;
f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe);
}
testcase TC_AE_DMR_UPD_001_NL() runs on CseSimu system AeSystem {
var template RequestPrimitive v_expectedUpdateRequestAe;
var template UtTriggerPrimitive v_utRequest := m_updateAeBase;
var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute nodeLink";
v_utRequest.primitiveContent.aE.nodeLink := "/CSE_ID/S-AE-ID-STEM";
f_AE_DMR_UPD_001(v_utRequest,v_action);
v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest;
v_expectedUpdateRequestAe.primitiveContent.aE.nodeLink := ?;
f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe);
}
testcase TC_AE_DMR_UPD_001_RR() runs on CseSimu system AeSystem {
var template RequestPrimitive v_expectedUpdateRequestAe;
var template UtTriggerPrimitive v_utRequest := m_updateAeBase;
var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute requestReachability";
v_utRequest.primitiveContent.aE.requestReachability := true;
f_AE_DMR_UPD_001(v_utRequest,v_action);
v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest;
v_expectedUpdateRequestAe.primitiveContent.aE.requestReachability := ?;
f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe);
}
testcase TC_AE_DMR_UPD_001_CSZ() runs on CseSimu system AeSystem {
var template RequestPrimitive v_expectedUpdateRequestAe;
var template UtTriggerPrimitive v_utRequestTestBody := m_updateAeBase;
var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute contentSerialization";
v_utRequestTestBody.primitiveContent.aE.contentSerialization := {applicationxml};
f_AE_DMR_UPD_001(v_utRequestTestBody,v_action);
v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest;
v_expectedUpdateRequestAe.primitiveContent.aE.contentSerialization := ?;
f_AE_DMR_UPD_001(v_utRequestTestBody,v_action, v_expectedUpdateRequestAe);
}
function f_AE_DMR_UPD_001(template UtTriggerPrimitive p_utRequestTestBody, in charstring p_action) runs on CseSimu {
function f_AE_DMR_UPD_001(template UtTriggerPrimitive p_utRequestTestBody, in charstring p_action, template RequestPrimitive p_expectedUpdateRequest) runs on CseSimu {
//primitives for mcaPortIn
var MsgIn v_request;
var ResponsePrimitive v_responsePrimitive;
var integer v_aeIndex := -1;
var template RequestPrimitive v_expectedUpdateRequestAe := mw_updateAe();
var integer v_aeIndex := -1;
f_cf03Up();
......@@ -1397,20 +1427,17 @@ module OneM2M_Testcases_AE {
v_aeIndex := f_ae_preamble_registerAe();
//Send Trigger Message
p_utRequestTestBody.to_ := f_getResourceAddress(v_aeIndex);
p_utRequestTestBody.to_ := f_getLocalResourceAddress(v_aeIndex);
f_sendUtPrimitive(p_utRequestTestBody,p_action);
//Test behavior
v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest;
v_expectedUpdateRequestAe.primitiveContent := f_getTemplateFromPrimitiveContent(p_utRequestTestBody.primitiveContent);
tc_ac.start;
alt{
[] mcaPortIn.receive(mw_request(v_expectedUpdateRequestAe)) -> value v_request {
[] mcaPortIn.receive(mw_request(p_expectedUpdateRequest)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__, " : AE registration update request is accepted!");
v_responsePrimitive := valueof(m_responsePrimitive(int2001, "To_be_defined", omit));
v_responsePrimitive := valueof(m_responsePrimitive(int2004, v_request.primitive.requestPrimitive.requestIdentifier, omit));
//send back responsePrimitive
mcaPortIn.send(m_response(v_responsePrimitive));
......@@ -1517,7 +1544,7 @@ module OneM2M_Testcases_AE {
setverdict(pass, __SCOPE__, " : Container update request is accepted!!");
//set responseStatusCode back to SUT
v_responsePrimitive := valueof(m_responsePrimitive(int2001, "To_be_defined", omit));
v_responsePrimitive := valueof(m_responsePrimitive(int2004, "To_be_defined", omit));
//send back responsePrimitive
mcaPortIn.send(m_response(v_responsePrimitive));
......
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