Commit dd589ce7 authored by Antonio Castillo Verdugo's avatar Antonio Castillo Verdugo
Browse files

Registration Delete contribution


Signed-off-by: Antonio Castillo Verdugo's avataracverdugo <acverdugo@at4wireless.com>
parent 161632d5
......@@ -1424,14 +1424,43 @@ module OneM2M_Functions {
} //end f_check_notificationContent
}// end of group NotificationFunctions
}// end of group NotificationFunctions
/**
* @desc Check that a resource is present in the IUT (resourceId is known)
* @param p_resourceIndex Resource index
* @return boolean
*/
function f_cse_isResourcePresent (integer p_resourceIndex) runs on CseSimu return boolean {
//Check to see if the resource is present or not
mccPort.send(m_request(m_retrieveResource(f_getResourceAddress(p_resourceIndex), f_getOriginator(p_resourceIndex))));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitive(int2000))) {
tc_ac.stop;
setverdict(pass, testcasename() & ": Resource present: " & f_getResourceAddress(p_resourceIndex));
return true;
}
[] mccPort.receive(mw_response(mw_responsePrimitive(?, -))) {
tc_ac.stop;
setverdict(inconc, testcasename() & ": Wrong response status code in the response");
return false;
}
[] tc_ac.timeout {
setverdict(inconc, testcasename() & ": No answer while retrieving resource");
return false;
}
}
return false;
}
/**
* @desc Registration of Test System (simulating a CSE) to the CSE IUT (creation of remoteCSE)
* @param p_requestPrimitive Template request primitive
* @return Internal resource index of the created resource
*/
function f_cse_registerRemoteCse(in template RequestPrimitive p_requestPrimitive) runs on CseSimu return integer {
function f_cse_registerRemoteCse(in template RequestPrimitive p_requestPrimitive, in template PrimitiveContent p_contentResponse := ?) runs on CseSimu return integer {
var MsgIn v_response;
var RequestPrimitive v_request;
......@@ -1442,7 +1471,7 @@ module OneM2M_Functions {
mccPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type RemoteCSE created successfuly");
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
......
......@@ -1051,10 +1051,10 @@ module OneM2M_Templates {
discoveryResultType := omit
};
template RequestPrimitive mw_deleteRequest(template XSD.ID p_resourceAddress := ?) := {
template RequestPrimitive mw_deleteRequest(template XSD.ID p_resourceAddress := ?, template XSD.ID p_from := *) := {
operation := int4,
to_ := p_resourceAddress,
from_ := ?,
from_ := p_from,
requestIdentifier := ?,
resourceType := *,
primitiveContent := *,
......
......@@ -1637,46 +1637,100 @@ module OneM2M_Testcases_CSE {
testcase TC_CSE_REG_CRE_029() runs on CseSimu system CseSystem {
var MsgIn v_response;
var MsgIn v_response;
var RequestPrimitive v_request;
var RequestPrimitive v_createRequestPrimitive := valueof(m_createRemoteCSEBase);
var ResourceType v_resourceType := int16;
// Test control
// Test component configuration
f_cf04Up();
// Test adapter configuration
// Preamble
v_request := f_getCreateRequestPrimitive(v_resourceType, v_createRequestPrimitive, -1);
tc_ac.start;
alt {
[] mccPort.receive(mw_request(mw_createRemoteCSEBase(PX_CSE_ID,f_getResourceAddress(-1)))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
}
[] mccPort.receive {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while creating resource type remoteCSE");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource type remoteCSE");
}
}
// Postamble
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf04Down();
}
var RequestPrimitive v_request;
var RequestPrimitive v_createRequestPrimitive := valueof(m_createRemoteCSEBase);
var ResourceType v_resourceType := int16;
// Test control
/**
* @desc Check that IUT accepts a CSE registration request with OPTIONAL_ATTRIBUTE attribute
*
*/
/*testcase TC_CSE_REG_CRE_034() runs on CseSimu system CseSystem {
//Local variables
var MsgIn v_response;
var RequestPrimitive v_request;
var ResourceType v_resourceType := int16; //remoteCSE
var template PrimitiveContent v_contentResponse;
// Test control
// Test component configuration
f_cf04Up();
// Test component configuration
f_cf04Up();
// Test adapter configuration
// Test adapter configuration
// Preamble
v_request := f_getCreateRequestPrimitive(v_resourceType, v_createRequestPrimitive, -1);
// 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;
tc_ac.start;
alt {
[] mccPort.receive(mw_request(mw_createRemoteCSEBase(PX_CSE_ID,f_getResourceAddress(-1)))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
}
[] mccPort.receive {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while creating resource type remoteCSE");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource type remoteCSE");
}
}
// Test Body
v_request := valueof(m_delete(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(-1, false)));
// Postamble
f_cse_postamble_deleteResourcesCSE();
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");
}
}
// Tear down
f_cf04Down();
// Postamble
f_cse_postamble_deleteResourcesCSE();
}
// Tear down
f_cf04Down();
}//end TC_CSE_REG_CRE_034*/
} //end group Create
......@@ -2064,7 +2118,6 @@ module OneM2M_Testcases_CSE {
}
function f_CSE_REG_UPD_002(template RequestPrimitive p_requestPrimitive, in AttributeAux p_Attribute) runs on CseSimu {
// Local variables
//Local variables
var MsgIn v_response;
var RequestPrimitive v_request;
......@@ -2410,7 +2463,202 @@ module OneM2M_Testcases_CSE {
// Tear down
f_cf01Down();
}//end TC_CSE_REG_DEL_BI_001
}//end TC_CSE_REG_DEL_001
/**
* @desc Check that the IUT accepts an delete request of <remoteCSE> resource.
*
*/
testcase TC_CSE_REG_DEL_002() runs on CseSimu system CseSystem {
//Local variables
var MsgIn v_response;
var RequestPrimitive v_request;
var ResourceType v_resourceType := int16; //remoteCSE
// Test control
// Test component configuration
f_cf04Up();
// Test adapter configuration
// Preamble
vc_remoteCseIndex := f_cse_registerRemoteCse(m_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");
}
}
// Postamble
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf04Down();
}//end TC_CSE_REG_DEL_002
/**
* @desc Check that the IUT accepts an AE de-registration
*
*/
testcase TC_CSE_REG_DEL_003() runs on AeSimu system CseSystem {
//Local variables
var MsgIn v_response;
var RequestPrimitive v_request;
var integer v_aeIndex := -1;
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
// Test Body
v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator()));
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": AE has been de-registered successfully");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while de-registering AE");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while de-registering AE");
}
}
// Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf01Down();
}//end TC_CSE_REG_DEL_003
/**
* @desc Check that IUT sends a <remoteCSE> delete request on TARGET_REMOTE_CSE_ADDRESS
*
*/
testcase TC_CSE_REG_DEL_004() runs on CseSimu system CseSystem {
//Local variables
// Test control
// Test component configuration
f_cf04Up();
// Test adapter configuration
// Preamble
vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase);
// Test Body
tc_ac.start;
alt {
[] mccPort.receive(mw_request(mw_deleteRequest( f_getResourceAddress(vc_remoteCseIndex), PX_CSE_ID))) {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": <remoteCSE> delete request has been received");
}
[] mccPort.receive {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while receiving <remoteCSE> delete request");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while receiving <remoteCSE> delete request");
}
}
// Postamble
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf04Down();
}//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
......@@ -2439,7 +2687,7 @@ module OneM2M_Testcases_CSE {
if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
if(not ispresent(v_responsePrimitive.primitiveContent.container.resourceName)){
setverdict(fail, __SCOPE__, ": Error, resourceName attribute not provided");
}
}
}
}
......@@ -2456,8 +2704,9 @@ module OneM2M_Testcases_CSE {
if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
if(not ispresent(v_responsePrimitive.primitiveContent.container.resourceName)){
if(getverdict == pass){
v_responsePrimitive := f_getResponsePrimitive(v_ae1);
if(not ispresent(v_responsePrimitive.primitiveContent.container.resourceName)){
setverdict(fail, __SCOPE__, ": Error, resourceName attribute not provided");
}
}
......
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