Commit 656c88af authored by Pramod Kulkarni's avatar Pramod Kulkarni
Browse files

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

parents 0c24b5cc ac99d137
<
......@@ -28,19 +28,46 @@ module OneM2M_Functions {
/**
@desc Ports mapping and default behaviour activation for Config 1
*/
function f_cf01Up() runs on CseTester {
function f_cf01Up(in boolean p_auxiliaryAe2Required := false) runs on AeSimu {
// Variables
vc_config := e_cf01;
// Map
map(self:mcaPort, system:mcaPort);
map(self:acPort, system:acPort);
activate(a_default());
activate(a_cse_cf01());
// Connect
// Initialize AE2
if(p_auxiliaryAe2Required) {
vc_auxiliaryAe2Up := p_auxiliaryAe2Required;
vc_ae2 := AeSimu.create("AE2") alive;
vc_ae2.start(f_cf01UpAe2());
}
//Initialze the IUT
} // end f_cf01Up
/**
@desc Ports mapping and default behaviour activation for Config 1 on the auxiliary AE2
*/
function f_cf01UpAe2() runs on AeSimu {
// Variables
vc_config := e_cf01;
// Map
map(self:mcaPort, system:mcaPort);
map(self:mcaPortIn, system:mcaPortIn);
map(self:acPort, system:acPort);
activate(a_default());
activate(a_cse_cf01());
activate(a_cse_cf01_ae2()); //For mcaPortIn
//Initialze the IUT
} // end f_cf01Up
......@@ -48,28 +75,51 @@ module OneM2M_Functions {
/**
* @desc Ports mapping and default behaviour activation for Config 02
*/
function f_cf02Up() runs on CseTester {
function f_cf02Up() runs on AeSimu {
// Variables
vc_config := e_cf02;
vc_cseSimu := CseSimu.create("CSE1") alive;
// Map
map(self:mcaPort, system:mcaPort);
map(self:mccPort, system:mccPort);
map(vc_cseSimu:mccPort, system:mccPort);
map(self:acPort, system:acPort);
activate(a_default());
activate(a_cse_cf02());
activate(a_cse_aeSimu());
// Connect
f_connectInfoPort(vc_cseSimu);
//Initialze the IUT
} // end f_cf02Up
/**
* @desc Ports mapping and default behaviour activation for Config 02
*/
function f_cf02UpCseSimuMaster() runs on CseSimu {
// Variables
vc_config := e_cf02;
vc_aeSimu := AeSimu.create("AE1") alive;
// Map
map(self:mccPort, system:mccPort);
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_cf02UpCseSimuMaster
/**
* @desc Ports mapping and default behaviour activation for Config 03
*/
function f_cf03Up() runs on AeTester {
function f_cf03Up() runs on CseSimu {
// Variables
vc_config := e_cf03;
......@@ -89,7 +139,7 @@ module OneM2M_Functions {
/**
* @desc Ports mapping and default behaviour activation for Config 04
*/
function f_cf04Up() runs on CseTester {
function f_cf04Up() runs on CseSimu {
// Variables
vc_config := e_cf04;
......@@ -110,7 +160,7 @@ module OneM2M_Functions {
* @desc Ports unmapping
* @verdict
*/
function f_cfCseTesterDown() runs on CseTester {
/*function f_cfCseTesterDown() runs on Tester {
if(vc_config == e_cf01) {
f_cf01Down()
......@@ -122,35 +172,62 @@ module OneM2M_Functions {
* @desc Ports unmapping
* @verdict
*/
function f_cfAeTesterDown() runs on AeTester {
/*function f_cfAeTesterDown() runs on AeSimu {
if(vc_config == e_cf03) {
f_cf03Down()
}
}
}
/**
* @desc Ports unmapping
* @verdict
*/
function f_cf01Down() runs on CseTester {
function f_cf01Down() runs on AeSimu {
unmap(self:mcaPort, system:mcaPort);
unmap(self:acPort, system:acPort);
}
if(vc_auxiliaryAe2Up) {
vc_ae2.start(f_cf01DownAe2());
}
}
/**
* @desc Ports unmapping
* @verdict
*/
function f_cf01DownAe2() runs on AeSimu {
unmap(self:mcaPort, system:mcaPort);
unmap(self:acPort, system:acPort);
unmap(self:mcaPortIn, system:mcaPortIn);
}
/**
* @desc Ports unmapping
* @verdict
*/
function f_cf02Down() runs on CseTester {
function f_cf02Down() runs on AeSimu {
unmap(self:mcaPort, system:mcaPort);
unmap(vc_cseSimu:mccPort, system:mccPort);
unmap(self:acPort, system:acPort);
unmap(vc_cseSimu:acPort, system:acPort);
}
/**
* @desc Ports unmapping
* @verdict
*/
function f_cf02DownCseSimuMaster() 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 for Config 03
*/
function f_cf03Down() runs on AeTester {
function f_cf03Down() runs on CseSimu {
unmap(self:mcaPort, system:mcaPort);
unmap(self:acPort, system:acPort);
......@@ -159,12 +236,22 @@ module OneM2M_Functions {
/**
* @desc Ports unmapping for Config 04
*/
function f_cf04Down() runs on CseTester {
function f_cf04Down() runs on CseSimu {
unmap(self:mccPort, system:mccPort);
unmap(self:acPort, system:acPort);
}
function f_connectInfoPort(in Tester p_tester) runs on Tester {
// Connect
connect(self:infoPort, p_tester:infoPort);
}
function f_disconnectInfoPort(in Tester p_tester) runs on Tester {
// Disconnect
disconnect(self:infoPort, p_tester:infoPort);
}
}//end group configFunctions
group CseFunctions {
......@@ -177,7 +264,7 @@ module OneM2M_Functions {
* @return Internal ACP resource index
* @verdict
*/
function f_cse_preamble_createAcpAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) AccessControlOperations p_allowedOperations := int63) runs on CseTester return integer {//c_CRUDNDi
function f_cse_preamble_createAcpAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) AccessControlOperations p_allowedOperations := int63) runs on AeSimu return integer {//c_CRUDNDi
return f_cse_createAccessControlPolicyAux(p_acpName, -, p_allowedOperations);
......@@ -190,7 +277,7 @@ module OneM2M_Functions {
* @return Internal AE resource index
* @verdict
*/
function f_cse_preamble_registerAe(template (omit) AcpType p_accessControlPolicyIDs := omit, in template (omit) PoaList p_poaList := omit) runs on CseTester return integer {//c_CRUDNDi
function f_cse_preamble_registerAe(template (omit) AcpType p_accessControlPolicyIDs := omit, in template (omit) PoaList p_poaList := omit) runs on AeSimu return integer {//c_CRUDNDi
var RequestPrimitive v_request;
var MsgIn v_response;
......@@ -236,7 +323,7 @@ module OneM2M_Functions {
}
}
f_checkCseTesterStatus();
f_checkAeSimuStatus();
return vc_aeAuxIndex;
}
......@@ -247,10 +334,9 @@ module OneM2M_Functions {
* @return Internal AE resource index
* @verdict
*/
function f_cse_preamble_registerAeWithId(XSD.ID p_appId, in template (value) AccessControlOperations p_allowedOperations := int63) runs on CseTester return integer {//c_CRUDNDi
function f_cse_preamble_registerAeWithId(XSD.ID p_appId, in template (value) AccessControlOperations p_allowedOperations := int63) runs on AeSimu return integer {//c_CRUDNDi
var RequestPrimitive v_request;
var MsgIn v_response;
var integer v_aeAuxIndex := -1;
var integer v_acpAuxIndex := -1;
......@@ -273,15 +359,15 @@ module OneM2M_Functions {
}
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__&": INFO: Application registered successfuly");
if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) {
if(ischosen(vc_response.primitive.responsePrimitive.primitiveContent.aE)) {
vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
vc_aeAuxIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, int2);
if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)){
f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)));
if(ispresent(vc_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)){
f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(vc_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)));
} else {
f_sendAcPrimitive("AE-ID_changed", "0");
}
......@@ -304,12 +390,12 @@ module OneM2M_Functions {
}
}
f_checkCseTesterStatus();
f_checkAeSimuStatus();
return vc_aeAuxIndex;
}
function f_cse_preamble_createServiceSubscribedAppRule(in template ListOfM2MID p_allowedAEs := {""}) runs on CseTester return integer {//c_CRUDNDi
function f_cse_preamble_createServiceSubscribedAppRule(in template ListOfM2MID p_allowedAEs := {""}) runs on AeSimu return integer {//c_CRUDNDi
var integer v_serviceSubscribedAppRuleIndex := -1;
......@@ -319,14 +405,33 @@ module OneM2M_Functions {
}
function f_cse_preamble_subscriptionVerification(out CseTester p_notifyHandler,in integer p_aeIndex, inout integer p_ae2Index, inout template RequestPrimitive p_createRequestPrimitive,in ResourceType p_resourceType, in ResponseStatusCode p_responseStatusCode := int2001) runs on CseTester {
function f_cse_preamble_createServiceSubscribedProfile(in template ListOfM2MID p_allowedAEs := {""}) runs on AeSimu return integer {//c_CRUDNDi
var integer v_serviceSubscribedAppRuleIndex := -1;
var integer v_serviceSubscribedProfileIndex := -1;
var template RequestPrimitive m_request := m_createM2mServiceSubscriptionProfileBase;
//TODO Create/Update serviceSubscribedNode //m_request.primitiveContent.m2mServiceSubscriptionProfile.choice.choice_list[0].serviceSubscribedNode := m_contentServiceSubscribedNode;
v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, m_createServiceSubscribedAppRule({"None"}, {PX_APP_ID}, valueof(p_allowedAEs)));
m_request.primitiveContent.m2mServiceSubscriptionProfile.choice.choice_list[0].serviceSubscribedNode.ruleLinks := {f_getResourceAddress(v_serviceSubscribedAppRuleIndex)};
v_serviceSubscribedProfileIndex := f_cse_createResource(int11, m_request);
return v_serviceSubscribedProfileIndex;
}
function f_cse_preamble_subscriptionVerification(inout integer p_ae2Index, inout template RequestPrimitive p_createRequestPrimitive,in ResourceType p_resourceType, in ResponseStatusCode p_responseStatusCode := int2001) runs on AeSimu {
if(p_resourceType == int23){
p_notifyHandler := CseTester.create("NotifyHandler") alive;
p_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1); // AE2 is registred
vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred
f_checkComponentDoneAndGetVerdict(vc_ae2);
p_ae2Index := f_getResource(vc_ae2);
if(ischosen(p_createRequestPrimitive.primitiveContent.subscription)){ //this condition is necessary for Subscription TCs where notification URI is set in m_createSubscriptionAdvanced
p_createRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(p_ae2Index)};
}
p_notifyHandler.start(f_cse_notifyProcedure_subscriptionVerificationHandler(p_aeIndex, p_responseStatusCode));
vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler(p_responseStatusCode));
}
}
......@@ -338,13 +443,17 @@ module OneM2M_Functions {
* @desc Deletion of all resources created during the test case execution. IUT gets clean and ready for next execution
* @verdict
*/
function f_cse_postamble_deleteResources() runs on CseTester {
function f_cse_postamble_deleteResources() runs on AeSimu {
var integer i;
var XSD.ID v_resourceAddress;
var RequestPrimitive v_request;
if (PX_RUN_POSTAMBLE) {
if(vc_auxiliaryAe2Up) {
f_cse_postamble_aeSimu(vc_ae2);
}
for(i := lengthof(vc_resourcesIndexToBeDeleted) -1; i >=0; i := i - 1) {
v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i]);
......@@ -372,15 +481,25 @@ module OneM2M_Functions {
}
}
f_cse_postamble_default();
}
/**
* @desc Calls to postamble for AE2 entity
* @verdict
*/
function f_cse_postamble_aeSimu(in AeSimu p_ae) runs on AeSimu {
if(p_ae.running) {
p_ae.stop;
}
p_ae.start(f_cse_postamble_deleteResources());
}
/**
* @desc Deletion of all resources created during the test case execution. IUT gets clean and ready for next execution
* @verdict
*/
function f_cse_postamble_deleteResourcesCSE() runs on CseTester {
function f_cse_postamble_deleteResourcesCSE() runs on CseSimu {
var integer i;
var XSD.ID v_resourceAddress;
var RequestPrimitive v_request;
......@@ -414,35 +533,178 @@ module OneM2M_Functions {
}
}
}
/**
@desc
*/
function f_getResponsePrimitive(in AeSimu p_ae) runs on Tester return ResponsePrimitive {
var ResponsePrimitive v_response;
f_cse_postamble_default();
f_connectInfoPort(p_ae);
p_ae.start(f_sendResponsePrimitive());
alt {
[]infoPort.receive(mw_responsePrimitiveforInfoPort) -> value v_response {
}
}
f_disconnectInfoPort(p_ae);
return v_response;
}
/**
* @desc Default postamble
* @verdict
*/
function f_cse_postamble_default() runs on CseTester {
@desc
*/
function f_getRequestPrimitive(in AeSimu p_ae) runs on Tester return RequestPrimitive {
var RequestPrimitive v_request;
f_connectInfoPort(p_ae);
p_ae.start(f_sendRequestPrimitive());
alt {
[]infoPort.receive(mw_requestPrimitiveforInfoPort) -> value v_request {
}
}
f_disconnectInfoPort(p_ae);
return v_request;
}
function f_is_component_done(in CseTester p_notifyHandler) runs on CseTester {
function f_getRemoteCseRequestPrimitive(in CseSimu p_cse) runs on Tester return RequestPrimitive {
var RequestPrimitive v_request;
f_connectInfoPort(p_cse);
p_cse.start(f_sendRemoteCseRequestPrimitive());
alt {
[]infoPort.receive(mw_requestPrimitiveforInfoPort) -> value v_request {
}
}
f_disconnectInfoPort(p_cse);
return v_request;
}
tc_ac.start(10.0);
/**
@desc
*/
function f_getPrimitiveContentRetrievedResource(in AeSimu p_ae) runs on Tester return PrimitiveContent {
var PrimitiveContent v_primitiveContent;
f_connectInfoPort(p_ae);
p_ae.start(f_sendPrimitiveContentRetrievedResource());
alt {
[] p_notifyHandler.done {
tc_ac.stop;
[]infoPort.receive(mw_primitiveContent) -> value v_primitiveContent {
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__ & "INFO: Notify verification not received");
}
f_disconnectInfoPort(p_ae);
return v_primitiveContent;
}
/**
@desc
*/
function f_getRemoteCseResource(in CseSimu p_cse) runs on AeSimu return integer {
var MyResource v_resource;
var integer v_resourceIndex := -1;
f_connectInfoPort(p_cse);
p_cse.start(f_sendRemoteCseResource());
alt {
[]infoPort.receive(mw_resource) -> value v_resource {
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex, false);
}
}
} //end f_is_component_done
f_disconnectInfoPort(p_cse);
return v_resourceIndex;
}
/**
@desc
*/
function f_getResource(in AeSimu p_ae, in integer p_resourceIndex := -1) runs on AeSimu return integer {
var MyResource v_resource;
var integer v_resourceIndex := -1;
f_connectInfoPort(p_ae);
p_ae.start(f_sendResource(p_resourceIndex));
alt {
[]infoPort.receive(mw_resource) -> value v_resource {
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex, false);
}
}
f_disconnectInfoPort(p_ae);
p_ae.done;
return v_resourceIndex;
}
function f_sendResponsePrimitive() runs on AeSimu {
infoPort.send(vc_response.primitive.responsePrimitive);
}
function f_sendRequestPrimitive() runs on AeSimu {
infoPort.send(vc_request.primitive.requestPrimitive);
}
function f_sendRemoteCseRequestPrimitive() runs on CseSimu {
infoPort.send(vc_request.primitive.requestPrimitive);
}
function f_sendPrimitiveContentRetrievedResource() runs on AeSimu {
infoPort.send(vc_primitiveContentRetrievedResource);
}
function f_sendRemoteCseResource() runs on CseSimu {
infoPort.send(vc_resourcesList[vc_remoteCseIndex]);
}
function f_sendResource(in integer p_resourceIndex) runs on AeSimu {
if(p_resourceIndex == -1) {
infoPort.send(vc_resourcesList[vc_aeAuxIndex]);
} else {
infoPort.send(vc_resourcesList[p_resourceIndex]);
}
}
}//end group postambleFunctions
group HelpingFunctions {
group AeSimuFunctions {
/**
* @desc Creation of a resource
* @param p_resourceType Resource type of the resource to be created
......@@ -451,9 +713,8 @@ module OneM2M_Functions {
* @return Internal resource index of the created resource
* @verdict
*/
function f_cse_createResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create, integer p_parentIndex := -1) runs on CseTester return integer {
function f_cse_createResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create, integer p_parentIndex := -1) runs on AeSimu return integer {
var MsgIn v_response;
var RequestPrimitive v_request;
var integer v_resourceIndex := -1;
......@@ -462,11 +723,14 @@ module OneM2M_Functions {
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly");
f_checkAttributesToBeSaved(p_resourceType, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, p_parentIndex);
f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, p_resourceType, p_parentIndex);
if(p_resourceType == int2) {
vc_aeAuxIndex := v_resourceIndex;
}
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
......@@ -481,7 +745,7 @@ module OneM2M_Functions {
}
}
f_checkCseTesterStatus();
f_checkAeSimuStatus();
return v_resourceIndex;
......@@ -494,8 +758,7 @@ module OneM2M_Functions {
* @return Internal resource index of the created auxiliar ACP resource
* @verdict
*/
function f_cse_createAccessControlPolicyAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63) runs on CseTester return integer{ var RequestPrimitive v_request;
var MsgIn v_response;
function f_cse_createAccessControlPolicyAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63) runs on AeSimu return integer{ var RequestPrimitive v_request;
var integer v_acpAuxIndex := -1;
v_request := valueof(m_createAcpAux(p_acpName := p_acpName, p_allowedOperations := p_allowedOperations));
......@@ -505,11 +768,11 @@ module OneM2M_Functions {
mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;