Implemented new test cases TC_CSE_SEC_ACP_CRE_005 and TC_CSE_SEC_ACP_015

Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent a8d98d1d
......@@ -947,7 +947,7 @@ module OneM2M_Functions {
* @desc Getting the address of the last resource saved in the vc_resourcesList
* @param p_tester Given component
*/
function f_getLatestResourceAddress(in CseSimu p_component, AddressingMethod p_addressingMethod := PX_ADDRESSING_METHOD, PrimitiveScope p_primitiveScope := PX_PRIMITIVE_SCOPE) runs on Tester return XSD.ID {
function f_getLatestResourceAddress(in Tester p_component, AddressingMethod p_addressingMethod := PX_ADDRESSING_METHOD, PrimitiveScope p_primitiveScope := PX_PRIMITIVE_SCOPE) runs on Tester return XSD.ID {
var XSD.ID v_resourceAddress;
f_connectInfoPort(p_component);
......@@ -1131,7 +1131,7 @@ module OneM2M_Functions {
/**
* @desc Sending the address of the last resource saved in the vc_resourcesList
*/
function f_sendLatestResourceAddress(AddressingMethod p_addressingMethod := PX_ADDRESSING_METHOD, PrimitiveScope p_primitiveScope := PX_PRIMITIVE_SCOPE) runs on CseSimu {
function f_sendLatestResourceAddress(AddressingMethod p_addressingMethod := PX_ADDRESSING_METHOD, PrimitiveScope p_primitiveScope := PX_PRIMITIVE_SCOPE) runs on Tester {
infoPort.send(f_getResourceAddress(lengthof(vc_resourcesList)-1, p_addressingMethod, p_primitiveScope));
......
......@@ -8870,6 +8870,70 @@ module OneM2M_PermutationFunctions {
} //end f_CSE_SEC_ACP_012
function f_CSE_SEC_ACP_015(template RequestPrimitive p_request, in ResponseStatusCode p_responseStatusCode) runs on AeSimu system CseSystem {
// Local variables
var integer v_aeIndex := -1;
var integer v_acpIndex := -1;
var integer v_groupIndex := -1;
var XSD.AnyURI v_ae2ResourceAddress;
var template RequestPrimitive v_groupRequest := m_createGroup(1, -, omit, int2, -, -, -);
var template RequestPrimitive v_createRequest := valueof(m_createAcpBase);
// Test control
// Test component configuration
f_cf01Up(true);
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe(-, -);
v_groupRequest.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_aeIndex].resource)};
v_groupIndex := f_cse_createResource(int9, v_groupRequest, -);
v_createRequest := m_createAcp(-, {f_getResourceId(vc_resourcesList[v_groupIndex].resource)} , -);
v_acpIndex := f_cse_createResource(int1, v_createRequest, -);
vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, {f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, omit), -1)); // AE2 is registred
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2ResourceAddress := f_getLatestResourceAddress(vc_ae2);
// Test Body
p_request.to_ := v_ae2ResourceAddress;
p_request.from_ := f_getOriginator(v_aeIndex);
p_request.requestIdentifier := valueof(p_request.requestIdentifier) & f_rnd(1, 1000000);
f_send(e_mcaPort, m_request(valueof(p_request)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Operation denied because of lack of right on Container");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while operation on resource type int2 (Ae)");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int2 (Ae)");
}
}
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
} //end f_CSE_SEC_ACP_015
}// end of Basic_Operations
}//end group AccessControlPolicy
......
......@@ -9394,6 +9394,92 @@ module OneM2M_Testcases_CSE_Release_3 {
group Create {
/**
* @desc Check that the IUT responds successfully when an AE creates an accessControlPolicy resource having accessControlOriginators
* element set to a group resource identifier which contains AE resource as member
*
*/
testcase TC_CSE_SEC_ACP_CRE_005() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_CRE_005());
v_ae1.done;
}
function f_CSE_SEC_ACP_CRE_005() runs on AeSimu system CseSystem {
// Local variables
var integer v_aeIndex := -1;
var integer v_acpIndex := -1;
var integer v_groupIndex := -1;
var XSD.ID v_ae2ResourceId;
var template RequestPrimitive v_groupRequest := m_createGroup(1, -, omit, int2, -, -, -);
var template RequestPrimitive v_createRequest := valueof(m_createAcpBase);
// Test control
// Test component configuration
f_cf01Up(true);
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe(-, -);
vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, omit), -1)); // AE2 is registred
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2ResourceId := f_getLatestResourceAddress(vc_ae2, e_nonHierarchical, e_cseRelative);
v_groupRequest.primitiveContent.group_.memberIDs := {v_ae2ResourceId};
v_groupIndex := f_cse_createResource(int9, v_groupRequest, v_aeIndex);
v_createRequest := m_createAcp(-, {f_getResourceId(vc_resourcesList[v_groupIndex].resource)} , -);
// Test Body
v_createRequest := f_getCreateRequestPrimitive(int1, v_createRequest, v_aeIndex);
f_send(e_mcaPort, m_request(valueof(v_createRequest)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource created successfully");
f_checkAttributesToBeSaved(int1, valueof(v_createRequest), vc_response.primitive.responsePrimitive);
v_acpIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, int1, v_aeIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while creating resource");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource");
}
}
f_checkAeSimuStatus();
//Check to see if the resource is present or not
if(f_cse_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_005
}// end of group Create
group Update {
......@@ -9402,6 +9488,44 @@ module OneM2M_Testcases_CSE_Release_3 {
group Basic_Operations {
group g_CSE_SEC_ACP_015{
/**
* @desc Check that the IUT responds successfully when an AE tries an OPERATION on the AE1 resource whose accessControlPolicyIDs contains a group resource identifier where AE is a member.
*
*/
testcase TC_CSE_SEC_ACP_015_CRE() runs on Tester system CseSystem { //Create
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_015(m_createContainerBase, int2001));
v_ae1.done;
}//end TC_CSE_SEC_ACP_015_CRE
testcase TC_CSE_SEC_ACP_015_UPD() runs on Tester system CseSystem { //Update
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var template RequestPrimitive v_updateRequest := m_updateAeBase;
var Labels v_labels_1:= {"VALUE_1"};
v_updateRequest.primitiveContent.aE.labels := v_labels_1;
v_ae1.start(f_CSE_SEC_ACP_015(v_updateRequest, int2004));
v_ae1.done;
}//end TC_CSE_SEC_ACP_015_UPD
testcase TC_CSE_SEC_ACP_015_RET() runs on Tester system CseSystem { //Retrieve
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_015(m_retrieve("Temporary", "Temporary"), int2000));
v_ae1.done;
}//end TC_CSE_SEC_ACP_015_RET
testcase TC_CSE_SEC_ACP_015_DEL() runs on Tester system CseSystem { //Delete
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_015(m_delete("Temporary", "Temporary"), int2002));
v_ae1.done;
}//end TC_CSE_SEC_ACP_015_DEL
} //end g_CSE_SEC_ACP_015
}// end of Basic_Operations
}//end group AccessControlPolicy
......
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