New test cases implemented:

TC_CSE_SEC_ACP_005_CRE
TC_CSE_SEC_ACP_005_UPD
TC_CSE_SEC_ACP_005_RET
TC_CSE_SEC_ACP_005_DEL
TC_CSE_SEC_ACP_006_CRE
TC_CSE_SEC_ACP_006_UPD
TC_CSE_SEC_ACP_006_RET
TC_CSE_SEC_ACP_006_DEL
TC_CSE_SEC_ACP_007_CRE
TC_CSE_SEC_ACP_007_UPD
TC_CSE_SEC_ACP_007_RET
TC_CSE_SEC_ACP_007_DEL
TC_CSE_SEC_ACP_008_CRE
TC_CSE_SEC_ACP_008_UPD
TC_CSE_SEC_ACP_008_RET
TC_CSE_SEC_ACP_008_DEL
TC_CSE_SEC_ACP_009_CRE
TC_CSE_SEC_ACP_009_UPD
TC_CSE_SEC_ACP_009_RET
TC_CSE_SEC_ACP_009_DEL
TC_CSE_SEC_ACP_010_CRE
TC_CSE_SEC_ACP_010_UPD
TC_CSE_SEC_ACP_010_RET
TC_CSE_SEC_ACP_010_DEL
TC_CSE_DMR_CRE_012_SUB_SU small correction
Signed-off-by: Miguel Angel Reina Ortega's avatarMiguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
parent 5f540a60
......@@ -2196,6 +2196,12 @@ module OneM2M_Functions {
if(match(valueof(p_request.primitiveContent.subscription.notificationURI), v_defaultListOfURIs )){
p_request.primitiveContent.subscription.notificationURI := {f_getResourceAddress(p_parentIndex)};
}
//subscriberURI
if(ispresent(p_request.primitiveContent.subscription.subscriberURI)) {
if(match(valueof(p_request.primitiveContent.subscription.subscriberURI), "NotInitialized" )){
p_request.primitiveContent.subscription.subscriberURI := f_getResourceAddress(vc_aeAuxIndex);
}
}
//creator attribute
if(ispresent(p_request.primitiveContent.subscription.creator)) {
p_request.primitiveContent.subscription.creator := f_getCreator(p_parentIndex);
......@@ -2499,7 +2505,7 @@ module OneM2M_Functions {
* @param p_announcementTargetResource Announcement Target Resource
* @return p_annoucementTargetPoA Announcemenet Target PoA
*/
function f_getAnnouncementTargetPoA(in charstring p_protocolBinding := PX_PROTOCOL_BINDING, in charstring p_announcementTargetAddress := PX_CSE1_ADDRESS, charstring p_announcementTargetResource := "CseBaseTester" ) return charstring {
function f_getAnnouncementTargetPoA(in charstring p_protocolBinding := PX_PROTOCOL_BINDING, in charstring p_announcementTargetAddress := PX_CSE1_ADDRESS, charstring p_announcementTargetResource := "" ) return charstring {
if(p_protocolBinding == "HTTP") {
return "http://" & p_announcementTargetAddress & "/" & p_announcementTargetResource;
......@@ -3380,6 +3386,41 @@ module OneM2M_Functions {
}
/**
* @desc Retrieve Year from a given timestamp
* @param p_timestamp Given timestamp
* @return Year
*/
function f_getYear(charstring p_timestamp) runs on Tester return charstring {
var charstring v_year;
var integer i;
for(i := 0; i < 3; i := i+1){
v_year := v_year & p_timestamp[i];
}
return v_year;
} // end f_getYear
/**
* @desc Retrieve IP address from a given address which includes port information separated by :
* @param p_addressPort Given address
* @return IPv4 Address
*/
function f_getIpv4Address(charstring p_addressPort) runs on Tester return charstring {
var charstring v_ipv4Address;
var integer i:= 0;
while ((i < lengthof(p_addressPort)-1) and (p_addressPort[i] != ":")){
v_ipv4Address := v_ipv4Address & p_addressPort[i];
i := i + 1;
}
return v_ipv4Address;
} // end f_getIpv4Address
}//end of commonFunctions
group externalFunctions {
......
......@@ -95,13 +95,13 @@ module OneM2M_Types {
ListOfURIs accessControlOriginators,
AccessControlOperations accessControlOperations,
record of record {
record of ScheduleEntry accessControlWindow_list,
record of ScheduleEntry accessControlWindow_list optional,//TODO It must be optional
record {
record length(1 .. infinity) of Ipv4 ipv4Addresses optional,//TODO It must be optional,
record length(1 .. infinity) of Ipv6 ipv6Addresses optional//TODO It must be optional
} accessControlIpAddresses optional,
LocationRegion accessControlLocationRegion optional
} accessControlContexts_list
} accessControlContexts_list optional //TODO It must be optional
}
with {
variant "name as uncapitalized";
......
......@@ -5974,7 +5974,7 @@ module OneM2M_Testcases_CSE {
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
const AttributeList c_optionalAttribute := {"subscriberURI"};
v_createRequest.primitiveContent.subscription.subscriberURI := "MySubscriberURI";
v_createRequest.primitiveContent.subscription.subscriberURI := "NotInitialized";
v_ae1.start(f_CSE_DMR_CRE_012(int23, v_createRequest, c_optionalAttribute));
v_ae1.done;
......@@ -21971,6 +21971,587 @@ module OneM2M_Testcases_CSE {
}//end g_CSE_SEC_ACP_004
group g_CSE_SEC_ACP_005 {
/**
* @desc Check that the IUT responds successfully when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource and that the request is within accessControlTimeWindow context.
*
*/
testcase TC_CSE_SEC_ACP_005_CRE() runs on Tester system CseSystem { //Create
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_005(m_createContainerBase, int2001));
v_ae1.done;
}//end TC_CSE_SEC_ACP_005_CRE
testcase TC_CSE_SEC_ACP_005_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_005(v_updateRequest, int2004));
v_ae1.done;
}//end TC_CSE_SEC_ACP_005_UPD
testcase TC_CSE_SEC_ACP_005_RET() runs on Tester system CseSystem { //Retrieve
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_005(m_retrieveResource("Temporary", "Temporary"), int2000));
v_ae1.done;
}//end TC_CSE_SEC_ACP_005_RET
testcase TC_CSE_SEC_ACP_005_DEL() runs on Tester system CseSystem { //Delete
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_005(m_delete("Temporary", "Temporary"), int2002));
v_ae1.done;
}//end TC_CSE_SEC_ACP_005_DEL
function f_CSE_SEC_ACP_005(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
// Local variables
var MsgIn v_response;
var integer v_aeIndex := -1;
var integer v_acpIndex := -1;
var charstring v_currentTime;
var RequestPrimitive v_createRequest;
var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
v_currentTime := fx_generateTimestamp();
v_accessControlRule.accessControlContexts_list := {{{"* * * * * " & f_getYear(v_currentTime)}, omit, omit}};
v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
// Test Body
p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
mcaPort.send(m_request(valueof(p_requestPrimitive)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Successful operation on resource type int2 (Ae)");
}
[] 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 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_005
}//end g_CSE_SEC_ACP_005
group g_CSE_SEC_ACP_006 {
/**
* @desc Check that the IUT responds with an error when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource out of accessControlTimeWindow context.
*
*/
testcase TC_CSE_SEC_ACP_006_CRE() runs on Tester system CseSystem { //Create
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_006(m_createContainerBase, int2001));
v_ae1.done;
}//end TC_CSE_SEC_ACP_006_CRE
testcase TC_CSE_SEC_ACP_006_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_006(v_updateRequest, int2004));
v_ae1.done;
}//end TC_CSE_SEC_ACP_006_UPD
testcase TC_CSE_SEC_ACP_006_RET() runs on Tester system CseSystem { //Retrieve
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_006(m_retrieveResource("Temporary", "Temporary"), int2000));
v_ae1.done;
}//end TC_CSE_SEC_ACP_006_RET
testcase TC_CSE_SEC_ACP_006_DEL() runs on Tester system CseSystem { //Delete
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_006(m_delete("Temporary", "Temporary"), int2002));
v_ae1.done;
}//end TC_CSE_SEC_ACP_006_DEL
function f_CSE_SEC_ACP_006(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
// Local variables
var MsgIn v_response;
var integer v_aeIndex := -1;
var integer v_acpIndex := -1;
var RequestPrimitive v_createRequest;
var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
v_accessControlRule.accessControlContexts_list := {{{"* * * * * 3000"}, omit, omit}};
v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
// Test Body
p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
mcaPort.send(m_request(valueof(p_requestPrimitive)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Operation denied due to lack of privileges, out of accessControlTimeWindow");
}
[] 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 operation have been accpeted without having privileges");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while executing operation");
}
}
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
}//end f_CSE_SEC_ACP_006
}//end g_CSE_SEC_ACP_006
group g_CSE_SEC_ACP_007 {
/**
* @desc Check that the IUT responds successfully when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource and that the request is within accessControlLocationRegion context.
*
*/
testcase TC_CSE_SEC_ACP_007_CRE() runs on Tester system CseSystem { //Create
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_007(m_createContainerBase, int2001));
v_ae1.done;
}//end TC_CSE_SEC_ACP_007_CRE
testcase TC_CSE_SEC_ACP_007_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_007(v_updateRequest, int2004));
v_ae1.done;
}//end TC_CSE_SEC_ACP_007_UPD
testcase TC_CSE_SEC_ACP_007_RET() runs on Tester system CseSystem { //Retrieve
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_007(m_retrieveResource("Temporary", "Temporary"), int2000));
v_ae1.done;
}//end TC_CSE_SEC_ACP_007_RET
testcase TC_CSE_SEC_ACP_007_DEL() runs on Tester system CseSystem { //Delete
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_007(m_delete("Temporary", "Temporary"), int2002));
v_ae1.done;
}//end TC_CSE_SEC_ACP_007_DEL
function f_CSE_SEC_ACP_007(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
// Local variables
var MsgIn v_response;
var integer v_aeIndex := -1;
var integer v_acpIndex := -1;
var RequestPrimitive v_createRequest;
var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
v_accessControlRule.accessControlContexts_list := {{omit, omit, { choice := { countryCode := {"ES"}}}}};
v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
//TODO How to indicate the location of the Originator (AE1)?
v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
// Test Body
p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
mcaPort.send(m_request(valueof(p_requestPrimitive)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Successful operation on resource type int2 (Ae)");
}
[] 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 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_007
}//end g_CSE_SEC_ACP_007
group g_CSE_SEC_ACP_008 {
/**
* @desc Check that the IUT responds with an error when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource out of accessControlLocationRegion context
*
*/
testcase TC_CSE_SEC_ACP_008_CRE() runs on Tester system CseSystem { //Create
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_008(m_createContainerBase, int2001));
v_ae1.done;
}//end TC_CSE_SEC_ACP_008_CRE
testcase TC_CSE_SEC_ACP_008_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_008(v_updateRequest, int2004));
v_ae1.done;
}//end TC_CSE_SEC_ACP_008_UPD
testcase TC_CSE_SEC_ACP_008_RET() runs on Tester system CseSystem { //Retrieve
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_008(m_retrieveResource("Temporary", "Temporary"), int2000));
v_ae1.done;
}//end TC_CSE_SEC_ACP_008_RET
testcase TC_CSE_SEC_ACP_008_DEL() runs on Tester system CseSystem { //Delete
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_008(m_delete("Temporary", "Temporary"), int2002));
v_ae1.done;
}//end TC_CSE_SEC_ACP_008_DEL
function f_CSE_SEC_ACP_008(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
// Local variables
var MsgIn v_response;
var integer v_aeIndex := -1;
var integer v_acpIndex := -1;
var RequestPrimitive v_createRequest;
var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
v_accessControlRule.accessControlContexts_list := {{omit, omit, { choice := { countryCode := {"ES"}}}}};
v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
//TODO How to indicate the location of the Originator (AE1)?
v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
// Test Body
p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
mcaPort.send(m_request(valueof(p_requestPrimitive)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Operation denied due to lack of privileges, out of accessControlTimeWindow");
}
[] 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 operation have been accpeted without having privileges");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while executing operation");
}
}
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
}//end f_CSE_SEC_ACP_008
}//end g_CSE_SEC_ACP_008
group g_CSE_SEC_ACP_009 {
/**
* @desc Check that the IUT responds successfully when the AE tries an OPERATION on a TARGET_RESOURCE_TYPE resource and that the request is within accessControlIpAddresses context.
*
*/
testcase TC_CSE_SEC_ACP_009_CRE() runs on Tester system CseSystem { //Create
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_009(m_createContainerBase, int2001));
v_ae1.done;
}//end TC_CSE_SEC_ACP_009_CRE
testcase TC_CSE_SEC_ACP_009_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_009(v_updateRequest, int2004));
v_ae1.done;
}//end TC_CSE_SEC_ACP_009_UPD
testcase TC_CSE_SEC_ACP_009_RET() runs on Tester system CseSystem { //Retrieve
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_009(m_retrieveResource("Temporary", "Temporary"), int2000));
v_ae1.done;
}//end TC_CSE_SEC_ACP_009_RET
testcase TC_CSE_SEC_ACP_009_DEL() runs on Tester system CseSystem { //Delete
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_009(m_delete("Temporary", "Temporary"), int2002));
v_ae1.done;
}//end TC_CSE_SEC_ACP_009_DEL
function f_CSE_SEC_ACP_009(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
// Local variables
var MsgIn v_response;
var integer v_aeIndex := -1;
var integer v_acpIndex := -1;
var RequestPrimitive v_createRequest;
var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
v_accessControlRule.accessControlContexts_list := {{omit, {{f_getIpv4Address(PX_AE1_ADDRESS)}, omit}, omit}};
v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, {f_getAnnouncementTargetPoA(-, PX_AE1_ADDRESS, -)});
// Test Body
p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
mcaPort.send(m_request(valueof(p_requestPrimitive)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Successful operation on resource type int2 (Ae)");
}
[] 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 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_009
}//end g_CSE_SEC_ACP_009
group g_CSE_SEC_ACP_010 {
/**
* @desc Check that the IUT responds with an error when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource out of accessControlIpAddresses context.
*
*/
testcase TC_CSE_SEC_ACP_010_CRE() runs on Tester system CseSystem { //Create
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_010(m_createContainerBase, int2001));
v_ae1.done;
}//end TC_CSE_SEC_ACP_010_CRE
testcase TC_CSE_SEC_ACP_010_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_010(v_updateRequest, int2004));
v_ae1.done;
}//end TC_CSE_SEC_ACP_010_UPD
testcase TC_CSE_SEC_ACP_010_RET() runs on Tester system CseSystem { //Retrieve
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_010(m_retrieveResource("Temporary", "Temporary"), int2000));
v_ae1.done;
}//end TC_CSE_SEC_ACP_010_RET
testcase TC_CSE_SEC_ACP_010_DEL() runs on Tester system CseSystem { //Delete
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SEC_ACP_010(m_delete("Temporary", "Temporary"), int2002));
v_ae1.done;
}//end TC_CSE_SEC_ACP_010_DEL
function f_CSE_SEC_ACP_010(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
// Local variables
var MsgIn v_response;
var integer v_aeIndex := -1;
var integer v_acpIndex := -1;
var RequestPrimitive v_createRequest;
var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
v_accessControlRule.accessControlContexts_list := {{omit, {{f_getIpv4Address(PX_AE2_ADDRESS)}, omit}, omit}};
v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, {f_getAnnouncementTargetPoA(-, PX_AE1_ADDRESS, -)});
// Test Body
p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
mcaPort.send(m_request(valueof(p_requestPrimitive)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Operation denied due to lack of privileges, out of accessControlTimeWindow");
}
[] 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 operation have been accpeted without having privileges");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while executing operation");
}
}
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
}//end f_CSE_SEC_ACP_010
}//end g_CSE_SEC_ACP_010
group g_CSE_SEC_ACP_011 {
/**
......
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