/**
 *  Copyright Notification
 *  No part of this document may be reproduced, in an electronic retrieval system or otherwise, except as authorized by written permission.
 *  The copyright and the foregoing restriction extend to reproduction in all media.
 *  © 2016, oneM2M Partners Type 1 (ARIB, ATIS, CCSA, ETSI, TIA, TSDSI, TTA, TTC).
 *  All rights reserved.
 *  
 *  @author     ETSI
 *  @version    $URL: https://oldforge.etsi.org/svn/oneM2M/branches/Release1/ttcn/OneM2M_Testcases.ttcn $
 *              $Id: OneM2M_Testcases.ttcn 347 2017-08-11 08:48:20Z reinaortega $
 *  @desc       Module containing test cases for oneM2M
 *
 */
module OneM2M_PermutationFunctions {

	import from OneM2M_TestSystem all;
	import from OneM2M_Templates all;
	import from OneM2M_Types all;//{type XSD.ID};
	import from OneM2M_TypesAndValues all;
	import from OneM2M_Pixits all;
	import from LibCommon_Time all;
	import from OneM2M_Pics all;
	import from OneM2M_Functions all;
	import from XSD all;
	
	group AE {
		
		group General {
			
			group Create {
						
					function f_AE_GEN_CRE_001(PrimitiveScope p_primitiveScope) runs on CseSimu {
						
						var ResponsePrimitive v_responsePrimitive;
						var template UtTriggerPrimitive v_utRequest := m_utCreateContainer;
						var UtTriggerAckPrimitive v_trigger_response;
						var integer v_parentIndex := -1;
						var integer v_resourceIndex := -1;
						var MsgIn v_request;
						var PrimitiveContent v_modifiedResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid CREATE Request for container containing To set to " & f_getLocalResourceAddress(0, e_nonHierarchical, p_primitiveScope);
						
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__, ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}

						f_cf03Up();
						
						//Send Trigger Message
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(-, e_nonHierarchical, p_primitiveScope);
						f_sendUtPrimitive(v_utRequest, v_action);
						
						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_createContainer(-,v_utRequest.requestPrimitive.to_))) -> value v_request {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container creation request received successfuly");
								v_parentIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_);
								v_modifiedResource := f_ae_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentIndex, v_request.primitive.requestPrimitive.resourceType);
								v_resourceIndex := f_setLocalResource(v_modifiedResource, v_request.primitive.requestPrimitive.resourceType, v_parentIndex);	
								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, v_modifiedResource));
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(?)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Error while creating container");
								stop;
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, " : No answer while creating resource");
								stop;
							}
						}
						
						// Postamble
						f_cf03Down();
					}
					function f_AE_GEN_CRE_002(PrimitiveScope p_primitiveScope) runs on CseSimu {
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
						var template UtTriggerPrimitive v_utRequest := m_utCreateContainer;
						var UtTriggerAckPrimitive v_trigger_response;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid CREATE Request for container containing To set to " & f_getLocalResourceAddress(-, e_hierarchical, p_primitiveScope);
						
						
						//Test Control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__, ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
	
						f_cf03Up();
	
						//Send Trigger Message
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(-, e_hierarchical, p_primitiveScope);
						f_sendUtPrimitive(v_utRequest,v_action);
							
	
						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_createContainer(-,v_utRequest.requestPrimitive.to_))) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container creation request received successfuly");
		
								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, omit));
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(?)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Error while creating container");
								stop;
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, " : No answer while creating resource");
								stop;
							}
						}
	
						// Postamble
						f_cf03Down();
					}
				
			} //end group Create
			
			group Update {
						
					function f_AE_GEN_UPD_001(PrimitiveScope p_primitiveScope) runs on CseSimu {
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
						var template UtTriggerPrimitive v_utRequest := m_utUpdateContainer;
						var UtTriggerAckPrimitive v_trigger_response;
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid UPDATE Request for container containing To set to " & f_getLocalResourceAddress(-, e_nonHierarchical, p_primitiveScope);
						
						
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__, ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
						
						f_cf03Up();
						
						//Send Trigger Message
						v_localResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger, e_nonHierarchical, p_primitiveScope);
						f_sendUtPrimitive(v_utRequest,v_action);
						
						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_updateContainer(-,v_utRequest.requestPrimitive.to_))) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container update request received successfuly");
							
								v_responsePrimitive := valueof(m_responsePrimitive(int2004, v_request.primitive.requestPrimitive.requestIdentifier, omit));
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(?)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Error while updating container");
								stop;
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, " : No answer while updating resource");
								stop;
							}
						}
						
						// Postamble
						f_cf03Down();
					}
					function f_AE_GEN_UPD_002(PrimitiveScope p_primitiveScope) runs on CseSimu {
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
						var template UtTriggerPrimitive v_utRequest := m_utUpdateContainer;
						var UtTriggerAckPrimitive v_trigger_response;
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid UPDATE Request for container containing To set to " & f_getLocalResourceAddress(-, e_hierarchical, p_primitiveScope);
						
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__, ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
	
						f_cf03Up();
	
						//Send Trigger Message
						v_localResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger, e_hierarchical, p_primitiveScope);
						f_sendUtPrimitive(v_utRequest,v_action);
								
						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_updateContainer(-,v_utRequest.requestPrimitive.to_))) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container update request received successfuly");
							
								v_responsePrimitive := valueof(m_responsePrimitive(int2004, v_request.primitive.requestPrimitive.requestIdentifier, omit));
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(?)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Error while updating container");
								stop;
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, " : No answer while updating resource");
								stop;
							}
						}
	
						// Postamble
						f_cf03Down();
					}
				
			} //end group Update
			
			group Retrieve {
						
					function f_AE_GEN_RET_001(PrimitiveScope p_primitiveScope) runs on CseSimu {
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
						var template UtTriggerPrimitive v_utRequestTemplate;
                        var UtTriggerPrimitive v_utRequest;
						var UtTriggerAckPrimitive v_trigger_response;
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid RETRIEVE Request for container containing To set to " & f_getLocalResourceAddress(-, e_nonHierarchical, p_primitiveScope);
						
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__, ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
			
						f_cf03Up();
			
						//Send Trigger Message
						v_localResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequestTemplate := m_utRetrieve(f_getLocalResourceAddress(v_auxInteger, e_nonHierarchical, p_primitiveScope));
						f_sendUtPrimitive(v_utRequestTemplate,v_action);
                        v_utRequest := valueof(v_utRequestTemplate);
			
						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_retrieve(v_utRequest.requestPrimitive.to_))) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container retrieve request received successfuly");
				
								v_responsePrimitive := valueof(m_responsePrimitive(int2000, v_request.primitive.requestPrimitive.requestIdentifier, omit));
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(?)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Error while retrieving container");
								stop;
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, " : No answer while retrieving resource");
								stop;
							}
						}
			
						// Postamble
						f_cf03Down();
					}
					function f_AE_GEN_RET_002(PrimitiveScope p_primitiveScope) runs on CseSimu {
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
						var template UtTriggerPrimitive v_utRequestTemplate;
                        var UtTriggerPrimitive v_utRequest;
						var UtTriggerAckPrimitive v_trigger_response;
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid RETRIEVE Request for container containing To set to " & f_getLocalResourceAddress(-, e_hierarchical, p_primitiveScope);
						
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__, ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}

						f_cf03Up();

						//Send Trigger Message
						v_localResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequestTemplate := m_utRetrieve(f_getLocalResourceAddress(v_auxInteger, e_hierarchical, p_primitiveScope));
                        v_utRequest := valueof(v_utRequestTemplate);
						f_sendUtPrimitive(v_utRequest,v_action);

						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_retrieve(v_utRequest.requestPrimitive.to_))) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container retrieve request received successfuly");
				
								v_responsePrimitive := valueof(m_responsePrimitive(int2000, v_request.primitive.requestPrimitive.requestIdentifier, omit));
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(?)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Error while retrieving container");
								stop;
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, " : No answer while retrieving resource");
								stop;
							}
						}

						// Postamble
						f_cf03Down();
					}
	
			} //end group Retrieve
						
			group Delete {
						
					function f_AE_GEN_DEL_001(PrimitiveScope p_primitiveScope) runs on CseSimu {
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
						var template UtTriggerPrimitive v_utRequest := m_utDelete;
						var UtTriggerAckPrimitive v_trigger_response;
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid DELETE Request for container containing To set to " & f_getLocalResourceAddress(-, e_nonHierarchical, p_primitiveScope);

						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__, ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
			
						f_cf03Up();
			
						//Send Trigger Message
						v_localResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger, e_nonHierarchical, p_primitiveScope);
						f_sendUtPrimitive(v_utRequest,v_action);
			
						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_delete(v_utRequest.requestPrimitive.to_))) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container update request received successfuly");
				
								v_responsePrimitive := valueof(m_responsePrimitive(int2004, v_request.primitive.requestPrimitive.requestIdentifier, omit));
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(?)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Error while updating container");
								stop;
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, " : No answer while updating resource");
								stop;
							}
						}
			
						// Postamble
						f_cf03Down();
					}
					function f_AE_GEN_DEL_002(PrimitiveScope p_primitiveScope) runs on CseSimu {
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
						var template UtTriggerPrimitive v_utRequest := m_utDelete;
						var UtTriggerAckPrimitive v_trigger_response;
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid DELETE Request for container containing To set to " & f_getLocalResourceAddress(-, e_hierarchical, p_primitiveScope);
						
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__, ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}

						f_cf03Up();

						//Send Trigger Message
						v_localResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger, e_hierarchical, p_primitiveScope);
						f_sendUtPrimitive(v_utRequest,v_action);
				

						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_delete(v_utRequest.requestPrimitive.to_))) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container update request received successfuly");
				
								v_responsePrimitive := valueof(m_responsePrimitive(int2004, v_request.primitive.requestPrimitive.requestIdentifier, omit));
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(?)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Error while updating container");
								stop;
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, " : No answer while updating resource");
								stop;
							}
						}

						// Postamble
						f_cf03Down();
					}
	
			} //end group Delete
			
		}//end group General

		group Registration {
			
			group Create {
						
				   function f_AE_REG_CRE_002(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu {
	
						//primitives for mcaPortIn
					    var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
	
					   f_cf03Up();
	
					   //Send Trigger Message
					   p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(-, -, -);
					   p_request.to_ := p_utRequest.requestPrimitive.to_;
					   f_sendUtPrimitive(p_utRequest,p_action);
	
					   //Test behavior
					   tc_ac.start;
					   alt{
							[] mcaPortIn.receive(mw_request(p_request)) -> value v_request {
							   tc_ac.stop;
							   setverdict(pass, __SCOPE__, " : AE registration request is accepted!!");
								//v_responsePrimitive := valueof(m_responsePrimitiveTemp(int2000, omit));
								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, omit));
	
							   //send back responsePrimitive
								mcaPortIn.send(m_response(v_responsePrimitive));
						   }
							[] mcaPortIn.receive(mw_request(mw_createAe(*,?,m_contentCreateAe_Invalid))) -> value v_request {
							   tc_ac.stop;
							   setverdict(fail, __SCOPE__, " : AE registration request is rejected due to not including the optional attribute!");
						   }
						   [] tc_ac.timeout{
							   setverdict(fail, __SCOPE__, " : Timeout due to no response received from requested SUT!");
						   }
	
					   }
	
					   // Postamble
					   f_cf03Down();
			   		}
			
			} // End of subgroup Create
			
			group Delete {
			
			}// End Delete subgroup

		}//end Registration subgroup

		group Data_Management_and_Repository {
			
			group Create {
			
					function f_AE_DMR_CRE_003(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu {
						var MsgIn v_request;
						var PrimitiveContent v_localResource;
						var integer v_containerIndex := -1;
						var ResponsePrimitive v_responsePrimitive;
	
						//Test component configuration
						f_cf03Up();
	
						//send triggering primitive to SUT
						v_localResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_containerIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_containerIndex, -, -);
						p_request.to_ := p_utRequest.requestPrimitive.to_;
						f_sendUtPrimitive(p_utRequest,p_action);
	
						//Test behavior
						tc_ac.start;
						alt{
	
							//receive MsgIn requestPrimitive
							[] mcaPortIn.receive(mw_request(p_request)) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : ContentInstance creation request is accepted!!");
	
								//set responseStatusCode back to SUT
								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, omit));
	
								//send back responsePrimitive
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
	
							[] mcaPortIn.receive {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : ContentInstance creation request is rejected due to not including the attribute!");
							}
	
							[] tc_ac.timeout{
								setverdict(fail, __SCOPE__, " : Timeout due to no response received from requested SUT!");
							}
						}
	
						// Postamble
						f_cf03Down();
					}
					function f_AE_DMR_CRE_004(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 component configuration
						f_cf03Up();
	
						//send triggering primitive to SUT
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(-, -, -);
						p_request.to_ := p_utRequest.requestPrimitive.to_;
						f_sendUtPrimitive(p_utRequest,p_action);
	
						//Test behavior
						tc_ac.start;
						alt{
	
							//receive MsgIn requestPrimitive
							[] mcaPortIn.receive(mw_request(p_request)) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container creation request is accepted!!");
	
								//set responseStatusCode back to SUT
								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, omit));
	
								//send back responsePrimitive
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
	
							[] mcaPortIn.receive {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Container creation request is rejected due to not including the attribute!");
							}
	
							[] tc_ac.timeout{
								setverdict(fail, __SCOPE__, " : Timeout due to no response received from requested SUT!");
							}
						}
	
						// Postamble
						f_cf03Down();
					}
				 
			}//End of subgroup Create
			
			group Update {
				
				   function f_AE_DMR_UPD_001(template UtTriggerPrimitive p_utRequest, in universal charstring p_action, template RequestPrimitive p_expectedUpdateRequest) runs on CseSimu {
	
						//primitives for mcaPortIn
					   	var MsgIn v_request;
						var integer v_auxInteger := -1;
					   	var PrimitiveContent v_modifiedResource;
					   	var PrimitiveContent v_localResource;
	
					   	f_cf03Up();
					   
					   	//Preamble
						
					   	//Send Trigger Message
						v_localResource := f_ae_generateLocalResource(valueof(m_primitiveContentAe(m_contentCreateAe(omit, omit, omit, omit))), vc_cSEBaseIndex, int2);
						v_auxInteger := f_setLocalResource(v_localResource, int2, vc_cSEBaseIndex);
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger);
					   	f_sendUtPrimitive(p_utRequest,p_action);
	
					   //Test behavior
					   
					   tc_ac.start;
					   alt{
							[] mcaPortIn.receive(mw_request(p_expectedUpdateRequest)) -> value v_request {
							   tc_ac.stop;
							   setverdict(pass, __SCOPE__, " : AE update request is accepted!");
							   
							   vc_response.primitive.responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, omit));

							   mcaPortIn.send(m_response(vc_response.primitive.responsePrimitive));
						   }
							[] mcaPortIn.receive(mw_request(?)) -> value v_request {
							   tc_ac.stop;
							   setverdict(fail, __SCOPE__, " : AE update request is rejected due to not including the optional attribute!");
						   }
						   [] tc_ac.timeout{
							   setverdict(fail, __SCOPE__, " : Timeout due to no response received from requested SUT!");
						   }
	
					   }
	
					   // Postamble
					   f_cf03Down();
					}
	
					function f_AE_DMR_UPD_002(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu {
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_localResource;
						var integer v_auxInteger := -1;

						//Test component configuration
						f_cf03Up();

						//send triggering primitive to SUT
						v_localResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger);
						f_sendUtPrimitive(p_utRequest,p_action);

						//Test behavior
						tc_ac.start;
						alt{

							//receive MsgIn requestPrimitive
							[] mcaPortIn.receive(mw_request(p_request)) -> value (v_request) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Container update request is accepted!!");

								//set responseStatusCode back to SUT
								v_responsePrimitive := valueof(m_responsePrimitive(int2004, v_request.primitive.requestPrimitive.requestIdentifier, omit));

								//send back responsePrimitive
								mcaPortIn.send(m_response(v_responsePrimitive));
							}

							[] mcaPortIn.receive {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Container update request is rejected due to not including the attribute!");
							}

							[] tc_ac.timeout{
								setverdict(fail, __SCOPE__, " : Timeout due to no response received from requested SUT!");
							}
						}

						// Postamble
						f_cf03Down();
					}

			}//End of subgroup Update

			group Retrieve {
				
					function f_AE_DMR_RET_001(ResourceType p_resourceType, template PrimitiveContent p_primitiveContent, in universal charstring p_action) runs on CseSimu {
		
						//variables
						var template UtTriggerPrimitive v_utRequest;
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_localResource;
						var integer v_auxInteger := -1;
		
						//Test component configuration
						f_cf03Up();
		
						//send triggering primitive to SUT
						v_localResource := f_ae_generateLocalResource(valueof(p_primitiveContent), vc_cSEBaseIndex, p_resourceType);
						v_auxInteger := f_setLocalResource(v_localResource, p_resourceType, vc_cSEBaseIndex);
						v_utRequest := m_utRetrieve(f_getLocalResourceAddress(v_auxInteger));
						f_sendUtPrimitive(v_utRequest,p_action);
						
						//Test behavior
						tc_ac.start;
						alt{
							[] mcaPortIn.receive(mw_request(mw_retrieve(f_getLocalResourceAddress(v_auxInteger)))) -> value v_request {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : retrieve resource type request is accepted!!");
								
								//set responseStatusCode back to SUT
								v_responsePrimitive := valueof(m_responsePrimitive(int2000, v_request.primitive.requestPrimitive.requestIdentifier, omit));
		
								//send back responsePrimitive
								mcaPortIn.send(m_response(v_responsePrimitive));
								tc_ac.stop;
							}
							[] mcaPortIn.receive {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : error while retrieving resource !");
							}
							[] tc_ac.timeout{
								setverdict(fail, __SCOPE__, " : Timeout due to no response received from requested SUT!");
							}
						}
		
						// Postamble
						f_cf03Down();
					}
					

			}//End of subgroup Retrieve
			
			group Delete {
			
			}

		}//end DMR subgroup

		group Subscription_and_Notification {
			
			group Create {
				
					function f_AE_SUB_CRE_002(template UtTriggerPrimitive p_utRequest, template RequestPrimitive p_request, in universal charstring p_action) runs on CseSimu {
	
						var MsgIn v_request;
						var ResponsePrimitive v_responsePrimitive;

						f_cf03Up();

						//send triggering primitive to SUT
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress();
						f_sendUtPrimitive(p_utRequest,p_action);

						//Test behavior
						tc_ac.start;
						alt{
							[] mcaPortIn.receive(mw_request(p_request)) -> value v_request {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, " : Subscription creation request is accepted!");

								//set responseStatusCode back to SUT
								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, omit));

								//send back responsePrimitive
								mcaPortIn.send(m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive {
								tc_ac.stop;
								setverdict(fail, __SCOPE__, " : Subscription creation request is rejected due to not including the optional attribute!");
							}
							[] tc_ac.timeout{
								setverdict(fail, __SCOPE__, " : Timeout due to no response received from requested SUT!");
							}
						}

						// Postamble
						f_cf03Down();

					}
			
			}//End Create Group
			
			group Notify {
				
			}//End of Notify group


		}//end SUB subgroup


	}//end group AE
	
	
		
	group CSE {
		
		group Generic {
			
			group Create {
								
					function f_CSE_GEN_CRE_001(in PrimitiveScope p_primitiveScope) runs on AeSimu {
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
						v_addressingMethod := e_nonHierarchical;
						v_primitiveScope := p_primitiveScope;
						v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex);
						v_request.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource created using non-hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating container resource using non-hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_CRE_001				
				
					function f_CSE_GEN_CRE_002(in PrimitiveScope p_primitiveScope) runs on AeSimu {
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
						v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex);
						v_request.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
												
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource created using hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating container resource using hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_CRE_002				
				
			} // end of group Create
			
			group Retrieve {

					function f_CSE_GEN_RET_001(in PrimitiveScope p_primitiveScope) runs on AeSimu {
    				
						// Local variables
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
						v_addressingMethod := e_nonHierarchical;
						v_primitiveScope := p_primitiveScope;
						
						mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope), f_getOriginator(v_resourceIndex))));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource retrieved using non-hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving container resource using non-hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_RET_001				
				
					function f_CSE_GEN_RET_002(in PrimitiveScope p_primitiveScope) runs on AeSimu {
    				
						// Local variables
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
						
						mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope), f_getOriginator(v_resourceIndex))));tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource retrieved using hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving container resource using hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_RET_002				
				
			} // end of group Retrieve
			
			group Update {
								
					function f_CSE_GEN_UPD_001(in PrimitiveScope p_primitiveScope) runs on AeSimu {
    				
						// Local variables
						var RequestPrimitive v_updateRequest := valueof(m_updateContainerBase);
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
						v_addressingMethod := e_nonHierarchical;
						v_primitiveScope := p_primitiveScope;
						
						v_updateRequest.primitiveContent.container.labels := {"MyLabel"};
						
						v_updateRequest := f_getUpdateRequestPrimitive(int3, v_resourceIndex, v_updateRequest);
						v_updateRequest.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
						
						mcaPort.send(m_request(v_updateRequest));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource updated using non-hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while updating container resource using non-hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_UPD_001				
				
					function f_CSE_GEN_UPD_002(in PrimitiveScope p_primitiveScope) runs on AeSimu {
    				
						// Local variables
						var RequestPrimitive v_updateRequest := valueof(m_updateContainerBase);
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
						
						v_updateRequest.primitiveContent.container.labels := {"MyLabel"};
						
						v_updateRequest := f_getUpdateRequestPrimitive(int3, v_resourceIndex, v_updateRequest);
						v_updateRequest.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
						
						mcaPort.send(m_request(v_updateRequest));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource updated using hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while updating container resource using hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_UPD_002				
				
			} // end of group Update
			
			group Delete {

					function f_CSE_GEN_DEL_001(in PrimitiveScope p_primitiveScope) runs on AeSimu {
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Unstructured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
						v_addressingMethod := e_nonHierarchical;
						v_primitiveScope := p_primitiveScope;
						
						v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope), f_getOriginator(v_resourceIndex)));
												
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource deleted using non-hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while deleting container resource using non-hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_DEL_001				
				
					function f_CSE_GEN_DEL_002(in PrimitiveScope p_primitiveScope) runs on AeSimu {
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
											   
						// Test control
						if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
							setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
						// Test Body
						//Force usage of Non-Hierarchical addressing method
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
						
						v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope), f_getOriginator(v_resourceIndex)));
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Container resource deleted using hierarchical addressing method");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while deleting container resource using hierarchical addressing method");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_GEN_DEL_002				
				
			} // end of group Delete
		
		} // end of group Generic
		
		group Registration {
			
			group Create{
				
					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 Body
						
						v_request := valueof(p_createAe);
						v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
						
						mcaPort.send(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");
							}
						}
						
						//Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
					}
									
					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(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 {
						
						//Local variables
						var ResourceType v_resourceType := int2;   
						var RequestPrimitive v_request;
						
						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble

						// Test Body
						v_request := f_getCreateRequestPrimitive(int2, p_createRequestPrimitive, -1);
						
						mcaPort.send(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();

						// 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;
						}

						//Test component configuration
						f_cf04Up();

						//send triggering primitive to SUT
						f_sendUtPrimitive(p_utRequest,p_action);

						//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");

								//set responseStatusCode back to SUT
								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, omit));

								//send back responsePrimitive
								mccPortIn.send(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();
	
					}
					
					function f_CSE_REG_CRE_028(RequestPrimitive p_request, template PrimitiveContent p_contentResponse) runs on CseSimu{ //system CseSystem {
						//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(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
			
			group Retrieve{
				
					function f_CSE_REG_RET_002(template PrimitiveContent p_contentResponse) runs on AeSimu {
						//Local variables
						 var MsgIn v_response;
						 var integer v_aeIndex := -1;
								   
						 // Test control

						 // Test component configuration
						 f_cf01Up();

						 // Test adapter configuration

						 // Preamble
						 v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						 
						 mcaPort.send(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(v_aeIndex))));
						 tc_ac.start;
						 alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, resource elements provided not matching expected resource elements");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	

						// Postamble
						f_cse_postamble_deleteResources();

						// Tear down
						f_cf01Down();
					} //end f_CSE_REG_RET_002
					
					function f_CSE_REG_RET_004(template RequestPrimitive p_createRequestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
						//Local variables
						 var MsgIn v_response;
						 var integer v_aeIndex := -1;
				   
						 // Test control

						 // Test component configuration
						 f_cf01Up();

						 // Test adapter configuration

						 // Preamble
						 v_aeIndex := f_cse_createResource(int2, p_createRequestPrimitive, -1);
		 
						 mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex))));//TODO Maybe PX_SUPER_AE_ID
						 tc_ac.start;
						 alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
							    setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, resource elements provided not matching expected resource elements");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	

						// Postamble
						f_cse_postamble_deleteResources();

						// Tear down
						f_cf01Down();
					} //end f_CSE_REG_RET_004
	
					function f_CSE_REG_RET_007(template RequestPrimitive p_createRequestPrimitive, template PrimitiveContent p_contentResponse) runs on CseSimu {
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var ResourceType v_resourceType := int16;	//remoteCSE
						var template PrimitiveContent v_contentResponse;
 		
						// Test control

						// Test component configuration
						f_cf04Up();

						// Test adapter configuration

						// Preamble
						if(PICS_IN_CSE){
							vc_remoteCseIndex := f_cse_registerRemoteCse(p_createRequestPrimitive);
							mccPort.send(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))));
						    tc_ac.start;
							alt {
								[] mccPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute");
								}
								[] mccPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
								}
								[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements");
								}
								[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
								}
							}
						} else if (PICS_MN_CSE){
							vc_remoteCseIndex := f_cse_registrationRemoteCse(p_createRequestPrimitive);
							mccPort.send(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))));
							tc_ac.start;
							alt {
								[] mccPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute");
								}
								[] mccPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
								}
								[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements");
								}
								[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
								}
							}
						}
						
						//Postamble
  					    f_cse_postamble_deleteResourcesCSE();

						// Tear down
						f_cf04Down();
					} // f_CSE_REG_RET_007
							
			}//end group Retrieve
			
			group Update{
			
					function f_CSE_REG_UPD_002(template RequestPrimitive p_requestPrimitive) 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
						vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);

						// Test Body
						v_request := f_getUpdateRequestPrimitive(int16, vc_remoteCseIndex, p_requestPrimitive);
	
						mccPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mccPort.receive(mw_response(mw_responsePrimitive(int2004, f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Accepted updation for resource type remoteCSE containing attribute ");
							}
							[] 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");
							}
							[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Accepted updation for resource type remoteCSE without containing attribute ");
							}
							[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Rejected updation of resource type remoteCSE containing attribute");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type remoteCSE");
							}
						}					    

						// Postamble
						f_cse_postamble_deleteResourcesCSE();

						// Tear down
						f_cf04Down();

					}//end f_CSE_REG_UPD_002
	
					function f_CSE_REG_UPD_003(template RequestPrimitive p_requestPrimitive, in AttributeList p_attribute) runs on CseSimu {
						// Local variables
						//Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var ResourceType v_resourceType := int16;	//remoteCSE
						var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
						var universal charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request containing To set to " & PX_CSE1_ADDRESS & " and Content containing remoteCSE resource containing a valid attribute " & p_attribute[0];														// 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_cf04Up();

						// Test adapter configuration

						// Preamble
						vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase);
						
						//Send Trigger Message
					    v_utRequest.requestPrimitive.to_ := f_getResourceAddress();
					    f_sendUtPrimitive(v_utRequest, v_action);

						// Test Body
						v_request := f_getUpdateRequestPrimitive(int16, vc_remoteCseIndex, p_requestPrimitive);

						tc_ac.start;
						alt {
							[] mccPortIn.receive(mw_request(v_request)) {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Received request for updation for resource type remoteCSE containing attribute " & p_attribute[0]);
								f_setResource(v_request.primitiveContent,int16);
							}
							[] mccPortIn.receive {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error: Did not receive update request for resource type remoteCSE");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type remoteCSE");
							}
						}					    

						// Postamble
						f_cse_postamble_deleteResourcesCSE();

						// Tear down
						f_cf04Down();

					}//end f_CSE_REG_UPD_003
			    
			}// end group Update
			
			group Delete{
			
			
			}// end group Delete
	  	  	
		}//end Registration
		
		group Data_Management_and_Repository {
						
			group Create {
				
					function f_CSE_DMR_CRE_001(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit) runs on AeSimu return ResponsePrimitive {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_parentIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_acpAuxIndex := -1;
						var PoaList v_poaList := {"http://" & PX_AE2_ADDRESS & "/"};
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
						
						// Test adapter configuration
    				
						// Preamble
    					
						if(ispresent(p_parentRequestPrimitive)) {
							if(match(int23, p_parentRequestPrimitive.resourceType)){
								vc_ae2.start(f_cse_preamble_createAcpAux("SubscriptionVerificationAcp", int63));
								f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
								
								vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred
								f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
								
								v_ae2Index := f_getResource(vc_ae2);
								p_parentRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)};
								vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
							}
							if(ischosen(p_parentRequestPrimitive.primitiveContent.group_)){
							
								f_cse_preamble_registerAe();
							
							}
							v_parentIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_parentIndex);
							
							
							
						} else {//Resource under CSEBase
						
							if(p_resourceType != int1) {
													
								v_acpAuxIndex := f_cse_createAccessControlPolicyAux(-, -, -);
												
								p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID});
							}
							
							if(ischosen(p_requestPrimitive.primitiveContent.group_)){
							
								f_cse_preamble_registerAe();
							
							}
												
						}															
    									
						// Test Body
    					
						if(match(int23, p_requestPrimitive.resourceType)){
							vc_ae2.start(f_cse_preamble_createAcpAux("SubscriptionVerificationAcp", int63));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
							vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
							v_ae2Index := f_getResource(vc_ae2);
							p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)}; 
							vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
						}
    					
						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_parentIndex);
						
						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__ & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfully");
								f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive);
								v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_parentIndex);
							}
							[] 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__ & ": Error while creating 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();
						
						return vc_response.primitive.responsePrimitive;
    					    				
					}//end f_CSE_DMR_CRE_001
					
					function f_CSE_DMR_CRE_001_cseSimu(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on CseSimu return ResponsePrimitive {
    				
							// Local variables
							var MsgIn v_response;
							var RequestPrimitive v_request;
							var integer v_parentIndex := -1;
							var integer v_resourceIndex := -1;
							var integer v_ae1Index := -1;
							var integer v_acpAuxIndex := -1;
							var PoaList v_poaList := {"http://" & PX_AE1_ADDRESS & "/"};
    										   
							// Test control
    				
							// Test component configuration
							f_cf02UpCseSimuMaster();
						
							// Test adapter configuration
    				
							// Preamble
							vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
							
    						if(match(int23, p_resourceType)){
    							vc_ae1.start(f_cse_preamble_createAcpAux("SubscriptionVerificationAcp", int63));
								f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
								vc_ae1.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM, "MyAe", v_poaList), -1)); // AE1 is registered
								f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
								v_ae1Index := f_getResource(vc_ae1);
								p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae1Index)}; 
								vc_ae1.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
							}
							
							// Test Body
    					
							v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, vc_remoteCseIndex);
						
							mccPort.send(m_request(v_request));
							tc_ac.start;
							alt {
								[] mccPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfully");
									f_checkAttributesToBeSaved(p_resourceType, v_request, vc_response.primitive.responsePrimitive);
									v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, p_resourceType, vc_remoteCseIndex);
								}
								[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
									}
								[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while creating resource type " & int2str(enum2int(p_resourceType)));
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(p_resourceType)));
								}
							}	
    					
							f_checkCseSimuStatus();
    								
							//Check to see if the resource is present or not
							if (f_cse_isResourcePresent(v_resourceIndex)){
								setverdict(pass, __SCOPE__ & ":INFO: Resource created");
							} else {
								setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
							}
    								
							// Postamble
							f_cse_postamble_deleteResourcesCSE();
						
							// Tear down
							f_cf02DownCseSimuMaster();
						
							return vc_response.primitive.responsePrimitive;
    					    				
						}//end f_CSE_DMR_CRE_001_cseSimu
    									
					function f_CSE_DMR_CRE_002(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu return ResponsePrimitive{//system CseSystem { MRO system keyword not supported on functions in Titan
				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_resourceIndex := -1;
										   
						// Test control
				
						// Test component configuration
						f_cf01Up(true);
				
						// Test adapter configuration
				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); 
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
									
						// 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__ & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfully");
								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__ & ": Error while creating 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();
						
						return vc_response.primitive.responsePrimitive;
				
					}//end f_CSE_DMR_CRE_002
					
					function f_CSE_DMR_CRE_003(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {//system CseSystem { MRO system keyword not supported on functions in Titan
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true); 
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi)
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 	
						
						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
  					    						    									
						// Test Body
						v_request.requestIdentifier := "Existing resource";
						
						if(p_resourceType == int23){
							vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
						}
    					
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4105))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource already exists");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating an already existing resource");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Creating a resource that already exists");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
    					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_CRE_003
    				
					function f_CSE_DMR_CRE_004(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {//system CseSystem { MRO system keyword not supported on functions in Titan
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_acpAuxIndex := -1;
						var integer v_aeIndex := -1;
											   
						// Test control
						if(not(PICS_ACP_SUPPORT)) {
							setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up(); 
    				
						// Test adapter configuration
    				
						// Preamble
						if (p_resourceType != int23) {
							v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int62);//c_RUDNDi)
						} else {
							v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int60);//c_UDNDi);
						}	
												
						v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);
						
						// 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(int4103))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Access denied to create a resource");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating a resource without privileges");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Resource created without creation privileges");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						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();
    				
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_CRE_004
    				
					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); 
					
						// 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");
						}
					
				        		
						// Postamble
						f_cse_postamble_deleteResources();
						
						// 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");
						}
								
						// 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;
							}
						}

						// Test component configuration
						f_cf01Up(true); 

						// 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;
						}
					
						// 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);
							}
							[] 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");
						}
								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
					    					    				
					}//end f_CSE_DMR_CRE_012
					
					function f_CSE_DMR_CRE_014(ResourceType p_parentResourceType, template RequestPrimitive p_parentResourceRequestPrimitive, ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive) runs on AeSimu {
						// 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);

						v_resourceIndex := f_cse_createResource(p_parentResourceType, p_parentResourceRequestPrimitive, v_aeIndex);
						
						// Test Body
						v_request := f_getCreateRequestPrimitive(p_childResourceType, p_childRequestPrimitive, v_resourceIndex); 
	
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource created");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error when creating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
						
						//Check currentByteSize
						mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								if(v_response.primitive.responsePrimitive.primitiveContent.container.currentByteSize == 8) { //Default content: "AnyValue" (8 bytes length)
									setverdict(pass, __SCOPE__ & ": CurrentByteSize attribute in content resource is incremented successfully");	
								}
								else{
									setverdict(fail, __SCOPE__ & ": CurrentByteSize attribute in content resource not incremented successfully");
								}
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	

						// Postamble
						f_cse_postamble_deleteResources();

						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_CRE_014

					function f_CSE_DMR_CRE_015(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
											   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
					
						// Test Body
						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
						v_request.resultContent := int0;//Attributes
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, omit))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": No content provided with RC set to 0");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(omit))) -> 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__ & ": Content provided with RC set to 0");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_CRE_015
    				
					function f_CSE_DMR_CRE_016(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
											   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
					
						// Test Body
						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
						v_request.resultContent := int2;//Attributes
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								if(f_isHierarchical(v_response.primitive.responsePrimitive.primitiveContent.uRI)) {
									setverdict(pass, __SCOPE__ & ": Response returning correctly only the hierarchical address of the created resource");
								} else {
									setverdict(fail, __SCOPE__ & ": Response returning the address of the created resource with wrong format");							
								}
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Wrong content provided with RC set to 2");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
						
    				
					}//end f_CSE_DMR_CRE_016
    				
					function f_CSE_DMR_CRE_017(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
											   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
											
						// Test Body
						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
						v_request.resultContent := int3;//Attributes + Hierarchichal Address
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								if(f_isHierarchical(v_response.primitive.responsePrimitive.primitiveContent.resource.uRI)) {
									setverdict(pass, __SCOPE__ & ": Response returning correctly the hierarchical address of the created resource and resource representation");
								} else {
									setverdict(fail, __SCOPE__ & ": Response returning the address of the created resource with wrong format");							
								}
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Wrong content provided with RC set to 3");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_CRE_017
    				
					function f_CSE_DMR_CRE_020(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template (present) RequestPrimitive p_requestAnnc) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_parentIndex := -1;
						var integer v_containerIndex := -1;
											   
						// Test control
    				
						// Test component configuration
						f_cf02Up();
    				
						// Test adapter configuration
    				
						// Preamble
						v_parentIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						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);
						
						mcaPort.send(m_request(v_request));
						
						vc_cse1.start(f_cse_receiveCreateRequest(p_requestAnnc));
						vc_cse1.done;	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf02Down();
    				
					}//end f_CSE_DMR_CRE_020
    				
					function f_CSE_DMR_CRE_021(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template (present) RequestPrimitive p_requestAnnc) runs on AeSimu{
	
						// Local variables
						var MsgIn v_anncRequest;
						var RequestPrimitive v_request;
						var integer v_parentIndex := -1;
						var integer v_containerIndex := -1;
						var integer v_remoteCseIndex;
						var integer v_aeAnncIndex;
						var integer v_resourceIndex;
							   
						// Test control
	
						// Test component configuration
						f_cf02Up();
	
						// Test adapter configuration
	
						// Preamble
						
						if (PX_MN_CSE) {
							vc_cse1.start(f_cse_registrationRemoteCse(m_createRemoteCSEBase));
						}else if (PX_IN_CSE) {
							vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));
						}	
						vc_cse1.done;						
						
						vc_cse1.start(f_cse_announcementProcedure_createHandler());						
						v_resourceIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, omit));						
						vc_cse1.done;
		
						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);
						
						vc_cse1.start(f_cse_receiveCreateRequest(p_requestAnnc));						
						mcaPort.send(m_request(v_request));
						vc_cse1.done;	
    								
						vc_request.primitive.requestPrimitive := f_getRequestPrimitive(vc_cse1);
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf02Down();
						
						//return v_anncRequest.primitive.requestPrimitive;
	
					}//end f_CSE_DMR_CRE_021
	
			}//end group Create
			
			group Retrieve {
				
					function f_CSE_DMR_RET_001(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu return ResponsePrimitive {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_containerIndex := -1;
						var integer v_parentIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
						
						if(p_resourceType == int4) {	//ContentInstance
							v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
							v_parentIndex := v_containerIndex;
						}else{
							v_parentIndex := v_aeIndex;
						}
    									
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_parentIndex); 				
    									
						// Test Body
						mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, resource elements provided not matching expected resource elements");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
						
						return v_response.primitive.responsePrimitive;
    				
					}//end f_CSE_DMR_RET_001
					function f_CSE_DMR_RET_003(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpAuxIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
    										   
						// Test control
						if(not(PICS_ACP_SUPPORT)) {
							log(__SCOPE__ & ":INFO: AccessControlPolicy support is required for executing this test case");
							stop;
						}
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						if(p_resourceType != int1) {
							v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int61);//c_CRUDNDi)
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)});
						}
						
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi;
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
										
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 	

						// Test Body
						mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Access denied to retrieve attributes from resource type " & int2str(enum2int(p_resourceType)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving attributes from resource without having privileges");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Retrieving attributes from resource without having privileges");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_RET_003
    				
					function f_CSE_DMR_RET_004(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var XSD.String v_attribute := "#pi";//Attribute parentId to be retrieved
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);	
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 				
    									
						// Test Body
						mcaPort.send(m_request(m_retrieveAttributeToOption(f_getResourceAddress(v_resourceIndex) & v_attribute, f_getOriginator(v_resourceIndex))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Requested attribute retrieved successfully");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, not only requested attribute retrieved");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource attribute");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attribute");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_RET_004
    				
					function f_CSE_DMR_RET_005(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 				
    									
						// Test Body
						mcaPort.send(m_request(m_retrieveAttributeContentOption(f_getResourceAddress(v_resourceIndex) ,	{"pi"}, f_getOriginator(v_resourceIndex))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Requested attribute retrieved successfully");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, not only requested attribute retrieved");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource attribute");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attribute");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_RET_005
    				
					function f_CSE_DMR_RET_006(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 				
    									
						// Test Body
						mcaPort.send(m_request(m_retrieveAttributeContentOption(f_getResourceAddress(v_resourceIndex) ,
																						{"pi", "ct"}, f_getOriginator(v_resourceIndex))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Requested attributes retrieved successfully");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, not only requested attributes retrieved");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource attributes");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attributes");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_RET_006
    				
					function f_CSE_DMR_RET_007(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
											   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 				
    									
						// Test Body
						mcaPort.send(m_request(m_retrieveAttributeContentOption(f_getResourceAddress(v_resourceIndex),
																						{"lbl"}, f_getOriginator(v_resourceIndex))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response {
								tc_ac.stop;
							}
							[] 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__ & ": Error : attribute was retrieved while it doesn't exist");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attribute");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_RET_007
    				
					function f_CSE_DMR_RET_008(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
											   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 				
    									
						// Test Body
						mcaPort.send(m_request(m_retrieveAttributeContentOption(f_getResourceAddress(v_resourceIndex),
																						{"lbl", "at"}, f_getOriginator(v_resourceIndex))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response {
								tc_ac.stop;
							}
							[] 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__ & ": Error : attribute was retrieved while it doesn't exist");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attributes");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_RET_008
    				
					function f_CSE_DMR_RET_013(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_acpIndex := -1;
												    										   
						// Test control
    				
						// Test component configuration
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Up(true);
						} else {
							f_cf02Up();
						}
    				
						// Test adapter configuration
    				
						// Preamble
						
						if(p_resourceType != int2) {	//ResourceType != AE
						
							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
							
						}
						
						if(p_resourceType != int1) {
							
							v_acpIndex := f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[v_acpIndex].resource.accessControlPolicy.resourceID});
						}
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							
							f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
							
							v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive);//under the CSEBase resource
							
							if (p_resourceType==int2){
								v_aeIndex := v_resourceIndex;
							}
										
						} else {	//ResourceType = RemoteCSE
													
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							vc_cse1.done;
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
								
						}
						
						// Test Body
						mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_aeIndex))));//from AE ID

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, resource elements provided not matching expected resource elements");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Down();
						} else {
							f_cf02Down();
						}
						
					}//end f_CSE_DMR_RET_013
    				
					function f_CSE_DMR_RET_014(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpAuxIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
											   
						// Test control
						if(not(PICS_ACP_SUPPORT)) {
							log(__SCOPE__ & ":INFO: AccessControlPolicy support is required for executing this test case");
							stop;
						}
    				
						// Test component configuration
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Up(true);
						} else {
							f_cf02Up();
						}
    				
						// Test adapter configuration
    				
						// Preamble
						
						if (p_resourceType!=int2){
							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi;
						}
						
						if(p_resourceType != int1) {
							
							v_acpAuxIndex := f_cse_createAccessControlPolicyAux(-, -, int61);
					
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID});
						}
					
					
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
						
							f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
					
							v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive);//under the CSEBase resource
							
							if (p_resourceType==int2){
								v_aeIndex := v_resourceIndex;
							}
														
									
						} else {	//ResourceType = RemoteCSE
												
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							vc_cse1.done;
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
							
						}
								
						// Test Body
						mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_aeIndex))));//from AE ID

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Access denied to retrieve attributes from resource type " & int2str(enum2int(p_resourceType)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving attributes from resource without having privileges");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Retrieving attributes from resource without having privileges");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_RET_014
    				
					function f_CSE_DMR_RET_015(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var XSD.String v_attribute := "#pi";//Attribute parentId to be retrieved
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_acpAuxIndex := -1;
						    										   
						// Test control
    				
						// Test component configuration
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Up(true);
						} else {
							f_cf02Up();
						}
    				
						// Test adapter configuration
    				
						// Preamble
						if(p_resourceType != int2) {	//ResourceType != AE
							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);	
						}
						
						if(p_resourceType != int1) {
							
							v_acpAuxIndex := f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID});
						}
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							
							f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
						
							v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive);//under the CSEBase resource
    									
						} else {
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							vc_cse1.done;
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						// Test Body
						mcaPort.send(m_request(m_retrieveAttributeToOption(f_getResourceAddress(v_resourceIndex) & v_attribute, f_getOriginator(v_aeIndex))));//from AE ID

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Requested attribute retrieved successfully");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, not only requested attribute retrieved");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource attribute");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attribute");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Down();
						} else {
							f_cf02Down();
						}
    				
					}//end f_CSE_DMR_RET_015
    				
					function f_CSE_DMR_RET_016(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_acpAuxIndex := -1;
						    										   
						// Test control
    				
						// Test component configuration
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Up(true);
						} else {
							f_cf02Up();
						}
    				
						// Test adapter configuration
    				
						// Preamble
						if(p_resourceType != int2) {	//ResourceType != AE
							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						}
						
						if(p_resourceType != int1) {
							
							v_acpAuxIndex := f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID});
						}
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
	
							f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
							
							v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive);//under the CSEBase resource
    									
						}else{
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							vc_cse1.done;
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						mcaPort.send(m_request(m_retrieveAttributeContentOption(f_getResourceAddress(v_resourceIndex) ,	{"pi"}, f_getOriginator(v_aeIndex))));//from AE ID

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Requested attribute retrieved successfully");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, not only requested attribute retrieved");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource attribute");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attribute");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Down();
						} else {
							f_cf02Down();
						}
    				
					}//end f_CSE_DMR_RET_016
    				
					function f_CSE_DMR_RET_017(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_acpAuxIndex := -1;
						    										   
						// Test control
    				
						// Test component configuration
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Up(true);
						} else {
							f_cf02Up();
						}
    				
						// Test adapter configuration
    				
						// Preamble
						if(p_resourceType != int2) {	//ResourceType != AE
							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						}
						
						if(p_resourceType != int1) {
							
							v_acpAuxIndex := f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID});
						}
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
	
							f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
							
							v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive);//under the CSEBase resource
    									
						}else{
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							vc_cse1.done;
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						mcaPort.send(m_request(m_retrieveAttributeContentOption(f_getResourceAddress(v_resourceIndex) ,
																						{"pi", "ct"}, f_getOriginator(v_aeIndex))));//from AE ID

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Requested attributes retrieved successfully");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, not only requested attributes retrieved");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource attributes");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attributes");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Down();
						} else {
							f_cf02Down();
						}
    				
					}//end f_CSE_DMR_RET_017
    				
					function f_CSE_DMR_RET_018(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_acpAuxIndex := -1;
																	   
						// Test control
    				
						// Test component configuration
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Up(true);
						} else {
							f_cf02Up();
						};
    				
						// Test adapter configuration
    				
						// Preamble
						if(p_resourceType != int2) {	//ResourceType != AE
							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						}
						
						if(p_resourceType != int1) {
							
							v_acpAuxIndex := f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID});
						}
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
	
							f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
							
							v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive);//under the CSEBase resource
    									
						}else{
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							vc_cse1.done;
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						mcaPort.send(m_request(m_retrieveAttributeContentOption(f_getResourceAddress(v_resourceIndex),
																						{"lbl"}, f_getOriginator(v_aeIndex))));//from AE ID

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Retrieved attribute does not exist");
							}
							[] 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__ & ": Error : attribute was retrieved while it doesn't exist");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attribute");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Down();
						} else {
							f_cf02Down();
						}
    				
					}//end f_CSE_DMR_RET_018
    				
					function f_CSE_DMR_RET_019(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_acpAuxIndex := -1;
																	   
						// Test control
    				
						// Test component configuration
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Up(true);
						} else {
							f_cf02Up();
						}
    				
						// Test adapter configuration
    				
						// Preamble
						if(p_resourceType != int2) {	//ResourceType != AE
							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						}
						
						if(p_resourceType != int1) {
							
							v_acpAuxIndex := f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID});
						}
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
	
							f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, p_resourceType);
							
							v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive);//under the CSEBase resource
    									
						}else{
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							vc_cse1.done;
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						mcaPort.send(m_request(m_retrieveAttributeContentOption(f_getResourceAddress(v_resourceIndex),
																						{"lbl", "at"}, f_getOriginator(v_aeIndex))));//from AE ID

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Retrieved attribute does not exist");
							}
							[] 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__ & ": Error : attribute was retrieved while it doesn't exist");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attributes");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Down();
						} else {
							f_cf02Down();
						}
    				
					}//end f_CSE_DMR_RET_019
    				
				function f_CSE_DMR_RET_020(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, ResultContent p_resultContent) runs on AeSimu {
		
					// 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);
		    					
					v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 				
							
					// Test Body
					v_request := valueof(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
					v_request.resultContent := p_resultContent;
					mcaPort.send(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)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error, Result content set to " & int2str(enum2int(p_resultContent)) & " is impossible for a retrieve request ");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
						}
					}	
						
					// Postamble
					f_cse_postamble_deleteResources();
		
					// Tear down
					f_cf01Down();
		
				}//end f_CSE_DMR_RET_020
		
				function f_CSE_DMR_RET_021(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive) runs on AeSimu {
		
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_resourceIndex := -1;
						var integer v_childResourceIndex := -1;
								   
						// Test control
		
						// Test component configuration
						f_cf01Up(true);
		
						// Test adapter configuration
		
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
		
						if(isvalue(p_childResourceType)) {
							if(valueof(p_childResourceType) == int23) {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_childRequestPrimitive, valueof(p_childResourceType));
							} else {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, valueof(p_resourceType));
							}
						} 
	
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 
		
						if(p_resourceType != int15) {
							v_childResourceIndex := f_cse_createResource(valueof(p_childResourceType), p_childRequestPrimitive, v_resourceIndex);				
						}
						
						// Test Body
						v_request := valueof(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						v_request.resultContent := int1;//Attributes
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": No child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
						
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_RET_021
		
					function f_CSE_DMR_RET_022(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive) runs on AeSimu {
		
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_resourceIndex := -1;
						var integer v_childResourceIndex := -1;
								   
						// Test control
		
						// Test component configuration
						f_cf01Up(true);
		
						// Test adapter configuration
		
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);

						if(isvalue(p_childResourceType)) {
							if(valueof(p_childResourceType) == int23) {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_childRequestPrimitive, valueof(p_childResourceType));
							} else {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, valueof(p_resourceType));
							}
						} 
							
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex);
	
						if(p_resourceType != int15) {
							v_childResourceIndex := f_cse_createResource(valueof(p_childResourceType), p_childRequestPrimitive, v_resourceIndex);					
						}
							
						// Test Body
						v_request := valueof(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						v_request.resultContent := int4;//Attributes and child resources
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": No child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
						
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_RET_022
		
					function f_CSE_DMR_RET_023(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive) runs on AeSimu {
		
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_resourceIndex := -1;
						var integer v_childResourceIndex := -1;
								   
						// Test control
		
						// Test component configuration
						f_cf01Up(true);
		
						// Test adapter configuration
		
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);

						if(isvalue(p_childResourceType)) {
							if(valueof(p_childResourceType) == int23) {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_childRequestPrimitive, valueof(p_childResourceType));
							} else {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, valueof(p_resourceType));
							}
						} 
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 
					
		
						if(p_resourceType != int15) {
							v_childResourceIndex := f_cse_createResource(valueof(p_childResourceType), p_childRequestPrimitive, v_resourceIndex);					
						}				
							
						// Test Body
						v_request := valueof(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						v_request.resultContent := int5;//attributes and child resource references
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": No child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
						
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_RET_023
		
					function f_CSE_DMR_RET_024(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive) runs on AeSimu {
		
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_resourceIndex := -1;
						var integer v_childResourceIndex := -1;
								   
						// Test control
		
						// Test component configuration
						f_cf01Up(true);
		
						// Test adapter configuration
		
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);

						if(isvalue(p_childResourceType)) {
							if(valueof(p_childResourceType) == int23) {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_childRequestPrimitive, valueof(p_childResourceType));
							} else {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, valueof(p_resourceType));
							}
						} 
							
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 				
		
						if(p_resourceType != int15) {
							v_childResourceIndex := f_cse_createResource(valueof(p_childResourceType), p_childRequestPrimitive, v_resourceIndex);				
						}				
							
						// Test Body
						v_request := valueof(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						v_request.resultContent := int6;//Child resource references
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": No child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
						
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_RET_024
		
					function f_CSE_DMR_RET_025(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive) runs on AeSimu {
		
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_resourceIndex := -1;
						var integer v_childResourceIndex := -1;
								   
						// Test control
		
						// Test component configuration
						f_cf01Up(true);
		
						// Test adapter configuration
		
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);

						if(isvalue(p_childResourceType)) {
							if(valueof(p_childResourceType) == int23) {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_childRequestPrimitive, valueof(p_childResourceType));
							} else {
								f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, valueof(p_resourceType));
							}
						}
							
						v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); 				
		
						if(p_resourceType != int15) {
							v_childResourceIndex := f_cse_createResource(valueof(p_childResourceType), p_childRequestPrimitive, v_resourceIndex);				
						}				
							
						// Test Body
						v_request := valueof(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						v_request.resultContent := int6;//Child resource references
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": No child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Child resources provided with RC set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							}
						}	
						
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_RET_025
		
			}//end group Retrieve
			
			group Update {
					function f_CSE_DMR_UPD_001(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) 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;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
    									
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
							}
							[] 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__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
    								
						f_checkAeSimuStatus();
						
						//Used to check that the resource has been updated
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
						
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
						
						return vc_response.primitive.responsePrimitive;
    					    				
					}//end f_CSE_DMR_UPD_001
    				
					function f_CSE_DMR_UPD_002(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) 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;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
    									
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
							}
							[] 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__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
    								
						//Used to check that the resource has been updated
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
									
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
						
						return vc_response.primitive.responsePrimitive;
    					    				
					}//end f_CSE_DMR_UPD_002
    				
					function f_CSE_DMR_UPD_003(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive, template (omit) AttributeAux_list p_nullFields := omit) runs on AeSimu return ResponsePrimitive {
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
						
						//f_match2PrimitiveContent(vc_resourcesList[v_resourceIndex].resource, p_createRequestPrimitive.primitiveContent); TODO fix the match problem
    						
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						
						mcaPort.send(m_request(v_request, p_nullFields));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
							}
							[] 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__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
    								
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
									
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
						
						return vc_response.primitive.responsePrimitive;
    					    				
					}//end f_CSE_DMR_UPD_003
    				
					function f_CSE_DMR_UPD_004(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive, template (omit) AttributeAux_list p_nullFields := omit) 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;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
    					
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						
						mcaPort.send(m_request(v_request, p_nullFields));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
							}
							[] 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__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
    								
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
									
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
						
						return vc_response.primitive.responsePrimitive;
    					    				
					}//end f_CSE_DMR_UPD_004
    				
					function f_CSE_DMR_UPD_006(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_acpAuxIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
    										   
						// Test control
						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 adapter configuration
    				
						// Preamble
						v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int59);//c_CRDNDi)
						
						v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//c_CRDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
																
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Access denied to update attributes from resource type " & int2str(enum2int(p_resourceType)));
							}
							[] 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)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Updating attributes from resource without having privileges");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
    								
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);	
    								
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    					    				
					}//end f_CSE_DMR_UPD_006
    				
					function f_CSE_DMR_UPD_007(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
																
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation not allowed. RO attribute from resource type " & int2str(enum2int(p_resourceType)) );
							}
							[] 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)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Updating RO attribute from resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
    								
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
									
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    					    				
					}//end f_CSE_DMR_UPD_007
    				
					function f_CSE_DMR_UPD_008(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive, template (omit) AttributeAux_list p_nullFields := omit) runs on AeSimu {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
    										   
						// Test control
    				
						// Test component configuration
						f_cf01Up(true);
    				
						// Test adapter configuration
    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
																
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						
						mcaPort.send(m_request(v_request,p_nullFields));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation not allowed. Mandatory RW attribute from resource type " & int2str(enum2int(p_resourceType)) );
							}
							[] 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)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Deleting a mandatory RW attribute from resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
    								
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
									
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
    					    				
					}//end f_CSE_DMR_UPD_008
					
					function f_CSE_DMR_UPD_009(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu {
	    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_resourceIndex := -1;
												   
						// Test control
	    				
						// Test component configuration
						f_cf01Up(true);
	    				
						// Test adapter configuration
	    				
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
							
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
							
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive , v_aeIndex);
	
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
	
						mcaPort.send(m_request(v_request));
						
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": It is not possible to update an unexisting attribute of resource type " & int2str(enum2int(p_resourceType)));
							}
							[] 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)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while updating an unexisting resource type " & int2str(enum2int(p_resourceType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
	    								
						// Postamble
						f_cse_postamble_deleteResources();
							
						// Tear down
						f_cf01Down();
	    					    				
					}//end f_CSE_DMR_UPD_009
    				
					function f_CSE_DMR_UPD_014(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu {
	
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
							   
						// Test control
	
						// Test component configuration
						f_cf01Up(true);
	
						// Test adapter configuration
	
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
		
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
		
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
						
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
		
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while updating resource type " & int2str(enum2int(p_resourceType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
					
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
				
					}//end f_CSE_DMR_UPD_014
	
					function f_CSE_DMR_UPD_015(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive, boolean p_secondAcp := false) runs on AeSimu {
						//Local variables
						var MsgIn v_response;
						var AcpType v_acpi;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_acpAuxIndex := -1;
						var integer v_acpIndex := -1;
						   
						// Test control

						// Test component configuration
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Up(true);
						} else {
							f_cf02Up();
						}

						// Test adapter configuration

						// Preamble
						if(p_resourceType != int2) {
							v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						}

						if(p_resourceType != int1) {
							
							v_acpAuxIndex := f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_createRequestPrimitive := f_setAcpId(p_createRequestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID});
						}
						
						if(p_secondAcp) {//A second ACP is required
							v_acpIndex := f_cse_createResource(int1, m_createAcpBase);
							
							v_acpi := {vc_resourcesList[v_acpIndex].resource.accessControlPolicy.resourceID};
							
							p_updateRequestPrimitive := f_setAcpId(p_updateRequestPrimitive, v_acpi);
							
						}
  
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
	
							f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);

							v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive);//under the CSEBase resource
						} else {	//ResourceType = RemoteCSE
							vc_cse1.start(f_cse_registerRemoteCse(p_createRequestPrimitive));
							vc_cse1.done;
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);	
						}
					 
						//Test Body
						vc_request.primitive.requestPrimitive := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
 
						mcaPort.send(m_request(vc_request.primitive.requestPrimitive)); //CSEBase
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
							}
							[] 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__, ": Error while updating optional attribute");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}
					  
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);

						//Postamble
						f_cse_postamble_deleteResources();

						// Tear down
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Down();
						} else {
							f_cf02Down();
						}
					  
					} // end function f_CSE_DMR_UPD_015
			  		
					function f_CSE_DMR_UPD_016(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu {
						 //Local variables
						 var MsgIn v_response;
						 var RequestPrimitive v_request;
						 var ResponsePrimitive v_responsePrimitive;
						 var integer v_aeIndex := -1;
						 var integer v_resourceIndex := -1;
						 var integer v_ae2Index := -1;
						 var integer v_acpAuxIndex := -1;
							   
						 // Test control

						 // Test component configuration
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Up(true);
						} else {
							f_cf02Up();
						}

						 // Test adapter configuration

						 // Preamble
						if(p_resourceType != int2) {
						 	v_aeIndex := f_cse_preamble_registerAe(-, {f_getAnnouncementTargetPoA("HTTP", PX_AE1_ADDRESS, "")});//c_CRUDNDi);
						}
						
						if(p_resourceType != int1) {
							
							v_acpAuxIndex := f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_createRequestPrimitive := f_setAcpId(p_createRequestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID});
						}
												 
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							
							f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);

						 	v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive);//under the CSEBase resource
							if(vc_ae2.running) {
						 		vc_ae2.stop;
						 	}
						} else {	//ResourceType = RemoteCSE
							vc_cse1.start(f_cse_registerRemoteCse(p_createRequestPrimitive));
							vc_cse1.done;
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);	
						}
											 
						//Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						
						if((p_resourceType == int23) and (ispresent(v_request.primitiveContent.subscription.notificationURI))) {	//Subscription
							v_request.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_aeIndex)};							
						}
						
						mcaPort.send(m_request(v_request));
						
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__, ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfully");
							}
							[] 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__, ": Error while updating mandatory attribute");
							}
							[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotificationVerification))) -> value vc_request {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ":INFO: Notification for Subscription verification received");
								v_responsePrimitive := valueof(m_responseNotification(int2000, omit));
								v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
								mcaPortIn.send(m_response(v_responsePrimitive));
								tc_ac.start;
								repeat;
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__, ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
							}
						}
						
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
						
						//Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						if (p_resourceType!=int16){	//ResourceType != RemoteCSE
							f_cf01Down();
						} else {
							f_cf02Down();
						}
						
					} //end function f_CSE_DMR_UPD_016
			  	
			}//end group Update
			
			group Delete {
			
					function f_CSE_DMR_DEL_001(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive) runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_parentIndex := -1;
						var integer v_containerIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
                							   
						// Test control
                
						// Test component configuration
						f_cf01Up(true);
                
						// Test adapter configuration
                
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi)
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
                		
						if(p_resourceType == int4) {
							v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
							v_parentIndex := v_containerIndex;
						}else{
							v_parentIndex := v_aeIndex;
						}
                												
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_parentIndex); 				
                												
						// Test Body
						v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						                		
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource" & int2str(enum2int(p_resourceType)) & " deleted successfully");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while deleting resource type " & int2str(enum2int(p_resourceType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
						
						f_checkAeSimuStatus();
    								
						//Check to see if the resource is present or not
						if (f_isResourceNotPresent(v_aeIndex, f_getResourceName(vc_resourcesList[v_resourceIndex].resource))){
							setverdict(pass, __SCOPE__ & ":INFO: Resource deleted");
						} else {
							setverdict(fail, __SCOPE__ & ":ERROR: Resource not deleted");
						}
                					
						// Postamble
						f_cse_postamble_deleteResources();
                		
						// Tear down
						f_cf01Down();
                							
					};//end f_CSE_DMR_DEL_001
                
					function f_CSE_DMR_DEL_002(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive) runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var RequestPrimitive v_updateRequest;
						var integer v_acpAuxIndex := -1;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var AccessControlRule v_accessControlRule_1 := valueof(m_createAcr({PX_SUPER_AE_ID}, int63));
						var AccessControlRule v_accessControlRule_2;
						var SetOfAcrs v_setOfArcs;
                							   
						// Test control
						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 adapter configuration
                
						// Preamble
						v_acpAuxIndex := f_cse_preamble_createAcpAux(-,-);//c_CRDNDi);
						v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//c_CRUNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
                		
						//Update ACP Aux to remove DELETE operation rights to AE, keeping rights of SUPER USER to run postamble
						v_accessControlRule_2 := valueof(m_createAcr({f_getResourceId(vc_resourcesList[v_aeIndex].resource)}, int55));
                		
						v_setOfArcs.accessControlRule_list := {v_accessControlRule_1, v_accessControlRule_2};
						v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs, -));
						v_updateRequest := f_getUpdateRequestPrimitive(int1, vc_acpAuxIndex, v_updateRequest);
						f_cse_updateResource(v_updateRequest);
						
						//Adjustments for ACP resource type
						if(p_resourceType == int1) {
							p_createRequestPrimitive.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list := {v_accessControlRule_2};//{v_accessControlRule_1,v_accessControlRule_2};
						} else {
							p_createRequestPrimitive := f_setAcpId(p_createRequestPrimitive, {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)});
						}
                		
						//Creation of resource
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
                												
						// Test Body
						v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						v_request.from_ := f_getOriginator(v_aeIndex);
                		
						mcaPort.send(m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Access denied to delete the resource " & int2str(enum2int(p_resourceType)));
							}
							[] 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__ & ": Error resource deleted without having privileges");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource type " & int2str(enum2int(p_resourceType)));
							}
						}	
                					
						f_checkAeSimuStatus();
                		
						//Check if the resource has been deleted or not
						if(f_isResourcePresent(v_resourceIndex)) {
							setverdict(pass, __SCOPE__ & ":INFO: Resource not deleted");
						} else {
							setverdict(fail, __SCOPE__ & ":INFO: Resource deleted");
						}
                					
						// Postamble
						// We are forced to delete the Ae because the delete request in the postamble_deleteResources is sent by Ae itself, witch doesn't have privileges
						f_cse_deleteResource(v_aeIndex, m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator()));//Use of PX_SUPER_AE_ID to remove AE						
						f_cse_postamble_deleteResources();
                		
						// Tear down
						f_cf01Down();
                							
					};//end f_CSE_DMR_DEL_002
                	
					function f_CSE_DMR_DEL_004(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, ResourceType p_childResourceType, template RequestPrimitive p_createRequestPrimitiveChildResource) runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_childResourceIndex := -1;
						var integer v_ae2Index := -1;
                							   
						// Test control
                
						// Test component configuration
						f_cf01Up(true);
                
						// Test adapter configuration
                
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 
                
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitiveChildResource, p_childResourceType);
						
						v_childResourceIndex := f_cse_createResource(p_childResourceType, p_createRequestPrimitiveChildResource, v_resourceIndex); 
                												
						if((p_resourceType == int23) or (p_childResourceType == int23)) {
							vc_ae2.start(f_cse_notifyProcedure_defaultHandler());						
						}
						
						f_cse_deleteResource(v_resourceIndex);
						
						f_checkAeSimuStatus();
                		
						// Test Body
						mcaPort.send(m_request(m_delete(f_getResourceAddress(v_childResourceIndex), f_getOriginator(v_childResourceIndex))));
                
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Error while deleting non existing resource");
							}
							[] 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__ & ": Error while deleting non existing resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
							}
						}		
                					
						// Postamble
						f_cse_postamble_deleteResources();
                		
						// Tear down
						f_cf01Down();
                						
					};//end f_CSE_DMR_DEL_004
				
			}//end group Delete
			
		}//end group Data_Management_and_Repository
		
		group Location {
		  		    
		  
		  
		}//end group Location
		
		group Group_Managment {
        
			group Create {
                
                                    
			} // end group Create
			
			group Retrieve {
            	
			} // end group Retrieve

			group Update {
            	
			} // end group Update
  			
			group Basic_Operations {
			
					function f_CSE_GMG_001(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpIndex := -1;
						var integer v_containerIndex_1 := -1;
						var integer v_containerIndex_2 := -1;
						var integer v_groupIndex := -1;
						var integer i;
						var ListOfURIs v_memberIDs;
						var AcpType v_acpIDs;
						var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyACP", -, -);
			
						// Test control
						if(not(PICS_ACP_SUPPORT)) {
							setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
							stop;
						}
	
						// Test component configuration
						f_cf01Up();
	
						// Test adapter configuration
	
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe(-, -); //c_CRUDNDi
						v_acpIndex := f_cse_createResource(int1, v_createAcp, v_aeIndex); // AE child resource
						v_containerIndex_1 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
						v_containerIndex_2 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
						v_memberIDs := {f_getResourceId(vc_resourcesList[v_containerIndex_1].resource), f_getResourceId(vc_resourcesList[v_containerIndex_2].resource)};
						v_acpIDs := {f_getResourceId(vc_resourcesList[v_acpIndex].resource)};
						v_groupIndex := f_cse_createResource(int9, m_createGroup(2, v_memberIDs, v_acpIDs, int3), v_aeIndex); // AE child resource
	       
						p_requestPrimitive.to_ := f_getResourceAddress(v_groupIndex) & "/fopt";
						p_requestPrimitive.from_ := f_getOriginator(v_groupIndex);
						p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
						
						// Test Body
	
						mcaPort.send(m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": creation successfull by using fanOutPoint in group resource");
	                
								if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__, ": Error, aggregatedResponse attribute not provided");
								}
								else {
									for(i:=0; i<lengthof(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list); i := i+1){
										if(not match(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list[i], mw_responsePrimitiveOK)){
											setverdict(fail, __SCOPE__, ": Error, one responsePrimitve of aggregatedResponse_list is not successful");
										}
									}
								}                       
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}
			
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();                    
	
					} // end f_CSE_GMG_001
	
					function f_CSE_GMG_002(template RequestPrimitive p_requestPrimitive, in AccessControlOperations p_accessControlOperations) runs on AeSimu {
					   // Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpIndex := -1;
						var integer v_containerIndex_1 := -1;
						var integer v_containerIndex_2 := -1;
						var integer v_groupIndex := -1;
						var ListOfURIs v_memberIDs;
						var ListOfURIs v_membersAcpIds;
						var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyACP", -, p_accessControlOperations);
	
						// Test control
						if(not(PICS_ACP_SUPPORT)) {
							setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
							stop;
						}
	
						// Test component configuration
						f_cf01Up();
	
						// Test adapter configuration
	                	
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe(-, -); //c_CRUDNDi
						v_acpIndex := f_cse_createResource(int1, v_createAcp, v_aeIndex); // AE child resource
						v_containerIndex_1 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
						v_containerIndex_2 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
						v_memberIDs := {f_getResourceId(vc_resourcesList[v_containerIndex_1].resource), f_getResourceId(vc_resourcesList[v_containerIndex_2].resource)};
						v_membersAcpIds := {f_getResourceId(vc_resourcesList[v_acpIndex].resource)};
						v_groupIndex := f_cse_createResource(int9, m_createGroup(2, v_memberIDs, omit, int3, -, v_membersAcpIds), v_aeIndex); // AE child resource
	   
						p_requestPrimitive.to_ := f_getResourceAddress(v_groupIndex) & "/fopt";
						p_requestPrimitive.from_ := f_getOriginator(v_groupIndex);
						p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
	
						// Test Body
	
						mcaPort.send(m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Update failed due to lack of privilege");
							}
							[] 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__ & ": Error operation successful while doesn't have privileges");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while executing operation");
							}
						}
	        
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();                    
	
					} // end f_CSE_GMG_002
	
					function f_CSE_GMG_003(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpIndex := -1;
						var integer v_containerIndex_1 := -1;
						var integer v_containerIndex_2 := -1;
						var integer v_groupIndex := -1;
						var integer i;
						var ListOfURIs v_memberIDs;
						var ListOfURIs v_membersAcpIds;
						var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyACP", -, -);
						
						// Test control
						if(not(PICS_ACP_SUPPORT)) {
							setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
							stop;
						}
	
						// Test component configuration
						f_cf01Up();
	
						// Test adapter configuration
	
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe(-, -); //c_CRUDNDi
						v_acpIndex := f_cse_createResource(int1, v_createAcp, v_aeIndex); // AE child resource
						v_containerIndex_1 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
						v_containerIndex_2 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
						v_memberIDs := {f_getResourceId(vc_resourcesList[v_containerIndex_1].resource), f_getResourceId(vc_resourcesList[v_containerIndex_2].resource)};
						v_membersAcpIds := {f_getResourceId(vc_resourcesList[v_acpIndex].resource)};
						v_groupIndex := f_cse_createResource(int9, m_createGroup(2, v_memberIDs, omit, int3, -, v_membersAcpIds), v_aeIndex); // AE child resource
						
						p_requestPrimitive.to_ := f_getResourceAddress(v_groupIndex) & "/fopt";
						p_requestPrimitive.from_ := f_getOriginator(v_groupIndex);
						p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
	
						// Test Body
	
						mcaPort.send(m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": creation successfull by using fanOutPoint in group resource");
	    
								if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__, ": Error, aggregatedResponse attribute not provided");
								}
								else {
									for(i:=0; i<lengthof(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list); i := i+1){
										if(not match(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list[i], mw_responsePrimitiveOK)){
											setverdict(fail, __SCOPE__, ": Error, one responsePrimitve of aggregatedResponse_list is not successful");
										}
									}
								}                       
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}
	
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();                    
	
					} // end f_CSE_GMG_003
	
					function f_CSE_GMG_004(template RequestPrimitive p_requestPrimitive, in AccessControlOperations p_accessControlOperations) runs on AeSimu {
					   // Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpIndex := -1;
						var integer v_containerIndex_1 := -1;
						var integer v_containerIndex_2 := -1;
						var integer v_groupIndex := -1;
						var ListOfURIs v_memberIDs;
						var AcpType v_acpIDs;
						var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyACP", -, p_accessControlOperations);
	
						// Test control
						if(not(PICS_ACP_SUPPORT)) {
							setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
							stop;
						}
	
						// Test component configuration
						f_cf01Up();
	
						// Test adapter configuration
	    	
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe(-, -); //c_CRUDNDi
						v_acpIndex := f_cse_createResource(int1, v_createAcp, v_aeIndex); // AE child resource
						v_containerIndex_1 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
						v_containerIndex_2 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
						v_memberIDs := {f_getResourceId(vc_resourcesList[v_containerIndex_1].resource), f_getResourceId(vc_resourcesList[v_containerIndex_2].resource)};
						v_acpIDs := {f_getResourceId(vc_resourcesList[v_acpIndex].resource)};
						v_groupIndex := f_cse_createResource(int9, m_createGroup(2, v_memberIDs, v_acpIDs, int3), v_aeIndex); // AE child resource
	   
						p_requestPrimitive.to_ := f_getResourceAddress(v_groupIndex) & "/fopt";
						p_requestPrimitive.from_ := f_getOriginator(v_groupIndex);
						p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
	
						// Test Body
	
						mcaPort.send(m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Update failed due to lack of privilege");
							}
							[] 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__ & ": Error operation successful while doesn't have privileges");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while executing operation");
							}
						}
	
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();                    
	
					} // end f_CSE_GMG_004
	
					function f_CSE_GMG_005(template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, in ResponseStatusCode p_responseStatusCode) runs on AeSimu {
						//Local constants
						const integer c_numberOfResponsePrimitive := 2;
						
					   // Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_containerIndex_1 := -1;
						var integer v_containerIndex_2 := -1;
						var integer v_groupIndex := -1;
						var ListOfURIs v_memberIDs;
						var integer i;
						var template RequestPrimitive v_createContainerRequest_1 := m_createContainer_noResourceName;
						var template RequestPrimitive v_createContainerRequest_2 := m_createContainer_noResourceName;
						
						// Test control
	
						// Test component configuration
						f_cf01Up();
	
						// Test adapter configuration
	
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe(-, -); //c_CRUDNDi
						v_containerIndex_1 := f_cse_createResource(int3, v_createContainerRequest_1, v_aeIndex); // AE child resource
						v_containerIndex_2 := f_cse_createResource(int3, v_createContainerRequest_2, v_aeIndex); // AE child resource
						v_memberIDs := {f_getResourceId(vc_resourcesList[v_containerIndex_1].resource), f_getResourceId(vc_resourcesList[v_containerIndex_2].resource)};
						v_groupIndex := f_cse_createResource(int9, m_createGroup(2, v_memberIDs, omit, int3, -, -), v_aeIndex); // AE child resource
						   
						p_requestPrimitive.to_ := f_getResourceAddress(v_groupIndex) & "/fopt";
						p_requestPrimitive.from_ := f_getOriginator(v_aeIndex); 
						p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
	
						// Test Body
	
						mcaPort.send(m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": creation successfull by using fanOutPoint in group resource");
	                            
								if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__, ": Error, aggregatedResponse attribute not provided");
								}
								else{
									if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list) != c_numberOfResponsePrimitive){
										setverdict(fail, __SCOPE__, ": Error, length of aggregatedResponse is not valid");
									}
									else{
										for(i:=0; i<c_numberOfResponsePrimitive; i:=i+1){
											if(not match(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list[i].primitiveContent, p_contentResponse)){
												setverdict(fail, __SCOPE__, ": Error, aggregatedResponse doesn't match with template expected");
											}
										}
									}
								}                            
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}
	
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();                    
	
					} // end f_CSE_GMG_005
	
					function f_CSE_GMG_006(template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, in ResponseStatusCode p_responseStatusCode) runs on AeSimu {
						//Local constants
						const integer c_numberOfResponsePrimitive := 2;
			
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex_1, v_aeIndex_2, v_acpIndex, v_containerIndex_1, v_containerIndex_2, v_groupIndex := -1;
						var integer i;
						var ListOfURIs v_memberIDs;
						var ListOfURIs v_membersAcpIds;
						var RequestPrimitive v_createRequest := valueof(m_createContentInstance("NotInitialized", "Value1"));
						var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyACP", -, -);
						var template PrimitiveContent v_contentResponse;
						
						v_contentResponse.contentInstance := mw_contentContentInstanceBase;
						
						// Test control
						if(not(PICS_ACP_SUPPORT)) {
							setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
							stop;
						}
	
						// Test component configuration
						f_cf01Up();
	
						// Test adapter configuration
	
						// Preamble
						v_aeIndex_1 := f_cse_preamble_registerAe(-, -); //c_CRUDNDi
						v_aeIndex_2 := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, omit), -1); // AE2 is registred
						v_acpIndex := f_cse_createResource(int1, v_createAcp, -1); // AE child resource
						v_containerIndex_1 := f_cse_createResource(int3, m_createContainerBase, v_aeIndex_1); // AE1 child resource
						v_containerIndex_2 := f_cse_createResource(int3, m_createContainerBase, v_aeIndex_2); // AE2 child resource
						v_memberIDs := {f_getResourceId(vc_resourcesList[v_aeIndex_1].resource), f_getResourceId(vc_resourcesList[v_aeIndex_2].resource)};
						v_membersAcpIds := {f_getResourceId(vc_resourcesList[v_acpIndex].resource)};
						v_groupIndex := f_cse_createResource(int9, m_createGroup(2, v_memberIDs, omit, int2, -, v_membersAcpIds, -), -);
	   
						v_createRequest.to_ := f_getResourceAddress(v_groupIndex) & "/" & c_resourceShortNameFanOutPoint & "/" & c_defaultContainerResourceName;
						v_createRequest.from_ := f_getOriginator(v_groupIndex); //TODO see if it is correct or if we have to use PX_SUPER_ADMIN
						v_createRequest.requestIdentifier := v_createRequest.requestIdentifier & f_rnd(1, 1000000);
	
						// Test Body
	
						mcaPort.send(m_request(v_createRequest));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": creation successfull by using fanOutPoint in group resource");
	                
								if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__, ": Error, aggregatedResponse attribute not provided");
								}
								else{
									if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list) != c_numberOfResponsePrimitive){
										setverdict(fail, __SCOPE__, ": Error, length of aggregatedResponse is not valid");
									}
									else{
										for(i:=0; i<c_numberOfResponsePrimitive; i:=i+1){
											if(not match(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list[i].primitiveContent, v_contentResponse)){
												setverdict(fail, __SCOPE__, ": Error, aggregatedResponse doesn't match with template expected");
											}
										}
									}
								}                            
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}
			
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();                    
	
					} // end f_CSE_GMG_006

			}// End of Basic_Operations
            
		} // end group Group_Managment
		
		group Discovery {
			
			function f_CSE_DIS_008(in FilterCriteria p_filterCriteria) runs on AeSimu {
			
				//Local variables
				var MsgIn v_response;
				var integer v_aeIndex := -1;
				var integer v_resourceIndex := -1;
				var RequestPrimitive v_request;
				var integer v_childResourceIndex := -1;
				const ResourceType c_containerResourceType := int3; 
	
				// Test control
	
				// Test component configuration
				f_cf01Up();
	
				// Test adapter configuration
	
				// Preamble
				v_aeIndex := f_cse_preamble_registerAe();//AE1 is registred;
	
				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_retrieveFilterCriteria(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), p_filterCriteria));
				mcaPort.send(m_request(v_request));
				tc_ac.start;
				alt {
	
					[] mcaPort.receive(mw_response(mw_responsePrimitive(int4102))) -> value v_response {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Contents Unacceptable");
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { 
						tc_ac.stop;
						setverdict(fail, __SCOPE__ & ": Wrong response status code while retrieving resource");
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { 
						tc_ac.stop;
						setverdict(fail, __SCOPE__ & ": Wrong response while retrieving resource");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
					}
				}	
				
				 // Postamble
				 f_cse_postamble_deleteResources();
	
				 // Tear down
				 f_cf01Down();
			
			}	// end f_CSE_DIS_008
        	
		} //end group Group Discovery
		
		group Subscription_And_Notification {
	
			group Create {
				
	
			}//end group Create
			
			group Notify{
				

			}//end group Notify
			
			group Update {
				


			}//end group Update
			
			group Delete {
				
				
			}//end group Delete
			
		}//end group Subscription_And_Notification
		
		group Security {
	
			group Access_Control_Policy {
				
				group Create {
	
				
				}// end of group Create
			
				group Update {
				
					
				}// end of group Update
				
				group Basic_Operations {
				
						function f_CSE_SEC_ACP_001(template RequestPrimitive p_requestPrimitive) runs on AeSimu {
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_acpIndex := -1;
							var RequestPrimitive v_createRequest := valueof(m_createAcpBase);
							var RequestPrimitive v_updateRequest;
							var AccessControlRule v_accessControlRule_1;
							var SetOfAcrs v_setOfArcs;
	
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
			
							v_accessControlRule_1 := valueof(m_createAcr({ f_getOriginator(v_aeIndex), PX_SUPER_AE_ID}, int63));
							v_setOfArcs.accessControlRule_list := {v_accessControlRule_1};
							v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs, v_setOfArcs));
							v_updateRequest := f_getUpdateRequestPrimitive(int1, v_acpIndex, v_updateRequest);
							f_cse_updateResource(v_updateRequest);
			
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := "UnknowOriginator";
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
	
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Operation denied because of lack of right on Container");
								}
								[] 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__ & ": Error operation have been accpeted without having privileges");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int3 (Container)");
								}
							}
	
							//Postamble
							//We are forced to delete the Ae because the delete request in the postamble_deleteResources is sent by Ae itself, witch doesn't have privileges
						  	if(testcasename() == "TC_CSE_SEC_ACP_001_DEL") {
								  f_cse_deleteResource(v_aeIndex, m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator()));//Use of PX_SUPER_AE_ID to remove AE
						  	}	
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						} //end f_CSE_SEC_ACP_001
	
						function f_CSE_SEC_ACP_002(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu {
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_acpIndex1 := -1;
							var integer v_acpIndex2 := -1;
							var RequestPrimitive v_createRequest := valueof(m_createAcp(f_getResourceAddress(-1), omit));
							var RequestPrimitive v_updateRequest;
							var AccessControlRule v_accessControlRule_1;
							var SetOfAcrs v_setOfArcs;
	
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_acpIndex1 := f_cse_createResource(int1, v_createRequest); // CSE child resource
							v_acpIndex2 := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex1].resource), f_getResourceId(vc_resourcesList[v_acpIndex2].resource)}, -);
			
							v_accessControlRule_1 := valueof(m_createAcr({f_getOriginator(v_aeIndex)}, int3)); // c_CR 
							v_setOfArcs.accessControlRule_list := {v_accessControlRule_1};
							v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs, -));
							v_updateRequest := f_getUpdateRequestPrimitive(int1, v_acpIndex1, v_updateRequest);
							f_cse_updateResource(v_updateRequest);
							
							v_accessControlRule_1 := valueof(m_createAcr({f_getOriginator(v_aeIndex)}, int60)); // c_UDNDi  
							v_setOfArcs.accessControlRule_list := {v_accessControlRule_1};
							v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs, -));
							v_updateRequest := f_getUpdateRequestPrimitive(int1, v_acpIndex2, v_updateRequest);
							f_cse_updateResource(v_updateRequest);
	
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
	
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Successful operation on resource type int2 (Ae)");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while operation on resource type int2 (Ae)");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int2 (Ae)");
								}
							}
	
							//Postamble
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						} //end f_CSE_SEC_ACP_002
						
						function f_CSE_SEC_ACP_003(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_acpIndex := -1;
							var RequestPrimitive v_createRequest;
							var AccessControlRule v_accessControlRule_1;
							var RequestPrimitive v_updateRequest;
							var SetOfAcrs v_setOfArcs;
							
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_createRequest := valueof(m_createAcp(f_getResourceAddress(), -, {"testDomain"}));
							v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
							
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := "testDomain";
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
							
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Successful operation on resource type int2 (Ae)");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while operation on resource type int2 (Ae)");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int2 (Ae)");
								}
							}
	
							//Postamble
							v_accessControlRule_1 := valueof(m_createAcr({"all"}, int63));
							v_setOfArcs.accessControlRule_list := {v_accessControlRule_1};
							v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs, v_setOfArcs));
							v_updateRequest := f_getUpdateRequestPrimitive(int1, v_acpIndex, v_updateRequest);
							v_updateRequest.from_ := "testDomain";
							mcaPort.send(m_request(v_updateRequest));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									log(__SCOPE__ & ":INFO:  Attribute of resource type ACP updated successfully");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									log(__SCOPE__ & ":INFO:  Error while updating resource type ACP");
								}
								[] tc_ac.timeout {
									log(__SCOPE__ & ":INFO:  No answer while updating resource type ACP");
								}
							}
							
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						}//end f_CSE_SEC_ACP_003
			
						function f_CSE_SEC_ACP_004(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_acpIndex := -1;
							var RequestPrimitive v_createRequest;
			
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
							v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
			
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := "UnknowOriginator";
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
			
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Successful operation on resource type int2 (Ae)");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while operation on resource type int2 (Ae)");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int2 (Ae)");
								}
							}
	
	
							//Postamble
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						}//end f_CSE_SEC_ACP_004
	
						function f_CSE_SEC_ACP_005(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var charstring v_currentTime;
							var RequestPrimitive v_createRequest;
							var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));	
			
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
							v_currentTime := fx_generateTimestamp();
							v_accessControlRule.accessControlContexts_list := {{{"* * * * " & f_getMonth(v_currentTime) & " *"}, omit, omit}};
							v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
							vc_acpAuxIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpAuxIndex].resource)}, -);
			
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
			
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Successful operation on resource type int2 (Ae)");
									if(p_responseStatusCode == int2002) {
										f_removeElementFromList(vc_resourcesIndexToBeDeleted, v_aeIndex);
									}
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while operation on resource type int2 (Ae)");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int2 (Ae)");
								}
							}
	
	
							//Postamble
							f_cse_updateAcpAuxResource(int63);
							
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						}//end f_CSE_SEC_ACP_005
	
						function f_CSE_SEC_ACP_006(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
							// Local variables
							var MsgIn v_response;
							var charstring v_month;
							var charstring v_currentTime;
							var integer v_aeIndex := -1;
							var RequestPrimitive v_createRequest;
							var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));	
			
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
							v_currentTime := fx_generateTimestamp();
							v_month := f_getMonth(v_currentTime);
							if(v_month =="12") {
								v_month := "1";
							} else {
								v_month := int2char(char2int(v_month) + 1);
							}
							v_accessControlRule.accessControlContexts_list := {{{"* * * * " & v_month & " *"}, omit, omit}};
							v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
							vc_acpAuxIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpAuxIndex].resource)}, -);
			
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
			
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Operation denied due to lack of privileges, out of accessControlTimeWindow");
								}
								[] 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__ & ": Error operation have been accpeted without having privileges");
									if(p_responseStatusCode == int2002) {
										f_removeElementFromList(vc_resourcesIndexToBeDeleted, v_aeIndex);
									}
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation");
								}
							}
	
	
							//Postamble
							f_cse_updateAcpAuxResource(int63);
							
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						}//end f_CSE_SEC_ACP_006
	
						function f_CSE_SEC_ACP_007(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_acpIndex := -1;
							var RequestPrimitive v_createRequest;
							var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));	
			
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
							v_accessControlRule.accessControlContexts_list := {{{}, omit, { choice := { countryCode := {"ES"}}}}};
							v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
							v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							//TODO How to indicate the location of the Originator (AE1)?
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
			
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
			
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Successful operation on resource type int2 (Ae)");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while operation on resource type int2 (Ae)");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int2 (Ae)");
								}
							}
	
	
							//Postamble
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						}//end f_CSE_SEC_ACP_007
	
						function f_CSE_SEC_ACP_008(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_acpIndex := -1;
							var RequestPrimitive v_createRequest;
							var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));	
			
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
							v_accessControlRule.accessControlContexts_list := {{{}, omit, { choice := { countryCode := {"ES"}}}}};
							v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
							v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							//TODO How to indicate the location of the Originator (AE1)?
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
			
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
			
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Operation denied due to lack of privileges, out of accessControlTimeWindow");
								}
								[] 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__ & ": Error operation have been accpeted without having privileges");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation");
								}
							}
	
	
							//Postamble
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						}//end f_CSE_SEC_ACP_008
	
						function f_CSE_SEC_ACP_009(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var RequestPrimitive v_createRequest;
							var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));	
			
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
							v_accessControlRule.accessControlContexts_list := {{{}, {{f_getIpv4Address(PX_AE1_ADDRESS)}, omit}, omit}};
							v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
							vc_acpAuxIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpAuxIndex].resource)}, {f_getAnnouncementTargetPoA(-, PX_AE1_ADDRESS, -)});
			
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
			
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Successful operation on resource type int2 (Ae)");
									if(p_responseStatusCode == int2002) {
										f_removeElementFromList(vc_resourcesIndexToBeDeleted, v_aeIndex);
									}
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while operation on resource type int2 (Ae)");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int2 (Ae)");
								}
							}
	
	
							//Postamble
							f_cse_updateAcpAuxResource(int63);
							
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						}//end f_CSE_SEC_ACP_009
	
						function f_CSE_SEC_ACP_010(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var RequestPrimitive v_createRequest;
							var AccessControlRule v_accessControlRule := valueof(m_createAcr({"all"}, int63));	
			
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_createRequest := f_getCreateRequestPrimitive(int1, m_createAcpBase, -1);
							v_accessControlRule.accessControlContexts_list := {{{}, {{"240.0.0.0"}, omit}, omit}};
							v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
							vc_acpAuxIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpAuxIndex].resource)}, {f_getAnnouncementTargetPoA(-, PX_AE1_ADDRESS, -)});
			
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
			
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Operation denied due to lack of privileges, out of accessControlTimeWindow");
								}
								[] 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__ & ": Error operation have been accpeted without having privileges");
									if(p_responseStatusCode == int2002) {
										f_removeElementFromList(vc_resourcesIndexToBeDeleted, v_aeIndex);
									}
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation");
								}
							}
	
	
							//Postamble
							f_cse_updateAcpAuxResource(int63);
							
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						}//end f_CSE_SEC_ACP_010
	
						function f_CSE_SEC_ACP_011(template RequestPrimitive p_requestPrimitive, in ResponseStatusCode p_responseStatusCode) runs on AeSimu {
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_containerIndex := -1;
	
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_aeIndex := f_cse_preamble_registerAe(-, -);
							v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
							
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_containerIndex);
							p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
	
							mcaPort.send(m_request(valueof(p_requestPrimitive)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(p_responseStatusCode))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Successful operation on resource type int3 (Container)");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Wrong response status code");
								}
								[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
									tc_ac.stop;
									setverdict(fail, __SCOPE__ & ": Error while operation on resource type int3 (Container)");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int3 (Container)");
								}
							}
	
							//Postamble
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						} //end f_CSE_SEC_ACP_011
	
						function f_CSE_SEC_ACP_012(template RequestPrimitive p_requestPrimitive, in AccessControlOperations p_acor) runs on AeSimu {
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_containerIndex := -1;
							var integer v_acpIndex := -1;
							var RequestPrimitive v_request; 
							var RequestPrimitive v_createRequest := valueof(m_createAcpBase);
							var RequestPrimitive v_updateRequest;
							var AccessControlRule v_accessControlRule_1, v_accessControlRule_2;
							var SetOfAcrs v_setOfArcs;
	
							// Test control
	
							// Test component configuration
							f_cf01Up();
	
							// Test adapter configuration
	
							// Preamble
							v_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex].resource)}, -);
							v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
							
							v_accessControlRule_1 := valueof(m_createAcr({PX_SUPER_AE_ID}, int63));
							v_accessControlRule_2 := valueof(m_createAcr({f_getOriginator(v_aeIndex)}, p_acor));
							v_setOfArcs.accessControlRule_list := {v_accessControlRule_1, v_accessControlRule_2};
							v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs, -));
							v_updateRequest := f_getUpdateRequestPrimitive(int1, v_acpIndex, v_updateRequest);
							f_cse_updateResource(v_updateRequest);
							
							// Test Body
							v_request := f_getCreateRequestPrimitive(int3, p_requestPrimitive, v_containerIndex);
							
							mcaPort.send(m_request(valueof(v_request)));
							tc_ac.start;
							alt {
								[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
									tc_ac.stop;
									setverdict(pass, __SCOPE__ & ": Operation denied because of lack of right on Container");
								}
								[] 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__ & ": Error operation have been accpeted without having privileges");
								}
								[] tc_ac.timeout {
									setverdict(fail, __SCOPE__ & ": No answer while executing operation on resource type int3 (Container)");
								}
							}
	
							//Postamble
							//We are forced to delete the Ae because the delete request in the postamble_deleteResources is sent by Ae itself, witch doesn't have privileges
							if(testcasename() == "TC_CSE_SEC_ACP_012_DEL") {
								f_cse_deleteResource(v_aeIndex, m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator()));//Use of PX_SUPER_AE_ID to remove AE
							}						
							f_cse_postamble_deleteResources();
	
							//Tear down
							f_cf01Down();
	
						} //end f_CSE_SEC_ACP_012
	
				}// end of Basic_Operations
				
			}//end group AccessControlPolicy
			
		}//end group Security
		
		group Annoucement {
			
			group Basic {
		
				function f_CSE_ANNC_001(ResourceType p_resourceType, template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit, in template RequestPrimitive p_requestUpdatePrimitive := omit) runs on AeSimu {

					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
				   
					// Test control

					// Test component configuration
					f_cf02Up();

					// Test adapter configuration
			
					//Register the CSE
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));	
					vc_cse1.done;
					
					//Preamble
					vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -)));
					v_aeIndex := f_cse_createResource(int2,v_create);
					vc_cse1.done;
					
					// Test Body
					if (ispresent (p_requestUpdatePrimitive)) {
						v_resourceIndex := f_cse_createResource(p_resourceType,p_requestCreatePrimitive);
 				      	v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_requestUpdatePrimitive);
					  	v_responsePrimitive.responseStatusCode := int2004;
					} else {
					  	v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestCreatePrimitive, v_parentIndex);
					  	v_responsePrimitive.responseStatusCode := int2001;
					}
					vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc));	
					mcaPort.send(m_request(v_request));

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(v_responsePrimitive.responseStatusCode))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__, ": Operation for resource " & int2str(enum2int(p_resourceType)) & " performed successfully");	
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__, ": Wrong response status code");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__, ": No answer while updating resource type " & int2str(enum2int(p_resourceType)));
						}
					}
										
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf02Down();

				}//end f_CSE_ANNC_001
	
			}//end group Basic
		
		}// end group Announcement
	
	}//end group CSE

	
}