From da4028cc032752480562f5de4a36b39cec81f376 Mon Sep 17 00:00:00 2001
From: Miguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
Date: Thu, 3 Aug 2017 10:36:35 +0200
Subject: [PATCH] Notify Procedure functions regrouped and renamed consistently

Signed-off-by: Miguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
---
 LibOneM2M/OneM2M_Functions.ttcn | 347 +++++++++++++++++++-------------
 OneM2M_TestControl.ttcn         |  97 ++++-----
 OneM2M_Testcases.ttcn           |  92 ++-------
 3 files changed, 271 insertions(+), 265 deletions(-)

diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn
index 31b82c3..96051ba 100644
--- a/LibOneM2M/OneM2M_Functions.ttcn
+++ b/LibOneM2M/OneM2M_Functions.ttcn
@@ -7,7 +7,7 @@
  *  
  *  @author     oneM2M
  *  @version    $URL: https://oldforge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Functions.ttcn $
- *              $Id: OneM2M_Functions.ttcn 334 2017-07-31 08:11:48Z reinaortega $
+ *              $Id: OneM2M_Functions.ttcn 338 2017-08-03 08:36:12Z reinaortega $
  *  @desc       Module containing functions for oneM2M
  *
  */
@@ -328,7 +328,7 @@ module OneM2M_Functions {
 					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_subscriptionVerificationHandler(p_aeIndex, p_responseStatusCode));
+					p_notifyHandler.start(f_cse_notifyProcedure_subscriptionVerificationHandler(p_aeIndex, p_responseStatusCode));
 				}
 			}
 		
@@ -763,62 +763,6 @@ module OneM2M_Functions {
 				unmap(self:acPort, system:acPort); 
 
 			} //end f_cse_resourceAnnouncementHandler			
-			
-    		function f_subscriptionVerificationHandler(in integer p_creatorIndex, in ResponseStatusCode p_responseStatusCode := int2001) runs on CseTester {
-    			// Local variables
-    			var MsgIn v_request;
-    			var ResponsePrimitive v_responsePrimitive;
-    			var template Notification v_notificationRequest := mw_contentNotificationVerification;
-    			
-    			map(self:mcaPort, system:mcaPort);
-    			map(self:acPort, system:acPort);
-    			
-    			//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 
-    			
-    			//Preparation of Notification response to be sent
-    			v_responsePrimitive := valueof(m_responseNotification(p_responseStatusCode, omit));
-    	
-    			tc_ac.start;
-    			alt {
-    				[] mcaPort.receive(mw_request(mw_notify(v_notificationRequest))) -> value v_request {
-    					tc_ac.stop;
-    					setverdict(pass, __SCOPE__ & ":INFO: Notification received");
-						v_responsePrimitive.requestIdentifier := v_request.primitive.requestPrimitive.requestIdentifier;
-//    					if(f_isHierarchical(v_request.primitive.requestPrimitive.primitiveContent.notification.creator)) {
-//							setverdict(fail, __SCOPE__ & ": Creator cannot contain a hierarchical address");
-//							v_responsePrimitive.responseStatusCode := int4000;
-//						}
-//    					if(f_compareURIs(p_creatorIndex, v_request.primitive.requestPrimitive.primitiveContent.notification.creator)) {
-//							setverdict(pass, __SCOPE__ & ": Creator set to originator of the subscription creation primitive");
-//    					} else {
-//							setverdict(fail, __SCOPE__ & ": Creator not set to originator of the subscription creation primitive");
-//							v_responsePrimitive.responseStatusCode := int4000;
-//    					}
-    					mcaPort.send(m_httpResponse(v_responsePrimitive)); 						
-    				}
-    				[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
-    					tc_ac.stop;
-    					setverdict(fail, __SCOPE__ & ":ERROR: Notification received but verificationRequest isn't set to TRUE");							
-    				}
-    				[] mcaPort.receive{
-    					tc_ac.stop;
-    					setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
-    				}
-    				[] tc_ac.timeout {
-    					setverdict(fail, __SCOPE__ & ":ERROR:  No notification received");
-    				}
-    			}
-    	
-    			//mcaPort.send(m_response(v_responsePrimitive));	// TODO have to be deleted
-    
-    			unmap(self:mcaPort, system:mcaPort);
-    			unmap(self:acPort, system:acPort); 
-    
-    		} //end f_subscriptionVerificationHandler
     		
     		function f_checkAttributesToBeSaved (ResourceType p_resourceType, RequestPrimitive p_request, inout ResponsePrimitive p_response) {
     			select (p_resourceType) {
@@ -892,54 +836,6 @@ module OneM2M_Functions {
     
     			// TODO test that if the resource name is returned is the same resource name as used in the create message
     		}
-    
-    		function f_check_notificationContent(in RequestPrimitive p_requestPrimitive, template PrimitiveContent p_primitiveContent) runs on CseTester return boolean{
-    			// Local variables
-    			var boolean v_matchResult := false;
-    			var integer i;
-    			var integer v_numberOfAggregatedNotification;
-    	
-    			if (ischosen(p_primitiveContent.aE)){
-    				if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource)) {
-    					v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.aE, p_primitiveContent.aE)
-    				}
-    				else if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive)) {
-    					v_matchResult :=match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.aE, p_primitiveContent.aE)
-    				}
-    				else if (ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification)) {
-    					v_matchResult := true;
-    					v_numberOfAggregatedNotification := lengthof(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list);
-    					for(i := 0; i< v_numberOfAggregatedNotification; i := i + 1){
-    						if(ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.resource)) {
-    							if(not (match(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.resource.aE, p_primitiveContent.aE))){
-    								v_matchResult := false;
-    							}
-    						}
-    						else if(ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive)) {
-    							if(not (match(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive.primitiveContent.aE, p_primitiveContent.aE))){
-    								v_matchResult := false;
-    							}
-    						}						
-    					}
-    					if (i == 0){
-    						v_matchResult := false;
-    					}
-    				}
-    
-    			}
-    	
-    			if (ischosen(p_primitiveContent.container)){
-    				if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource)) {
-    					v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.container, p_primitiveContent.container)
-    				}
-    				else if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive)) {
-    					v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.container, p_primitiveContent.container)
-    				}
-    			}
-    	
-    			return v_matchResult;
-    
-    		} //end f_check_notificationContent	
 		
     		function f_compareURIs(in integer p_expectedURIIndex, in XSD.ID p_receivedURI) runs on CseTester return boolean{
     			// Local variables
@@ -973,43 +869,138 @@ module OneM2M_Functions {
     
     		} //end f_compareURIs	
 
-    		function f_cse_notifyProcedure(template PrimitiveContent p_primitiveContent) runs on CseTester {
-    			// Local variables
-    			var MsgIn v_request;
-    	
-    			map(self:mcaPort, system:mcaPort);
-    			map(self:acPort, system:acPort);
+			group NotificationFunctions { 
+				
+				function f_cse_notifyProcedure_subscriptionVerificationHandler(in integer p_creatorIndex, in ResponseStatusCode p_responseStatusCode := int2001) runs on CseTester {
+					// Local variables
+					var MsgIn v_request;
+					var ResponsePrimitive v_responsePrimitive;
+					var template Notification v_notificationRequest := mw_contentNotificationVerification;
+    			
+					map(self:mcaPort, system:mcaPort);
+					map(self:acPort, system:acPort);
+    			
+					//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 
+    			
+					//Preparation of Notification response to be sent
+					v_responsePrimitive := valueof(m_responseNotification(p_responseStatusCode, omit));
     	
-    			tc_ac.start;
-    			alt {
-    				[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
-    					tc_ac.stop;
-    					if(f_check_notificationContent(v_request.primitive.requestPrimitive, p_primitiveContent)){
-    						setverdict(pass, __SCOPE__ & ":INFO: Notification received");
-    						mcaPort.send(m_response(valueof(m_responseNotification(int2001))));
-    					}
-    					else{
-    						setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
-    					}
-    				}
-    				[] mcaPort.receive{
-    					tc_ac.stop;
-    					setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
-    				}
-    				[] tc_ac.timeout {
-    					setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
-    				}
-    			}
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_request(mw_notify(v_notificationRequest))) -> value v_request {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ":INFO: Notification received");
+							v_responsePrimitive.requestIdentifier := v_request.primitive.requestPrimitive.requestIdentifier;
+//							if(f_isHierarchical(v_request.primitive.requestPrimitive.primitiveContent.notification.creator)) {
+//								setverdict(fail, __SCOPE__ & ": Creator cannot contain a hierarchical address");
+//								v_responsePrimitive.responseStatusCode := int4000;
+//							}
+//							if(f_compareURIs(p_creatorIndex, v_request.primitive.requestPrimitive.primitiveContent.notification.creator)) {
+//								setverdict(pass, __SCOPE__ & ": Creator set to originator of the subscription creation primitive");
+//							} else {
+//								setverdict(fail, __SCOPE__ & ": Creator not set to originator of the subscription creation primitive");
+//								v_responsePrimitive.responseStatusCode := int4000;
+//							}
+							mcaPort.send(m_httpResponse(v_responsePrimitive)); 						
+						}
+						[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ":ERROR: Notification received but verificationRequest isn't set to TRUE");							
+						}
+						[] mcaPort.receive{
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ":ERROR:  No notification received");
+						}
+					}
     	
+					//mcaPort.send(m_response(v_responsePrimitive));	// TODO have to be deleted
+    
+					unmap(self:mcaPort, system:mcaPort);
+					unmap(self:acPort, system:acPort); 
+    
+				} //end f_subscriptionVerificationHandler
     		
-    			unmap(self:mcaPort, system:mcaPort);
-    			unmap(self:acPort, system:acPort); 
+	    		function f_cse_notifyProcedure_representationHandler(template PrimitiveContent p_primitiveContent) runs on CseTester {
+	    			// Local variables
+	    			var MsgIn v_request;
+	    	
+	    			map(self:mcaPort, system:mcaPort);
+	    			map(self:acPort, system:acPort);
+	    	
+	    			tc_ac.start;
+	    			alt {
+	    				[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
+	    					tc_ac.stop;
+	    					if(f_check_notificationContent(v_request.primitive.requestPrimitive, p_primitiveContent)){
+	    						setverdict(pass, __SCOPE__ & ":INFO: Notification received");
+	    						mcaPort.send(m_response(valueof(m_responseNotification(int2001))));
+	    					}
+	    					else{
+	    						setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
+	    					}
+	    				}
+	    				[] mcaPort.receive{
+	    					tc_ac.stop;
+	    					setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
+	    				}
+	    				[] tc_ac.timeout {
+	    					setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
+	    				}
+	    			}
+	    	
+	    		
+	    			unmap(self:mcaPort, system:mcaPort);
+	    			unmap(self:acPort, system:acPort); 
+	    	
+	    		} //end f_cse_notifyProcedure_representationHandler
+	    		
+				function f_cse_notifyProcedure_aggregatedNoficationHandler(template PrimitiveContent p_primitiveContent,in integer p_numberOfAggregatedNotification) runs on CseTester {
+					// Local variables
+					var MsgIn v_response;
+    
+					map(self:mcaPort, system:mcaPort);
+					map(self:acPort, system:acPort);
+    
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response {
+							tc_ac.stop;
+							if(p_numberOfAggregatedNotification == lengthof(v_response.primitive.requestPrimitive.primitiveContent.aggregatedNotification.notification_list)){
+								if(f_check_notificationContent(v_response.primitive.requestPrimitive, p_primitiveContent)){
+									setverdict(pass, __SCOPE__ & ": Notification received");
+								}
+								else{
+									setverdict(fail, __SCOPE__ & ": Notification received but the content doesn't match");
+								}
+							}
+							else {
+								setverdict(fail, __SCOPE__ & ": Number of Notification in Aggregatednotification isn't right");
+							}
+						}
+						[] mcaPort.receive{
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error, unexpected message received");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No notification received");
+						}
+					}
     	
