From 563428f8949fc4e694123d34a79da81a945c6542 Mon Sep 17 00:00:00 2001
From: reinaortega <miguelangel.reinaortega@etsi.org>
Date: Wed, 3 Apr 2019 19:15:48 +0200
Subject: [PATCH] Minor enhancements for defaults, f_updateLocalResource and
 checkComponentDoneAndGetVerdict functions

Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org>
---
 LibOneM2M/OneM2M_Functions.ttcn  | 112 ++++++++++++++++++++-----------
 LibOneM2M/OneM2M_TestSystem.ttcn |   1 +
 2 files changed, 75 insertions(+), 38 deletions(-)

diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn
index 85c2421..6d93e64 100644
--- a/LibOneM2M/OneM2M_Functions.ttcn
+++ b/LibOneM2M/OneM2M_Functions.ttcn
@@ -1968,6 +1968,7 @@ module OneM2M_Functions {
 							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));			
 						}
 						[] mccPortIn.receive(mw_request(?)) -> value v_request {
+							tc_ac.stop;
 							setverdict(fail, __SCOPE__ & ":ERROR:  Request received with unexpected parameters");
 							v_responsePrimitive := valueof(m_responsePrimitive(int4000,v_request.primitive.requestPrimitive.requestIdentifier));
 							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
@@ -3005,6 +3006,46 @@ module OneM2M_Functions {
 					if(ispresent(p_resource.aE.supportedReleaseVersions)) {
 						vc_localResourcesList[p_localResourceIndex].resource.aE.supportedReleaseVersions := p_resource.aE.supportedReleaseVersions;
 					}
+				} else if(ischosen(vc_localResourcesList[p_localResourceIndex].resource.aEAnnc) and (ischosen(p_resource.aEAnnc))) {//AEAnnc
+					if(ispresent(p_resource.aEAnnc.accessControlPolicyIDs)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.accessControlPolicyIDs := p_resource.aEAnnc.accessControlPolicyIDs;
+					}
+					if(ispresent(p_resource.aEAnnc.expirationTime)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.expirationTime := p_resource.aEAnnc.expirationTime;
+					}
+					if(ispresent(p_resource.aEAnnc.labels)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.labels := p_resource.aEAnnc.labels;
+					}
+					if(ispresent(p_resource.aEAnnc.link)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.link := p_resource.aEAnnc.link;
+					}
+					if(ispresent(p_resource.aEAnnc.dynamicAuthorizationConsultationIDs)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.dynamicAuthorizationConsultationIDs := p_resource.aEAnnc.dynamicAuthorizationConsultationIDs;
+					}
+					if(ispresent(p_resource.aEAnnc.appName)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.appName := p_resource.aEAnnc.appName;
+					}
+					if(ispresent(p_resource.aEAnnc.pointOfAccess)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.pointOfAccess := p_resource.aEAnnc.pointOfAccess;
+					}
+					if(ispresent(p_resource.aEAnnc.ontologyRef)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.ontologyRef := p_resource.aEAnnc.ontologyRef;
+					}
+					if(ispresent(p_resource.aEAnnc.nodeLink)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.nodeLink := p_resource.aEAnnc.nodeLink;
+					}
+					if(ispresent(p_resource.aEAnnc.requestReachability)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.requestReachability := p_resource.aEAnnc.requestReachability;
+					}
+					if(ispresent(p_resource.aEAnnc.contentSerialization)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.contentSerialization := p_resource.aEAnnc.contentSerialization;
+					}
+					if(ispresent(p_resource.aEAnnc.e2eSecInfo)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.e2eSecInfo := p_resource.aEAnnc.e2eSecInfo;
+					}
+					if(ispresent(p_resource.aEAnnc.supportedReleaseVersions)) {
+						vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.supportedReleaseVersions := p_resource.aEAnnc.supportedReleaseVersions;
+					}
 				} else if(ischosen(vc_localResourcesList[p_localResourceIndex].resource.accessControlPolicy) and (ischosen(p_resource.accessControlPolicy))) { //AccessControlPolicy
 					if(ispresent(p_resource.accessControlPolicy.expirationTime)) {
 						vc_localResourcesList[p_localResourceIndex].resource.accessControlPolicy.expirationTime := p_resource.accessControlPolicy.expirationTime;
@@ -3157,16 +3198,13 @@ module OneM2M_Functions {
 				
 				[] mccPortIn.receive(mw_request(mw_create())) -> value v_request {
 					log(__SCOPE__&": WARNING: Unexpected CREATE message received");
-					tc_ac.stop;
 					
 					v_localResourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);
 	
 					mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
-					tc_ac.start(10.0);
 					repeat;
 				}
 				[] mccPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request {
-					tc_ac.stop;
 					log(__SCOPE__&": WARNING: Unexpected RETRIEVE message received");
 					
 					f_processRetrieveRequestPrimitive(v_request.primitive.requestPrimitive);
@@ -3175,36 +3213,29 @@ module OneM2M_Functions {
 					} else {
 						mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
 					}
-					tc_ac.start(10.0);
 					repeat;
 				}
 				[] mccPortIn.receive(mw_request(mw_update())) -> value v_request {
-					tc_ac.stop;
 					log(__SCOPE__&": WARNING: Unexpected UPDATE message received");
 
 					f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive);
 					mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
-					tc_ac.start(10.0);
 					repeat;
 				}
 				[] mccPortIn.receive(mw_request(mw_delete())) -> value v_request {
-					tc_ac.stop;
 					log(__SCOPE__&": WARNING: Unexpected DELETE message received");
 
 					f_processDeleteRequestPrimitive(v_request.primitive.requestPrimitive);
 					mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
-					tc_ac.start(10.0);
 					repeat;
 				}
 				[] mccPortIn.receive(mw_request(mw_notify)) -> value v_request {
-					tc_ac.stop;
 					log(__SCOPE__&": WARNING: Unexpected NOTIFY message received");
 
 					//Send response in any case
 					v_response := valueof(m_responseNotification(int2000, omit));
 					v_response.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
 					mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
-					tc_ac.start(10.0);
 					repeat;
 				}
 				[] mccPortIn.receive (mw_request(?)){
@@ -3225,14 +3256,12 @@ module OneM2M_Functions {
 				var ResponsePrimitive v_response;
 				
 			 	[] mcaPortIn.receive(mw_request(mw_notify)) -> value v_request {
-					tc_ac.stop;
 					log(__SCOPE__&": WARNING: Unexpected NOTIFY message received");
 
 					//Send response in any case
 					v_response := valueof(m_responseNotification(int2000, omit));
 					v_response.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
 					mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
-					tc_ac.start(10.0);
 					repeat;
 				}
 			 	[] mcaPortIn.receive {
@@ -3249,32 +3278,39 @@ module OneM2M_Functions {
 			  * @desc	Activation of the corresponding default altstep depending on config for CseSimu
 			  */
 			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");
-					}
-				}	
+				deactivate;
+				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_cf02CseSimuMaster) {
+					activate(a_cse_cf02_cse1());
+					log(__SCOPE__&": INFO: Default cf02_cse1 activated");
+				} else if(vc_config == e_cf03) {
+					activate(a_cse_cf03());
+					log(__SCOPE__&": INFO: Default cf03 activated");
+				} else if(vc_config == e_cf04) {
+					activate(a_cse_cf04());
+					log(__SCOPE__&": INFO: Default cf04 activated");
+				}
 			}
 	
 			/**
 			  * @desc	Activation of the corresponding default altstep depending on config for AeSimu
 			  */
 			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");
-					}
-				}	
+				deactivate;
+				activate(a_default());
+				if(vc_config == e_cf01) {
+					activate(a_cse_cf01());
+					log(__SCOPE__&": INFO: Default cf01 activated");
+				} else if(vc_config == e_cf02) {
+					activate(a_cse_cf02_ae1());
+					log(__SCOPE__&": INFO: Default cf02_ae1 activated");
+				} else if(vc_config == e_cf02CseSimuMaster) {
+					activate(a_cse_cf02_ae1());
+					log(__SCOPE__&": INFO: Default cf02_ae1 activated");
+				}
 			}
 		}//end group CseAltstepFunctions
 		
