Commit a4d30057 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Merge branch 'Test_architecture_improvement' of https://git.onem2m.org/TST/ATS...

Merge branch 'Test_architecture_improvement' of https://git.onem2m.org/TST/ATS into Test_architecture_improvement
parents f0c97691 0a6bc1a6
......@@ -68,6 +68,29 @@ module OneM2M_Functions {
} // end f_cf02Up
/**
* @desc Ports mapping and default behaviour activation for Config 01
*/
function f_cf01UpCseSimuMaster() runs on CseSimu {
// Variables
vc_config := e_cf01;
vc_aeSimu := AeSimu.create("AE1") alive;
// Map
map(self:mccPort, system:mcaPort);
map(vc_aeSimu:mcaPort, system:mcaPort);
map(self:acPort, system:acPort);
activate(a_default());
activate(a_cse_cseSimu());
// Connect
f_connectInfoPort(vc_aeSimu);
//Initialze the IUT
} // end f_cf01UpCseSimuMaster
/**
* @desc Ports mapping and default behaviour activation for Config 02
*/
......@@ -78,7 +101,7 @@ module OneM2M_Functions {
vc_aeSimu := AeSimu.create("AE1") alive;
// Map
map(self:mccPort, system:mcaPort);
map(self:mccPort, system:mccPort);
map(vc_aeSimu:mcaPort, system:mcaPort);
map(self:acPort, system:acPort);
activate(a_default());
......@@ -160,7 +183,19 @@ module OneM2M_Functions {
unmap(self:mcaPort, system:mcaPort);
unmap(self:acPort, system:acPort);
}
}
/**
* @desc Ports unmapping
* @verdict
*/
function f_cf01DownCseSimuMaster() runs on CseSimu {
unmap(self:mccPort, system:mccPort);
unmap(vc_aeSimu:mcaPort, system:mcaPort);
unmap(self:acPort, system:acPort);
unmap(vc_aeSimu:acPort, system:acPort);
}
/**
* @desc Ports unmapping
* @verdict
......@@ -923,7 +958,9 @@ module OneM2M_Functions {
setverdict(pass, __SCOPE__ & ":INFO: Announcement received");
//TODO Save resource and generate required attributes
v_responsePrimitive := f_getCreateResponsePrimitive(v_request.primitive.requestPrimitive.resourceType, v_request.primitive.requestPrimitive);
mccPort.send(m_response(v_responsePrimitive));
mccPort.send(m_response(v_responsePrimitive));
f_checkAttributesToBeSaved(v_request.primitive.requestPrimitive.resourceType, v_request.primitive.requestPrimitive, vc_response.primitive.responsePrimitive);
f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, v_request.primitive.requestPrimitive.resourceType, vc_remoteCseIndex);
}
[] mccPort.receive{
tc_ac.stop;
......@@ -1330,7 +1367,7 @@ module OneM2M_Functions {
v_request := f_getCreateRequestPrimitive(int16, p_requestPrimitive, -1);
mcaPort.send(m_request(v_request));
mccPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
......@@ -1363,7 +1400,7 @@ module OneM2M_Functions {
* @param p_requestPrimitive Template request primitive
* @return Internal resource index of the created resource
*/
function f_cse_registrationRemoteCse(in template RequestPrimitive p_requestPrimitive) runs on InCseSimu return integer {
function f_cse_registrationRemoteCse(in template RequestPrimitive p_requestPrimitive := ?) runs on InCseSimu return integer {
var MsgIn v_request;
var ResponsePrimitive v_response;
......@@ -1372,15 +1409,11 @@ module OneM2M_Functions {
tc_ac.start;
alt {
[] mccPort.receive(mw_request(?)) -> value v_request {
[] mccPort.receive(mw_request(p_requestPrimitive)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type RemoteCSE created successfuly");
v_resourceIndex := f_cse_createLocalResource(v_request.primitive.requestPrimitive.primitiveContent, 1, int16, v_remoteCSEResource);//TODO Get index from v_request.primitive.requestPrimitive.to_
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type RemoteCSE");
}
[] mccPort.receive {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
......@@ -2378,10 +2411,11 @@ module OneM2M_Functions {
f_cse_postamble_deleteResourcesCSE();
if(vc_config == e_cf03) {
f_cf03Down();
stop;
} else if (vc_config ==e_cf04) {
f_cf04Down();
stop;
}
stop;
}
}
......
......@@ -417,7 +417,7 @@ module OneM2M_Templates {
template (value) RequestPrimitive m_updateAEAnnc(template (omit) AcpType p_accessControlPolicyIds := omit, template (omit) XSD.ID p_to := omit, template (omit) XSD.ID p_from := omit, XSD.ID p_appId, XSD.ID p_stemId := "") modifies m_update:= {
requestIdentifier := testcasename() & "-m_updateAEAnnc" & f_rnd(1, 1000000),
resourceType := int10002,
primitiveContent := {aEAnnc := m_contentUpdateAEAnnc}
primitiveContent := {aEAnnc := m_contentUpdateAEAnnc(p_appId,p_stemId)}
};
}//end group Update
......@@ -588,6 +588,14 @@ module OneM2M_Templates {
primitiveContent := {remoteCSE := m_contentCreateRemoteCSE(p_resourceName, p_accessControlPolicyIds,p_cSEBase, p_cSE_ID)}
};
/**
* @desc CREATE request primitive for remoteCSE resource
*/
template RequestPrimitive mw_createRemoteCSEBase(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_create := {
resourceType := int16,
primitiveContent := ?//{remoteCSE := m_contentCreateRemoteCSE(p_resourceName, p_accessControlPolicyIds,p_cSEBase, p_cSE_ID)}
};
/**
* @desc CREATE request primitive for Container resource wiht no resourceName provided
*/
......@@ -2132,7 +2140,7 @@ module OneM2M_Templates {
choice := omit
}
template (value) AEAnnc_optional m_contentUpdateAEAnnc := {
template (value) AEAnnc_optional m_contentUpdateAEAnnc (template XSD.ID p_appId := omit, template XSD.ID p_stemId := omit) := {
resourceName := omit,
resourceType := omit,
resourceID := omit,
......@@ -2144,7 +2152,7 @@ module OneM2M_Templates {
expirationTime := omit,
link := omit,
appName := omit,
app_ID := omit,
app_ID := p_appId,
aE_ID := omit,
pointOfAccess := omit,
ontologyRef := omit,
......
......@@ -40,11 +40,11 @@ module OneM2M_TestControl {
execute(TC_CSE_REG_CRE_016_CST());
execute(TC_CSE_REG_CRE_016_POA());
execute(TC_CSE_REG_CRE_016_NL());
execute(TC_CSE_REG_CRE_018());
execute(TC_CSE_REG_CRE_019());
execute(TC_CSE_REG_CRE_022());
execute(TC_CSE_REG_CRE_023());
execute(TC_CSE_REG_CRE_025());
execute(TC_CSE_REG_CRE_026());
execute(TC_CSE_REG_CRE_028());
execute(TC_CSE_REG_RET_001());
execute(TC_CSE_REG_RET_005());
execute(TC_CSE_REG_RET_008());
......
......@@ -873,7 +873,7 @@ module OneM2M_Testcases {
f_cf01Up();
//Preamble
v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule({"C-AE-ID-STEM"});//c_CRUDNDi);
v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule({"S-AE-ID-STEM"}); //c_CRUDNDi);
//Test Body
v_request := valueof(m_createAe(PX_APP_ID, omit, omit));
......@@ -955,7 +955,7 @@ module OneM2M_Testcases {
* @desc Check that the IUT rejects an AE registration (allowed App-ID, not allowed C-AE-ID-STEM provided by AE)
*
*/
testcase TC_CSE_REG_CRE_004() runs on AeSimu system CseSystem {
testcase TC_CSE_REG_CRE_004() runs on InCseSimu system CseSystem {
var MsgIn v_response;
var RequestPrimitive v_request;
......@@ -963,37 +963,37 @@ module OneM2M_Testcases {
var ResourceType v_resourceType := int2;
// Test component configuration
f_cf01Up();
f_cf01UpCseSimuMaster();
//Preambule
v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule(-);//c_CRUDNDi);
//v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule(-);//c_CRUDNDi);
vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase);
//Test Body
v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));
v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, v_cseBaseIndex);
//v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));
vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM")));
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) {
[] mccPort.receive(mw_response(mw_responsePrimitive(int4005))) {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": AE creation rejected.");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{
[] mccPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating AE");
}
}
}
// Postamble
f_cse_postamble_deleteResources();
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf01Down();
f_cf01DownCseSimuMaster();
}
......@@ -1001,33 +1001,48 @@ module OneM2M_Testcases {
* @desc Check that the IUT accepts an AE registration (allowed App-ID, S-AE-ID-STEM not provided by AE)
*
*/
testcase TC_CSE_REG_CRE_005() runs on AeSimu system CseSystem {
testcase TC_CSE_REG_CRE_005() runs on InCseSimu system CseSystem {
var RequestPrimitive v_request;
var integer v_cseBaseIndex := -1;
var ResourceType v_resourceType := int2;
// Test component configuration
f_cf02Up();
f_cf02UpCseSimuMaster();
//Preambule
v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule({"S"});//c_CRUDNDi);
//v_cseBaseIndex := f_cse_preamble_createServiceSubscribedAppRule({"S"});//c_CRUDNDi);
vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase);
//Test Body
v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));
vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, omit)));
v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, v_cseBaseIndex);
//v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, v_cseBaseIndex);
mcaPort.send(m_request(v_request));
//mcaPort.send(m_request(v_request));
tc_ac.start;
alt{
[]mccPort.receive(mw_request(mw_createAEAnnc("/S", "CSE_ID", -))){
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": AE creation redirected.");
}
[] mccPort.receive {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while creating AE");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating AE");
}
}
vc_cseSimu.start(f_cse_receiveCreateRequest(mw_createAEAnnc(-, -, -)));
vc_cseSimu.done;
/*vc_cseSimu.start(f_cse_receiveCreateRequest(mw_createAEAnnc(-, -, -)));
vc_cseSimu.done;*/
// Postamble
f_cse_postamble_deleteResources();
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf01Down();
f_cf02DownCseSimuMaster();
}
......@@ -1035,7 +1050,7 @@ module OneM2M_Testcases {
* @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), transfer request to the IN-CSE
*
*/
testcase TC_CSE_REG_CRE_008() runs on CseSimu system CseSystem {
testcase TC_CSE_REG_CRE_008() runs on InCseSimu system CseSystem {
var RequestPrimitive v_request;
var integer v_cseBaseIndex := -1;
......@@ -1045,15 +1060,19 @@ module OneM2M_Testcases {
f_cf02UpCseSimuMaster();
//Preambule
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase);
//Test Body
vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S-AE-ID-STEM")));
vc_aeSimu.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
tc_ac.start;
alt {
[] mccPort.receive(mw_request(mw_createAEAnnc("/S", "CSE_ID", -))) {
[] mccPort.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))) {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": AE creation redirected.");
}
[] mccPort.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))) {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": AE creation redirected.");
}
......@@ -1078,7 +1097,7 @@ module OneM2M_Testcases {
* @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), communication between MN-CSE and IN-CSE
*
*/
testcase TC_CSE_REG_CRE_009() runs on CseSimu system CseSystem {
testcase TC_CSE_REG_CRE_009() runs on MnCseSimu system CseSystem {
var MsgIn v_response;
var RequestPrimitive v_request;
......@@ -1095,9 +1114,12 @@ module OneM2M_Testcases {
v_aeAnncIndex := f_cse_announceResource(int2, m_createAEAnnc(-, -, -, PX_APP_ID, -));
//Test Body
v_request := valueof(m_updateAEAnnc(-, -, -, "APP-ID", -)); //TODO to double check all parameters
v_request := valueof(m_updateAEAnnc(-, -, -, PX_APP_ID, -)); //TODO to double check all parameters
v_request := f_getUpdateRequestPrimitive(f_getAnnouncedResourceType(int2),v_aeAnncIndex, v_request);//TODO
v_request.from_ := f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S";
v_request.primitiveContent.aEAnnc.app_ID := PX_APP_ID;
v_request.primitiveContent.aEAnnc.labels := {"Credential-ID:None"};
mccPort.send(m_request(v_request));
tc_ac.start;
......@@ -1146,7 +1168,9 @@ module OneM2M_Testcases {
vc_cseSimu.start(f_cse_resourceAnnouncementHandler());
//TODO Deregister
//f_cse_deleteResource(v_aeIndex);
v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)));
mcaPort.send(m_request(v_request));
//Test Body
f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, f_getResourceId(vc_resourcesList[v_aeIndex].resource)));
......@@ -1159,8 +1183,16 @@ module OneM2M_Testcases {
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": AE creation success.");
//continue to test the content
if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
if (v_response.primitive.responsePrimitive.primitiveContent.aE.app_ID == PX_APP_ID){
setverdict(pass, __SCOPE__ & ": AE creation success.");
}else{
setverdict(fail, __SCOPE__ & ": Error in AE content.");
}
}else{
setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist");
}
}
[] mcaPort.receive {
tc_ac.stop;
......@@ -1219,6 +1251,7 @@ module OneM2M_Testcases {
v_createRequest.primitiveContent.remoteCSE.pointOfAccess := {"http://" & PX_CSE1_ADDRESS & "/"};
v_cse1.start(f_CSE_REG_CRE_016(v_createRequest, c_optionalAttribute));
v_cse1.done;
}
......@@ -1260,14 +1293,17 @@ module OneM2M_Testcases {
[] mccPort.receive(mw_response(mw_responsePrimitive(int2001, f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Accepted creation for resource type remoteCSE containing attribute " & p_optionalAttribute.name);
f_setResource(v_request.primitiveContent,int16);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveOK(f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
f_setResource(v_request.primitiveContent,int16);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Accepted creation for resource type remoteCSE without containing attribute " & p_optionalAttribute.name);
f_setResource(v_request.primitiveContent,int16);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop;
......@@ -1292,7 +1328,7 @@ module OneM2M_Testcases {
* @desc Check that the IUT rejects an AE registration (not allowed App-ID)
*
*/
testcase TC_CSE_REG_CRE_018() runs on AeSimu system CseSystem {
testcase TC_CSE_REG_CRE_019() runs on AeSimu system CseSystem {
var MsgIn v_response;
var RequestPrimitive v_request;
......@@ -1492,7 +1528,7 @@ module OneM2M_Testcases {
* @desc Check that the IUT rejects registration of already registered AE (C-AE-ID-STEM provided by AE)
*
*/
testcase TC_CSE_REG_CRE_026() runs on AeSimu system CseSystem {
testcase TC_CSE_REG_CRE_028() runs on AeSimu system CseSystem {
var MsgIn v_response;
var RequestPrimitive v_request;
......
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