diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn
index 2badcc6a6e3a0a0a737ca8520dca3527f05a918d..ff1376a3453c1b1ca5f9952d119f15e67518e43a 100644
--- a/OneM2M_PermutationFunctions.ttcn
+++ b/OneM2M_PermutationFunctions.ttcn
@@ -1720,230 +1720,338 @@ module OneM2M_PermutationFunctions {
 			
 			group Create{
 				
-					function f_CSE_REG_CRE_012(in template RequestPrimitive p_createAe) runs on AeSimu {
+				function f_CSE_REG_CRE_001(in XSD.ID v_aeIdStem) runs on AeSimu {
+		  	  	
+					var MsgIn v_response;
+					var RequestPrimitive v_request;
+					var integer v_cseBaseIndex := -1;
+					var ResourceType v_resourceType := int2;
+					var universal charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AE-ID is allowed to register: " & PX_ALLOWED_C_AE_IDS[0];
+	                
+					//Test control
+					if(v_aeIdStem[0] == "S") {
+						if(not(PICS_IN_CSE)) {
+							setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case");
+							stop;
+						}
+					}
 					
-						//Local variables
-						var MsgIn v_response;
-						var RequestPrimitive v_request;
-						var ResourceType v_resourceType := int2;	//AE
-										   
-						// Test control
+					// Test component configuration
+					f_cf01Up();
+	                
+					//Preamble
+					action(v_action);
+					f_sleepIgnoreDef(PX_TCONFIG_IUT);
 					
-						// Test component configuration
-						f_cf01Up(); 
-						
-						//Test Body
-						
-						v_request := valueof(p_createAe);
-						v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
-						
-						mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
-						tc_ac.start;
-						alt {
-							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
-								tc_ac.stop;
-								
-								f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
-								vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
-								
-								setverdict(pass, __SCOPE__ & ": AE creation successfull.");
-							}
-							[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
-								tc_ac.stop;
-								setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
-							}
-							[] tc_ac.timeout {
-								setverdict(fail, __SCOPE__ & ": No answer while creating AE");
-							}
+					//Test Body
+					v_request := valueof(m_createAe(PX_APP_ID, omit, PX_CSE_ID & "/" & v_aeIdStem));	
+					
+					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
+					
+					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
+					
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+							tc_ac.stop;
+							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
+							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
+							
+							setverdict(pass, __SCOPE__ & ": AE successfully created.");
 						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
+						}
+					}	
+									
+					// Postamble
+					f_cse_postamble_deleteResources();
+					
+					// Tear down
+					f_cf01Down();
 						
-						//Postamble
-						f_cse_postamble_deleteResources();
-						
-						// Tear down
-						f_cf01Down();
+				}
+
+				function f_CSE_REG_CRE_002(in XSD.ID v_aeIdStem) runs on AeSimu {
+		  	  	
+					var MsgIn v_response;
+					var RequestPrimitive v_request;
+					var integer v_cseBaseIndex := -1;
+					var ResourceType v_resourceType := int2;
+					
+					//Test control
+					if(v_aeIdStem[0] == "S") {
+						if(not(PICS_IN_CSE)) {
+							setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case");
+							stop;
+						}
 					}
+	                
+					// Test component configuration
+					f_cf01Up();
+		  	  	
+					//Preamble
+					
+					//Test Body
+					v_request := valueof(m_createAe(PX_APP_ID, omit, v_aeIdStem));				
+	    									
+					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
+	
+					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
+							tc_ac.stop;
+							
+							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
+							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
+							setverdict(pass, __SCOPE__ & ": AE successfully created.");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
+						}
+					}	
 									
-					function f_CSE_REG_CRE_013(template RequestPrimitive p_requestPrimitive, in AttributeAux p_optionalAttribute) runs on CseSimu {
+					// Postamble
+					f_cse_postamble_deleteResources();
 					
-						// Local variables
-						var MsgIn v_response;
-						var RequestPrimitive v_request;
-						var ResourceType v_resourceType := int16;	//remoteCSE
-										   
-						// Test control
+					// Tear down
+					f_cf01Down();
+						
+				}
+
+				function f_CSE_REG_CRE_012(in template RequestPrimitive p_createAe) runs on AeSimu {
+				
+					//Local variables
+					var MsgIn v_response;
+					var RequestPrimitive v_request;
+					var ResourceType v_resourceType := int2;	//AE
+									   
+					// Test control
+				
+					// Test component configuration
+					f_cf01Up(); 
 					
-						// Test component configuration
-						f_cf04Up(); 
+					//Test Body
 					
-						// Test adapter configuration
+					v_request := valueof(p_createAe);
+					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
 					
-						// Preamble
+					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
+							tc_ac.stop;
+							
+							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
+							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
+							
+							setverdict(pass, __SCOPE__ & ": AE creation successfull.");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
+						}
+					}
 					
-						// Test Body
-						v_request := f_getCreateRequestPrimitive(v_resourceType, p_requestPrimitive, -1);
+					//Postamble
+					f_cse_postamble_deleteResources();
 					
-						mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));
-						tc_ac.start;
-						alt {
-							[] mccPort.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 remoteCSE containing attribute " & p_optionalAttribute.name);
-								f_setResource(v_response.primitive.responsePrimitive.primitiveContent,int16);
-							}
-							[] mccPort.receive(mw_response(mw_responsePrimitiveOK(f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
-								tc_ac.stop;
-								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
-								f_setResource(v_response.primitive.responsePrimitive.primitiveContent,int16);
-							}
-							[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
-								tc_ac.stop;
-								setverdict(fail, __SCOPE__ & ": Accepted creation for resource type remoteCSE without containing attribute " & p_optionalAttribute.name);
-								f_setResource(v_response.primitive.responsePrimitive.primitiveContent,int16);
-							}
-							[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
-								tc_ac.stop;
-								setverdict(fail, __SCOPE__ & ": Rejected creation of resource type remoteCSE containing attribute " & p_optionalAttribute.name);
-							}
-							[] tc_ac.timeout {
-								setverdict(fail, __SCOPE__ & ": No answer while creating resource type remoteCSE");
-							}
-						}	
+					// Tear down
+					f_cf01Down();
+				}
 								
-						// Postamble
-						f_cse_postamble_deleteResourcesCSE();
-						
-						// Tear down
-						f_cf04Down();
-																
-					}//end f_CSE_REG_CRE_BV_013
+				function f_CSE_REG_CRE_013(template RequestPrimitive p_requestPrimitive, in AttributeAux p_optionalAttribute) runs on CseSimu {
+				
+					// Local variables
+					var MsgIn v_response;
+					var RequestPrimitive v_request;
+					var ResourceType v_resourceType := int16;	//remoteCSE
+									   
+					// Test control
+				
+					// Test component configuration
+					f_cf04Up(); 
+				
+					// Test adapter configuration
+				
+					// Preamble
+				
+					// Test Body
+					v_request := f_getCreateRequestPrimitive(v_resourceType, p_requestPrimitive, -1);
+				
+					mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));
+					tc_ac.start;
+					alt {
+						[] mccPort.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 remoteCSE containing attribute " & p_optionalAttribute.name);
+							f_setResource(v_response.primitive.responsePrimitive.primitiveContent,int16);
+						}
+						[] mccPort.receive(mw_response(mw_responsePrimitiveOK(f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
+							f_setResource(v_response.primitive.responsePrimitive.primitiveContent,int16);
+						}
+						[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Accepted creation for resource type remoteCSE without containing attribute " & p_optionalAttribute.name);
+							f_setResource(v_response.primitive.responsePrimitive.primitiveContent,int16);
+						}
+						[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Rejected creation of resource type remoteCSE containing attribute " & p_optionalAttribute.name);
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while creating resource type remoteCSE");
+						}
+					}	
+							
+					// Postamble
+					f_cse_postamble_deleteResourcesCSE();
 					
+					// Tear down
+					f_cf04Down();
+															
+				}//end f_CSE_REG_CRE_BV_013
+				
+				
+				function f_CSE_REG_CRE_017(template RequestPrimitive p_createRequestPrimitive) runs on AeSimu {
 					
-					function f_CSE_REG_CRE_017(template RequestPrimitive p_createRequestPrimitive) runs on AeSimu {
-						
-						//Local variables
-						var ResourceType v_resourceType := int2;   
-						var RequestPrimitive v_request;
-						
-						// Test control
+					//Local variables
+					var ResourceType v_resourceType := int2;   
+					var RequestPrimitive v_request;
+					
+					// Test control
 
-						// Test component configuration
-						f_cf01Up();
+					// Test component configuration
+					f_cf01Up();
 
-						// Test adapter configuration
+					// Test adapter configuration
 
-						// Preamble
+					// Preamble
 
-						// Test Body
-						v_request := f_getCreateRequestPrimitive(int2, p_createRequestPrimitive, -1);
-						
-						mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
-						tc_ac.start;
-						alt {
-							 [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) { //BAD REQUEST
-								 tc_ac.stop;
-								 setverdict(pass, __SCOPE__ & ": Request successfully rejected");
-							 }
-							 [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { 
-								 tc_ac.stop;
-								 setverdict(fail, __SCOPE__ & ": Wrong response status code");
-							 }
-							 [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)){
-								 tc_ac.stop;
-								 setverdict(fail, __SCOPE__ & ": Error, AE has been registered");
-							 }
-							 [] tc_ac.timeout {
-								 setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
-							 }
-						}	
+					// Test Body
+					v_request := f_getCreateRequestPrimitive(int2, p_createRequestPrimitive, -1);
+					
+					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
+					tc_ac.start;
+					alt {
+						 [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) { //BAD REQUEST
+							 tc_ac.stop;
+							 setverdict(pass, __SCOPE__ & ": Request successfully rejected");
+						 }
+						 [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { 
+							 tc_ac.stop;
+							 setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						 }
+						 [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)){
+							 tc_ac.stop;
+							 setverdict(fail, __SCOPE__ & ": Error, AE has been registered");
+						 }
+						 [] tc_ac.timeout {
+							 setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
+						 }
+					}	
 
-						// Postamble
-						f_cse_postamble_deleteResources();
+					// Postamble
+					f_cse_postamble_deleteResources();
 
-						// Tear down
-						f_cf01Down();
-						
-					}
+					// Tear down
+					f_cf01Down();
+					
+				}
 
-					function f_CSE_REG_CRE_026(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu {
-	  
-						var MsgIn v_request;
-						var ResponsePrimitive v_responsePrimitive;
-						
-						//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;
-						}
+				function f_CSE_REG_CRE_026(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu {
+  
+					var MsgIn v_request;
+					var ResponsePrimitive v_responsePrimitive;
+					
+					//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_cf04Up();
+					//Test component configuration
+					f_cf04Up();
 
-						//send triggering primitive to SUT
-						f_sendUtPrimitive(p_utRequest,p_action);
+					//send triggering primitive to SUT
+					f_sendUtPrimitive(p_utRequest,p_action);
 
-						//Test behavior
-						tc_ac.start;
-						alt{
+					//Test behavior
+					tc_ac.start;
+					alt{
 
-							//receive MsgIn requestPrimitive
-							[] mccPortIn.receive(mw_request(p_request)) -> value v_request {
-								tc_ac.stop;
-								setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly");
+						//receive MsgIn requestPrimitive
+						[] mccPortIn.receive(mw_request(p_request)) -> value v_request {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly");
 
-								//set responseStatusCode back to SUT
-								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, omit));
+							//set responseStatusCode back to SUT
+							v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, omit));
 
-								//send back responsePrimitive
-								mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
-							}
-							[] mccPortIn.receive {
-								tc_ac.stop;
-								setverdict(fail, __SCOPE__&":INFO: Unexpected message received");
-							}
-							[] tc_ac.timeout {
-								setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
-							}
+							//send back responsePrimitive
+							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
+						}
+						[] mccPortIn.receive {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__&":INFO: Unexpected message received");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
 						}
