Skip to content
Snippets Groups Projects
Commit 3dafc13e authored by Enrique Sabatel's avatar Enrique Sabatel Committed by Miguel Angel Reina Ortega
Browse files

Added TC_AE_SEC_ESP_RET_002 and TC_AE_SEC_ESP_RET_003

parent cfa15343
No related branches found
No related tags found
No related merge requests found
......@@ -1151,8 +1151,8 @@ module OneM2M_Testcases_AE_Release_3 {
var MsgIn v_response;
var XSD.ID v_targetResourceAddress;
var template RequestPrimitive v_notifyRequest;
var integer v_remoteCseIndex := -1;
var template PrimitiveContent v_remoteCSE;
var integer v_receiverRemoteCseIndex := -1;
var template PrimitiveContent v_receiverRemoteCSE;
var charstring v_poa;
// Test control
......@@ -1172,13 +1172,13 @@ module OneM2M_Testcases_AE_Release_3 {
//Creating resource in Hosting CSE
var E2eSecInfo v_myE2eSecInfo := {{int11},omit,omit}; //sharedReceiverESPrimRandObject not present
v_poa:= f_getCompletePoA(PX_TS_CSE2.mccPortIn, "");
v_remoteCSE := m_primitiveContentRemoteCSE(m_contentRemoteCSE_e2eSecInfo(v_myE2eSecInfo, v_poa, PX_TS_CSE2));
v_receiverRemoteCSE := m_primitiveContentRemoteCSE(m_contentRemoteCSE_e2eSecInfo(v_myE2eSecInfo, v_poa, PX_TS_CSE2));
vc_cse2.start(f_generateAndSetLocalResource(valueof(v_remoteCSE), -, int16));
vc_cse2.start(f_generateAndSetLocalResource(valueof(v_receiverRemoteCSE), -, int16));
vc_cse2.done;
v_remoteCseIndex := f_getLatestResourceIndex(vc_cse2);
vc_cse2.start(f_cse_retrieveResourceHandler(v_remoteCseIndex));
v_receiverRemoteCseIndex := f_getLatestResourceIndex(vc_cse2);
vc_cse2.start(f_cse_retrieveResourceHandler(v_receiverRemoteCseIndex));
// Test Body
v_notifyRequest := valueof(m_notify(f_getResourceAddress()));
......@@ -1234,8 +1234,8 @@ module OneM2M_Testcases_AE_Release_3 {
var MsgIn v_response;
var XSD.ID v_targetResourceAddress;
var template RequestPrimitive v_notifyRequest;
var template PrimitiveContent v_remoteCSE;
var integer v_remoteCseIndex := -1;
var template PrimitiveContent v_receiverRemoteCSE;
var integer v_receiverRemoteCseIndex := -1;
var charstring v_poa;
// Test control
......@@ -1250,6 +1250,8 @@ module OneM2M_Testcases_AE_Release_3 {
// Test adapter configuration
// Preamble
vc_cse2.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));
vc_cse2.done;
fx_establish_pairwiseESPrimKey();
//Creating resource in Hosting CSE
......@@ -1257,13 +1259,13 @@ module OneM2M_Testcases_AE_Release_3 {
myAbsRelTimestamp.alt_ := "20181231T012345";
var E2eSecInfo v_myE2eSecInfo := {{int11},omit,{"1","24",myAbsRelTimestamp,{int1},{int10}}}; //expired sharedReceiverESPrimRandObject
v_poa:= f_getCompletePoA(PX_TS_CSE2.mccPortIn, "");
v_remoteCSE := m_primitiveContentRemoteCSE(m_contentRemoteCSE_e2eSecInfo(v_myE2eSecInfo, v_poa, PX_TS_CSE2));
v_receiverRemoteCSE := m_primitiveContentRemoteCSE(m_contentRemoteCSE_e2eSecInfo(v_myE2eSecInfo, v_poa, PX_TS_CSE2));
vc_cse2.start(f_generateAndSetLocalResource(valueof(v_remoteCSE), -, int16));
vc_cse2.start(f_generateAndSetLocalResource(valueof(v_receiverRemoteCSE), -, int16));
vc_cse2.done;
v_remoteCseIndex := f_getLatestResourceIndex(vc_cse2);
vc_cse2.start(f_cse_retrieveResourceHandler(v_remoteCseIndex));
v_receiverRemoteCseIndex := f_getLatestResourceIndex(vc_cse2);
vc_cse2.start(f_cse_retrieveResourceHandler(v_receiverRemoteCseIndex));
// Test Body
v_notifyRequest := valueof(m_notify(f_getResourceAddress()));
......@@ -1332,9 +1334,9 @@ module OneM2M_Testcases_AE_Release_3 {
// Test adapter configuration
// Preamble
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
fx_establish_pairwiseESPrimKey();
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
v_notifyRequest := valueof(m_notify(f_getResourceAddress()));
v_notifyRequest.primitiveContent.securityInfo.securityInfoType := int5;
......@@ -1398,9 +1400,9 @@ module OneM2M_Testcases_AE_Release_3 {
// Local variables
var MsgIn v_response;
var XSD.ID v_targetResourceAddress;
var integer v_remoteCseIndex;
var integer v_receiverRemoteCseIndex;
var template RequestPrimitive v_notifyRequest;
var PrimitiveContent v_remoteCseResource;
var PrimitiveContent v_receiverrRemoteCseResource;
var charstring v_poa;
// Test control
......@@ -1421,42 +1423,53 @@ module OneM2M_Testcases_AE_Release_3 {
var AbsRelTimestamp myAbsRelTimestamp;
myAbsRelTimestamp.alt_ := "20331231T012345";
var E2eSecInfo v_myE2eSecInfo := {{int11},omit,{"1","24",myAbsRelTimestamp,{int1},{int10}}}; //expired sharedReceiverESPrimRandObject
v_poa:= f_getCompletePoA(PX_TS_CSE2.mccPortIn, "");
v_remoteCseResource := m_primitiveContentRemoteCSE(m_contentRemoteCSE_e2eSecInfo(v_myE2eSecInfo, v_poa, PX_TS_CSE2));
v_remoteCseIndex := f_generateAndSetLocalResource(valueof(v_remoteCseResource), -, int16);
v_poa:= f_getCompletePoA(PX_TS_CSE1.mccPortIn, "");
v_receiverrRemoteCseResource := m_primitiveContentRemoteCSE(m_contentRemoteCSE_e2eSecInfo(v_myE2eSecInfo, v_poa, PX_TS_CSE1));
v_receiverRemoteCseIndex := f_generateAndSetLocalResource(valueof(v_receiverrRemoteCseResource), -, int16);
// Test Body
var template UtTriggerPrimitive v_utRequest := m_utNotify;
var universal charstring v_action := __SCOPE__ & ": Please, send a valid ESPrim object to " & f_getResourceAddress(v_remoteCseIndex); // Test control
v_utRequest.requestPrimitive.to_ := f_getResourceAddress();
f_sendUtPrimitive(v_utRequest, v_action);
var template UtTriggerPrimitive v_utRequest := m_utRetrieveRemoteCSE(f_getResourceAddress(v_receiverRemoteCseIndex));
var MsgIn v_request;
var template RequestPrimitive v_requestPrimitive := mw_retrieve(f_getLocalResourceAddress(v_receiverRemoteCseIndex));
var universal charstring v_action := __SCOPE__ & ": Please, send a valid RETRIEVE Request for the e2eSecInfo attribute of the Receiver’s <remoteCSE> to: ";
v_notifyRequest := valueof(m_notify(f_getResourceAddress()));
v_notifyRequest.primitiveContent.securityInfo.securityInfoType := int5;
// Send triggering primitive to SUT
v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_receiverRemoteCseIndex);
v_requestPrimitive.to_ := v_utRequest.requestPrimitive.to_;
f_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_receiverRemoteCseIndex));
//Test behavior
tc_ac.start;
alt{
[] mcaPortIn.receive(mw_request(v_notifyRequest)) -> value vc_request {
[] mcaPortIn.receive(mw_request(v_requestPrimitive)) -> value vc_request {
tc_ac.stop;
if (ispresent(vc_request.primitive.requestPrimitive.primitiveContent.securityInfo.esprimObject))
if(ischosen(vc_request.primitive.requestPrimitive.primitiveContent.remoteCSE)) {
if(ispresent(vc_request.primitive.requestPrimitive.primitiveContent.remoteCSE.e2eSecInfo)) {
setverdict(pass, __SCOPE__ & " : Received retrieve request for e2eSecInfo attribute");
}
else
{
setverdict(pass, __SCOPE__ & ": ESPrim object received");
setverdict(fail, __SCOPE__ & ": Error: Unexpected retrieve request");
}
}
else
{
setverdict(fail, __SCOPE__ & ": Wrong message received");
setverdict(fail, __SCOPE__ & ": Error: Unexpected retrieve request");
}
}
[] mcaPortIn.receive(mw_request(?)) {
[] mcaPortIn.receive(mw_request(?)) -> value vc_request {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong message received");
setverdict(fail, __SCOPE__ & " : Unexpected request received");
f_send(e_mcc_in_port, m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit))));
}
[] tc_ac.timeout{
setverdict(fail, __SCOPE__ & ": No answer while waiting for a valid ESPrim object");
setverdict(fail, __SCOPE__ & " : Timeout due to no retrieve request received from SUT");
}
}
f_cseSimu_checkComponentDoneAndGetVerdict(vc_cse2);
// Postamble
f_cse_postamble_deleteResourcesCSE();
......@@ -1466,7 +1479,180 @@ module OneM2M_Testcases_AE_Release_3 {
}//end f_AE_SEC_ESP_RET_001
/**
* @desc Check that the IUT sends a notification containing an inner “receiverESPrimRandObject request” to the Receiver if the sharedReceiverESPrimRandObject parameter is not present in the <remoteCSE> resource
*
*/
testcase TC_AE_SEC_ESP_RET_002() runs on Tester system CseSystem {
//Local variables
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
v_cse1.start(f_AE_SEC_ESP_RET_002());
v_cse1.done;
}
function f_AE_SEC_ESP_RET_002() runs on CseSimu system CseSystem {
// Local variables
var MsgIn v_response;
var XSD.ID v_targetResourceAddress;
var integer v_receiverRemoteCseIndex;
var template RequestPrimitive v_notifyRequest;
var PrimitiveContent v_receiverRemoteCseResource;
var charstring v_poa;
// Test control
if(not(PICS_ESP_SUPPORT)) {
setverdict(inconc, __SCOPE__ & ": End-to-End Security of Primitives (ESPrim) support is required to run this test case");
stop;
}
// Test component configuration
f_cf03Up(-,true);
// Test adapter configuration
// Preamble
fx_establish_pairwiseESPrimKey();
//Creating resource in Hosting CSE
var E2eSecInfo v_myE2eSecInfo := {{int11},omit,omit}; //sharedReceiverESPrimRandObject not present
v_poa:= f_getCompletePoA(PX_TS_CSE2.mccPortIn, "");
v_receiverRemoteCseResource := m_primitiveContentRemoteCSE(m_contentRemoteCSE_e2eSecInfo(v_myE2eSecInfo, v_poa, PX_TS_CSE2));
vc_cse2.start(f_generateAndSetLocalResource(valueof(v_receiverRemoteCseResource), -, int16));
vc_cse2.done;
v_receiverRemoteCseIndex := f_getLatestResourceIndex(vc_cse2);
vc_cse2.start(f_cse_retrieveResourceHandler(v_receiverRemoteCseIndex));
// Test Body
var template UtTriggerPrimitive v_utRequest := m_utRetrieveRemoteCSE(f_getResourceAddress(vc_remoteCseIndex));
var MsgIn v_request;
var template RequestPrimitive v_requestPrimitive := mw_retrieve(f_getLocalResourceAddress(-, -, -));
var universal charstring v_action := __SCOPE__ & ": Please, send a valid RETRIEVE Request for the e2eSecInfo attribute of the Receiver’s <remoteCSE> to: ";
// Send triggering primitive to SUT
v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_receiverRemoteCseIndex, -, -);
v_requestPrimitive.to_ := v_utRequest.requestPrimitive.to_;
f_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_receiverRemoteCseIndex, -, -));
//Test behavior
v_notifyRequest := valueof(m_notify(f_getResourceAddress()));
v_notifyRequest.primitiveContent.securityInfo.securityInfoType := int3;
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(v_notifyRequest)) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Notification request containing inner receiverESPrimRandObject received");
}
[] mccPortIn.receive(mw_request(?)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong message received");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while waiting for Notification");
}
}
f_cseSimu_checkComponentDoneAndGetVerdict(vc_cse2);
// Postamble
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf03Down();
}//end f_AE_SEC_ESP_RET_002
/**
* @desc Check that the IUT sends a notification containing an inner “receiverESPrimRandObject request” to the Receiver if the sharedReceiverESPrimRandObject parameter is not present in the <remoteCSE> resource
*
*/
testcase TC_AE_SEC_ESP_RET_003() runs on Tester system CseSystem {
//Local variables
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
v_cse1.start(f_AE_SEC_ESP_RET_003());
v_cse1.done;
}
function f_AE_SEC_ESP_RET_003() runs on CseSimu system CseSystem {
// Local variables
var MsgIn v_response;
var XSD.ID v_targetResourceAddress;
var integer v_receiverRemoteCseIndex;
var template RequestPrimitive v_notifyRequest;
var PrimitiveContent v_receiverRemoteCseResource;
var charstring v_poa;
// Test control
if(not(PICS_ESP_SUPPORT)) {
setverdict(inconc, __SCOPE__ & ": End-to-End Security of Primitives (ESPrim) support is required to run this test case");
stop;
}
// Test component configuration
f_cf03Up(-,true);
// Test adapter configuration
// Preamble
fx_establish_pairwiseESPrimKey();
//Creating resource in Hosting CSE
var AbsRelTimestamp myAbsRelTimestamp;
myAbsRelTimestamp.alt_ := "20181231T012345";
var E2eSecInfo v_myE2eSecInfo := {{int11},omit,{"1","24",myAbsRelTimestamp,{int1},{int10}}}; //expired sharedReceiverESPrimRandObject
v_poa:= f_getCompletePoA(PX_TS_CSE2.mccPortIn, "");
v_receiverRemoteCseResource := m_primitiveContentRemoteCSE(m_contentRemoteCSE_e2eSecInfo(v_myE2eSecInfo, v_poa, PX_TS_CSE2));
vc_cse2.start(f_generateAndSetLocalResource(valueof(v_receiverRemoteCseResource), -, int16));
vc_cse2.done;
v_receiverRemoteCseIndex := f_getLatestResourceIndex(vc_cse2);
vc_cse2.start(f_cse_retrieveResourceHandler(v_receiverRemoteCseIndex));
// Test Body
var template UtTriggerPrimitive v_utRequest := m_utRetrieveRemoteCSE(f_getResourceAddress(vc_remoteCseIndex));
var MsgIn v_request;
var template RequestPrimitive v_requestPrimitive := mw_retrieve(f_getLocalResourceAddress(-, -, -));
var universal charstring v_action := __SCOPE__ & ": Please, send a valid RETRIEVE Request for the e2eSecInfo attribute of the Receiver’s <remoteCSE> to: ";
// Send triggering primitive to SUT
v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_receiverRemoteCseIndex, -, -);
v_requestPrimitive.to_ := v_utRequest.requestPrimitive.to_;
f_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_receiverRemoteCseIndex, -, -));
//Test behavior
v_notifyRequest := valueof(m_notify(f_getResourceAddress()));
v_notifyRequest.primitiveContent.securityInfo.securityInfoType := int3;
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(v_notifyRequest)) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Notification request containing inner receiverESPrimRandObject received");
}
[] mccPortIn.receive(mw_request(?)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong message received");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while waiting for Notification");
}
}
f_cseSimu_checkComponentDoneAndGetVerdict(vc_cse2);
// Postamble
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf03Down();
}//end f_AE_SEC_ESP_RET_003
} //end group Retrieve
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment