From 87f61485c9b5f976fef338a903003feb1e984e5d Mon Sep 17 00:00:00 2001
From: reinaortega <miguelangel.reinaortega@etsi.org>
Date: Wed, 25 Sep 2019 08:28:02 +0200
Subject: [PATCH] Small improvement of
 f_cse_notifyProcedure_subscriptionVerificationHandler + using default timer
 values for tc_done

Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org>
---
 LibOneM2M/OneM2M_Functions.ttcn | 47 ++++++++++++---------------------
 1 file changed, 17 insertions(+), 30 deletions(-)

diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn
index a83b843..625a603 100644
--- a/LibOneM2M/OneM2M_Functions.ttcn
+++ b/LibOneM2M/OneM2M_Functions.ttcn
@@ -1873,45 +1873,36 @@ module OneM2M_Functions {
 					
 					//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
-					//Some participants use SP relative UNSTRUCTURED
-					//v_notificationRequest.subscriptionReference := "I Don't know which URI is expected"; // TODO mandatory parameter 
+					//v_notificationRequest.creator := p_creator;(which format?)
+					//v_notificationRequest.subscriptionReference := "I Don't know which URI is expected";
     			
-					//Preparation of Notification response to be sent
-					v_responsePrimitive := valueof(m_responseNotification(p_responseStatusCode, omit));
-    	
 					tc_ac.start;
 					alt {
 						[] mcaPortIn.receive(mw_request(mw_notifyNotification(v_notificationRequest))) -> value vc_request {
 							tc_ac.stop;
-							setverdict(pass, __SCOPE__ & ":INFO: Notification received");
+							setverdict(pass, __SCOPE__ & ":INFO: Subscription Verification Notification received");
 						}
 						[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
 							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ":ERROR: Notification received but verificationRequest isn't set to TRUE");							
-						}
-						[] mcaPortIn.receive{
-							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
-							stop;
+							setverdict(inconc, __SCOPE__ & ":ERROR: Notification received but verificationRequest isn't set to TRUE");							
 						}
 						[] tc_ac.timeout {
-							setverdict(fail, __SCOPE__ & ":ERROR:  No notification received");
+							setverdict(inconc, __SCOPE__ & ":ERROR:  No subscriptionVerification notification received");
 							stop;
 						}
 					}
-						
-					v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
-					if(getverdict == pass) {
-						f_send(e_mca_in_port, m_httpResponse(v_responsePrimitive));
-					} else {
+					
+					//Sending response to the notification received	
+					//Preparation of Notification response to be sent
+					v_responsePrimitive := valueof(m_responseNotification(p_responseStatusCode, omit));
+    				v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
+					
+					if(getverdict != pass) {
 						v_responsePrimitive.responseStatusCode := int4000; 
-						f_send(e_mca_in_port, m_httpResponse(v_responsePrimitive));
 					}
-					
-					//mcaPort.send(m_response(v_responsePrimitive));	// TODO have to be deleted
-        
-				} //end f_subscriptionVerificationHandler
+					f_send(e_mca_in_port, m_response(v_responsePrimitive));
+					        
+				} //end f_cse_notifyProcedure_subscriptionVerificationHandler
 				
 				/**
 				 * @desc Default handling message exchange for the notification procedure
@@ -1975,10 +1966,6 @@ module OneM2M_Functions {
 							v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
 							f_send(e_mca_in_port, m_response(v_responsePrimitive));
 						}
-						[] mcaPortIn.receive{
-							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
-						}
 						[] tc_ac.timeout {
 							setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
 						}
@@ -5129,7 +5116,7 @@ module OneM2M_Functions {
 				
 				var verdicttype v_verdict := none;
 	
-				tc_done.start(15.0);
+				tc_done.start;
 				alt {
 					[] p_component.done -> value v_verdict {
 						tc_done.stop;
@@ -5158,7 +5145,7 @@ module OneM2M_Functions {
 				
 				var verdicttype v_verdict := none;
 	
-				tc_done.start(15.0);
+				tc_done.start;
 				alt {
 					[] p_component.done -> value v_verdict {
 						tc_done.stop;
-- 
GitLab