Skip to content
Snippets Groups Projects
Commit 5f540a60 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

TC_CSE_SEC_ACP_CRE_003 and TC_CSE_SEC_ACP_CRE_004 implemented

parent c4c8ab2b
No related branches found
No related tags found
No related merge requests found
......@@ -21239,6 +21239,142 @@ module OneM2M_Testcases_CSE {
f_cf01Down();
}//end TC_CSE_SEC_ACP_CRE_002
/**
* @desc Check that the IUT accepts the creation of a accessControlPolicy resource with privileges attribute having empty rules
*
*/
testcase TC_CSE_SEC_ACP_CRE_003() runs on AeSimu system CseSystem {
// Local variables
var MsgIn v_response;
var integer v_acpIndex := -1;
var template PrimitiveContent v_contentResponse;
var RequestPrimitive v_createRequest := valueof(m_createAcpBase);
const ResourceType c_accessControlPolicyType := int1;
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {};
v_contentResponse.accessControlPolicy := mw_contentAcp_rc1;
v_contentResponse.accessControlPolicy.privileges.accessControlRule_list := {};
// Test Body
v_createRequest := f_getCreateRequestPrimitive(c_accessControlPolicyType, v_createRequest, -1);
mcaPort.send(m_request(v_createRequest));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, v_contentResponse))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " created successfully");
f_checkAttributesToBeSaved(c_accessControlPolicyType, v_createRequest, v_response.primitive.responsePrimitive);
v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1, -, -);
}
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " created successfully, but wrong ACP representation");
f_checkAttributesToBeSaved(c_accessControlPolicyType, v_createRequest, v_response.primitive.responsePrimitive);
v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1, -, -);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
}
}
f_checkAeSimuStatus();
//Check to see if the resource is present or not
if(f_isResourcePresent(v_acpIndex)) {
setverdict(pass, __SCOPE__ & ":INFO: Resource created");
} else {
setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
}
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
}//end TC_CSE_SEC_ACP_CRE_003
/**
* @desc Check that the IUT responds with an error when the creation of a accessControlPolicy resource with selfPrivileges attribute having empty rules
*
*/
testcase TC_CSE_SEC_ACP_CRE_004() runs on AeSimu system CseSystem {
// Local variables
var MsgIn v_response;
var integer v_acpIndex := -1;
var RequestPrimitive v_createRequest := valueof(m_createAcpBase);
const ResourceType c_accessControlPolicyType := int1;
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_createRequest.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list := {};
// Test Body
v_createRequest := f_getCreateRequestPrimitive(c_accessControlPolicyType, v_createRequest, -1);
mcaPort.send(m_request(v_createRequest));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " creation correctly rejected due to empty selfPriviles accessControlRules");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
f_checkAttributesToBeSaved(c_accessControlPolicyType, v_createRequest, v_response.primitive.responsePrimitive);
v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1, -, -);
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
}
}
f_checkAeSimuStatus();
//Check to see if the resource is present or not
if(f_isResourceNotPresent(-1, v_createRequest.primitiveContent.accessControlPolicy.resourceName)) {
setverdict(pass, __SCOPE__ & ":INFO: Resource not created");
} else {
setverdict(fail, __SCOPE__ & ":ERROR: Resource created");
}
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
}//end TC_CSE_SEC_ACP_CRE_004
}// end of group Create
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment