From 7af1b2f072c285d71d5a39e3c5f88b998f33eeaf Mon Sep 17 00:00:00 2001
From: acverdugo <acverdugo@at4wireless.com>
Date: Thu, 11 Jan 2018 16:40:54 +0100
Subject: [PATCH] - Small fix in f_cse_postamble_ae function - Updated comments
 in f_cse_notifyProcedure_updateHandler function - New PICS PICS_ASN_CSE
 created - New template m_retrieveFilterCriteria - New template
 m_filterCriteria - New parameter in template mw_createAEAnnc - New parameter
 in template mw_contentCreateAEAnnc - Fixed f_CSE_DIS_008 Test Case -
 Implemented TC_CSE_REG_CRE_006 Test Case - Implemented TC_CSE_REG_CRE_007
 Test Case - Small fix in TC_CSE_REG_CRE_008 Test Case - Small fix in
 TC_CSE_REG_CRE_010 Test Case - Small fix in TC_CSE_REG_CRE_020 Test Case -
 Small fix in TC_CSE_DIS_007 Test Case - Small fix in TC_CSE_DIS_008_CRB_CRA
 Test Case - Small fix in TC_CSE_DIS_008_MS_US Test Case - Small fix in
 TC_CSE_DIS_008_STS_STB Test Case - Small fix in TC_CSE_DIS_008_EXB_EXA Test
 Case

Signed-off-by: acverdugo <acverdugo@at4wireless.com>
---
 LibOneM2M/OneM2M_Functions.ttcn     |   7 +-
 LibOneM2M/OneM2M_Pics.ttcn          |   3 +-
 LibOneM2M/OneM2M_Templates.ttcn     |  93 ++++---
 OneM2M_PermutationFunctions.ttcn    | 383 ++++++++++++++--------------
 OneM2M_TestControl_MN_profile.ttcn  |   2 +-
 OneM2M_Testcases_CSE_Release_1.ttcn | 144 ++++++++++-
 6 files changed, 391 insertions(+), 241 deletions(-)

diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn
index 03fa446..077e07d 100644
--- a/LibOneM2M/OneM2M_Functions.ttcn
+++ b/LibOneM2M/OneM2M_Functions.ttcn
@@ -746,7 +746,8 @@ module OneM2M_Functions {
 				if(p_ae.running) {
 					p_ae.stop;
 				}
-					p_ae.start(f_cse_postamble_deleteResources());
+				p_ae.start(f_cse_postamble_deleteResources());
+				p_ae.done;
 			}
 			
 			/**
@@ -1567,15 +1568,13 @@ module OneM2M_Functions {
 				
 				/**
 				 * @desc Handling message exchange for the AE Annc update
-				 * @param p_responseStatusCode Response Status Code to be used for the response to the AE Annc request
 				 * @verdict 
 				 */
 				//TODO TO BE FINALIZED
 				function f_cse_notifyProcedure_updateHandler() runs on CseSimu {
 					// Local variables
 					var ResponsePrimitive v_responsePrimitive;
-					var template Notification v_notificationRequest := mw_contentNotification_any;
-	 
+					var template Notification v_notificationRequest := mw_contentNotification_any;	 
 
 					//Preparation of Notification response to be sent
 					v_responsePrimitive := valueof(m_responseNotification(int2004, omit));
diff --git a/LibOneM2M/OneM2M_Pics.ttcn b/LibOneM2M/OneM2M_Pics.ttcn
index 8061df0..3f792c0 100644
--- a/LibOneM2M/OneM2M_Pics.ttcn
+++ b/LibOneM2M/OneM2M_Pics.ttcn
@@ -19,7 +19,8 @@ module OneM2M_Pics {
 	 */
 	modulepar boolean PICS_ACP_SUPPORT := true;
 	modulepar boolean PICS_IN_CSE := true;
-	modulepar boolean PICS_MN_CSE := true;	
+	modulepar boolean PICS_MN_CSE := true;
+	modulepar boolean PICS_ASN_CSE := true;		
 	modulepar boolean PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT := true;
 	modulepar boolean PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT := true;
 	
diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn
index 625f2a4..016b5c9 100644
--- a/LibOneM2M/OneM2M_Templates.ttcn
+++ b/LibOneM2M/OneM2M_Templates.ttcn
@@ -230,6 +230,17 @@ module OneM2M_Templates {
 				}
 			};
 			
+			/**
+			  * @desc RETRIEVE request primtive containing the Filter Criteria in the filterCriteria field
+			  * @param p_targetResourceAddress Target resource address 
+			  * @param p_filterCriteria FilterCriteria
+			  * @param p_originator Originator (from)
+			 */
+			template (value) RequestPrimitive m_retrieveFilterCriteria(XSD.ID p_targetResourceAddress, in XSD.ID p_originator, in template (value) FilterCriteria p_filterCriteria) modifies m_retrieve := {
+				requestIdentifier := "m_retrieveResourceFilterUsageOption" & f_rnd(1, 1000000),
+				filterCriteria := p_filterCriteria
+			};
+			
 			/**
 			  * @desc RETRIEVE request primtive containing the Filter Criteria in the filterCriteria field
 			  * @param p_targetResourceAddress Target resource address 
@@ -289,32 +300,56 @@ module OneM2M_Templates {
 			};
 			
 			/**
-				  * @desc RETRIEVE request primtive containing the Discovery Type in the discoveryResultType field and Filter Criteria in the filterCriteria field
-				  * @param p_targetResourceAddress Target resource address 
-				  * @param p_filterCriteria FilterCriteria
-				  * @param p_originator Originator (from)
-				 */
-				template (value) RequestPrimitive m_retrieveInvalidFormatOption(XSD.ID p_targetResourceAddress, in XSD.ID p_originator) modifies m_retrieve := {
-					requestIdentifier := "m_retrieveResourceFilterUsageOption" & f_rnd(1, 1000000),
-					filterCriteria := {
-						createdBefore := omit,
-						createdAfter := omit,
-						modifiedSince := omit,
-						unmodifiedSince := omit,
-						stateTagSmaller := omit,
-						stateTagBigger := omit,
-						expireBefore := omit,
-						expireAfter := omit,
-						labels := omit,
-						resourceType := omit,
-						sizeAbove := omit,
-						sizeBelow := omit,
-						contentType_list := {},
-						attribute_list := {},
-						filterUsage := omit,
-						limit := omit
-					}
-				};
+			  * @desc RETRIEVE request primtive containing the Discovery Type in the discoveryResultType field and Filter Criteria in the filterCriteria field
+			  * @param p_targetResourceAddress Target resource address 
+			  * @param p_filterCriteria FilterCriteria
+			  * @param p_originator Originator (from)
+			 */
+			template (value) RequestPrimitive m_retrieveInvalidFormatOption(XSD.ID p_targetResourceAddress, in XSD.ID p_originator) modifies m_retrieve := {
+				requestIdentifier := "m_retrieveResourceFilterUsageOption" & f_rnd(1, 1000000),
+				filterCriteria := {
+					createdBefore := omit,
+					createdAfter := omit,
+					modifiedSince := omit,
+					unmodifiedSince := omit,
+					stateTagSmaller := omit,
+					stateTagBigger := omit,
+					expireBefore := omit,
+					expireAfter := omit,
+					labels := omit,
+					resourceType := omit,
+					sizeAbove := omit,
+					sizeBelow := omit,
+					contentType_list := {},
+					attribute_list := {},
+					filterUsage := omit,
+					limit := omit
+				}
+			};
+			
+			/**
+			  * @desc FilterCriteria empty template
+			 */
+			template (value) FilterCriteria m_filterCriteria := {
+				createdBefore := omit,
+				createdAfter := omit,
+				modifiedSince := omit,
+				unmodifiedSince := omit,
+				stateTagSmaller := omit,
+				stateTagBigger := omit,
+				expireBefore := omit,
+				expireAfter := omit,
+				labels := omit,
+				resourceType := omit,
+				sizeAbove := omit,
+				sizeBelow := omit,
+				contentType_list := {},
+				attribute_list := {},
+				filterUsage := omit,
+				limit := omit
+			}
+			
+			
 			
 		}//end group Retrieve
 