-    		} //end f_cse_notifyProcedure
-    		
-    		function f_cse_notifyProcedure_subscriptionDeletion( template PrimitiveContent p_primitiveContent) runs on CseTester {
+					unmap(self:mcaPort, system:mcaPort);
+					unmap(self:acPort, system:acPort); 
+    
+				} //end f_cse_notifyProcedure_aggregatedNotificationHandler
+	    		
+	    		function f_cse_notifyProcedure_subscriptionDeletionHandler( template PrimitiveContent p_primitiveContent) runs on CseTester {
 					var MsgIn v_response;
-
+	
 					map(self:mcaPort, system:mcaPort);
 					map(self:acPort, system:acPort);
 					
@@ -1039,9 +1030,82 @@ module OneM2M_Functions {
 					
 					unmap(self:mcaPort, system:mcaPort);
 					unmap(self:acPort, system:acPort);  
-
-				} //end f_cse_notifyProcedure_subscriptionDeletion    		
-    		
+	
+				} //end f_cse_notifyProcedure_subscriptionDeletionHandler  
+				
+				function f_cse_notifyProcedure_noNotificationHandler() runs on CseTester {
+					// Local variables
+					var MsgIn v_response;
+	
+					map(self:mcaPort, system:mcaPort);
+					map(self:acPort, system:acPort);
+		
+					tc_ac.start(10.0);
+					alt {
+						[] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error, Non expected notification received");
+						}
+						[] tc_ac.timeout {
+							setverdict(pass, __SCOPE__ & ": No notification received");
+						}
+					}
+	
+					unmap(self:mcaPort, system:mcaPort);
+					unmap(self:acPort, system:acPort); 
+	
+				} //end f_cse_notifyProcedure_noNotification Handler
+				
+				function f_check_notificationContent(in RequestPrimitive p_requestPrimitive, template PrimitiveContent p_primitiveContent) runs on CseTester return boolean{
+					// Local variables
+					var boolean v_matchResult := false;
+					var integer i;
+					var integer v_numberOfAggregatedNotification;
+    	
+					if (ischosen(p_primitiveContent.aE)){
+						if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource)) {
+							v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.aE, p_primitiveContent.aE)
+						}
+						else if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive)) {
+							v_matchResult :=match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.aE, p_primitiveContent.aE)
+						}
+						else if (ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification)) {
+							v_matchResult := true;
+							v_numberOfAggregatedNotification := lengthof(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list);
+							for(i := 0; i< v_numberOfAggregatedNotification; i := i + 1){
+								if(ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.resource)) {
+									if(not (match(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.resource.aE, p_primitiveContent.aE))){
+										v_matchResult := false;
+									}
+								}
+								else if(ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive)) {
+									if(not (match(p_requestPrimitive.primitiveContent.aggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive.primitiveContent.aE, p_primitiveContent.aE))){
+										v_matchResult := false;
+									}
+								}						
+							}
+							if (i == 0){
+								v_matchResult := false;
+							}
+						}
+    
+					}
+    	
+					if (ischosen(p_primitiveContent.container)){
+						if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource)) {
+							v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.container, p_primitiveContent.container)
+						}
+						else if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive)) {
+							v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.container, p_primitiveContent.container)
+						}
+					}
+    	
+					return v_matchResult;
+    
+				} //end f_check_notificationContent	
+				
+			}// end of group NotificationFunctions 		
+	    		
     		/**
     		 * @desc It determines whether the addressing method of the given address is non-hierarchical. Not valid for CSE-Base as target
     		 * @param p_resourceAddress
@@ -1080,6 +1144,7 @@ module OneM2M_Functions {
     			   return false;
     			}
     		}
+			
     		
 			/**
 			 * @desc It determines whether the addressing method of the given address is hierarchical. Not valid for CSE-Base as target
diff --git a/OneM2M_TestControl.ttcn b/OneM2M_TestControl.ttcn
index d37533e..4cb438c 100644
--- a/OneM2M_TestControl.ttcn
+++ b/OneM2M_TestControl.ttcn
@@ -7,7 +7,7 @@
  *  
  *  @author     oneM2M
  *  @version    $URL: https://oldforge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_TestControl.ttcn $
- *              $Id: OneM2M_TestControl.ttcn 335 2017-07-31 09:04:53Z reinaortega $
+ *              $Id: OneM2M_TestControl.ttcn 338 2017-08-03 08:36:12Z reinaortega $
  *  @desc       Test control module for oneM2M
  *
  */