-
-						// Postamble
-						f_cse_postamble_deleteResourcesCSE();
-	
-						// Tear down
-						f_cf04Down();
-	
 					}
+
+					// Postamble
+					f_cse_postamble_deleteResourcesCSE();
+
+					// Tear down
+					f_cf04Down();
+
+				}
+				
+				function f_CSE_REG_CRE_028(RequestPrimitive p_request, template PrimitiveContent p_contentResponse) runs on CseSimu {
+					//Local variables
+					var ResourceType v_resourceType := int16;	//remoteCSE	
+					// Test control
+
+					// Test component configuration
+					f_cf04Up();
+
+					// Test adapter configuration
+
+					// Preamble
 					
-					function f_CSE_REG_CRE_028(RequestPrimitive p_request, template PrimitiveContent p_contentResponse) runs on CseSimu {
-						//Local variables
-						var ResourceType v_resourceType := int16;	//remoteCSE	
-						// Test control
-	
-						// Test component configuration
-						f_cf04Up();
-	
-						// Test adapter configuration
-	
-						// Preamble
-						
-						
-						//Test Body					
-						vc_remoteCseIndex := f_cse_registerRemoteCse(p_request, p_contentResponse);
-						
-						//Check if the resource has been deleted or not
-						if(f_cse_isResourcePresent_cseSimu(vc_remoteCseIndex)) {
-							setverdict(pass, __SCOPE__ & ":INFO: Resource created");
-						} else {
-							setverdict(fail, __SCOPE__ & ":INFO: Resource not created");
-						}	
-	
-						// Postamble
-						f_cse_postamble_deleteResourcesCSE();
-	
-						// Tear down
-						f_cf04Down();
-	
-					}//end TC_CSE_REG_CRE_028
+					
+					//Test Body					
+					vc_remoteCseIndex := f_cse_registerRemoteCse(p_request, p_contentResponse);
+					
+					//Check if the resource has been deleted or not
+					if(f_cse_isResourcePresent_cseSimu(vc_remoteCseIndex)) {
+						setverdict(pass, __SCOPE__ & ":INFO: Resource created");
+					} else {
+						setverdict(fail, __SCOPE__ & ":INFO: Resource not created");
+					}	
+
+					// Postamble
+					f_cse_postamble_deleteResourcesCSE();
+
+					// Tear down
+					f_cf04Down();
+
+				}//end TC_CSE_REG_CRE_028
 			
 			}	//end group Create
 			