@@ -556,7 +591,7 @@ module OneM2M_Templates {
 			/**
 			 * @desc Reception template for CREATE AEAnnc
 			 */
-			template RequestPrimitive mw_createAEAnnc(template (omit) XSD.ID p_from := omit, template (omit) XSD.ID p_to := omit, template (omit) AcpType p_accessControlPolicyIds := omit) modifies mw_create := {
+			template RequestPrimitive mw_createAEAnnc(template (omit) XSD.ID p_from := omit, template (omit) XSD.ID p_to := omit, template (omit) AcpType p_accessControlPolicyIds := omit, template XSD.AnyURI p_link := ?) modifies mw_create := {
 				resourceType := int10002,
 				primitiveContent := {aEAnnc := mw_contentCreateAEAnnc({"Credential-ID:None"}, p_accessControlPolicyIds)}
 			};
@@ -1240,7 +1275,7 @@ module OneM2M_Templates {
 		 * @param p_appId App ID
 		 * @param p_nodeLink Node link
 		 */
-		template AEAnnc_optional mw_contentCreateAEAnnc (in template  Labels p_labels := ?, in template AcpType p_accessControlPolicyIds := ?) := {
+		template AEAnnc_optional mw_contentCreateAEAnnc (in template  Labels p_labels := ?, in template AcpType p_accessControlPolicyIds := ?, template XSD.AnyURI p_link := ?) := {
 			resourceName := omit,//NA M
 			resourceType := omit,//NA M
 			resourceID := omit,//NA M
@@ -1250,7 +1285,7 @@ module OneM2M_Templates {
 			labels := p_labels,//MA
 			accessControlPolicyIDs := p_accessControlPolicyIds,//MA
 			expirationTime := ?,//MA M
-			link := ?,//M
+			link := p_link,//M
 			appName := omit,//OA
 			app_ID := omit,//OA
 			aE_ID := omit,//OA
diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn
index 4abc904..43fb43f 100644
--- a/OneM2M_PermutationFunctions.ttcn
+++ b/OneM2M_PermutationFunctions.ttcn
@@ -2147,214 +2147,214 @@ module OneM2M_PermutationFunctions {
     				
 					function f_CSE_DMR_CRE_005(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, in AttributeAux p_invalidAttribute) runs on AeSimu {
     				
-							// Local variables
-							var MsgIn v_response;
-							var RequestPrimitive v_request;
-							var integer v_aeIndex := -1;
-									   
-							// Test control
-    				
-							// Test component configuration
-							f_cf01Up();
-    				
-							// Test adapter configuration
-    				
-							// Preamble
-							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); 
+						// Local variables
+						var MsgIn v_response;
+						var RequestPrimitive v_request;
+						var integer v_aeIndex := -1;
+								   
+						// Test control
+				
+						// Test component configuration
+						f_cf01Up();
+				
+						// Test adapter configuration
+				
+						// Preamble
+						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); 
+					
+						// Test Body
+						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
 						
-							// Test Body
-							v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
-							
-							mcaPort.send(m_request(v_request, {p_invalidAttribute}));
-							tc_ac.start;
-							alt {
-								[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response {
-									tc_ac.stop;
-									setverdict(pass, __SCOPE__ & ": Creation rejected for resource type " & int2str(enum2int(p_resourceType)) & " containing an invalid value for attribute " & p_invalidAttribute.name);
-								}								
-								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
-									tc_ac.stop;
-									setverdict(fail, __SCOPE__ & ": Wrong response status code");
-								}								
-								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
-									tc_ac.stop;
-									setverdict(fail, __SCOPE__ & ": Accepted creation of resource type " & int2str(enum2int(p_resourceType)) & " containing an invalid value for attribute" & p_invalidAttribute.name);
-								}
-								[] tc_ac.timeout {
-									setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(p_resourceType)));  
-								}
-							}	
-    								
-							f_checkAeSimuStatus();
-    					
-							//Check to see if the resource is NOT present
-							if(f_isResourceNotPresent(v_aeIndex, f_getResourceName(v_request.primitiveContent))){
-							  setverdict(pass, __SCOPE__ & ":INFO: Resource not created");
-							} else {
-							  setverdict(fail, __SCOPE__ & ":ERROR: Resource created");
+						mcaPort.send(m_request(v_request, {p_invalidAttribute}));
+						tc_ac.start;
+						alt {
+							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response {
+								tc_ac.stop;
+								setverdict(pass, __SCOPE__ & ": Creation rejected for resource type " & int2str(enum2int(p_resourceType)) & " containing an invalid value for attribute " & p_invalidAttribute.name);
+							}								
+							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
+								tc_ac.stop;
+								setverdict(fail, __SCOPE__ & ": Wrong response status code");
+							}								
+							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+								tc_ac.stop;
+								setverdict(fail, __SCOPE__ & ": Accepted creation of resource type " & int2str(enum2int(p_resourceType)) & " containing an invalid value for attribute" & p_invalidAttribute.name);
+							}
+							[] tc_ac.timeout {
+								setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(p_resourceType)));  
 							}
+						}	
+								
+						f_checkAeSimuStatus();
+					
+						//Check to see if the resource is NOT present
+						if(f_isResourceNotPresent(v_aeIndex, f_getResourceName(v_request.primitiveContent))){
+						  setverdict(pass, __SCOPE__ & ":INFO: Resource not created");
+						} else {
+						  setverdict(fail, __SCOPE__ & ":ERROR: Resource created");
+						}
+					
+				        		
+						// Postamble
+						f_cse_postamble_deleteResources();
 						
