Adding activation of defaults when behaviours used in PTCs

Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent 1c955609
......@@ -65,10 +65,6 @@ module OneM2M_Functions {
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
......@@ -115,10 +111,7 @@ module OneM2M_Functions {
map(self:mccPort, system:mccPort);
map(self:mccPortIn, system:mccPortIn);
map(self:acPort, system:acPort);
activate(a_default());
activate(a_cse_cf02_cse1());
v_cSEBaseResource := f_cse_generateLocalResource(-, -1, int5);
vc_cSEBaseIndex := f_setLocalResource(v_cSEBaseResource, int5, -1);
......@@ -169,9 +162,6 @@ module OneM2M_Functions {
map(self:mcaPortIn, system:mcaPortIn);
map(self:acPort, system:acPort);
activate(a_default());
activate(a_cse_cf02_ae1());
//Initialze the IUT
} // end f_cf02UpAe1
......@@ -526,7 +516,10 @@ module OneM2M_Functions {
var RequestPrimitive v_request;
var MsgIn v_response;
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
v_request := valueof(m_createAeAux(p_accessControlPolicyIDs, p_poaList));
v_request := f_getCreateRequestPrimitive(int2, v_request, -1);
......@@ -582,6 +575,9 @@ module OneM2M_Functions {
var RequestPrimitive v_request;
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
if(PICS_ACP_SUPPORT){
vc_acpAuxIndex := f_cse_createAccessControlPolicyAux(p_allowedOperations := p_allowedOperations);
}
......@@ -828,7 +824,10 @@ module OneM2M_Functions {
var RequestPrimitive v_request;
var integer v_resourceIndex := -1;
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, p_parentIndex);
mcaPort.send(m_request(v_request));
......@@ -1168,87 +1167,7 @@ module OneM2M_Functions {
f_checkAeSimuStatus();
}
/**
* @desc Handling of announcement of resources
* @param p_from Expected originator of the request primitive
* @param p_to Expected receiver of the request primitive
* @verdict
*/
//TODO To finalize this function
function f_cse_resourceAnnouncementHandler(template RequestPrimitive p_requestprimitive := ?) runs on CseSimu {
// Local variables
var MsgIn v_request;
var integer v_parentIndex := vc_localRemoteCseIndex;
var integer v_announcedResourceIndex;
var ResponsePrimitive v_responsePrimitive;
var PrimitiveContent v_announcedResource;
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(p_requestprimitive)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ":INFO: Announcement received");
//TODO Save resource and generate required attributes
v_announcedResource:= f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentIndex,v_request.primitive.requestPrimitive.resourceType);
v_announcedResourceIndex := f_setLocalResource(v_announcedResource, v_request.primitive.requestPrimitive.resourceType, v_parentIndex);
v_responsePrimitive := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
v_responsePrimitive.from_ := PX_CSE1_ID;
v_responsePrimitive.to_ := v_request.primitive.requestPrimitive.from_;
v_responsePrimitive.primitiveContent := vc_localResourcesList[vc_localRemoteCseIndex].resource;
mccPortIn.send(m_response(v_responsePrimitive));
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ":ERROR: No announcement received");
}
}
f_checkCseSimuStatus();
} //end f_cse_resourceAnnouncementHandler
/**
* @desc Message exchange for the announcement of resources
* @param p_resourceType ResourceType of the resource to be announced
* @param p_requestPrimitive CREATE request to be used for the announcement
* @verdict
*/
//TODO To finalize this function
function f_cse_announceResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create) runs on CseSimu return integer {
// Local variables
var RequestPrimitive v_request;
var ResponsePrimitive v_responsePrimitive;
var integer v_resourceIndex := -1;
v_request := f_getCreateRequestPrimitive(f_getAnnouncedResourceType(p_resourceType), p_requestPrimitive, vc_remoteCseIndex);
mccPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mccPort.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, vc_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, f_getAnnouncedResourceType(p_resourceType), vc_remoteCseIndex);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type " & int2str(enum2int(p_resourceType)));
}
[] mccPort.receive {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while creating resource type " & int2str(enum2int(p_resourceType)));
}
}
f_checkCseSimuStatus();
return v_resourceIndex;
} //end f_cse_announceResource
/**
* @desc Checking of returned important attributed (in response) in order to save properly internally
......@@ -1384,7 +1303,10 @@ module OneM2M_Functions {
// Local variables
var ResponsePrimitive v_responsePrimitive;
var template Notification v_notificationRequest := mw_contentNotificationVerification;
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
//Preparation of expected Notification verification
//TODO To add checks for creator and subscription reference
//v_notificationRequest.creator := p_creator; TODO To check what address format is to be expected
......@@ -1436,6 +1358,9 @@ module OneM2M_Functions {
// Local variables
var ResponsePrimitive v_responsePrimitive;
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
......@@ -1471,7 +1396,10 @@ module OneM2M_Functions {
// Local variables
var ResponsePrimitive v_responsePrimitive;
var integer v_notificationsReceived := 0;
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notifyAggregatedNotification)) -> value vc_request {
......@@ -1528,6 +1456,10 @@ module OneM2M_Functions {
*/
function f_cse_notifyProcedure_subscriptionDeletionHandler( template Notification p_notification) runs on AeSimu {
var ResponsePrimitive v_responsePrimitive;
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notifyNotification(p_notification))) -> value vc_request {
......@@ -1556,7 +1488,10 @@ module OneM2M_Functions {
*/
function f_cse_notifyProcedure_noNotificationHandler() runs on AeSimu {
// Local variables
//Activate defaults when running on a PTC
f_cse_activateDefaults_ae();
tc_ac.start(10.0);
alt {
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
......@@ -1626,16 +1561,108 @@ module OneM2M_Functions {
} //end f_check_notificationContent
}// end of group NotificationFunctions
group AnnouncementFunctions {
/**
* @desc Handling of announcement of resources
* @param p_from Expected originator of the request primitive
* @param p_to Expected receiver of the request primitive
* @verdict
*/
//TODO To finalize this function
function f_cse_announcementProcedure_createHandler(template RequestPrimitive p_requestprimitive := ?) runs on CseSimu {
// Local variables
var MsgIn v_request;
var integer v_parentIndex := vc_localRemoteCseIndex;
var integer v_announcedResourceIndex;
var ResponsePrimitive v_responsePrimitive;
var PrimitiveContent v_announcedResource;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(p_requestprimitive)) -> value v_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ":INFO: Announcement received");
//TODO Save resource and generate required attributes
v_announcedResource:= f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentIndex,v_request.primitive.requestPrimitive.resourceType);
v_announcedResourceIndex := f_setLocalResource(v_announcedResource, v_request.primitive.requestPrimitive.resourceType, v_parentIndex);
v_responsePrimitive := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
v_responsePrimitive.from_ := PX_CSE1_ID;
v_responsePrimitive.to_ := v_request.primitive.requestPrimitive.from_;
v_responsePrimitive.primitiveContent := vc_localResourcesList[v_announcedResourceIndex].resource;
mccPortIn.send(m_response(v_responsePrimitive));
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ":ERROR: No announcement received");
}
}
f_checkCseSimuStatus();
} //end f_cse_resourceAnnouncementHandler
/**
* @desc Message exchange for the announcement of resources
* @param p_resourceType ResourceType of the resource to be announced
* @param p_requestPrimitive CREATE request to be used for the announcement
* @verdict
*/
//TODO To finalize this function
function f_cse_announcementProcedure_announceResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create) runs on CseSimu return integer {
// Local variables
var RequestPrimitive v_request;
var ResponsePrimitive v_responsePrimitive;
var integer v_resourceIndex := -1;
v_request := f_getCreateRequestPrimitive(f_getAnnouncedResourceType(p_resourceType), p_requestPrimitive, vc_remoteCseIndex);
mccPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mccPort.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, vc_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, f_getAnnouncedResourceType(p_resourceType), vc_remoteCseIndex);
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type " & int2str(enum2int(p_resourceType)));
}
[] mccPort.receive {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while creating resource type " & int2str(enum2int(p_resourceType)));
}
}
f_checkCseSimuStatus();
return v_resourceIndex;
} //end f_cse_announceResource
/**
* @desc Handling message exchange for the AE Annc update
* @verdict
*/
//TODO TO BE FINALIZED
function f_cse_notifyProcedure_updateHandler() runs on CseSimu {
function f_cse_announcementProcedure_updateHandler() runs on CseSimu {
// Local variables
var ResponsePrimitive v_responsePrimitive;
var template Notification v_notificationRequest := mw_contentNotification_any;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
//Preparation of Notification response to be sent
v_responsePrimitive := valueof(m_responseNotification(int2004, omit));
......@@ -1666,7 +1693,7 @@ module OneM2M_Functions {
} //end f_cse_notifyProcedure_updateHandler
}// end of group NotificationFunctions
}//end of group AnnouncementFunctions
/**
* @desc Check that a resource is present in the IUT (resourceId is known)
......@@ -1745,6 +1772,9 @@ module OneM2M_Functions {
var MsgIn v_response;
var RequestPrimitive v_request;
var PrimitiveContent v_remoteCSEResource;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
v_request := f_getCreateRequestPrimitive(int16, p_requestPrimitive, -1);
......@@ -1797,7 +1827,8 @@ module OneM2M_Functions {
var boolean v_remoteCSERegistered:=false;
var integer v_ResourceIndex := -1;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
//send triggering primitive to SUT
f_sendUtPrimitive(v_utRequest,v_action);
......@@ -1823,15 +1854,12 @@ module OneM2M_Functions {
}
[] tc_ac.timeout {
if(not (v_remoteCSERegistered)){
setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
}
setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
}
}
}
f_checkCseSimuStatus();
//In order for the IUT to perform some actions
f_sleep(10.0);
return v_resourceIndex;
......@@ -1842,8 +1870,11 @@ module OneM2M_Functions {
* @param p_requestPrimitive Expected CREATE request primitive
*/
function f_cse_receiveCreateRequest(in template RequestPrimitive p_requestPrimitive := ?) runs on CseSimu {
var ResponsePrimitive v_responsePrimitive;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(p_requestPrimitive)) -> value vc_request {
......@@ -2014,21 +2045,13 @@ module OneM2M_Functions {
* @desc Cse altstep for config 01
*/
altstep a_cse_cf01() runs on AeSimu {
var MsgIn v_request;
var ResponsePrimitive v_responsePrimitive;
[] mcaPort.receive {
log(__SCOPE__&": WARNING: Unexpected message received");
repeat;
}
}
/**
* @desc Cse altstep for config 01 for AE2
*/
altstep a_cse_cf01_ae2() runs on AeSimu {
var MsgIn v_request;
var ResponsePrimitive v_responsePrimitive;
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value v_request {
//Send response
v_responsePrimitive := valueof(m_responseNotification(int2001, omit));
......@@ -2140,7 +2163,33 @@ module OneM2M_Functions {
}
}
}//end group altstepFunctions
}//end group altstepFunctions
function f_cse_activateDefaults_cse1() runs on CseSimu {
if(not(self == mtc)) {
activate(a_default());
if(vc_config == e_cf02) {
activate(a_cse_cf02_cse1());
log(__SCOPE__&": INFO: Default cf02_cse1 activated");
} else if(vc_config == e_cf04) {
activate(a_cse_cf04());
log(__SCOPE__&": INFO: Default cf04 activated");
}
}
}
function f_cse_activateDefaults_ae() runs on AeSimu {
if(not(self == mtc)) {
activate(a_default());
if(vc_config == e_cf01) {
activate(a_cse_cf01());
log(__SCOPE__&": INFO: Default cf01 and cf01_ae2 activated");
} else if(vc_config == e_cf02CseSimuMaster) {
activate(a_cse_cf02_ae1());
log(__SCOPE__&": INFO: Default cf02_ae1 activated");
}
}
}
}//end cseFunctions
......@@ -2347,16 +2396,16 @@ module OneM2M_Functions {
var integer v_resourceIndex, v_parentIndex;
var RequestPrimitive v_rp;
[] mcaPort.receive(mw_request(mw_create)) -> value v_request {
[] mcaPortIn.receive(mw_request(mw_create)) -> value v_request {
v_rp := v_request.primitive.requestPrimitive;
v_parentIndex := f_getResourceIndex(v_rp.to_);
v_modifiedResource := f_ae_generateLocalResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType);
v_resourceIndex := f_setLocalResource(v_modifiedResource, v_rp.resourceType, v_parentIndex);
if(v_resourceIndex != -1) {
mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource)));
mcaPortIn.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource)));
}
else {
mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier)));
mcaPortIn.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier)));
}
repeat;
}
......@@ -2366,6 +2415,16 @@ module OneM2M_Functions {
}//end group altstepFunctions
function f_ae_activateDefaults() runs on CseSimu {
if(not(self == mtc)) {
activate(a_default());
if(vc_config == e_cf03) {
activate(a_ae_cf03());
log(__SCOPE__&": INFO: Default cf03 activated");
}
}
}
}//end of aeFunctions
......
......@@ -2672,7 +2672,7 @@ module OneM2M_PermutationFunctions {
}
vc_cse1.done;
vc_cse1.start(f_cse_resourceAnnouncementHandler());
vc_cse1.start(f_cse_announcementProcedure_createHandler());
v_resourceIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, omit));
vc_cse1.done;
......@@ -6394,7 +6394,7 @@ module OneM2M_PermutationFunctions {
vc_cse1.done;
//Preamble
vc_cse1.start(f_cse_resourceAnnouncementHandler(mw_createAEAnnc(-, -, -)));
vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -)));
v_aeIndex := f_cse_createResource(int2,v_create);
vc_cse1.done;
......@@ -6407,7 +6407,7 @@ module OneM2M_PermutationFunctions {
v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestCreatePrimitive, v_parentIndex);
v_responsePrimitive.responseStatusCode := int2001;
}
vc_cse1.start(f_cse_resourceAnnouncementHandler(p_createRequestAnnc));
vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc));
mcaPort.send(m_request(v_request));
tc_ac.start;
......
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