/**
 *  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 template UtTriggerPrimitive v_utRequest := m_utCreateContainer;
						var integer v_resourceIndex := -1;
						var MsgIn v_request;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid CREATE Request for container to ";
						
						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 & f_getLocalResourceAddress(-, e_nonHierarchical, p_primitiveScope));
						
						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_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
								mcaPortIn.send(f_getMsgOutPrimitive(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive))));
							}
							[] mcaPortIn.receive(mw_request(mw_createContainer())) -> value v_request {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Create Request with unexpected target");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
								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 Integer v_resourceIndex := -1;
						var template UtTriggerPrimitive v_utRequest := m_utCreateContainer;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid CREATE Request for container to ";
						
						
						//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  & f_getLocalResourceAddress(-, e_hierarchical, p_primitiveScope));
							
	
						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_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
								mcaPortIn.send(f_getMsgOutPrimitive(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive))));
							}
							[] mcaPortIn.receive(mw_request(mw_createContainer())) -> value v_request {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Create Request with unexpected target");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
								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 template UtTriggerPrimitive v_utRequest := m_utUpdateContainer;
						var integer v_resourceIndex;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid UPDATE Request for container to ";
						
						
						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_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex, e_nonHierarchical, p_primitiveScope);
						f_sendUtPrimitive(v_utRequest,v_action  & f_getLocalResourceAddress(v_resourceIndex, e_nonHierarchical, p_primitiveScope));
						
						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");
								f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive);
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
							}
							[] mcaPortIn.receive(mw_request(mw_updateContainer())) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Update Request with unexpected target");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
								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 template UtTriggerPrimitive v_utRequest := m_utUpdateContainer;
						var integer v_resourceIndex := -1;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid UPDATE Request for container to ";
						
						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_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex, e_hierarchical, p_primitiveScope);
						f_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_resourceIndex, e_hierarchical, p_primitiveScope));
								
						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");
								f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive);
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
							}
							[] mcaPortIn.receive(mw_request(mw_updateContainer())) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Update Request with unexpected target");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
								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 template UtTriggerPrimitive v_utRequest;
                        var integer v_resourceIndex := -1;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid RETRIEVE Request for container to ";
						
						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_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest := m_utRetrieve(f_getLocalResourceAddress(v_resourceIndex, e_nonHierarchical, p_primitiveScope));
						f_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_resourceIndex, e_nonHierarchical, p_primitiveScope));
                        
						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");
								f_processRetrieveRequestPrimitive(v_request.primitive.requestPrimitive);
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
							}
							[] mcaPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Retrieve request with unexpected target");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
								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 template UtTriggerPrimitive v_utRequest;
                        var integer v_resourceIndex := -1;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid RETRIEVE Request for container to ";
						
						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_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						v_utRequest := m_utRetrieve(f_getLocalResourceAddress(v_resourceIndex, e_hierarchical, p_primitiveScope));
                        f_sendUtPrimitive(v_utRequest,v_action & f_getLocalResourceAddress(v_resourceIndex, e_hierarchical, p_primitiveScope));
						
						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");
								f_processRetrieveRequestPrimitive(v_request.primitive.requestPrimitive);
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
							}
							[] mcaPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Retrieve request with unexpected target");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
								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 template UtTriggerPrimitive v_utRequest := m_utDelete;
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid DELETE Request for container to ";

						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_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  & f_getLocalResourceAddress(v_auxInteger, e_nonHierarchical, p_primitiveScope));
			
						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_delete(v_utRequest.requestPrimitive.to_))) -> value v_request {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & " : Container delete request received successfuly");
								f_processDeleteRequestPrimitive(v_request.primitive.requestPrimitive);
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
							}
							[] mcaPortIn.receive(mw_request(mw_delete(?))) -> value v_request {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Delete request with unexpected target");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
								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 template UtTriggerPrimitive v_utRequest := m_utDelete;
						var integer v_auxInteger;
						var PrimitiveContent v_localResource;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a valid DELETE Request for container to ";
						
						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_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 & f_getLocalResourceAddress(v_auxInteger, e_hierarchical, p_primitiveScope));
				

						tc_ac.start;
						alt {
							[] mcaPortIn.receive(mw_request(mw_delete(v_utRequest.requestPrimitive.to_))) -> value v_request {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & " : Container delete request received successfuly");
								f_processDeleteRequestPrimitive(v_request.primitive.requestPrimitive);
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
							}
							[] mcaPortIn.receive(mw_request(mw_delete(?))) -> value v_request {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Delete request with unexpected target");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
								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 integer v_parentIndex := -1;
					    var integer v_resourceIndex := -1;
					    var PrimitiveContent v_resource;
						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 & f_getLocalResourceAddress(-, -, -));
	
					   //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_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
							
							   //send back responsePrimitive
							   mcaPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
						   }
							[] mcaPortIn.receive(mw_request(mw_createAe())) -> value v_request {
							   tc_ac.stop;
							   setverdict(fail, __SCOPE__ & " : Unexpected AE registration request");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
						   }
						   [] 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 integer v_resourceIndex := -1;
						var PrimitiveContent v_localResource;
						var integer v_containerIndex := -1;
						
						//Test component configuration
						f_cf03Up();
	
						//send triggering
						v_localResource := f_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 & f_getLocalResourceAddress(v_containerIndex, -, -));
	
						//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!!");
								v_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
								//send back responsePrimitive
								mcaPortIn.send(f_getMsgOutPrimitive(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive))));
							}
	
							[] mcaPortIn.receive(mw_request(mw_create)) -> value v_request{
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Unexpected CREATE request ");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
							}
							[] 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 integer v_resourceIndex := -1;
						
						//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 & f_getLocalResourceAddress(-, -, -));
	
						//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!!");
								v_resourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive);	
								//send back responsePrimitive
								mcaPortIn.send(f_getMsgOutPrimitive(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive))));
							}
							[] mcaPortIn.receive(mw_request(mw_create)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Unexpected CREATE request ");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
							}
							[] 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_resourceIndex := -1;
					   	var PrimitiveContent v_localResource;
					   	
					   	f_cf03Up();
					   
					   	//Preamble
						
					   	//Send Tr
					    v_localResource := f_generateLocalResource(valueof(m_primitiveContentAe(m_contentCreateAe(omit, omit, omit, omit))), vc_cSEBaseIndex, int2);
						v_resourceIndex := f_setLocalResource(v_localResource, int2, vc_cSEBaseIndex);
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex);
					   	f_sendUtPrimitive(p_utRequest,p_action & f_getLocalResourceAddress(v_resourceIndex));
	
					   //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!");
							   f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive);
							   mcaPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
							}
							[] mcaPortIn.receive(mw_request(mw_update)) -> value v_request {
							   tc_ac.stop;
							   setverdict(fail, __SCOPE__ & " : Unexpected UPDATE request");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
						   }
						   [] 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 PrimitiveContent v_localResource;
						var integer v_resourceIndex := -1;

						//Test component configuration
						f_cf03Up();

						//send triggering 
						v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
						v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex);
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex);
						f_sendUtPrimitive(p_utRequest,p_action & f_getLocalResourceAddress(v_resourceIndex));

						//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!!");
								f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive);
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
							}
							[] mcaPortIn.receive(mw_request(mw_update)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Unexpected UPDATE request");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
							}
							[] 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, in template (omit) 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_resourceIndex := -1;
						
						//Test component configuration
						f_cf03Up();
		
						//send triggering message
					    if(p_resourceType != int5) {
					    	v_localResource := f_generateLocalResource(p_primitiveContent, vc_cSEBaseIndex, p_resourceType);
					    	v_resourceIndex := f_setLocalResource(v_localResource, p_resourceType, vc_cSEBaseIndex);
					    } else {
					    	v_resourceIndex := vc_cSEBaseIndex;
					    }
						v_utRequest := m_utRetrieve(f_getLocalResourceAddress(v_resourceIndex));
						f_sendUtPrimitive(v_utRequest,p_action & f_getLocalResourceAddress(v_resourceIndex));
						
						//Test behavior
						tc_ac.start;
						alt{
							[] mcaPortIn.receive(mw_request(mw_retrieve(f_getLocalResourceAddress(v_resourceIndex)))) -> value v_request {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & " : retrieve resource type request is accepted!!");
								v_responsePrimitive := valueof(m_responsePrimitive(int2000, v_request.primitive.requestPrimitive.requestIdentifier, vc_localResourcesList[v_resourceIndex].resource));
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
							}
							[] mcaPortIn.receive (mw_request(mw_retrieve(?))){
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Retrieve request for unexpected target");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
							}
							[] 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 integer v_parentIndex := -1;
						var integer v_resourceIndex := -1;
						var PrimitiveContent v_resource;
						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!");
								v_parentIndex := f_getLocalResourceIndex(v_request.primitive.requestPrimitive.to_);
								v_resource := f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentIndex, v_request.primitive.requestPrimitive.resourceType);
								v_resourceIndex := f_setLocalResource(v_resource, v_request.primitive.requestPrimitive.resourceType, v_parentIndex);	
								v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, vc_localResourcesList[v_resourceIndex].resource));
								//send back responsePrimitive
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
							}
							[] mcaPortIn.receive {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Subscription creation request is rejected due to not including the optional attribute!");
								mcaPortIn.send(f_getMsgOutPrimitive(m_response(valueof(m_responsePrimitive(int4004, v_request.primitive.requestPrimitive.requestIdentifier, omit)))));
							}
							[] 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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(m_request(v_request)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
								tc_ac.stop;
								
								f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
								vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
								
								setverdict(pass, __SCOPE__ & ": AE creation successfull.");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating AE");
							}
						}
						
						//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(f_getMsgOutPrimitive(m_request(v_request)));
						tc_ac.start;
						alt {
							[] mccPort.receive(mw_response(mw_responsePrimitive(int2001, f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Accepted creation for resource type remoteCSE containing attribute " & p_optionalAttribute.name);
								f_setResource(v_response.primitive.responsePrimitive.primitiveContent,int16);
							}
							[] mccPort.receive(mw_response(mw_responsePrimitiveOK(f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
								f_setResource(v_response.primitive.responsePrimitive.primitiveContent,int16);
							}
							[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Accepted creation for resource type remoteCSE without containing attribute " & p_optionalAttribute.name);
								f_setResource(v_response.primitive.responsePrimitive.primitiveContent,int16);
							}
							[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Rejected creation of resource type remoteCSE containing attribute " & p_optionalAttribute.name);
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource type remoteCSE");
							}
						}	
								
						// Postamble
						f_cse_postamble_deleteResourcesCSE();
						
						// Tear down
						f_cf04Down();
																
					}//end f_CSE_REG_CRE_BV_013
					
					
					function f_CSE_REG_CRE_017(template RequestPrimitive p_createRequestPrimitive) runs on AeSimu {
						
						//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(f_getMsgOutPrimitive(m_request(v_request)));
						tc_ac.start;
						alt {
							 [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) { //BAD REQUEST
								 tc_ac.stop;
								 setverdict(pass, __SCOPE__ & ": Request successfully rejected");
							 }
							 [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { 
								 tc_ac.stop;
								 setverdict(fail, __SCOPE__ & ": Wrong response status code");
							 }
							 [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)){
								 tc_ac.stop;
								 setverdict(fail, __SCOPE__ & ": Error, AE has been registered");
							 }
							 [] tc_ac.timeout {
								 setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
							 }
						}	

						// Postamble
						f_cse_postamble_deleteResources();

						// 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(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
							}
							[] mccPortIn.receive {
								tc_ac.stop;
								setverdict(fail, __SCOPE__&":INFO: Unexpected message received");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
							}
						}

						// Postamble
						f_cse_postamble_deleteResourcesCSE();
	
						// Tear down
						f_cf04Down();
	
					}
					
					function f_CSE_REG_CRE_028(RequestPrimitive p_request, template PrimitiveContent p_contentResponse) runs on CseSimu {
						//Local variables
						var ResourceType v_resourceType := int16;	//remoteCSE	
						// Test control
	
						// Test component configuration
						f_cf04Up();
	
						// Test adapter configuration
	
						// Preamble
						
						
						//Test Body					
						vc_remoteCseIndex := f_cse_registerRemoteCse(p_request, p_contentResponse);
						
						//Check if the resource has been deleted or not
						if(f_cse_isResourcePresent_cseSimu(vc_remoteCseIndex)) {
							setverdict(pass, __SCOPE__ & ":INFO: Resource created");
						} else {
							setverdict(fail, __SCOPE__ & ":INFO: Resource not created");
						}	
	
						// Postamble
						f_cse_postamble_deleteResourcesCSE();
	
						// Tear down
						f_cf04Down();
	
					}//end TC_CSE_REG_CRE_028
			
			}	//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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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
						vc_remoteCseIndex := f_cse_registerRemoteCse(p_createRequestPrimitive);
						mccPort.send(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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 update 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 update for resource type remoteCSE without containing attribute ");
							}
							[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Rejected update 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_createRemoteCSE);
						
						//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 {
						
			function f_CSE_DMR_001(template RequestPrimitive p_requestPrimitive) runs on CseSimu {
    				
				// Local variables
				var integer v_aeIndex, v_remoteCseIndex, v_targetResourceIndex := -1;
				var ResponseStatusCode v_responseStatusCode := int2000;   
				var XSD.ID v_targetResourceAddress;
				
				// Test control

				// Test component configuration
				f_cf02UpCseSimuMaster();

				// Test adapter configuration

				// Preamble
				
				v_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, {f_getCompletePoA()}));
				
				vc_ae1.start(f_cse_preamble_registerAe());				
				vc_ae1.done;
				
				//Creating resource in Hosting CSE
				v_targetResourceIndex := f_generateAndSetLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3);
				
				// Test Body
				v_aeIndex := f_getLatestResource(vc_ae1);
				
				v_targetResourceAddress := f_getLocalResourceAddress(v_targetResourceIndex, PX_ADDRESSING_METHOD, e_spRelative);
				p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
				p_requestPrimitive.to_ := v_targetResourceAddress;
				
				if(valueof(p_requestPrimitive.operation) == int1) {
					v_responseStatusCode := int2001;
				} else if(valueof(p_requestPrimitive.operation) == int2) {
					v_responseStatusCode := int2000;
				} else if(valueof(p_requestPrimitive.operation) == int3) {
					v_responseStatusCode := int2004;
				} else if(valueof(p_requestPrimitive.operation) == int4) {
					v_responseStatusCode := int2002;
				}
				vc_ae1.start(f_cse_operationResource(p_requestPrimitive));
				
				tc_ac.start;
				alt {
					[v_responseStatusCode == int2001] mccPortIn.receive(mw_request(mw_create(-, v_targetResourceAddress))) -> value vc_request {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Request primitive retargeted successfully");
						f_processCreateRequestPrimitive(vc_request.primitive.requestPrimitive);
						mccPortIn.send(m_response(vc_response.primitive.responsePrimitive));
					}
					[v_responseStatusCode == int2000] mccPortIn.receive(mw_request(mw_retrieve(v_targetResourceAddress))) -> value vc_request {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Request primitive retargeted successfully");
						f_processRetrieveRequestPrimitive(vc_request.primitive.requestPrimitive);
						mccPortIn.send(m_response(vc_response.primitive.responsePrimitive));
					}
					[v_responseStatusCode == int2004] mccPortIn.receive(mw_request(mw_update(-, v_targetResourceAddress))) -> value vc_request {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Request primitive retargeted successfully");
						f_processUpdateRequestPrimitive(vc_request.primitive.requestPrimitive);
						mccPortIn.send(m_response(vc_response.primitive.responsePrimitive));
					}
					[v_responseStatusCode == int2002] mccPortIn.receive(mw_request(mw_delete(v_targetResourceAddress))) -> value vc_request {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Request primitive retargeted successfully");
						f_processDeleteRequestPrimitive(vc_request.primitive.requestPrimitive);
						mccPortIn.send(m_response(vc_response.primitive.responsePrimitive));
					}
					[] mccPortIn.receive(mw_request(?)) -> value vc_request {
						tc_ac.stop;
						setverdict(fail, __SCOPE__ & ": Wrong request received");
						mccPortIn.send(m_response(m_responsePrimitive(int4000, vc_request.primitive.requestPrimitive.requestIdentifier)));
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while retargeting request");
					}
				}	
				
				f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);

				// Postamble
				f_cse_postamble_deleteResourcesCSE();

				// Tear down
				f_cf02DownCseSimuMaster();
				
			}//end f_CSE_DMR_001

			function f_CSE_DMR_002(template RequestPrimitive p_requestPrimitive) runs on AeSimu {
    				
				// Local variables
				var integer v_aeIndex, v_cseBaseIndex, v_targetResourceIndex := -1;
				var ResponseStatusCode v_responseStatusCode := int2000;   
				var XSD.ID v_targetResourceAddress;
				
				// Test control

				// Test component configuration
				f_cf02Up();

				// Test adapter configuration

				// Preamble
				
				v_cseBaseIndex := f_getLatestLocalResourceIndex(vc_cse1);

				vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, {f_getCompletePoA()})));
				f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
				
				v_aeIndex := f_cse_preamble_registerAe();				
				
				//Creating resource in Hosting CSE
				vc_cse1.start(f_generateAndSetLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), v_cseBaseIndex, int3));
				vc_cse1.done;
				
				// Test Body

				v_targetResourceAddress := f_getLatestLocalResourceAddress(vc_cse1, PX_ADDRESSING_METHOD, e_spRelative);
				p_requestPrimitive.to_ := v_targetResourceAddress;
				p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);
				
				v_targetResourceIndex := f_getLatestLocalResourceIndex(vc_cse1);
				
				if(valueof(p_requestPrimitive.operation) == int1) {
					v_responseStatusCode := int2001;
					vc_cse1.start(f_cse_createResourceHandler(mw_create(-, v_targetResourceAddress )));
				} else if(valueof(p_requestPrimitive.operation) == int2) {
					v_responseStatusCode := int2000;
					vc_cse1.start(f_cse_retrieveResourceHandler(v_targetResourceIndex));
				} else if(valueof(p_requestPrimitive.operation) == int3) {
					v_responseStatusCode := int2004;
					vc_cse1.start(f_cse_updateResourceHandler(v_targetResourceIndex));
				} else if(valueof(p_requestPrimitive.operation) == int4) {
					v_responseStatusCode := int2002;
					vc_cse1.start(f_cse_deleteResourceHandler(v_targetResourceIndex));
				}

				mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitive(v_responseStatusCode))) -> value vc_response {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Request primitieve retargeted 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 retargeting request");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while retargeting request");
					}
				}	
				
				f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);

				// Postamble
				f_cse_postamble_deleteResources();

				// Tear down
				f_cf02Down();
				
			}//end f_CSE_DMR_002

			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_getResourceFromAeSimu(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_getResourceFromAeSimu(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(f_getMsgOutPrimitive(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_cse_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, ResourceType p_parentResourceType := int2, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit) runs on CseSimu{
    				
						// 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_getResourceFromAeSimu(vc_ae1);
							p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae1Index)}; 
							vc_ae1.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
						}
						
						if (not ispresent(p_parentRequestPrimitive)){	//Create the resource directly under RemoteCSE
							v_parentIndex := vc_remoteCseIndex;
						}else{	//Create the resource under parentResource
							v_parentIndex := f_cse_createResource_cseSimu(p_parentResourceType, p_parentRequestPrimitive, vc_remoteCseIndex); 	
						}
						
						// Test Body
					
						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_parentIndex);
					
						mccPort.send(f_getMsgOutPrimitive(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, v_parentIndex);
							}
							[] 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_cseSimu(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();
					    				
					}//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 {
				
						// 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(f_getMsgOutPrimitive(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_cse_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 {
    				
						// 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); 	
						
						if(p_resourceType == int15) {
							v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
							v_request.primitiveContent.container.resourceName := vc_resourcesList[v_resourceIndex].resource.pollingChannel.resourceName;
						} else {
							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(f_getMsgOutPrimitive(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 {
    				
						// 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(f_getMsgOutPrimitive(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_cse_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(f_getMsgOutPrimitive(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_cse_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(f_getMsgOutPrimitive(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_cse_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_007(ResourceType p_resourceTypeParent, template RequestPrimitive p_requestPrimitiveParent, ResourceType p_resourceTypeChild, template RequestPrimitive p_requestPrimitiveChild1, template RequestPrimitive p_requestPrimitiveChild2, XSD.String p_resourceName) 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_childIndex := -1;
									   
						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
							
						v_parentIndex := f_cse_createResource(p_resourceTypeParent, p_requestPrimitiveParent, v_aeIndex);	//Parent
	
						v_childIndex := f_cse_createResource(p_resourceTypeChild, p_requestPrimitiveChild1, v_parentIndex);	//Child1

						// Test Body
						v_request := f_getCreateRequestPrimitive(p_resourceTypeChild, p_requestPrimitiveChild2, v_parentIndex);	////Child2

						mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource " & int2str(enum2int(p_resourceTypeChild)) & " created");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating resource type " & int2str(enum2int(p_resourceTypeChild)));			
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(p_resourceTypeChild)));
							}
						}	
			
						f_checkAeSimuStatus();
	
						//Check to see if the resource is NOT present
						if(f_cse_isResourceNotPresent(v_parentIndex, p_resourceName)){
							setverdict(pass, __SCOPE__ & ":INFO: Oldest resource " & int2str(enum2int(p_resourceTypeChild)) & " has been removed to allow the creation of the new instance");
						} else {
							setverdict(fail, __SCOPE__ & ":ERROR: Oldest resource " & int2str(enum2int(p_resourceTypeChild)) & " has not been removed to allow the creation of the new instance");
						}
							
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();	
	
					}//end f_CSE_DMR_CRE_007
					
					function f_CSE_DMR_CRE_008(ResourceType p_resourceTypeParent, template RequestPrimitive p_requestPrimitiveParent, ResourceType p_resourceTypeChild, template RequestPrimitive p_requestPrimitiveChild1, template RequestPrimitive p_requestPrimitiveChild2, XSD.String p_resourceName) 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_childIndex := -1;		   
						// Test control
	
						// Test component configuration
						f_cf01Up();
	
						// Test adapter configuration
	
						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
							
						v_parentIndex := f_cse_createResource(p_resourceTypeParent, p_requestPrimitiveParent, v_aeIndex);	//Parent
	
						v_childIndex := f_cse_createResource(p_resourceTypeChild, p_requestPrimitiveChild1, v_parentIndex);	//Child1
	
						// Test Body
	
						v_request := f_getCreateRequestPrimitive(p_resourceTypeChild, p_requestPrimitiveChild2, v_parentIndex);	//Child2
	
						mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource " & int2str(enum2int(p_resourceTypeChild)) & " created");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating resource type " & int2str(enum2int(p_resourceTypeChild)));			
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(p_resourceTypeChild)));
							}
						}	
			
						f_checkAeSimuStatus();
	
						//Check to see if the resource is NOT present
						if(f_cse_isResourceNotPresent(v_parentIndex, p_resourceName)){
							setverdict(pass, __SCOPE__ & ":INFO: Oldest resource " & int2str(enum2int(p_resourceTypeChild)) & " has been removed to allow the creation of the new instance");
						} else {
							setverdict(fail, __SCOPE__ & ":ERROR: Oldest resource " & int2str(enum2int(p_resourceTypeChild)) & " has not been removed to allow the creation of the new instance");
						}
							
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();	

					}//end f_CSE_DMR_CRE_008
						
					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(f_getMsgOutPrimitive(m_request(v_request, {{v_myOptionalAttribute, omit}})));
						} else {
							mcaPort.send(f_getMsgOutPrimitive(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_cse_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_013(ResourceType p_resourceTypeParent, template RequestPrimitive p_requestPrimitiveParent, ResourceType p_resourceTypeChild, template RequestPrimitive p_requestPrimitiveChild) runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_parentIndex := -1;
						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
								
						v_parentIndex := f_cse_createResource(p_resourceTypeParent, p_requestPrimitiveParent, v_aeIndex);
	
						// Test Body
						v_request := f_getCreateRequestPrimitive(p_resourceTypeChild, p_requestPrimitiveChild, v_parentIndex);
	
						mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int5207))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Maximum byte size exceeded");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Bad responseStatusCode in response");
							}
			
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Accepted creation of resource type " & int2str(enum2int(p_resourceTypeChild)) & " exceding maximum byte size");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource type 4 " & int2str(enum2int(p_resourceTypeChild)));
							}
						}	
				
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_CRE_013
					
					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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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_018(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);
			    					
						// Test Body
						v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
						v_request.resultContent := p_resultContent;
						mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) { //BAD REQUEST
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Request successfully rejected");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { 
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> 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_CRE_018

					function f_CSE_DMR_CRE_019(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on CseSimu{
	    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_parentIndex := -1;
						var integer v_resourceIndex := -1;
						var integer v_aEAnncIndex := -1;
						   
						// Test control
	
						// Test component configuration
						f_cf04Up();
	
						// Test adapter configuration
	
						// Preamble
						vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
						
						v_aEAnncIndex := f_cse_createResource_cseSimu(int10002, m_createAEAnnc(omit, omit, omit, PX_CSE1_ID), vc_remoteCseIndex); //AEAnnnc under RemoteCSE
		
						// Test Body
	
						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aEAnncIndex);
	
						mccPort.send(f_getMsgOutPrimitive(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, v_aEAnncIndex);
							}
							[] 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_cseSimu(v_resourceIndex)){
							setverdict(pass, __SCOPE__ & ":INFO: Resource created");
						} else {
							setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
						}
				
						// Postamble
						f_cse_postamble_deleteResourcesCSE();
	
						// Tear down
						f_cf04Down();
	    				
					}//end f_CSE_DMR_CRE_019
    				
					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(f_getMsgOutPrimitive(m_request(v_request)));
						
						vc_cse1.start(f_cse_receiveCreateRequest_cseSimu(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(mw_createRemoteCSE));
						}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_cseSimu(p_requestAnnc));						
						mcaPort.send(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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;
								setverdict(pass, __SCOPE__ & ": Non-existing attribute not found");
							}
							[] 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, AttributeList_1 p_attributeList) 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(f_getMsgOutPrimitive(m_request(m_retrieveAttributeContentOption(f_getResourceAddress(v_resourceIndex),
																						p_attributeList, f_getOriginator(v_resourceIndex)))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Non-existing attribute not found");
							}
							[] 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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) { //BAD REQUEST
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Request successfully rejected");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { 
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Wrong response status code");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> 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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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__ & ": Attributes and 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(f_getMsgOutPrimitive(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__ & ": Attributes and child resources reference 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(f_getMsgOutPrimitive(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__ & ": Only child resources references 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 := int8;//Child resources
						mcaPort.send(f_getMsgOutPrimitive(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__ & ": Only 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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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_010(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu {
	    				
						// Local variables
						var MsgIn v_response;
						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_createRequestPrimitive, v_aeIndex); 
						
						// Test Body
						
						f_cse_updateResource(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
					
						mcaPort.send(f_getMsgOutPrimitive(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;
							}
							[] 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");
							}
						}	
						
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
						
						// Postamble
						f_cse_postamble_deleteResources();
						
						// Tear down
						f_cf01Down();
		    				
					}//end f_CSE_DMR_UPD_010
					
					function f_CSE_DMR_UPD_011(ResourceType p_resourceTypeParent, template RequestPrimitive p_createParentRequestPrimitive, ResourceType p_resourceTypeChild, template RequestPrimitive p_createChildRequestPrimitive,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_parentIndex := -1;
						var integer v_childIndex := -1; 
			   
						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
	
						v_parentIndex := f_cse_createResource(p_resourceTypeParent, p_createParentRequestPrimitive, v_aeIndex); 
	
						v_childIndex := f_cse_createResource(p_resourceTypeChild, p_createChildRequestPrimitive, v_parentIndex); 
	
						//Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceTypeChild, v_childIndex, p_updateRequestPrimitive);

						mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Not allowed to update resource " & int2str(enum2int(p_resourceTypeChild)) & " with error OPERATION_NOT_ALLOWED");
							}
							[] 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 update of resource " & int2str(enum2int(p_resourceTypeChild)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource " & int2str(enum2int(p_resourceTypeChild)));
							}
						}	
						 
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_childIndex);
		
						// Postamble
						f_cse_postamble_deleteResources();

						// Tear down
						f_cf01Down();
		    			
					}//end f_CSE_DMR_UPD_011
    				
					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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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_getCompletePoA("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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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
					
				function f_CSE_DMR_UPD_017(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
					v_create.primitiveContent.aE.announceTo := {PX_CSE1_ID};
		   
					//Test control
		
					// Test component configuration
					f_cf02UpCseSimuMaster();
		
					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	
		
					//Preamble
		
					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;
		
					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					v_ae1.done;					
			
					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
		
					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));
		
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_createRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: CREATE REQUEST received");
					
							if(match(v_request.primitive.requestPrimitive.to_, f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1, e_hierarchical, e_spRelative)) or 
							match(v_request.primitive.requestPrimitive.to_, f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1, e_nonHierarchical, e_spRelative))) {
								setverdict(pass, __SCOPE__ & ":matching ANNC_PARENT_RESOURCE_ADDRESS");     
							} else {
								setverdict(fail, __SCOPE__ & ":mis-matching ANNC_PARENT_RESOURCE_ADDRESS");
							}
								
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No CREATE REQUEST received");
						}
					}
					v_ae1.done;
		
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
		
					// Tear down
					f_cf02DownCseSimuMaster();
	
				}//end f_CSE_DMR_UPD_017
					
				function f_CSE_DMR_UPD_018(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive, template RequestPrimitive p_updateRequestAnnc) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;

					v_create.primitiveContent.aE.announceTo := {PX_CSE1_ID};
   
					//Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	

					//Preamble

					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;
					
					v_aeIndex := f_getLatestResourceIndex(v_ae1);

					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					

					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
					p_updateRequestAnnc.to_ := f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1);

					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));

					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_updateRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Announcement received");

							v_responsePrimitive := valueof(m_responsePrimitive(int2004,v_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.from_ := PX_CSE1_ID;
							v_responsePrimitive.to_ := v_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));			
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					v_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_DMR_UPD_018
			  	
			}//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(f_getMsgOutPrimitive(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_cse_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, -));
						f_cse_updateResource(int1, vc_acpAuxIndex, 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(f_getMsgOutPrimitive(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_cse_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(f_getMsgOutPrimitive(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
					
					function f_CSE_DMR_DEL_005(ResourceType p_resourceTypeParent, template RequestPrimitive p_requestPrimitiveParent, ResourceType p_resourceTypeChild, template RequestPrimitive p_requestPrimitiveChild) 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_childResourceIndex := -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_resourceTypeParent, p_requestPrimitiveParent, v_aeIndex); 
					
						v_childResourceIndex := f_cse_createResource(p_resourceTypeChild, p_requestPrimitiveChild, v_resourceIndex); 
				
						// Test Body
						mcaPort.send(f_getMsgOutPrimitive(m_request(m_delete(f_getResourceAddress(v_childResourceIndex), f_getOriginator(v_childResourceIndex)))));
					
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(p_resourceTypeChild)) & " 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_resourceTypeChild)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource type " & int2str(enum2int(p_resourceTypeChild)));
							}
						}					
				
						vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
					
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf01Down();
						
					};//end f_CSE_DMR_DEL_005
					
					function f_CSE_DMR_DEL_006(ResourceType p_resourceTypeParent, template RequestPrimitive p_requestPrimitiveParent, ResourceType p_resourceTypeChild, template RequestPrimitive p_requestPrimitiveChild) runs on AeSimu {
						//Local variables
						var integer v_aeIndex := -1;
						var integer v_parentIndex := -1;
						var integer v_childIndex := -1; 
						var PrimitiveContent v_attributesParent, v_attributesParent_afterDeletion;
			   
						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
	
						v_parentIndex := f_cse_createResource(p_resourceTypeParent, p_requestPrimitiveParent, v_aeIndex); 
	
						v_childIndex := f_cse_createResource(p_resourceTypeChild, p_requestPrimitiveChild, v_parentIndex); 
	
						v_attributesParent := f_cse_retrieveResource(v_parentIndex);
						
						if (p_resourceTypeParent==int3){	//Container
							if(not(ispresent(v_attributesParent.container.currentNrOfInstances))) {
								setverdict(fail, __SCOPE__ & ": Error the currentNrOfInstances attribute is empty");
								f_checkAeSimuStatus();
							}
						}else if (p_resourceTypeParent==int29){	//TimeSeries
							if(not(ispresent(v_attributesParent.timeSeries.currentNrOfInstances))) {
								setverdict(fail, __SCOPE__ & ": Error the currentNrOfInstances attribute is empty");
								f_checkAeSimuStatus();
							}
						}						
		
						// Test Body
						f_cse_deleteResource(v_childIndex);

						v_attributesParent_afterDeletion := f_cse_retrieveResource(v_parentIndex);
	
						if (p_resourceTypeParent==int3){	//Container
							if(not(ispresent(v_attributesParent_afterDeletion.container.currentNrOfInstances))) {
								setverdict(fail, __SCOPE__ & ": Error the currentNrOfInstances attribute is empty");
								f_checkAeSimuStatus();
							}
						}else if (p_resourceTypeParent==int29){	//TimeSeries
							if(not(ispresent(v_attributesParent_afterDeletion.timeSeries.currentNrOfInstances))) {
								setverdict(fail, __SCOPE__ & ": Error the currentNrOfInstances attribute is empty");
								f_checkAeSimuStatus();
							}
						}		
	
						if (p_resourceTypeParent==int3){	//Container
							if((v_attributesParent.container.currentNrOfInstances > v_attributesParent_afterDeletion.container.currentNrOfInstances) and
								(v_attributesParent.container.currentByteSize > v_attributesParent_afterDeletion.container.currentByteSize)) {
								setverdict(pass, __SCOPE__ & ": The currentNrOfInstances and currentByteSize attributes are decreased");
							} else {
								setverdict(fail, __SCOPE__ & ": currentNrOfInstances and/or currentByteSize attributes are not decreased");
							}
						}else if (p_resourceTypeParent==int29){	//TimeSeries
							if((v_attributesParent.timeSeries.currentNrOfInstances > v_attributesParent_afterDeletion.timeSeries.currentNrOfInstances) and
								(v_attributesParent.timeSeries.currentByteSize > v_attributesParent_afterDeletion.timeSeries.currentByteSize)) {
								setverdict(pass, __SCOPE__ & ": The currentNrOfInstances and currentByteSize attributes are decreased");
							} else {
								setverdict(fail, __SCOPE__ & ": currentNrOfInstances and/or currentByteSize attributes are not decreased");
							}
						}
		
						// Postamble
						f_cse_postamble_deleteResources();

						// Tear down
						f_cf01Down();
					};//end f_CSE_DMR_DEL_006
				
			}//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, omit, int3, -, v_acpIDs, -), 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(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation performed successfully by using fanOutPoint in the Group resource");
	                
								if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__ & ": Error, aggregatedResponse element 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_responsePrimitive(p_responseStatusCode))){
											setverdict(fail, __SCOPE__ & ": Error, one responsePrimitve of aggregatedResponse 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 performing the operation");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while performing the operation");
							}
						}
			
						// 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(f_getMsgOutPrimitive(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 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 no 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(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation performed successfully by using fanOutPoint in group resource");
	    
								if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__ & ": Error, aggregatedResponse element 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_responsePrimitive(p_responseStatusCode))){
											setverdict(fail, __SCOPE__ & ": Error, one responsePrimitve of aggregatedResponse 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 performing the operation");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while performing the operation");
							}
						}
	
						// 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(f_getMsgOutPrimitive(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 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 no 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) 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(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation performed successfully by using fanOutPoint in group resource");
	                            
								if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__ & ": Error, aggregatedResponse element 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 performing the operation");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while performing the operation");
							}
						}
	
						// 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) 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(f_getMsgOutPrimitive(m_request(v_createRequest)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation performed successfully 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 performing the operation");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while performing the operation");
							}
						}
			
						// 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(f_getMsgOutPrimitive(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 {
				
				function f_CSE_SUB_CRE_001(ResourceType p_parentResourceType, template RequestPrimitive p_parentResourceRequestPrimitive, ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive) runs on AeSimu {
					//Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_parentResourceIndex := -1;
					var integer v_childResourceIndex := -1;
					var RequestPrimitive v_request;
					var integer v_ae2Index := -1;
					var template RequestPrimitive v_createSubscriptionRequest := m_createSubscriptionBase;
	
					// Test control
	
					// Test component configuration
					f_cf01Up();
	
					// Test adapter configuration
								
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);	
									
					f_cse_preamble_subscriptionVerification(v_ae2Index, v_createSubscriptionRequest, int23);	
					
					v_parentResourceIndex := f_cse_createResource(p_parentResourceType, p_parentResourceRequestPrimitive, v_aeIndex);//Parent 	
					
					if(p_parentResourceType != int23){			
						v_childResourceIndex := f_cse_createResource(p_childResourceType, p_childRequestPrimitive, v_parentResourceIndex);//Child
					}else{
						v_childResourceIndex := v_parentResourceIndex;
					}
	
					v_request := f_getCreateRequestPrimitive(int23, v_createSubscriptionRequest, v_childResourceIndex);//Subscription under child
	
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int5203))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(p_childResourceType)) & " not subscribable");
						}
						[] 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__ & ": Subscription successful whereas resource type " & int2str(enum2int(p_childResourceType)) & " resource is not subscribable");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource");
						}
					}
	
					f_checkAeSimuStatus();
	
					//Check to see if the resource is NOT present
					if(f_cse_isResourceNotPresent(v_childResourceIndex, f_getResourceName(v_request.primitiveContent))){
						setverdict(pass, __SCOPE__ & ":INFO: Subscription resource not created");
					} else {
						setverdict(fail, __SCOPE__ & ":ERROR: Subscription resource created");
					}
	
					//Postamble
					f_cse_postamble_deleteResources();
	
					//Tear down
					f_cf01Down();
				}// end f_CSE_SUB_CRE_001
	
			}//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));
							f_cse_updateResource(int1, v_acpIndex, 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(f_getMsgOutPrimitive(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 accepted 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, -));
							f_cse_updateResource(int1, v_acpIndex1, 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, -));
							f_cse_updateResource(int1, v_acpIndex2, 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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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 := {{{"* * * * " & int2str(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(f_getMsgOutPrimitive(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 integer 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 := v_month + 1;
							}
							v_accessControlRule.accessControlContexts_list := {{{"* * * * " & int2str(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(f_getMsgOutPrimitive(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 accepted 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(f_getMsgOutPrimitive(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(f_getMsgOutPrimitive(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 accepted 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_getCompletePoA(-, 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(f_getMsgOutPrimitive(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_getCompletePoA(-, 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(f_getMsgOutPrimitive(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 accepted 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(f_getMsgOutPrimitive(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, -));
							f_cse_updateResource(int1, v_acpIndex, v_updateRequest);
							
							// Test Body
							v_request := f_getCreateRequestPrimitive(int3, p_requestPrimitive, v_containerIndex);
							
							mcaPort.send(f_getMsgOutPrimitive(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 accepted 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 integer v_AEAnncResourceIndex;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_create.primitiveContent.aE.announceTo := {PX_CSE1_ID};
				   
					// Test control

					// Test component configuration
					f_cf02Up();

					// Test adapter configuration
			
					//Register the CSE
					vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, {f_getCompletePoA()})));
					vc_cse1.done;
					
					f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
					
					//Preamble
					vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -)));
					v_aeIndex := f_cse_createResource(int2,v_create);
					vc_cse1.done;
					
					f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
					
					// 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_aeIndex);
					  	v_responsePrimitive.responseStatusCode := int2001;
					}
					
					//Retrieve the parent resource index
					v_AEAnncResourceIndex := f_getLatestLocalResourceIndex(vc_cse1);
					vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc, -, v_AEAnncResourceIndex));	
					mcaPort.send(f_getMsgOutPrimitive(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)));
						}
					}
					
					f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
										
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf02Down();

				}//end f_CSE_ANNC_001
	
			}//end group Basic
			
			group Create {
				
				function f_CSE_ANNC_CRE_001(ResourceType p_resourceType,template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit) runs on AeSimu {
				  //Local variables
				  var MsgIn v_response;
				  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_CSE1_ID};
				  //Test control

				  //Test component configuration
				  f_cf02Up();

				  //Register the CSE
				  vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, {f_getCompletePoA()})));
				  
				  f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);

				  //Preamble
				  vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -)));
				  v_aeIndex := f_cse_createResource(int2,v_create);
				  
				  f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
				  
				  vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc));	
				  f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex);
				  vc_cse1.done;

				  //Postamble
				  f_cse_postamble_deleteResources();

				  // Tear down
				  f_cf02Down();
				} //end f_CSE_ANNC_CRE_001
				
				function f_CSE_ANNC_CRE_002(ResourceType p_resourceType, template RequestPrimitive p_createRequest, in template RequestPrimitive p_updateRequest := omit, in template RequestPrimitive p_createRequestAnnc) runs on CseSimu {
					// Local variables
					var MsgIn v_response;
					var MsgIn v_request;
					var PrimitiveContent v_announcedResource;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex;
					var integer v_localResourceIndex := -1;
					var integer v_remoteCSEAnncIndex := -1;
					var ResponsePrimitive v_responsePrimitive;
					
					// Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration

					//Register the CSE
				  	f_cse_registrationRemoteCse(mw_createRemoteCSE);
				  
					//Preamble
					vc_ae1.start(f_cse_preamble_registerAe());
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					v_aeIndex := f_getLatestResourceIndex(vc_ae1);
					
					vc_ae1.start(f_cse_createResource(p_resourceType, p_createRequest, v_aeIndex));
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					v_resourceIndex := f_getLatestResourceIndex(vc_ae1);
	
					// Test Body
					vc_ae1.start(f_cse_sendUpdateRequestPrimitive(p_resourceType, p_updateRequest, v_resourceIndex));
					vc_ae1.done;
					
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(mw_updateRemoteCSE(PX_CSE_ID))) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: RemoteCSE UPDATE received");
							
							v_localResourceIndex := f_getLocalResourceIndex(v_request.primitive.requestPrimitive.to_);
							if(v_localResourceIndex == -1)
							{ 
								log(__SCOPE__&": ERROR: Resource Index not valid, target not found");
								v_responsePrimitive := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier));
							} else {
								v_responsePrimitive := valueof(m_responsePrimitive(int2004,v_request.primitive.requestPrimitive.requestIdentifier));
								f_updateLocalResource(v_localResourceIndex, v_request.primitive.requestPrimitive.primitiveContent);
								v_responsePrimitive.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
							}
							v_responsePrimitive.from_ := PX_CSE1_ID;
							v_responsePrimitive.to_ := v_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(valueof(v_responsePrimitive))));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					
					f_checkCseSimuStatus();
					
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_createRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Resource Announced CREATE received");
		
							//Simulate that resourceAnnc is created on CSE2
							v_announcedResource:= f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, -1,v_request.primitive.requestPrimitive.resourceType);
							//Set parentID correctly to remoteCSEAnnc-ID
							v_announcedResource := f_setParentID(v_announcedResource, f_resourceIdCleaner(vc_localResourcesList[v_localResourceIndex].resource.remoteCSE.announceTo[0]));
					
							v_responsePrimitive := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.primitiveContent := v_announcedResource;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					
					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_CRE_002
				
				function f_CSE_ANNC_CRE_003(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 integer v_containerAnncResourceIndex;
					var template RequestPrimitive v_createContainer := m_createContainerBase;
					v_createContainer.primitiveContent.container.announceTo := {PX_CSE1_ID};
					
   
					// Test control

					// Test component configuration
					f_cf02Up();

					// Test adapter configuration

					//Register the CSE
					vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, {f_getCompletePoA()})));
				  
				  	f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
	
					//Preamble
					v_aeIndex := f_cse_preamble_registerAe();
					vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createContainerAnnc(-, -)));
					v_resourceIndex := f_cse_createResource(int3,v_createContainer, v_aeIndex);
					f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
	
					// Test Body
					//Retrieve the parent resource index where contentInstanceAnnc must be created
					v_containerAnncResourceIndex := f_getLatestLocalResourceIndex(vc_cse1);
					v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestCreatePrimitive, v_resourceIndex);
					vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc,int4000, v_containerAnncResourceIndex));	
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__, ": Resource " & int2str(enum2int(p_resourceType)) & " created successfully");
							if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.contentInstance.announceTo)) {
								if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.contentInstance.announceTo) != 0) {
									setverdict(fail, __SCOPE__, ": Resource " & int2str(enum2int(p_resourceType)) & " contains the attribute announceTo");
								}
							}
						}
						[] 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 creating resource type " & int2str(enum2int(p_resourceType)));
						}
					}
					
					vc_cse1.done;
						
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf02Down();

				}//end f_CSE_ANNC_CRE_003
				
				function f_CSE_ANNC_CRE_004_CseSimu(ResourceType p_resourceType, template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit) runs on CseSimu {
					// Local variables
					var MsgIn v_request;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex;
					var integer v_aEAnncIndex := -1;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					
					v_create.primitiveContent.aE.announceTo := {PX_CSE1_ID};
   
					// Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();
					
					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, {f_getCompletePoA()}));
					
					//Preamble
					vc_ae1.start(f_cse_createResource(int2,v_create));
					v_aEAnncIndex := f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					v_aeIndex := f_getLatestResourceIndex(vc_ae1);
					
					// Test Body
					vc_ae1.start(f_cse_createResource(p_resourceType,p_requestCreatePrimitive, v_aeIndex));
					
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc, -, v_aEAnncIndex);					
					
					vc_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_CRE_004
				
				function f_CSE_ANNC_CRE_005_CseSimu(ResourceType p_resourceType, template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit) runs on CseSimu {
					// Local variables
					var MsgIn v_request;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_resourceAnncIndex := -1;
					var integer v_aEAnncIndex := -1;
					var ResponsePrimitive v_responsePrimitive;
					var PrimitiveContent v_announcedResource;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					var template RequestPrimitive v_createContainer := m_createContainerBase;
					
					// Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
				  
					f_checkCseSimuStatus();
					
					//Preamble
					vc_ae1.start(f_cse_createResource(int2,v_create));
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					v_aeIndex := f_getLatestResourceIndex(vc_ae1);
					
					v_createContainer.primitiveContent.container.announceTo := {"/CSE2_ID"};
					v_createContainer.primitiveContent.container.resourceName := "TriggerAnnounceIUT";
					vc_ae1.start(f_cse_createResource(int3,v_createContainer, v_aeIndex));
					
					//IUT shall announce itself by updating announceTo attribute of its remoteCSE on its registrar (CSE1)
					f_cse_updateResourceHandler(vc_localRemoteCseIndex, mw_updateRemoteCSE);				
					
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(mw_createContainerAnnc(PX_CSE_ID, vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.announceTo[0] ))) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Resource Announced CREATE received");
							
							//Simulate that resourceAnnc is created on CSE2
							v_announcedResource:= f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, -1,v_request.primitive.requestPrimitive.resourceType);
							//Set parentID correctly to remoteCSEAnnc-ID
							v_announcedResource := f_setParentID(v_announcedResource, f_resourceIdCleaner(vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.announceTo[0]));
										
							v_responsePrimitive := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.primitiveContent := v_announcedResource;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					// Test Body
					vc_ae1.start(f_cse_createResource(p_resourceType,p_requestCreatePrimitive, v_aeIndex));
					
					//IUT shall then create the announced resource on its remoteCSEAnnc as indicated in the announceTo attribute returned by its registrar (CSE1)
					p_createRequestAnnc.to_ := vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.announceTo[0];
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_createRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Resource Announced CREATE received");
				
							//Simulate that resourceAnnc is created on CSE2
							v_announcedResource:= f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, -1,v_request.primitive.requestPrimitive.resourceType);
							//Set parentID correctly to remoteCSEAnnc-ID
							v_announcedResource := f_setParentID(v_announcedResource, f_resourceIdCleaner(vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.announceTo[0]));
							
							v_responsePrimitive := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.primitiveContent := v_announcedResource;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					
					vc_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_CRE_005
				
				function f_CSE_ANNC_CRE_006_CseSimu(ResourceType p_resourceType, template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit) runs on CseSimu {
					// Local variables
					var MsgIn v_request;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex;
					var integer v_aEAnncIndex := -1;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					
					// Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, {f_getCompletePoA()}));
					
					//Preamble
					vc_ae1.start(f_cse_createResource(int2,v_create));
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					v_aeIndex := f_getLatestResourceIndex(vc_ae1);

					// Test Body
					vc_ae1.start(f_cse_createResource(p_resourceType,p_requestCreatePrimitive, v_aeIndex));

					f_cse_announcementProcedure_createHandler(p_createRequestAnnc, -, vc_localRemoteCseIndex);
										
					vc_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_CRE_006
				
				function f_CSE_ANNC_CRE_007_CseSimu(ResourceType p_resourceType, template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit) runs on CseSimu {
					// Local variables
					var MsgIn v_request;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex;
					var integer v_aEAnncIndex := -1;
					var ResponsePrimitive v_responsePrimitive;
					var PrimitiveContent v_announcedResource;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					var template RequestPrimitive v_createContainer := m_createContainerBase;
					
					// Test control
					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
				  
					f_checkCseSimuStatus();
					
					//Preamble
					vc_ae1.start(f_cse_createResource(int2,v_create));
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					v_aeIndex := f_getLatestResourceIndex(vc_ae1);
					
					v_createContainer.primitiveContent.container.announceTo := {"/CSE2_ID"};
					v_createContainer.primitiveContent.container.resourceName := "TriggerAnnounceIUT";
					vc_ae1.start(f_cse_createResource(int3,v_createContainer, v_aeIndex));
					
					//IUT shall announce itself by updating announceTo attribute of its remoteCSE on its registrar (CSE1)
					f_cse_updateResourceHandler(vc_localRemoteCseIndex, mw_updateRemoteCSE);				
					
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(mw_createContainerAnnc(PX_CSE_ID, vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.announceTo[0] ))) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Resource Announced CREATE received");
							
							//Simulate that resourceAnnc is created on CSE2
							v_announcedResource:= f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, -1,v_request.primitive.requestPrimitive.resourceType);
							//Set parentID correctly to remoteCSEAnnc-ID
							v_announcedResource := f_setParentID(v_announcedResource, f_resourceIdCleaner(vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.announceTo[0]));
										
							v_responsePrimitive := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.primitiveContent := v_announcedResource;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					// Test Body
					vc_ae1.start(f_cse_createResource(p_resourceType,p_requestCreatePrimitive, v_aeIndex));
					
					//IUT shall then create the announced resource on its remoteCSEAnnc as indicated in the announceTo attribute returned by its registrar (CSE1)
					p_createRequestAnnc.to_ := vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.announceTo[0];
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_createRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Resource Announced CREATE received");
				
							//Simulate that resourceAnnc is created on CSE2
							v_announcedResource:= f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, -1,v_request.primitive.requestPrimitive.resourceType);
							//Set parentID correctly to remoteCSEAnnc-ID
							v_announcedResource := f_setParentID(v_announcedResource, f_resourceIdCleaner(vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE.announceTo[0]));
							
							v_responsePrimitive := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.primitiveContent := v_announcedResource;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					
					vc_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();
										
					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_CRE_007
				
				function f_CSE_ANNC_CRE_008_CseSimu(ResourceType p_resourceType, template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit) runs on CseSimu {
					// Local variables
					var MsgIn v_request;
					var integer v_aeIndex := -1;
					var integer v_aEAnncIndex := -1;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_create.primitiveContent.aE.announceTo := {PX_CSE1_ID};
   
					// Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();
					
					//Test adapter configuration
					// Register the CSE
					vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, {f_getCompletePoA()}));
					
					f_checkCseSimuStatus();
					
					vc_ae1.start(f_cse_createResource(int2,v_create));
					v_aEAnncIndex := f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					v_aeIndex := f_getLatestResourceIndex(vc_ae1);

					// Test Body
					vc_ae1.start(f_cse_createResource(p_resourceType,p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc, -, v_aEAnncIndex);
					vc_ae1.done;
					
					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_CRE_008
				
				function f_CSE_ANNC_CRE_009_CseSimu(ResourceType p_resourceType, template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit) runs on CseSimu {
					// Local variables
					var MsgIn v_request;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex;
					var integer v_aEAnncIndex := -1;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_create.primitiveContent.aE.announceTo := {PX_CSE1_ID};
   
					// Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();
	
					//Test adapter configuration
					// Register the CSE
					vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, {f_getCompletePoA()}));
					
					f_checkCseSimuStatus();
					vc_ae1.start(f_cse_createResource(int2,v_create));
					v_aEAnncIndex := f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
					
					v_aeIndex := f_getLatestResourceIndex(vc_ae1);

					// Test Body
					vc_ae1.start(f_cse_createResource(p_resourceType,p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc, -, v_aEAnncIndex);
					vc_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_CRE_009
				
			} //end group Create
			
			group Retrieve {
			
				function f_CSE_ANNC_RET_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 template RequestPrimitive v_createAE := m_createAe(PX_APP_ID, omit, omit);
					var template RequestPrimitive v_createAEAnnc := m_createAEAnnc(omit, omit, omit, PX_CSE1_ID);
					var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyAcp", -, int61);
					var integer v_aeAnncIndex;
					var integer v_resourceAnncIndex;
					var integer v_acpIndex;
					var XSD.ID v_membersAcpId;
   
					// Test control

					// Test component configuration
					f_cf02Up();

					// Test adapter configuration

					//Register the CSE
					vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));	
					vc_cse1.done;

					//Preamble
					v_aeIndex := f_cse_createResource(int2,v_createAE);
					
					v_acpIndex := f_cse_createResource(int1, v_createAcp, v_aeIndex); // AE child resource
					v_membersAcpId := f_getResourceId(vc_resourcesList[v_acpIndex].resource);
					
					v_createAEAnnc.primitiveContent.aEAnnc.resourceID := v_membersAcpId;
					v_aeAnncIndex := f_cse_createResource(int10002,v_createAEAnnc);
					
					v_resourceAnncIndex := f_cse_createResource(p_resourceType,p_createRequestAnnc);

					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(v_resourceAnncIndex)))));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__, ": Resource " & int2str(enum2int(p_resourceType)) & " retrieved 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 retrieving resource type " & int2str(enum2int(p_resourceType)));
						}
					}
		
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf02Down();

				}//end f_CSE_ANNC_RET_001
				
				function f_CSE_ANNC_RET_002(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 template RequestPrimitive v_createAE := m_createAe(PX_APP_ID, omit, omit);
					var template RequestPrimitive v_createAEAnnc := m_createAEAnnc(omit, omit, omit, PX_CSE1_ID);
					var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyAcp", -, int61);
					var integer v_aeAnncIndex;
					var integer v_resourceAnncIndex;
					var integer v_acpIndex;
					var XSD.ID v_membersAcpId;
					
					//Test control

					 // Test component configuration
					 f_cf02Up();

					 // Test adapter configuration

					 //Register the CSE
					 vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));	
					 vc_cse1.done;

					 //Preamble
					 v_aeIndex := f_cse_createResource(int2,v_createAE);
	
					 v_acpIndex := f_cse_createResource(int1, v_createAcp, v_aeIndex); // AE child resource
					 v_membersAcpId := f_getResourceId(vc_resourcesList[v_acpIndex].resource);
	
					 v_createAEAnnc.primitiveContent.aEAnnc.resourceID := v_membersAcpId;
					 v_aeAnncIndex := f_cse_createResource(int10002,v_createAEAnnc);
	
					 v_resourceAnncIndex := f_cse_createResource(p_resourceType,p_createRequestAnnc);
					 
					 //Postamble
       			     f_cse_postamble_deleteResources();

					 // Tear down
					 f_cf02Down();
					
				} //end f_CSE_ANNC_RET_002
			 
			} //end group Retrieve
			
			group Update{
			
				function f_CSE_ANNC_UPD_001(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
		
					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
	   
					//Test control
	
					// Test component configuration
					f_cf02UpCseSimuMaster();
	
					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	
	
					//Preamble
	
					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;
					
					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					v_ae1.done;					
		
					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
	
					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));
	
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_createRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: CREATE REQUEST received");
				
							if(match(v_request.primitive.requestPrimitive.to_, f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1, e_hierarchical, e_spRelative)) or 
							match(v_request.primitive.requestPrimitive.to_, f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1, e_nonHierarchical, e_spRelative))) {
								setverdict(pass, __SCOPE__ & ":matching ANNC_PARENT_RESOURCE_ADDRESS");     
							} else {
								setverdict(fail, __SCOPE__ & ":mis-matching ANNC_PARENT_RESOURCE_ADDRESS");
							}
							
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No CREATE REQUEST received");
						}
					}
					v_ae1.done;
	
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
	
					// Tear down
					f_cf02DownCseSimuMaster();
	
				}//end f_CSE_ANNC_UPD_001
	
				function f_CSE_ANNC_UPD_002(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive, template (omit) AttributeAux_list p_nullFields := omit) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex;
					var integer v_aEAnncIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
		
					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
	   
					//Test control
	
					// Test component configuration
					f_cf02UpCseSimuMaster();
	
					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	
	
					//Preamble
	
					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;
	
					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					
	
					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
	
					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));
	
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(mw_delete(f_getResourceAddress(v_latestResourceIndex)))){
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Delete Request received successfully");
						}
						[] mccPortIn.receive {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error Delete request was not received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while waiting to receive Delete request");
						}
					}
					v_ae1.done;
	
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
	
					// Tear down
					f_cf02DownCseSimuMaster();
	
				}//end f_CSE_ANNC_UPD_002
	
				function f_CSE_ANNC_UPD_003(ResourceType p_resourceType,template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit, template RequestPrimitive p_requestUpdatePrimitive, template (omit) AttributeAux_list p_nullFields := omit) runs on AeSimu {
					//Local variables
					var RequestPrimitive v_updateRequest;
					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();
	
					//Register the CSE
					vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));	
					vc_cse1.done;
	
					//Preamble
					vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -)));
					v_aeIndex := f_cse_createResource(int2,v_create);
					vc_cse1.done;
	
					vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc));	
					v_resourceIndex := f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex);
					vc_cse1.done;				  	
	
					vc_cse1.start(f_cse_announcementProcedure_deleteHandler());	
					v_updateRequest := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_requestUpdatePrimitive);
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest, p_nullFields)));
	
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource updated successfully");
				
						}
						[] 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");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						}
					}
		
					vc_cse1.done;
	
					//Used to check that the resource has been updated
					vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);
	
					//Postamble
					f_cse_postamble_deleteResources();
	
					// Tear down
					f_cf02Down();
				} //end f_CSE_ANNC_UPD_003
				
				function f_CSE_ANNC_UPD_004(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex;
					var integer v_aEAnncIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;

					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
   
					//Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	

					//Preamble
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					v_ae1.done;					

					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);

					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));
					v_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_UPD_004
	
				function f_CSE_ANNC_UPD_005(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive, template RequestPrimitive p_updateRequestAnnc, template (omit) AttributeAux_list p_nullFields := omit) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
		
					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
	   
					//Test control
	
					// Test component configuration
					f_cf02UpCseSimuMaster();
	
					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	
	
					//Preamble
	
					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;
	
					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					
	
					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
					p_updateRequestAnnc.to_ := f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1);
	
					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive, p_nullFields));
	
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_updateRequestAnnc)) -> value vc_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Announcement received");
			
							v_responsePrimitive := valueof(m_responsePrimitive(int2004,vc_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.from_ := PX_CSE1_ID;
							v_responsePrimitive.to_ := vc_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));			
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					v_ae1.done;
	
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
	
					// Tear down
					f_cf02DownCseSimuMaster();
	
				}//end f_CSE_ANNC_UPD_005
				
				function f_CSE_ANNC_UPD_006(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;

					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
   
					//Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	

					//Preamble

					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;

					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					

					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);

					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));

					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_createRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: CREATE Request received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No CREATE request received");
						}
					}
					v_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_UPD_006
				
				function f_CSE_ANNC_UPD_007(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;

					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
   
					//Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	

					//Preamble

					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;

					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					

					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);

					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));

					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_createRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: CREATE Request received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No CREATE request received");
						}
					}
					v_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_UPD_007
				
				function f_CSE_ANNC_UPD_008(ResourceType p_resourceType,template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit, template RequestPrimitive p_requestUpdatePrimitive) runs on AeSimu {
					//Local variables
					var RequestPrimitive v_updateRequest;
					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();

					//Register the CSE
					vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));	
					vc_cse1.done;

					//Preamble
					vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -)));
					v_aeIndex := f_cse_createResource(int2,v_create);
					vc_cse1.done;

					vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc));	
					v_resourceIndex := f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex);
					vc_cse1.done;				  	

					vc_cse1.start(f_cse_announcementProcedure_updateHandler());
					v_updateRequest := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_requestUpdatePrimitive);
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource updated successfully");

						}
						[] 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");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						}
					}

					vc_cse1.done;

					//Used to check that the resource has been updated
					vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);

					//Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf02Down();
				} //end f_CSE_ANNC_UPD_008
				
				function f_CSE_ANNC_UPD_009(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive, template RequestPrimitive p_updateRequestAnnc) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;

					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
   
					//Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	

					//Preamble

					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;

					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					

					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
					p_updateRequestAnnc.to_ := f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1);

					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));

					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_updateRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Announcement received");
			
							v_responsePrimitive := valueof(m_responsePrimitive(int2004,v_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.from_ := PX_CSE1_ID;
							v_responsePrimitive.to_ := v_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));			
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					v_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_UPD_009
				
				function f_CSE_ANNC_UPD_010(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive, template RequestPrimitive p_updateRequestAnnc) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;

					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
   
					//Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	

					//Preamble

					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;

					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					

					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
					p_updateRequestAnnc.to_ := f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1);

					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));

					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_updateRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Announcement received");

							v_responsePrimitive := valueof(m_responsePrimitive(int2004,v_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.from_ := PX_CSE1_ID;
							v_responsePrimitive.to_ := v_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));			
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					v_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_UPD_010
				
				function f_CSE_ANNC_UPD_011(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive, template RequestPrimitive p_updateRequestAnnc) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;

					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
   
					//Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	

					//Preamble

					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;

					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					

					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
					p_updateRequestAnnc.to_ := f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1);

					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive));

					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_updateRequestAnnc)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Announcement received");

							v_responsePrimitive := valueof(m_responsePrimitive(int2004,v_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.from_ := PX_CSE1_ID;
							v_responsePrimitive.to_ := v_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));			
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					v_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_UPD_011
				
				function f_CSE_ANNC_UPD_012(ResourceType p_resourceType, template RequestPrimitive p_requestCreatePrimitive, template RequestPrimitive p_createRequestAnnc, template RequestPrimitive p_requestUpdatePrimitive, template RequestPrimitive p_updateRequestAnnc, template (omit) AttributeAux_list p_nullFields := omit) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var RequestPrimitive v_requestUpdatePrimitive;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;

					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
   
					//Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	

					//Preamble

					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;

					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					

					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
					p_updateRequestAnnc.to_ := f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1);

					// Test Body
					v_ae1.start(f_cse_updateResource(p_resourceType, v_latestResourceIndex, p_requestUpdatePrimitive, p_nullFields));

					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(p_updateRequestAnnc)) -> value vc_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ":INFO: Announcement received");

							v_responsePrimitive := valueof(m_responsePrimitive(int2004,vc_request.primitive.requestPrimitive.requestIdentifier));
							v_responsePrimitive.from_ := PX_CSE1_ID;
							v_responsePrimitive.to_ := vc_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive)));			
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ":ERROR:  No announcement received");
						}
					}
					v_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_UPD_012
				
				function f_CSE_ANNC_UPD_013(ResourceType p_resourceType,template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit, template RequestPrimitive p_requestUpdatePrimitive, template (omit) AttributeAux_list p_nullFields := omit) runs on AeSimu {
					//Local variables
					var RequestPrimitive v_updateRequest;
					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();

					//Register the CSE
					vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));	
					vc_cse1.done;

					//Preamble
					vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -)));
					v_aeIndex := f_cse_createResource(int2,v_create);
					vc_cse1.done;

					vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc));	
					v_resourceIndex := f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex);
					vc_cse1.done;				  	

					vc_cse1.start(f_cse_announcementProcedure_updateHandler());
					v_updateRequest := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_requestUpdatePrimitive);
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest, p_nullFields)));

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource updated successfully");

						}
						[] 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");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						}
					}

					vc_cse1.done;

					//Used to check that the resource has been updated
					vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);

					//Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf02Down();
				} //end f_CSE_ANNC_UPD_013
				
				function f_CSE_ANNC_UPD_014(ResourceType p_resourceType,template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit, template RequestPrimitive p_requestUpdatePrimitive) runs on AeSimu {
					//Local variables
					var RequestPrimitive v_updateRequest;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex;
					var integer v_AEAnncResourceIndex;
					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();

					//Register the CSE
					vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));	
					vc_cse1.done;

					//Preamble
					vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -)));
					v_aeIndex := f_cse_createResource(int2,v_create);
					vc_cse1.done;
	
					v_resourceIndex := f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex);
						  	
					//Retrieve the parent resource index
					v_AEAnncResourceIndex := f_getLatestResourceIndex(vc_cse1);
					vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc,int4000, v_AEAnncResourceIndex));
					v_updateRequest := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_requestUpdatePrimitive);
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource updated successfully");
						}
						[] 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");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						}
					}

					vc_cse1.done;

					//Used to check that the resource has been updated
					vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);

					//Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf02Down();
				} //end f_CSE_ANNC_UPD_014
	
			}//end group Update
			
			group Delete{
				
				function f_CSE_ANNC_DEL_001(ResourceType p_resourceType,template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit) runs on AeSimu {
					//Local variables
					var RequestPrimitive v_request;
				  	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();

				  	//Register the CSE
				  	vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase));	
				  	vc_cse1.done;

				  	//Preamble
				  	vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -)));
				  	v_aeIndex := f_cse_createResource(int2,v_create);
				  	vc_cse1.done;

				  	vc_cse1.start(f_cse_announcementProcedure_createHandler(p_createRequestAnnc));	
					v_resourceIndex := f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex);
				  	vc_cse1.done;				  	
				  	
					vc_cse1.start(f_cse_announcementProcedure_deleteHandler());	
					v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource deleted successfully");
						}
						[] 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");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
						}
					}
					
					vc_cse1.done;
					
					//Check to see if the resource is present or not
					if (f_cse_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_cf02Down();
				} //end f_CSE_ANNC_DEL_001
			
				function f_CSE_ANNC_DEL_002(ResourceType p_resourceType, template RequestPrimitive p_createRequestAnnc, in template RequestPrimitive p_requestCreatePrimitive := omit) runs on CseSimu {
					// Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					var MsgIn v_request;
					var integer v_parentIndex := -1;
					var integer v_aeIndex := -1;
					var integer v_latestResourceIndex;
					var ResponsePrimitive v_responsePrimitive;
					var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, omit);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
					
					v_create.primitiveContent.aE.announceTo := {PX_CSE_ID};
   
					// Test control

					// Test component configuration
					f_cf02UpCseSimuMaster();

					// Test adapter configuration
					// Register the CSE
					f_cse_registerRemoteCse(m_createRemoteCSEBase);	
	
					//Preamble
					
					v_ae1.start(f_cse_createResource(int2,v_create));					
					f_cse_announcementProcedure_createHandler(mw_createAEAnnc(-, -, -));		
					v_ae1.done;
					
					v_aeIndex:= f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_createResource(p_resourceType, p_requestCreatePrimitive, v_aeIndex));
					f_cse_announcementProcedure_createHandler(p_createRequestAnnc);	
					v_ae1.done;					
	
					// Test Body
					v_latestResourceIndex := f_getLatestResourceIndex(v_ae1);
					
					v_ae1.start(f_cse_deleteResource(v_latestResourceIndex));
	
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(mw_delete(f_getResourceAddress(v_latestResourceIndex)))){
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Delete Request received successfully");
						}
						[] mccPortIn.receive {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error Delete request was not received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while waiting to receive Delete request");
						}
					}
					v_ae1.done;

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf02DownCseSimuMaster();

				}//end f_CSE_ANNC_DEL_002
			
			}//end group Delete
		
		}// end group Announcement
		
		group PollingChannel {
			
			function f_CSE_PCH_005(template RequestPrimitive p_requestPrimitive) runs on AeSimu {
		
				//Local variables
				var integer v_aeIndex1 := -1;
				var integer v_aeIndex2 := -1;
				var integer v_resourceIndex := -1;
				var integer v_acpAuxIndex := -1;
				var RequestPrimitive v_request;
				var MsgIn v_response;
				var RequestPrimitive v_requestNotify;

				// Test control

				// Test component configuration
				f_cf01Up(true);

				// Test adapter configuration

				// Preamble
				v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int63);//c_CUDNDi)
    
				v_aeIndex1 := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//c_CRDNDi);
	
				vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, PX_AE2_ID_STEM, c_defaultAE2Name, -), -1)); // AE2 is registred
				f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
					
				v_aeIndex2 := f_getResourceFromAeSimu(vc_ae2);
					
				v_resourceIndex := f_cse_createResource(int15, m_createPollingChannelBase, v_aeIndex1);
				
				p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex);
				p_requestPrimitive.from_ := f_getOriginator(v_aeIndex2);	
				
				mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) {
						tc_ac.stop;
						setverdict(pass, __SCOPE__&":INFO: Originator has no privilege");
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitive(?))) {
						tc_ac.stop;
						setverdict(fail, __SCOPE__&":INFO: Wrong response status code when originator has no privilege");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__&":INFO: No answer while creating polling resource type");
					}
				}	

				//Postamble
				f_cse_postamble_deleteResources();
		
				// Tear down
				f_cf01Down();
		  	 }
		  	 
		  } //end group PollingChannel
		
		group Non_Blocking_Requests{

			group Synchronous{

				function f_CSE_NBR_SYN_001(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := 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_acpAuxIndex := -1;
						   
					// Test control
					if(PICS_NON_BLOCKING_REQUEST_SYNCH){
						setverdict(inconc, __SCOPE__ & ": It is required to not support Non-blocking access resource in synchronous mode to run this test case");
						stop;
					}

					// Test component configuration
					f_cf01Up();
	
					// Test adapter configuration

					// Preamble
	
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
	
					if(ispresent(p_parentRequestPrimitive)) {
						v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex);	
						p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex);
					}else{
						p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
					}
					p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);					
					p_requestPrimitive.responseType := {int1, omit};		//nonBlockingRequestSynch
					
					// Test Body

					mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int5206))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Operation rejected because Non-blocking access resource in synchronous mode is not supported");
						}
						[] 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 accepted without supporting Non-Blocking Requests");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while executing a Non-blocking access resource in synchronous mode operation");
						}
					}
	
					f_checkAeSimuStatus();
				
					// Postamble
					f_cse_postamble_deleteResources();
	
					// Tear down
					f_cf01Down();
						
				}//end f_CSE_NBR_SYN_001
		
				function f_CSE_NBR_SYN_002(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := 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_acpAuxIndex := -1;
					var template PrimitiveContent v_contentResponse;
		   
					// Test control
					if(not PICS_NON_BLOCKING_REQUEST_SYNCH){
						setverdict(inconc, __SCOPE__ & ": It is required to support Non-blocking access resource in synchronous mode to run this test case");
						stop;
					}

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
			
					v_contentResponse.uRI := ?;

					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);

					if(ispresent(p_parentRequestPrimitive)) {
						v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex);	
						p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex);
					}else{
						p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
					}
					p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);					
					p_requestPrimitive.responseType := {int1,omit};		//nonBlockingRequestSynch
	
					// Test Body

					mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1001, v_contentResponse))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": URI attribute is set to <request> resource address");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1001))) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": URI attribute is not set to <request> resource address");
						}
						[] 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__ & ": Wrong response status code");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while executing a Non-blocking access resource in synchronous mode operation");
						}
					}

					f_checkAeSimuStatus();

					//Check to see if the resource is present or not
					if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.uRI)){
						mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(v_response.primitive.responsePrimitive.primitiveContent.uRI, f_getOriginator(v_aeIndex)))));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) {
								tc_ac.stop;
								setverdict(pass, testcasename() & ": Request resource present");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) {
								tc_ac.stop;
								setverdict(fail, testcasename() & ": Request resource not found");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitive(?, -))) {
								tc_ac.stop;
								setverdict(fail, testcasename() & ": Wrong response status code in the response");
							}
							[] tc_ac.timeout {
								setverdict(fail, testcasename() & ": No answer while retrieving resource");
							}
						}	
					}

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();
		
				}//end f_CSE_NBR_SYN_002
		
				function f_CSE_NBR_SYN_003(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit, in Operation p_operation) 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_acpAuxIndex := -1;
					var template PrimitiveContent v_contentResponseUri;
					var template PrimitiveContent v_contentResponseRequestResource;
					var RequestStatus v_requestStatus;
					var URI v_requestResourceURI;
					var ResponseStatusCode v_statusCode;
					var template PrimitiveContent v_primitiveContent;
   
							// Test control
					if(not PICS_NON_BLOCKING_REQUEST_SYNCH){
						setverdict(inconc, __SCOPE__ & ": It is required to support Non-blocking access resource in synchronous mode to run this test case");
						stop;
					}

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble

					v_contentResponseUri.uRI := ?;

					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);

					if(ispresent(p_parentRequestPrimitive)) {
						v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex);	
						p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex);
					}else{
						p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
					}
					p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);					
					p_requestPrimitive.responseType := {int1, omit};		//nonBlockingRequestSynch

					// Test Body

					mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1001, v_contentResponseUri))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": URI attribute is set to <request> resource address");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1001))) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": URI attribute is not set to <request> resource address");
						}
						[] 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__ & ": Wrong response status code");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while executing a Non-blocking access resource in synchronous mode operation");
						}
					}

					f_checkAeSimuStatus();

					//Check to see if the resource is present or not
					if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.uRI)){
						v_contentResponseRequestResource.request := mw_contentRequestBase;
						v_requestResourceURI := v_response.primitive.responsePrimitive.primitiveContent.uRI;
						if (p_operation == int1){		//create
							v_statusCode := int2001;
							v_primitiveContent := f_getTemplateFromPrimitiveContent(p_requestPrimitive.primitiveContent);
						}else if (p_operation == int2){	//retrieve
							v_statusCode := int2000;
							v_primitiveContent.container := mw_contentContainer_rc1;
						}else if (p_operation == int3){	//update
							v_statusCode := int2004;
							v_primitiveContent := f_getTemplateFromPrimitiveContent(p_requestPrimitive.primitiveContent);
						}else if (p_operation == int4){	//delete
							v_statusCode := int2002;
							v_primitiveContent.container := mw_contentContainer_rc1;
							//v_primitiveContent := omit;
						}
						mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(v_requestResourceURI, f_getOriginator(v_aeIndex)))));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponseRequestResource))) -> value v_response{
								setverdict(pass, testcasename() & ": Request resource has been received");
								v_requestStatus := v_response.primitive.responsePrimitive.primitiveContent.request.requestStatus;
								if (v_requestStatus==int1){			//COMPLETED
									tc_ac.stop;
									if (valueof(p_requestPrimitive.requestIdentifier) ==  valueof(v_response.primitive.responsePrimitive.primitiveContent.request.operationResult.requestIdentifier) ){
										setverdict(pass, testcasename() & ": RequestStatus: COMPLETED and requestIdentifier attribute correctly received");
									}else{
										setverdict(fail, testcasename() & ": RequestStatus: COMPLETED and requestIdentifier attribute not correctly received");
									}
									
									if (valueof(v_statusCode) ==  valueof(v_response.primitive.responsePrimitive.primitiveContent.request.operationResult.responseStatusCode) ){
										setverdict(pass, testcasename() & ": RequestStatus: COMPLETED and responseStatusCode attribute correctly received");
									}else{
										setverdict(fail, testcasename() & ": RequestStatus: COMPLETED and responseStatusCode attribute not correctly received");
									}
									
									if (match(v_response.primitive.responsePrimitive.primitiveContent.request.operationResult.primitiveContent, v_primitiveContent) ){
										setverdict(pass, testcasename() & ": RequestStatus: COMPLETED and primitiveContent template correctly received");
									}else{
										setverdict(fail, testcasename() & ": RequestStatus: COMPLETED and primitiveContent template not correctly received");
									}
									
								}else if (v_requestStatus==int2){	//FAILED
									tc_ac.stop;
									setverdict(fail, testcasename() & ": RequestStatus: FAIL");
								}else{								//PENDING, FORWARDING or PARTIALLY_COMPLETED
									f_sleep(PX_TAC/5.0);
									mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(v_requestResourceURI, f_getOriginator(v_aeIndex)))));
									repeat;								
								}
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) {
								tc_ac.stop;
								setverdict(fail, testcasename() & ": Request resource not found");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitive(?, -))) {
								tc_ac.stop;
								setverdict(fail, testcasename() & ": Wrong response status code in the response");
							}
							[] tc_ac.timeout {
								setverdict(fail, testcasename() & ": No answer while retrieving resource");
							}
						}	
					}

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}//end f_CSE_NBR_SYN_003
			}//end Group Synchronous

			group Asynchronous{
		
				function f_CSE_NBR_ASY_001(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := 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_acpAuxIndex := -1;
		   
					// Test control
					if(PICS_NON_BLOCKING_REQUEST_ASYNCH){
						setverdict(inconc, __SCOPE__ & ": It is required to not support Non-blocking access resource in asynchronous mode to run this test case");
						stop;
					}

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble

					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);

					if(ispresent(p_parentRequestPrimitive)) {
						v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex);	
						p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex);
					}else{
						p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
					}
					p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);					
					p_requestPrimitive.responseType := {int2,omit};		//nonBlockingRequestAsynch
					// Test Body

					mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1002, omit))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": No content provided with the right status code");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(omit))) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": No content provided with a wrong status code");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Content provided");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Wrong response status code");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while executing a Non-blocking access resource in asynchronous mode operation");
						}
					}

					f_checkAeSimuStatus();

					//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_deleteResources();

					// Tear down
					f_cf01Down();
		
				}//end f_CSE_NBR_ASY_001
				
				function f_CSE_NBR_ASY_002(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := 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_acpAuxIndex := -1;
					var template PrimitiveContent v_contentResponse;
		   
					// Test control
					if(not PICS_NON_BLOCKING_REQUEST_SYNCH){
						setverdict(inconc, __SCOPE__ & ": It is required to support Non-blocking access resource in synchronous mode to run this test case");
						stop;
					}

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
			
					v_contentResponse.uRI := ?;

					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);

					if(ispresent(p_parentRequestPrimitive)) {
						v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex);	
						p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex);
					}else{
						p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
					}
					p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);					
					p_requestPrimitive.responseType := {int2,omit};		//nonBlockingRequestAsynch
	
					// Test Body

					mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1002, v_contentResponse))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": URI attribute is set to <request> resource address");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1002))) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": URI attribute is not set to <request> resource address");
						}
						[] 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__ & ": Wrong response status code");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while executing a Non-blocking access resource in synchronous mode operation");
						}
					}

					f_checkAeSimuStatus();

					//Check to see if the resource is present or not
					if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.uRI)){
						mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(v_response.primitive.responsePrimitive.primitiveContent.uRI, f_getOriginator(v_aeIndex)))));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) {
								tc_ac.stop;
								setverdict(pass, testcasename() & ": Request resource present");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) {
								tc_ac.stop;
								setverdict(fail, testcasename() & ": Request resource not found");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitive(?, -))) {
								tc_ac.stop;
								setverdict(fail, testcasename() & ": Wrong response status code in the response");
							}
							[] tc_ac.timeout {
								setverdict(fail, testcasename() & ": No answer while retrieving resource");
							}
						}	
					}

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();
		
				}//end f_CSE_NBR_ASY_002
				
				function f_CSE_NBR_ASY_003(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit, in ResponseStatusCode p_responseStatusCode) 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_acpAuxIndex := -1;
					var template PrimitiveContent v_contentResponse;
   
					// Test control
					if(not PICS_NON_BLOCKING_REQUEST_SYNCH){
						setverdict(inconc, __SCOPE__ & ": It is required to support Non-blocking access resource in synchronous mode to run this test case");
						stop;
					}

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble

					v_contentResponse.uRI := ?;

					v_aeIndex := f_cse_preamble_registerAe(-,  {f_getCompletePoA(PX_PROTOCOL_BINDING_AE1, PX_AE1_ADDRESS, "")});//c_CRUDNDi);
					if(ispresent(p_parentRequestPrimitive)) {
						v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex);	
						p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex);
					}else{
						p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
					}
					p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);					
					p_requestPrimitive.responseType := {int2, omit};		//nonBlockingRequestAsynch and no notification target list is provided"

					mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1002, v_contentResponse))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": URI attribute is set to <request> resource address");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1002))) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": URI attribute is not set to <request> resource address");
						}
						[] 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__ & ": Wrong response status code");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while executing a Non-blocking access resource in synchronous mode operation");
						}
					}

					f_checkAeSimuStatus();
					
					//Test Body

					//Check to see if the notification is received
					f_cse_notifyProcedure_responsePrimitiveHandler(mw_responsePrimitive(p_responseStatusCode));

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}//end f_CSE_NBR_ASY_003
				
				function f_CSE_NBR_ASY_004(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := 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_acpAuxIndex := -1;
					var template PrimitiveContent v_contentResponse;
   
					// Test control
					if(not PICS_NON_BLOCKING_REQUEST_SYNCH){
						setverdict(inconc, __SCOPE__ & ": It is required to support Non-blocking access resource in synchronous mode to run this test case");
						stop;
					}

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble

					v_contentResponse.uRI := ?;

					v_aeIndex := f_cse_preamble_registerAe(-,  {f_getCompletePoA(PX_PROTOCOL_BINDING_AE1, PX_AE1_ADDRESS, "")});//c_CRUDNDi);

					if(ispresent(p_parentRequestPrimitive)) {
						v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex);	
						p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex);
					}else{
						p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
					}
					p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);					
					p_requestPrimitive.responseType.responseTypeValue := int2;		//nonBlockingRequestAsynch
					p_requestPrimitive.responseType.notificationURI := {};		//"...an empty notification target list is provided"

					// Test Body

					mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1002, v_contentResponse))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": URI attribute is set to <request> resource address");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1002))) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": URI attribute is not set to <request> resource address");
						}
						[] 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__ & ": Wrong response status code");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while executing a Non-blocking access resource in synchronous mode operation");
						}
					}

					f_checkAeSimuStatus();

					//Check if Notification is sent or not
					
					f_cse_notifyProcedure_noNotificationHandler();					

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}//end f_CSE_NBR_ASY_004
				
				function f_CSE_NBR_ASY_005(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{
			
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex, v_ae2Index := -1;
					var integer v_resourceIndex := -1;
					var integer v_acpAuxIndex := -1;
					var template PrimitiveContent v_contentResponse;
   
					// Test control
					if(not PICS_NON_BLOCKING_REQUEST_SYNCH){
						setverdict(inconc, __SCOPE__ & ": It is required to support Non-blocking access resource in synchronous mode to run this test case");
						stop;
					}

					// Test component configuration
					f_cf01Up(true);

					// Test adapter configuration

					// Preamble

					v_contentResponse.uRI := ?;

					v_aeIndex := f_cse_preamble_registerAe(-,  {f_getCompletePoA(PX_PROTOCOL_BINDING_AE1, PX_AE1_ADDRESS, "")});//c_CRUDNDi);

					f_checkAeSimuStatus();
					
					vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, {f_getCompletePoA(PX_PROTOCOL_BINDING_AE2, PX_AE2_ADDRESS, "")}))); // AE2 is registred
					
					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
					
					v_ae2Index := f_getResourceFromAeSimu(vc_ae2);
					
					if(ispresent(p_parentRequestPrimitive)) {
						v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex);	
						p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex);
					}else{
						p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
					}
					p_requestPrimitive.from_ := f_getOriginator(v_aeIndex);					
					p_requestPrimitive.responseType.responseTypeValue := int2;		//nonBlockingRequestAsynch
					p_requestPrimitive.responseType.notificationURI := {f_getResourceAddress(v_aeIndex), f_getResourceAddress(v_ae2Index)};		//"...an empty notification target list is provided"

					// Test Body

					mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1002, v_contentResponse))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": URI attribute is set to <request> resource address");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int1002))) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": URI attribute is not set to <request> resource address");
						}
						[] 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__ & ": Wrong response status code");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while executing a Non-blocking access resource in synchronous mode operation");
						}
					}

					f_checkAeSimuStatus();

					//Check if Notification is sent or not
					
					
					vc_ae2.start(f_cse_notifyProcedure_responsePrimitiveHandler(mw_responsePrimitive(p_responseStatusCode)));
					
					f_cse_notifyProcedure_responsePrimitiveHandler(mw_responsePrimitive(p_responseStatusCode));
					
					vc_ae2.done;

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}//end f_CSE_NBR_ASY_005
				

			}//end Group Asynchronous

		}//end group Non_Blocking_Requests
	
	}//end group CSE

	
}