-					        		
-							// Postamble
-							f_cse_postamble_deleteResources();
-							
-							// Tear down
-							f_cf01Down();
-						    				
-						}//end f_CSE_DMR_CRE_005
+						// Tear down
+						f_cf01Down();
+					    				
+					}//end f_CSE_DMR_CRE_005
 						
 					function f_CSE_DMR_CRE_006(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu return ResponsePrimitive {
     				
-							// Local variables
-							var MsgIn v_response;
-							var RequestPrimitive v_request;
-							var integer v_aeIndex := -1;
-							var integer v_resourceIndex := -1;
-											   
-							// Test control
-    				
-							// Test component configuration
-							f_cf01Up();
-    				
-							// Test adapter configuration
-    				
-							// Preamble
-							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); 
-						
-							// Test Body
-							v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
-    					
-							mcaPort.send(m_request(v_request));
-							tc_ac.start;
-							alt {
-								[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response {
-									tc_ac.stop;
-									setverdict(pass, __SCOPE__ & ": Accepted creation rejected for resource type " & int2str(enum2int(p_resourceType)));
-									f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive);
-									v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_aeIndex);
-								}
-								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
-									tc_ac.stop;
-									setverdict(fail, __SCOPE__ & ": Wrong response status code");
-								}
-								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
-									tc_ac.stop;
-									setverdict(fail, __SCOPE__ & ": Creation rejected of resource type " & int2str(enum2int(p_resourceType)));
-								}
-								[] tc_ac.timeout {
-									setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(p_resourceType)));
-								}
-							}	
-    								
-							f_checkAeSimuStatus();
-    						
-							//Check to see if the resource is present or not
-							if(f_isResourcePresent(v_resourceIndex)){
-								setverdict(pass, __SCOPE__ & ":INFO: Resource created");
-							} else {
-								setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
+						// Local variables
+						var MsgIn v_response;
+						var RequestPrimitive v_request;
+						var integer v_aeIndex := -1;
+						var integer v_resourceIndex := -1;
+										   
+						// Test control
+				
+						// Test component configuration
+						f_cf01Up();
+				
+						// Test adapter configuration
+				
+						// Preamble
+						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); 
+					
+						// Test Body
+						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
+					
+						mcaPort.send(m_request(v_request));
+						tc_ac.start;
+						alt {
+							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response {
+								tc_ac.stop;
+								setverdict(pass, __SCOPE__ & ": Accepted creation rejected for resource type " & int2str(enum2int(p_resourceType)));
+								f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive);
+								v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_aeIndex);
 							}