@@ -36,13 +36,13 @@ module OneM2M_TestControl {
 		execute(TC_CSE_REG_CRE_008());
 		execute(TC_CSE_REG_CRE_009());
 		execute(TC_CSE_REG_CRE_010());
-		execute(TC_CSE_REG_CRE_015_LBL());
-		execute(TC_CSE_REG_CRE_015_CST());
-		execute(TC_CSE_REG_CRE_015_POA());
-		execute(TC_CSE_REG_CRE_015_NL());
+		execute(TC_CSE_REG_CRE_016_LBL());
+		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_021());
 		execute(TC_CSE_REG_CRE_022());
+		execute(TC_CSE_REG_CRE_023());
 		execute(TC_CSE_REG_CRE_024());
 		execute(TC_CSE_REG_CRE_026());
 		execute(TC_CSE_REG_RET_001());
@@ -50,33 +50,7 @@ module OneM2M_TestControl {
 		execute(TC_CSE_REG_RET_008());
 		execute(TC_CSE_REG_UPD_001());
 		execute(TC_CSE_REG_DEL_001());
-		execute(TC_CSE_DMR_BV_001_01());
-		execute(TC_CSE_DMR_BV_001_02());
-		execute(TC_CSE_DMR_BV_001_03());
-		execute(TC_CSE_DMR_BV_002_01());
-		execute(TC_CSE_DMR_BV_002_02());
-		execute(TC_CSE_DMR_BV_002_03());
-		execute(TC_CSE_DMR_BV_002_04());
-		execute(TC_CSE_DMR_BV_002_05());
-		execute(TC_CSE_DMR_BV_002_06());
-		execute(TC_CSE_DMR_BV_003_01());
-		execute(TC_CSE_DMR_BV_003_02());
-		execute(TC_CSE_DMR_BV_003_03());
-		execute(TC_CSE_DMR_BV_003_04());
-		execute(TC_CSE_DMR_BV_003_05());
-		execute(TC_CSE_DMR_BV_003_06());
-		execute(TC_CSE_DMR_BV_004_01());
-		execute(TC_CSE_DMR_BV_004_02());
-		execute(TC_CSE_DMR_BV_004_03());
-		execute(TC_CSE_DMR_BV_004_04());
-		execute(TC_CSE_DMR_BV_004_05());
-		execute(TC_CSE_DMR_BV_004_06());
-		execute(TC_CSE_DMR_BV_005_01());
-		execute(TC_CSE_DMR_BV_005_02());
-		execute(TC_CSE_DMR_BV_005_03());
-		execute(TC_CSE_DMR_BV_005_04());
-		execute(TC_CSE_DMR_BV_005_05());
-		execute(TC_CSE_DMR_BV_005_06());
+
 		execute(TC_CSE_DMR_CRE_001_CNT_CB());
 		execute(TC_CSE_DMR_CRE_001_CNT_AE());
 		execute(TC_CSE_DMR_CRE_001_CNT_CNT());
@@ -164,6 +138,33 @@ module OneM2M_TestControl {
 		execute(TC_CSE_DMR_RET_008_SCH_AT());
 		execute(TC_CSE_DMR_RET_008_PCH_AT());
 		execute(TC_CSE_DMR_RET_008_SUB_AT());
+		execute(TC_CSE_DMR_RET_020_RCN_0());
+		execute(TC_CSE_DMR_RET_020_RCN_2());
+		execute(TC_CSE_DMR_RET_020_RCN_3());
+		execute(TC_CSE_DMR_RET_021_CNT());
+		execute(TC_CSE_DMR_RET_021_GRP());
+		execute(TC_CSE_DMR_RET_021_ACP());
+		execute(TC_CSE_DMR_RET_021_SCH());
+		execute(TC_CSE_DMR_RET_021_PCH());
+		execute(TC_CSE_DMR_RET_021_SUB());
+		execute(TC_CSE_DMR_RET_022_CNT());
+		execute(TC_CSE_DMR_RET_022_GRP());
+		execute(TC_CSE_DMR_RET_022_ACP());
+		execute(TC_CSE_DMR_RET_022_SCH());
+		execute(TC_CSE_DMR_RET_022_PCH());
+		execute(TC_CSE_DMR_RET_022_SUB());
+		execute(TC_CSE_DMR_RET_023_CNT());
+		execute(TC_CSE_DMR_RET_023_GRP());
+		execute(TC_CSE_DMR_RET_023_ACP());
+		execute(TC_CSE_DMR_RET_023_SCH());
+		execute(TC_CSE_DMR_RET_023_PCH());
+		execute(TC_CSE_DMR_RET_023_SUB());
+		execute(TC_CSE_DMR_RET_024_CNT());
+		execute(TC_CSE_DMR_RET_024_GRP());
+		execute(TC_CSE_DMR_RET_024_ACP());
+		execute(TC_CSE_DMR_RET_024_SCH());
+		execute(TC_CSE_DMR_RET_024_PCH());
+		execute(TC_CSE_DMR_RET_024_SUB());
 		execute(TC_CSE_DMR_UPD_001_CNT_LBL());
 		execute(TC_CSE_DMR_UPD_001_GRP_LBL());
 		execute(TC_CSE_DMR_UPD_001_ACP_LBL());
@@ -299,27 +300,27 @@ module OneM2M_TestControl {
 		execute(TC_CSE_DIS_006());
 		execute(TC_CSE_DIS_007());
 		execute(TC_CSE_SUB_CRE_001_SUB());
-		execute(TC_CSE_SUB_CRE_001_SUB());
+		execute(TC_CSE_SUB_CRE_001_CIN());
 		execute(TC_CSE_SUB_CRE_002());
 		execute(TC_CSE_SUB_CRE_003());
+		execute(TC_CSE_SUB_CRE_004());
+		execute(TC_CSE_SUB_CRE_005());
 		execute(TC_CSE_SUB_NTF_001());
 		execute(TC_CSE_SUB_NTF_002());
+		execute(TC_CSE_SUB_NTF_003());
 		execute(TC_CSE_SUB_UPD_001());
-		execute(TC_CSE_SUB_CRE_007());
-		execute(TC_CSE_SUB_DEL_008());
-		execute(TC_CSE_SUB_DEL_009());
-		execute(TC_CSE_SUB_CRE_010());
-		execute(TC_CSE_SUB_UPD_011());
-		execute(TC_CSE_SUB_UPD_012());
-		execute(TC_CSE_SUB_UPD_013());
-		execute(TC_CSE_SUB_UPD_014());
-		execute(TC_CSE_SUB_UPD_015());
-		execute(TC_CSE_SUB_UPD_016());
+		execute(TC_CSE_SUB_UPD_002());
+		execute(TC_CSE_SUB_UPD_003());
+		execute(TC_CSE_SUB_UPD_004());
+		execute(TC_CSE_SUB_UPD_005());
+		execute(TC_CSE_SUB_UPD_006());
+		execute(TC_CSE_SUB_UPD_007());
+		execute(TC_CSE_SUB_UPD_008());
+		execute(TC_CSE_SUB_UPD_009());
 		execute(TC_CSE_SUB_DEL_001());
-		execute(TC_CSE_SUB_UPD_018());
-		execute(TC_CSE_SUB_NTF_003());
-		execute(TC_CSE_SUB_UPD_020());
-		
+		execute(TC_CSE_SUB_DEL_002());
+		execute(TC_CSE_SUB_DEL_003());
+				
 		execute(TC_CSE_SEC_ACP_001_CRE());
 		execute(TC_CSE_SEC_ACP_001_UPD());
 		execute(TC_CSE_SEC_ACP_001_RET());
diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn
index 00710ff..c39b1aa 100644
--- a/OneM2M_Testcases.ttcn
+++ b/OneM2M_Testcases.ttcn
@@ -7,7 +7,7 @@
  *  
  *  @author     oneM2M
  *  @version    $URL: https://oldforge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Testcases.ttcn $
- *              $Id: OneM2M_Testcases.ttcn 337 2017-08-01 08:07:17Z reinaortega $
+ *              $Id: OneM2M_Testcases.ttcn 338 2017-08-03 08:36:12Z reinaortega $
  *  @desc       Module containing test cases for oneM2M
  *
  */
@@ -2226,7 +2226,7 @@ module OneM2M_Testcases {
 							if(match(int23, p_parentRequestPrimitive.resourceType)){
 								v_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", v_poaList), -1); // AE2 is registred
 								p_parentRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)}; 
-								p_notifyHandler.start(f_subscriptionVerificationHandler(v_parentIndex));
+								p_notifyHandler.start(f_cse_notifyProcedure_subscriptionVerificationHandler(v_parentIndex));
 							}
 							v_parentIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_parentIndex);
 						}										