@@ -4757,12 +4793,12 @@ module OneM2M_Functions {
 				
 				var verdicttype v_verdict := none;
 	
-				tc_ac.start(15.0);
+				tc_done.start(15.0);
 				alt {
 					[] p_component.done -> value v_verdict {
-						tc_ac.stop;
+						tc_done.stop;
 					}
-					[] tc_ac.timeout {
+					[] tc_done.timeout {
 						setverdict(inconc, __SCOPE__ & "INFO: Component did not finish");
 					}
 				}			 
@@ -4786,12 +4822,12 @@ module OneM2M_Functions {
 				
 				var verdicttype v_verdict := none;
 	
-				tc_ac.start(15.0);
+				tc_done.start(15.0);
 				alt {
 					[] p_component.done -> value v_verdict {
-						tc_ac.stop;
+						tc_done.stop;
 					}
-					[] tc_ac.timeout {
+					[] tc_done.timeout {
 						setverdict(inconc, __SCOPE__ & "INFO: Component did not finish");
 					}
 				}			 
diff --git a/LibOneM2M/OneM2M_TestSystem.ttcn b/LibOneM2M/OneM2M_TestSystem.ttcn
index 4b1e6af..d26e7c0 100644
--- a/LibOneM2M/OneM2M_TestSystem.ttcn
+++ b/LibOneM2M/OneM2M_TestSystem.ttcn
@@ -29,6 +29,7 @@ module OneM2M_TestSystem {
 		//timers
 		timer tc_ac := PX_TAC;
 		timer tc_wait := PX_TWAIT;
+		timer tc_done := PX_TDONE;
 		//global variables
 		var charstring vc_protocolBinding;
 		var Configurations vc_config;
-- 
GitLab