-    								
-							// Postamble
-							f_cse_postamble_deleteResources();
-							
-							// Tear down
-							f_cf01Down();
+							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
+								tc_ac.stop;
+								setverdict(fail, __SCOPE__ & ": Wrong response status code");
+							}
+							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
+								tc_ac.stop;
+								setverdict(fail, __SCOPE__ & ": Creation rejected of resource type " & int2str(enum2int(p_resourceType)));
+							}
+							[] tc_ac.timeout {
+								setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(p_resourceType)));
+							}
+						}	
+								
+						f_checkAeSimuStatus();
 						
-							return vc_response.primitive.responsePrimitive;
-    					    				
-						}//end f_CSE_DMR_CRE_006
+						//Check to see if the resource is present or not
+						if(f_isResourcePresent(v_resourceIndex)){
+							setverdict(pass, __SCOPE__ & ":INFO: Resource created");
+						} else {
+							setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
+						}
+								
+						// Postamble
+						f_cse_postamble_deleteResources();
+						
+						// Tear down
+						f_cf01Down();
+					
+						return vc_response.primitive.responsePrimitive;
+					    				
+					}//end f_CSE_DMR_CRE_006
 						
 					function f_CSE_DMR_CRE_012(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, in AttributeList p_optionalAttribute) runs on AeSimu {
     				
-							// Local variables
-							var MsgIn v_response;
-							var RequestPrimitive v_request;
-							var integer v_containerIndex := -1;
-							var integer v_parentIndex := -1;
-							var integer v_acpAuxIndex := -1;
-							var integer v_ae2Index := -1;
-							const XSD.NCName c_accessControlPolicyIDs := "accessControlPolicyIDs";
-							var integer v_resourceIndex := -1;
-							var XSD.NCName v_myOptionalAttribute := p_optionalAttribute[0];
-											   
-							// Test control
-							if(v_myOptionalAttribute == c_accessControlPolicyIDs) {
-								if(not(PICS_ACP_SUPPORT)) {
-									setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
-									stop;
-								}
+						// Local variables
+						var MsgIn v_response;
+						var RequestPrimitive v_request;
+						var integer v_containerIndex := -1;
+						var integer v_parentIndex := -1;
+						var integer v_acpAuxIndex := -1;
+						var integer v_ae2Index := -1;
+						const XSD.NCName c_accessControlPolicyIDs := "accessControlPolicyIDs";
+						var integer v_resourceIndex := -1;
+						var XSD.NCName v_myOptionalAttribute := p_optionalAttribute[0];
+										   
+						// Test control
+						if(v_myOptionalAttribute == c_accessControlPolicyIDs) {
+							if(not(PICS_ACP_SUPPORT)) {
+								setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
+								stop;
 							}
+						}
 
-							// Test component configuration
-							f_cf01Up(true); 
+						// Test component configuration
+						f_cf01Up(true); 
 
-							// Test adapter configuration
+						// Test adapter configuration
 
-							// Preamble
-							if (v_myOptionalAttribute == c_accessControlPolicyIDs) {
-								v_acpAuxIndex := f_cse_preamble_createAcpAux();//c_CRUDNDi)
-							}     				
-							
-							v_parentIndex := f_cse_preamble_registerAe();//c_CRUDNDi); 
-							
-							f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
-							
-							
-							if(p_resourceType == int4) {
-								v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_parentIndex);
-								v_parentIndex := v_containerIndex;
-							}
+						// Preamble
+						if (v_myOptionalAttribute == c_accessControlPolicyIDs) {
+							v_acpAuxIndex := f_cse_preamble_createAcpAux();//c_CRUDNDi)
+						}     				
 						
-							// Test Body
-							v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_parentIndex);
-    					
-							if(v_myOptionalAttribute == "creator") {
-								mcaPort.send(m_request(v_request, {{v_myOptionalAttribute, omit}}));
-							} else {
-								mcaPort.send(m_request(v_request));
+						v_parentIndex := f_cse_preamble_registerAe();//c_CRUDNDi); 
+						
+						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
+						
+						
+						if(p_resourceType == int4) {
+							v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_parentIndex);
+							v_parentIndex := v_containerIndex;
+						}
+					
+						// Test Body
+						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_parentIndex);
+					
+						if(v_myOptionalAttribute == "creator") {
+							mcaPort.send(m_request(v_request, {{v_myOptionalAttribute, omit}}));
+						} else {
+							mcaPort.send(m_request(v_request));
+						}
+						tc_ac.start;
+						alt {
+							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
+								tc_ac.stop;
+								setverdict(pass, __SCOPE__ & ": Accepted creation for resource type " & int2str(enum2int(p_resourceType)) & " containing attribute " & v_myOptionalAttribute);
+								f_checkAttributesToBeSaved(p_resourceType, v_request, v_response.primitive.responsePrimitive);
+								v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_parentIndex);
 							}