@@ -2236,7 +2236,7 @@ module OneM2M_Testcases {
 						if(match(int23, p_requestPrimitive.resourceType)){
 							v_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", v_poaList), -1); // AE2 is registred
 							p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)}; 
-							p_notifyHandler.start(f_subscriptionVerificationHandler(v_parentIndex));
+							p_notifyHandler.start(f_cse_notifyProcedure_subscriptionVerificationHandler(v_parentIndex));
 						}
     					
     					v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_parentIndex);
@@ -16304,7 +16304,7 @@ module OneM2M_Testcases {
 					// Test Body
 					v_request:= f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
 					
-					v_notifyHandler.start(f_cse_notifyProcedure(v_contentNotification)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentNotification)); // check if the notification is well received and if its content matchs
 					
 					mcaPort.send(m_request(v_request));
     				tc_ac.start;
@@ -16513,7 +16513,7 @@ module OneM2M_Testcases {
 					};
 
 					// Test Body
-					v_notifyHandler.start(f_CSE_SUB_UPD_007(v_contentResponse, 2)); // check that no notification is received
+					v_notifyHandler.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, 2)); // check that no notification is received
 
 					v_updateRequest.primitiveContent.aE.labels := v_labels_1;
 					v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1
@@ -16575,7 +16575,7 @@ module OneM2M_Testcases {
 					// Test Body
 					v_contentResponse.aE := mw_contentAeBase; // all attributes expected
 					
-					v_notifyHandler.start(f_cse_notifyProcedure(v_contentResponse)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs
 					
 					v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request
 					v_updateRequest.primitiveContent.aE.labels := v_labels_1; 
@@ -16651,7 +16651,7 @@ module OneM2M_Testcases {
 					//TODO Use f_getTemplateFromPrimitiveContent() which needs to be modified to receive the template in which the output template will be built upon
 					v_contentResponse.aE.labels := ?;// only modified attribute expected
 					
-					v_notifyHandler.start(f_cse_notifyProcedure(v_contentResponse)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs
 			
 					v_updateRequest.primitiveContent.aE.labels := v_labels_1; 
 			
@@ -16729,7 +16729,7 @@ module OneM2M_Testcases {
 					f_is_component_done(v_notifyHandler);
 			
 					// Test Body
-					v_notifyHandler.start(f_cse_notifyProcedure(v_contentResponse)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs
 					
 					mcaPort.send(m_request(v_request));
 					tc_ac.start;
@@ -16802,7 +16802,7 @@ module OneM2M_Testcases {
 					};
 					
 					// Test Body
-					v_notifyHandler.start(f_cse_notifyProcedure(v_contentResponse)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs
 
 					v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // AE update request
 					f_cse_updateResource(v_request); // AE update
@@ -16887,7 +16887,7 @@ module OneM2M_Testcases {
 					};
 	
 					// Test Body
-					v_notifyHandler.start(f_cse_notifyProcedure(v_contentResponse)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs
 					v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // AE update request
 					f_cse_updateResource(v_request); // AE update
 					
@@ -16967,7 +16967,7 @@ module OneM2M_Testcases {
 					};
 
 					// Test Body
-					v_notifyHandler.start(f_CSE_SUB_UPD_006()); // check that no notification is received
+					v_notifyHandler.start(f_cse_notifyProcedure_noNotificationHandler()); // check that no notification is received
 		
 					mcaPort.send(m_request(v_request));
 					tc_ac.start;
@@ -16999,29 +16999,6 @@ module OneM2M_Testcases {
 
 				} // end TC_CSE_SUB_UPD_006
 				
-				function f_CSE_SUB_UPD_006() runs on CseTester {
-					// Local variables
-					var MsgIn v_response;
-
-					map(self:mcaPort, system:mcaPort);
-					map(self:acPort, system:acPort);
-	
-					tc_ac.start(10.0);
-					alt {
-						[] mcaPort.receive{
-							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ": Error, Notification isn't expected ");
-						}
-						[] tc_ac.timeout {
-							setverdict(pass, __SCOPE__ & ": No notification received");
-						}
-					}
-
-					unmap(self:mcaPort, system:mcaPort);
-					unmap(self:acPort, system:acPort); 
-
-				} //end f_CSE_SUB_UPD_006
-				
 				/**
 				 * @desc Check that the IUT sends aggregated notification to the subscriber resource when the number value of the batchNotify attribute is set to GROUP_LIMIT and when this number have been reached
 				 * 
@@ -17065,7 +17042,7 @@ module OneM2M_Testcases {
 					};
 
 					// Test Body
-					v_notifyHandler.start(f_CSE_SUB_UPD_007(v_contentResponse, numberOfAggregatedNotification)); // check that no notification is received
+					v_notifyHandler.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, numberOfAggregatedNotification)); // check that no notification is received
 					
 					v_updateRequest.primitiveContent.aE.labels := v_labels_1;
 					v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1
@@ -17088,43 +17065,6 @@ module OneM2M_Testcases {
 					f_cf01Down();
 
 				} // end TC_CSE_SUB_UPD_007
-				
-				function f_CSE_SUB_UPD_007(template PrimitiveContent p_primitiveContent,in integer p_numberOfAggregatedNotification) runs on CseTester {
-    				// Local variables
-    				var MsgIn v_response;
-    
-    				map(self:mcaPort, system:mcaPort);
-    				map(self:acPort, system:acPort);
-    
-    				tc_ac.start;
-    				alt {
-    					[] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response {
-    						tc_ac.stop;
-    						if(p_numberOfAggregatedNotification == lengthof(v_response.primitive.requestPrimitive.primitiveContent.aggregatedNotification.notification_list)){
-        						if(f_check_notificationContent(v_response.primitive.requestPrimitive, p_primitiveContent)){
-        							setverdict(pass, __SCOPE__ & ": Notification received");
-        						}
-        						else{
-        							setverdict(fail, __SCOPE__ & ": Notification received but the content doesn't match");
-        						}
-    						}
-    						else {
-								setverdict(fail, __SCOPE__ & ": Number of Notification in Aggregatednotification isn't right");
-    						}
-    					}
-    					[] mcaPort.receive{
-    						tc_ac.stop;
-    						setverdict(fail, __SCOPE__ & ": Error, unexpected message received");
-    					}
-    					[] tc_ac.timeout {
-    						setverdict(fail, __SCOPE__ & ": No notification received");
-    					}
-    				}
-    	
-    				unmap(self:mcaPort, system:mcaPort);
-    				unmap(self:acPort, system:acPort); 
-    
-    			} //end f_CSE_SUB_UPD_007
 					
             	/**
             	 * @desc Check that the IUT sends the latest notification to the subscriber resource when latestNotify is set to TRUE, the number value of the batchNotify attribute is set to GROUP_LIMIT and when this number have been reached
@@ -17173,7 +17113,7 @@ module OneM2M_Testcases {
 					};
 					
 					// Test Body
-					v_notifyHandler.start(f_cse_notifyProcedure(v_contentResponse)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs
             					
             		v_updateRequest.primitiveContent.aE.labels := v_labels_1; 
             		v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1
@@ -17241,7 +17181,7 @@ module OneM2M_Testcases {
 					};
 			
 					// Test Body
-					v_notifyHandler.start(f_cse_notifyProcedure(v_contentResponse)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs
 					
 					mcaPort.send(m_request(v_request));
 					tc_ac.start;
@@ -17416,7 +17356,7 @@ module OneM2M_Testcases {
 					};
 
 					//Test Body
-					v_notifyHandler.start(f_cse_notifyProcedure_subscriptionDeletion(v_contentNotification)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_subscriptionDeletionHandler(v_contentNotification)); // check if the notification is well received and if its content matchs
 					
 					v_deleteRequest:= valueof(m_deleteRequest(f_getResourceAddress(v_aeIndex))); // Ae delete request
 					
@@ -17489,7 +17429,7 @@ module OneM2M_Testcases {
 					};
 
 					//Test Body
-					v_notifyHandler.start(f_cse_notifyProcedure(v_contentNotification)); // check if the notification is well received and if its content matchs
+					v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentNotification)); // check if the notification is well received and if its content matchs
 					
 					v_deleteRequest := valueof(m_deleteRequest(f_getResourceAddress(v_containerResourceIndex)));// Container deletion request
 					
-- 
GitLab