diff --git a/OneM2M_TestControl_IN_profile.ttcn b/OneM2M_TestControl_IN_profile.ttcn
index c5292b26940271b962312c4d0c4c9ef04fcd0048..28c5485b8bf40c758eb3a51edf3aaa63e389f925 100644
--- a/OneM2M_TestControl_IN_profile.ttcn
+++ b/OneM2M_TestControl_IN_profile.ttcn
@@ -81,8 +81,10 @@ module OneM2M_TestControl_IN_profile {
 		if(PICS_AE_POA) {execute (TC_CSE_REG_CRE_012_AE_POA());}
 		if(PICS_AE_POA) {execute (TC_CSE_REG_RET_004_POA());}
 		if(PICS_AE_POA) {execute (TC_CSE_DMR_UPD_015_AE_POA());}
-		if(PICS_IN_CSE) {execute (TC_CSE_REG_CRE_001());}
-		if(true) {execute (TC_CSE_REG_CRE_002());}
+		if(PICS_IN_CSE) {execute (TC_CSE_REG_CRE_001_CAE());}
+		if(PICS_IN_CSE) {execute (TC_CSE_REG_CRE_001_SAE());}
+		if(PICS_IN_CSE) {execute (TC_CSE_REG_CRE_002_CAE());}
+		if(PICS_IN_CSE) {execute (TC_CSE_REG_CRE_002_SAE());}
 		
 		//CE_REG_00004
 		if(true) {execute (TC_CSE_REG_CRE_018());}
diff --git a/OneM2M_TestControl_MN_profile.ttcn b/OneM2M_TestControl_MN_profile.ttcn
index f2f34abb281ab1407c7af6e34125a523ec481b3b..ad748670b7a9b87f5c36d5e394eef2f8ef246847 100644
--- a/OneM2M_TestControl_MN_profile.ttcn
+++ b/OneM2M_TestControl_MN_profile.ttcn
@@ -85,10 +85,10 @@ module OneM2M_TestControl_MN_profile {
 		if(PICS_AE_POA) {execute (TC_CSE_REG_CRE_012_AE_POA());}
 		if(PICS_AE_POA) {execute (TC_CSE_REG_RET_004_POA());}
 		if(PICS_AE_POA) {execute (TC_CSE_DMR_UPD_015_AE_POA());}
-		if(true) {execute (TC_CSE_REG_CRE_002());}
-		//if(true) {execute (TC_CSE_REG_CRE_003());} //TO BE IMPLEMENTED
-		if(PICS_MN_CSE or PICS_ASN_CSE) {execute (TC_CSE_REG_CRE_020());}
-
+		if(true) {execute (TC_CSE_REG_CRE_001_CAE());}
+		if(true) {execute (TC_CSE_REG_CRE_002_CAE());}
+		if(true) {execute (TC_CSE_REG_CRE_003());} //TO BE IMPLEMENTED
+		
 		//CE_REG_00004
 		if(true) {execute (TC_CSE_REG_CRE_018());}
 		if(true) {execute (TC_CSE_REG_CRE_019());}
diff --git a/OneM2M_Testcases_CSE_Release_1.ttcn b/OneM2M_Testcases_CSE_Release_1.ttcn
index ca083174085fcbfb3075b6a5fbf7b0e07f7b6f4c..764d21e8bb147fcefb9671d5f0fd7260edfafad7 100644
--- a/OneM2M_Testcases_CSE_Release_1.ttcn
+++ b/OneM2M_Testcases_CSE_Release_1.ttcn
@@ -436,168 +436,124 @@ module OneM2M_Testcases_CSE_Release_1 {
 			group Create{
 				
 				/**
-				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned SP_relative_ AE_ID.  
+				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned SP_RELATIVE_ AE_ID.  
 				 * 
 				 */
-				testcase TC_CSE_REG_CRE_001() runs on Tester system CseSystem {
+				group g_CSE_REG_CRE_001 {
 					
-					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+					testcase TC_CSE_REG_CRE_001_CAE() runs on Tester system CseSystem {
+					
+						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
 						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
 						v_ae1.done;
-					
-					v_ae1.start(f_CSE_REG_CRE_001());
-		  	  	
-		  	  		v_ae1.done;
-		  	  		
-				}
-				
-				function f_CSE_REG_CRE_001() runs on AeSimu {
-		  	  	
-					var MsgIn v_response;
-					var RequestPrimitive v_request;
-					var integer v_cseBaseIndex := -1;
-					var ResourceType v_resourceType := int2;
-					var universal charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AE-ID is allowed to register: " & PX_ALLOWED_C_AE_IDS[0];
-	                
-					//Test control
-					if(not(PICS_IN_CSE)) {
-						setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case");
-						stop;
+						
+						v_ae1.start(f_CSE_REG_CRE_001(PX_ALLOWED_C_AE_IDS[0]));
+			  	  		v_ae1.done;
+			  	  		
 					}
-	                
-					// Test component configuration
-					f_cf01Up();
-	                
-					//Preamble
-					action(v_action);
-					f_sleepIgnoreDef(PX_TCONFIG_IUT);
-					
-					//Test Body
-					v_request := valueof(m_createAe(PX_APP_ID, omit, PX_CSE_ID & "/" & PX_ALLOWED_C_AE_IDS[0]));	
-					
-					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
 					
-					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
-					
-					tc_ac.start;
-					alt {
-						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
-							tc_ac.stop;
-							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
-							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
-							
-							setverdict(pass, __SCOPE__ & ": AE successfully created.");
-						}
-						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
-							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
-						}
-						[] tc_ac.timeout {
-							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
-						}
-					}	
-									
-					// Postamble
-					f_cse_postamble_deleteResources();
-					
-					// Tear down
-					f_cf01Down();
+					testcase TC_CSE_REG_CRE_001_SAE() runs on Tester system CseSystem {
 						
-				}
-		  	  	
+						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
+						v_ae1.done;
+						
+						v_ae1.start(f_CSE_REG_CRE_001(PX_ALLOWED_S_AE_IDS[0]));
+			  	  		v_ae1.done;
+			  	  		
+					}
+					
+				}//end group g_CSE_REG_CRE_001 
+
 				/**
-				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned AE_ID of AE-ID-Stem format.
+				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned AE_ID_STEM of AE-ID-Stem format.
 				 * 
 				 */
-				testcase TC_CSE_REG_CRE_002() runs on Tester system CseSystem {
-					
-					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+				group g_CSE_REG_CRE_002 {
+
+					testcase TC_CSE_REG_CRE_002_CAE() runs on Tester system CseSystem {
+						
+						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
 						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
 						v_ae1.done;
+							
+						v_ae1.start(f_CSE_REG_CRE_002(PX_ALLOWED_C_AE_IDS[0]));
+				  	  	v_ae1.done;
+				  	  		
+					}
 						
-					v_ae1.start(f_CSE_REG_CRE_002());
-			  	  	
-					v_ae1.done;
+					testcase TC_CSE_REG_CRE_002_SAE() runs on Tester system CseSystem {
+						
+						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
+						v_ae1.done;
+							
+						v_ae1.start(f_CSE_REG_CRE_002(PX_ALLOWED_S_AE_IDS[0]));
+				  	  	v_ae1.done;
+				  	  		
+					}
+
+				}//end group g_CSE_REG_CRE_002 
+
+				/**
+				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned S-AE-ID-STEM. 
+				 */
+				
+				testcase TC_CSE_REG_CRE_003() runs on Tester system CseSystem {
+					
+					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
+					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
+					v_cse1.done;
+						
+					v_cse1.start(f_CSE_REG_CRE_003());
+			  	  	v_cse1.done;
 			  	  		
 				}
 					
-				function f_CSE_REG_CRE_002() runs on AeSimu {
-		  	  	
-					var MsgIn v_response;
-					var RequestPrimitive v_request;
-					var integer v_cseBaseIndex := -1;
-					var ResourceType v_resourceType := int2;
+				function f_CSE_REG_CRE_003() runs on CseSimu {
+					
+					//Local variables
+					var MsgIn v_request;
+					var template RequestPrimitive v_requestPrimitive;
 					
 					//Test control
-	                
+					
 					// Test component configuration
-					f_cf01Up();
+					f_cf02UpCseSimuMaster(int1);
 		  	  	
 					//Preamble
-					
+					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
+		
 					//Test Body
-					v_request := valueof(m_createAe(PX_APP_ID, omit, PX_ALLOWED_C_AE_IDS[0]));				
-	    									
-					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
-	
-					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
+					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_ALLOWED_S_AE_IDS[0])));
+					
+					v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & PX_ALLOWED_S_AE_IDS[0], -, -, PX_CSE_ID & PX_ALLOWED_S_AE_IDS[0]);
+											
 					tc_ac.start;
-					alt {
-						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
+					alt{
+						[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
 							tc_ac.stop;
-							
-							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
-							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
-							setverdict(pass, __SCOPE__ & ": AE successfully created.");
+							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
+							f_cse_sendResponse_cseSimu(v_request);
 						}
-						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
+						[] mccPortIn.receive(mw_request(mw_createAEAnnc())) -> value v_request {
 							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
+							setverdict(fail, __SCOPE__ & ": AE creation redirected but wrong parameters");
+							f_cse_sendResponse_cseSimu(v_request);
 						}
 						[] tc_ac.timeout {
 							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
 						}
-					}	
+					}
+					
+					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
 									
 					// Postamble
-					f_cse_postamble_deleteResources();
+					f_cse_postamble_deleteResourcesCSE();
 					
 					// Tear down
-					f_cf01Down();
-						
-				}
-
-				/**
-				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned SP_relative_AE_ID. 
-				 */
-				
-				testcase TC_CSE_REG_CRE_003() runs on Tester system CseSystem {
-					
-					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
-					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
-					v_cse1.done;
+					f_cf02DownCseSimuMaster();
 						
-					v_cse1.start(f_CSE_REG_CRE_003());
-			  	  	
-					v_cse1.done;
-			  	  		
-				}
-					
-				function f_CSE_REG_CRE_003() runs on CseSimu {
-					
-					var integer v_remoteCseIndex := -1;
-					
-					//Test Configuration
-					//f_cf02Up();
-					
-					//Preamble
-					v_remoteCseIndex := f_cse_registrationRemoteCse();
-					vc_ae1 := AeSimu.create("AE1") alive;
-					vc_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
-					vc_ae1.done;
-					vc_ae1.start(f_cse_preamble_registerAe());
-					vc_ae1.done;
-				
 				}
 		  	  	
 				/**
@@ -688,6 +644,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 					
 				function f_CSE_REG_CRE_005() runs on CseSimu {
 		  	  	
+		  	  		//Local variables
 		  	  		var MsgIn v_request;
 					var template RequestPrimitive v_requestPrimitive;
 					const  charstring v_cseId := PX_CSE_ID;
@@ -1537,103 +1494,6 @@ module OneM2M_Testcases_CSE_Release_1 {
 
 				}//end TC_CSE_REG_CRE_019
 
-				/**
-	 			 * @desc Check that the IUT accepts a response from IN_CSE on the success update of AEAnnc during AE registration with preprovisioned SP_relative_AE_ID
-				 * 
-				 */
-				 //TODO TO BE FINALIZED
-				testcase TC_CSE_REG_CRE_020() runs on Tester system CseSystem {
-					
-					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
-						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
-						v_ae1.done;
-							
-					v_ae1.start(f_CSE_REG_CRE_020());
-				  	  	
-					v_ae1.done;
-				  	  		
-				}
-						
-				function f_CSE_REG_CRE_020() runs on AeSimu {
-
-					var MsgIn v_response;
-					var RequestPrimitive v_request;
-					var integer v_aeIndex := -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_cf02Up();
-
-					//Preamble
-					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
-					vc_cse1.done;
-	
-					v_request := valueof(m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM));				
-						
-					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
-
-					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
-					tc_ac.start;
-					alt {
-						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
-							tc_ac.stop;
-		
-							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
-							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
-							setverdict(pass, __SCOPE__ & ": AE successfully created.");
-						}
-						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
-							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
-						}
-						[] tc_ac.timeout {
-							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
-						}
-					}	
-	
-					vc_cse1.start(f_cse_announcementProcedure_updateHandler());
-					vc_cse1.done;
-	
-	                //Test body
-					tc_ac.start;
-
-					alt {
-						[] mcaPort.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.app_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");
-							}
-						}
-						[] mcaPort.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 TC_CSE_REG_CRE_020
-
 				/**
 				 * @desc Check that the IUT rejects the create request of <CSEBase> resource.
 				 *