-							tc_ac.start;
-							alt {
-								[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
-									tc_ac.stop;
-									setverdict(pass, __SCOPE__ & ": Accepted creation for resource type " & int2str(enum2int(p_resourceType)) & " containing attribute " & v_myOptionalAttribute);
-									f_checkAttributesToBeSaved(p_resourceType, v_request, v_response.primitive.responsePrimitive);
-									v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_parentIndex);
-								}
-								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
-									tc_ac.stop;
-									setverdict(fail, __SCOPE__ & ": Wrong response status code");
-								}
-								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
-									tc_ac.stop;
-									setverdict(fail, __SCOPE__ & ": Accepted creation for resource type " & int2str(enum2int(p_resourceType)) & " with incorrect attributes");
-								}
-								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
-									tc_ac.stop;
-									setverdict(fail, __SCOPE__ & ": Rejected creation of resource type " & int2str(enum2int(p_resourceType)));
-								}
-								[] tc_ac.timeout {
-									setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(p_resourceType)));
-								}
-							}	
-    								
-							f_checkAeSimuStatus();
-    						
-							//Check to see if the resource is present or not
-							if(f_isResourcePresent(v_resourceIndex)) {
-								setverdict(pass, __SCOPE__ & ":INFO: Resource created");
-							} else {
-								setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
+							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
+								tc_ac.stop;
+								setverdict(fail, __SCOPE__ & ": Wrong response status code");
 							}
