CSE deregistration to be first started by Registrar (TS), then, if no success, by the Registree

Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent 8e953059
......@@ -805,7 +805,10 @@ module OneM2M_Functions {
var integer i;
var XSD.ID v_resourceAddress;
var RequestPrimitive v_request;
var boolean v_deregistrationPerformed := false;
var template UtTriggerPrimitive v_utRequest := m_utDelete;
var universal charstring v_action := __SCOPE__ & ": Please, perform deregistration by sending a valid DELETE Request for remoteCSE to ";
if (PX_RUN_POSTAMBLE) {
if(vc_config == e_cf02CseSimuMaster) {
......@@ -816,8 +819,9 @@ module OneM2M_Functions {
for(i := lengthof(vc_resourcesIndexToBeDeleted) -1; i >=0; i := i - 1) {
if(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.remoteCSE) and PX_MN_CSE) {
if(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.remoteCSE)) {
v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i], e_nonHierarchical, e_spRelative);
v_deregistrationPerformed := true;
} else {
v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i]);
}
......@@ -840,8 +844,68 @@ module OneM2M_Functions {
log(__SCOPE__&" INFO: No answer while deleting resource " & v_request.to_);
}
}
}
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");
}
}
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");
}
}
}
}
}
}
}
......@@ -1870,7 +1934,7 @@ module OneM2M_Functions {
var MsgIn v_response;
var RequestPrimitive v_request;
var PrimitiveContent v_remoteCSEResource;
var PrimitiveContent v_localRemoteCSEResource;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
......@@ -1885,8 +1949,8 @@ module OneM2M_Functions {
setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly");
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
vc_remoteCseIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16, -1);
v_remoteCSEResource := f_generateLocalResource(v_response.primitive.responsePrimitive.primitiveContent, vc_cSEBaseIndex, int16);
vc_localRemoteCseIndex := f_setLocalResource(v_remoteCSEResource, int16, vc_cSEBaseIndex);
v_localRemoteCSEResource := f_generateLocalResource(valueof(m_primitiveContentRemoteCSE(m_contentLocalRemoteCSEResource)), vc_cSEBaseIndex, int16);
vc_localRemoteCseIndex := f_setLocalResource(v_localRemoteCSEResource, int16, vc_cSEBaseIndex);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
......@@ -1916,15 +1980,12 @@ module OneM2M_Functions {
var MsgIn v_request;
var ResponsePrimitive v_response;
var PrimitiveContent v_remoteCSEResource;
var PrimitiveContent v_localRemoteCSEResource;
var integer v_resourceIndex := -1;
var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
var charstring v_action := "Please, send a CSE registration request";
var integer v_parentIndex := vc_localRemoteCseIndex;
var ResponsePrimitive v_responsePrimitive;
var PrimitiveContent v_announcedResource;
var boolean v_remoteCSERegistered:=false;
var integer v_ResourceIndex := -1;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
......@@ -1937,8 +1998,8 @@ module OneM2M_Functions {
[not v_remoteCSERegistered] mccPortIn.receive(mw_request(p_requestPrimitive)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly");
v_remoteCSEResource := f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, vc_cSEBaseIndex, int16);//TODO Get index from v_request.primitive.requestPrimitive.to_
vc_localRemoteCseIndex := f_setLocalResource(v_remoteCSEResource, int16, vc_cSEBaseIndex);
v_localRemoteCSEResource := f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, vc_cSEBaseIndex, int16);//TODO Get index from v_request.primitive.requestPrimitive.to_
vc_localRemoteCseIndex := f_setLocalResource(v_localRemoteCSEResource, int16, vc_cSEBaseIndex);
v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := PX_CSE1_ID;
......@@ -1946,7 +2007,7 @@ module OneM2M_Functions {
v_response.primitiveContent.remoteCSE := vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE;
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
vc_remoteCseIndex := f_setResource(valueof(m_primitiveContentRemoteCSE(m_contentMyRemoteCSEResource)), int16, -1);
vc_remoteCseIndex := f_setResource(valueof(m_primitiveContentRemoteCSE(m_contentMyRemoteCSEResource)), int16, -1, false);
v_resourceIndex := vc_remoteCseIndex;
v_remoteCSERegistered:=true;
tc_ac.start(10.0);
......@@ -2333,7 +2394,7 @@ module OneM2M_Functions {
v_localResourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
tc_ac.start(10.0);
repeat;
}
......@@ -2375,7 +2436,7 @@ module OneM2M_Functions {
//Send response in any case
v_response := valueof(m_responseNotification(int2000, omit));
v_response.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
tc_ac.start(10.0);
repeat;
}
......
......@@ -123,6 +123,33 @@ module OneM2M_Templates {
discoveryResultType := omit
};
/**
* @desc RETRIEVE request primitive for child references
* @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,
filterCriteria := {
createdBefore := omit,
createdAfter := omit,
modifiedSince := omit,
unmodifiedSince := omit,
stateTagSmaller := omit,
stateTagBigger := omit,
expireBefore := omit,
expireAfter := omit,
labels := omit,
resourceType := p_resourceTypeList,
sizeAbove := omit,
sizeBelow := omit,
contentType_list := {},
attribute_list := {},
filterUsage := omit,
limit := omit
}
};
/**
* @desc Base Receive RETRIEVE request primitive
* @param p_targetResourceAddress Target resource address
......@@ -2910,6 +2937,16 @@ module OneM2M_Templates {
requestReachability := true//M
};
template RemoteCSE_optional m_contentLocalRemoteCSEResource modifies m_contentRemoteCSE_allOmit := {
resourceName := PX_CSE_NAME,//M
resourceType := int16,//M
resourceID := PX_CSE_RESOURCE_ID,//M
pointOfAccess := {PX_SUT_ADDRESS},//O
cSEBase := PX_CSE_ID & "/" & PX_CSE_NAME,//M
cSE_ID := PX_CSE_ID,//M
requestReachability := true//M
};
template RemoteCSE_optional mw_contentRemoteCSEBase := {
resourceName := ?,//M
resourceType := ?,//M
......
......@@ -1819,6 +1819,7 @@ module OneM2M_Testcases_CSE_Release_1 {
var PrimitiveContent v_localResource;
var integer v_parentResourceIndex := -1;
var integer v_localResourceIndex := -1;
var boolean v_cseRegistered := false;
var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
var universal charstring v_action := __SCOPE__ & ": Please, send a CSE registration request with attributes multiplicity equals to 1";
......@@ -1840,7 +1841,7 @@ module OneM2M_Testcases_CSE_Release_1 {
// Test Body
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(mw_createRemoteCSEBase)) -> value v_request {
[not(v_cseRegistered)] mccPortIn.receive(mw_request(mw_createRemoteCSEBase)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: CREATE remoteCSE request received");
v_parentResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_);
......@@ -1850,20 +1851,19 @@ module OneM2M_Testcases_CSE_Release_1 {
} else {
v_localResource := f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentResourceIndex, v_request.primitive.requestPrimitive.resourceType);
v_localResourceIndex := f_setLocalResource(v_localResource, v_request.primitive.requestPrimitive.resourceType, v_parentResourceIndex);
vc_localRemoteCseIndex := f_setLocalResource(v_localResource, v_request.primitive.requestPrimitive.resourceType, v_parentResourceIndex);
v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
v_response.primitiveContent := vc_localResourcesList[vc_localRemoteCseIndex].resource;
v_cseRegistered := true;
}
v_response.from_ := PX_CSE1_ID;
v_response.to_ := v_request.primitive.requestPrimitive.from_;
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); }
[] mccPortIn.receive {
tc_ac.stop;
setverdict(fail, __SCOPE__&":INFO: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
if(not(v_cseRegistered)) {
setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
}
}
}
// Postamble
......
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