-    								
-							// Postamble
-							f_cse_postamble_deleteResources();
-							
-							// Tear down
-							f_cf01Down();
-						    					    				
-						}//end f_CSE_DMR_CRE_012
+							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+								tc_ac.stop;
+								setverdict(fail, __SCOPE__ & ": Accepted creation for resource type " & int2str(enum2int(p_resourceType)) & " with incorrect attributes");
+							}
+							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
+								tc_ac.stop;
+								setverdict(fail, __SCOPE__ & ": Rejected creation of resource type " & int2str(enum2int(p_resourceType)));
+							}
+							[] tc_ac.timeout {
+								setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(p_resourceType)));
+							}
+						}	
+								
+						f_checkAeSimuStatus();
+						
+						//Check to see if the resource is present or not
+						if(f_isResourcePresent(v_resourceIndex)) {
+							setverdict(pass, __SCOPE__ & ":INFO: Resource created");
+						} else {
+							setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
+						}
+								
+						// Postamble
+						f_cse_postamble_deleteResources();
+						
+						// Tear down
+						f_cf01Down();
+					    					    				
+					}//end f_CSE_DMR_CRE_012
 						
 					function f_CSE_DMR_CRE_015(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {
     				
@@ -5488,8 +5488,7 @@ module OneM2M_PermutationFunctions {
 	
 				v_resourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_aeIndex);
 				v_childResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_resourceIndex); 
-				v_request := valueof(m_retrieveFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1));
-				v_request.filterCriteria := p_filterCriteria;
+				v_request := valueof(m_retrieveFilterCriteria(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), p_filterCriteria));
 				mcaPort.send(m_request(v_request));
 				tc_ac.start;
 				alt {
diff --git a/OneM2M_TestControl_MN_profile.ttcn b/OneM2M_TestControl_MN_profile.ttcn
index c613cee..f14104b 100644
--- a/OneM2M_TestControl_MN_profile.ttcn
+++ b/OneM2M_TestControl_MN_profile.ttcn
@@ -84,7 +84,7 @@ module OneM2M_TestControl_MN_profile {
 		if(true) {execute (TC_CSE_REG_RET_004_POA());}
 		if(true) {execute (TC_CSE_DMR_UPD_015_AE_POA());}
 		if(true) {execute (TC_CSE_REG_CRE_002());}
-		if(true) {execute (TC_CSE_REG_CRE_003());}
+		//if(true) {execute (TC_CSE_REG_CRE_003());} //TO BE IMPLEMENTED
 		if(true) {execute (TC_CSE_REG_CRE_020());}
 
 		//CE_REG_00004
diff --git a/OneM2M_Testcases_CSE_Release_1.ttcn b/OneM2M_Testcases_CSE_Release_1.ttcn
index dbfe38b..158c248 100644
--- a/OneM2M_Testcases_CSE_Release_1.ttcn
+++ b/OneM2M_Testcases_CSE_Release_1.ttcn
@@ -604,6 +604,118 @@ module OneM2M_Testcases_CSE_Release_1 {
 					f_cf02DownCseSimuMaster();
 						
 				}
+				
+				/**
+				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided character ‘S’ in AE_ID_Stem ask for a SP_relative_AE_ID 
+				 * 
+				 */
+				testcase TC_CSE_REG_CRE_006() runs on InCseSimu system CseSystem {
+
+					var RequestPrimitive v_request;
+					var integer v_cseBaseIndex := -1;
+					var ResourceType v_resourceType := int2;
+	
+					//Test control
+					if(not(PICS_MN_CSE or PICS_ASN_CSE)) {
+						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE or ASN-CSE to run this test case");
+						stop;
+					}
+    
+					// Test component configuration
+					f_cf02UpCseSimuMaster();
+
+					//Preambule
+					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
+					
+					//Test Body
+					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
+					vc_ae1.done;
+							
+					tc_ac.start;
+
+					alt {
+						[] mccPortIn.receive(mw_request(mw_createAEAnnc(PX_CSE_ID, f_getLocalResourceAddress(vc_cSEBaseIndex), -, "S"))) {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
+						}
+						[] mccPortIn.receive {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while creating AE");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
+						}
+					}	
+					
+					// Postamble
+					f_cse_postamble_deleteResourcesCSE();
+	
+					// Tear down
+					f_cf02DownCseSimuMaster();
+		
+				}	// end of TC_CSE_REG_CRE_006
+				
+				/**
+				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided character ‘S’ in AE_ID_Stem ask for a SP_relative_AE_ID 
+				 * 
+				 */
+				testcase TC_CSE_REG_CRE_007() runs on AeSimu system CseSystem{
+
+					var MsgIn v_response;
+					var RequestPrimitive v_request;
+					var integer v_aeIndex := -1;
+					
+					//Test control
+					if(not(PICS_MN_CSE)) {
+						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
+						stop;
+					}
+					
+					// Test component configuration
+					f_cf02Up();
+					
+					//Preambule
+					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
+					vc_cse1.done;
+					
+					v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S"));
+					
+					vc_cse1.start(f_cse_resourceAnnouncementHandler());
+					vc_cse1.done;
+					
+					//Test Body
+					tc_ac.start;
+					
+					alt {
+						[] mcaPortIn.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+							tc_ac.stop;
+							//continue to test the content
+							if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
+								if (v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID == PX_APP_ID){
+									setverdict(pass, __SCOPE__ & ": AE creation success.");
+								}else{
+									setverdict(fail, __SCOPE__ & ": Error in AE content.");
+								}
+							}else{
+								setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist");
+							}
+						}
+						[] mcaPortIn.receive {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while creating AE");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
+						}
+					}	
+									
+					// Postamble
+					f_cse_postamble_deleteResources();
+					
+					// Tear down
+					f_cf02Down();
+
+				}	// end of TC_CSE_REG_CRE_007
 
 				/**
 				 * @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), transfer request to the IN-CSE 
@@ -640,15 +752,15 @@ module OneM2M_Testcases_CSE_Release_1 {
 					tc_ac.start;
 	
 					alt {
-						[] mccPort.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))) {
+						[] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))) {
 							tc_ac.stop;
 							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
 						}
-						[] mccPort.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))) {
+						[] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))) {
 							tc_ac.stop;
 							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
 						}
-						[] mccPort.receive {
+						[] mccPortIn.receive {
 							tc_ac.stop;
 							setverdict(fail, __SCOPE__ & ": Error while creating AE");
 						}
@@ -770,7 +882,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 					tc_ac.start;
 	
 					alt {
-						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+						[] mcaPortIn.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
 							tc_ac.stop;
 							//continue to test the content
 							if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
@@ -783,7 +895,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 								setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist");
 							}
 						}
-						[] mcaPort.receive {
+						[] mcaPortIn.receive {
 							tc_ac.stop;
 							setverdict(fail, __SCOPE__ & ": Error while creating AE");
 						}
@@ -1154,8 +1266,8 @@ module OneM2M_Testcases_CSE_Release_1 {
 					var ResourceType v_resourceType := int2;
 					
 					//Test control
-					if(not(PICS_MN_CSE)) {
-					   setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
+					if(not(PICS_MN_CSE or PICS_ASN_CSE)) {
+					   setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE or ASN-CSE to run this test case");
 					   stop;
 					}
     
@@ -9034,6 +9146,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 				var RequestPrimitive v_request;
 				var integer v_childResourceIndex := -1;
 				const ResourceType c_containerResourceType := int3; 
+				var AttributeAux v_invalidAttribute;
 			
 				// Test control
 
@@ -9048,9 +9161,8 @@ module OneM2M_Testcases_CSE_Release_1 {
 				v_resourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_aeIndex);
 				v_childResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_resourceIndex); 
 				v_request := valueof(m_retrieveFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1));
-				v_request.filterCriteria.expireBefore := "20171231T012345";
-				v_request.filterCriteria.expireAfter := "20181231T012345";
-				mcaPort.send(m_request(v_request));
+				v_invalidAttribute := {name := "filterCriteria.sizeBelow", value_ := "-1"};
+				mcaPort.send(m_request(v_request, {v_invalidAttribute}));
 				tc_ac.start;
 				alt {
 				
@@ -9088,10 +9200,11 @@ module OneM2M_Testcases_CSE_Release_1 {
 					
 					//Local variables
 					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
-					var FilterCriteria v_filterCriteria;
+					var FilterCriteria v_filterCriteria := valueof(m_filterCriteria);
 					
 					v_filterCriteria.createdBefore := "20171231T012345";
 					v_filterCriteria.createdAfter := "20181231T012345";
+					v_filterCriteria.filterUsage := int1;
 					
 					v_ae1.start(f_CSE_DIS_008(v_filterCriteria));
 					v_ae1.done;
@@ -9102,10 +9215,11 @@ module OneM2M_Testcases_CSE_Release_1 {
 					
 					//Local variables
 					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
-					var FilterCriteria v_filterCriteria;
+					var FilterCriteria v_filterCriteria := valueof(m_filterCriteria);
 	
 					v_filterCriteria.unmodifiedSince := "20171231T012345";
 					v_filterCriteria.modifiedSince := "20181231T012345";
+					v_filterCriteria.filterUsage := int1;
 	
 					v_ae1.start(f_CSE_DIS_008(v_filterCriteria));
 					v_ae1.done;
@@ -9116,10 +9230,11 @@ module OneM2M_Testcases_CSE_Release_1 {
 					
 					//Local variables
 					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
-					var FilterCriteria v_filterCriteria;
+					var FilterCriteria v_filterCriteria := valueof(m_filterCriteria);
 	
 					v_filterCriteria.stateTagSmaller := 1;
 					v_filterCriteria.stateTagBigger := 2;
+					v_filterCriteria.filterUsage := int1;
 	
 					v_ae1.start(f_CSE_DIS_008(v_filterCriteria));
 					v_ae1.done;
@@ -9130,10 +9245,11 @@ module OneM2M_Testcases_CSE_Release_1 {
 					
 					//Local variables
 					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
-					var FilterCriteria v_filterCriteria;
+					var FilterCriteria v_filterCriteria := valueof(m_filterCriteria);
 
 					v_filterCriteria.expireBefore := "20171231T012345";
 					v_filterCriteria.expireAfter := "20181231T012345";
+					v_filterCriteria.filterUsage := int1;
 
 					v_ae1.start(f_CSE_DIS_008(v_filterCriteria));
 					v_ae1.done;
-- 
GitLab