/**
 *  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     oneM2M/ETSI
 *  @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 system AeSystem {
						
						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_ae_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);	
								f_send(e_mca_in_port, 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");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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);	
								f_send(e_mca_in_port, 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");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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);
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(mw_updateContainer())) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Update Request with unexpected target");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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);
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(mw_updateContainer())) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Update Request with unexpected target");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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);
								f_send(e_mca_in_port, 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");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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);
								f_send(e_mca_in_port, 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");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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);
								f_send(e_mca_in_port, 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");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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);
								f_send(e_mca_in_port, 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");
								f_send(e_mca_in_port, 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 system AeSystem {
	
						//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_ae_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
							   f_send(e_mca_in_port, 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");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
							}
	
							[] mcaPortIn.receive(mw_request(mw_create)) -> value v_request{
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Unexpected CREATE request ");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(mw_create)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Unexpected CREATE request ");
								f_send(e_mca_in_port, 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 system AeSystem {
	
						//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))), vc_cSEBaseIndex, int2);
						v_resourceIndex := f_setLocalResource(v_localResource, int2, vc_cSEBaseIndex);
						p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex);
					   	f_ae_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);
							   f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(mw_update)) -> value v_request {
							   tc_ac.stop;
							   setverdict(fail, __SCOPE__ & " : Unexpected UPDATE request");
								f_send(e_mca_in_port, 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 system AeSystem {
						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_ae_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);
								f_send(e_mca_in_port, m_response(vc_response.primitive.responsePrimitive));
							}
							[] mcaPortIn.receive(mw_request(mw_update)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Unexpected UPDATE request");
								f_send(e_mca_in_port, 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 system AeSystem {
		
						//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_ae_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));
								f_send(e_mca_in_port, m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive (mw_request(mw_retrieve(?))){
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Retrieve request for unexpected target");
								f_send(e_mca_in_port, 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 system AeSystem {
	
						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_ae_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
								f_send(e_mca_in_port, m_response(v_responsePrimitive));
							}
							[] mcaPortIn.receive {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & " : Subscription creation request is rejected due to not including the optional attribute!");
								f_send(e_mca_in_port, 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 system CseSystem {
    				
						// 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);
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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 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);
												
						f_send(e_mca_port, 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		
					
					function f_CSE_GEN_CRE_003(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// Local variables
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var PrimitiveScope v_primitiveScope;
						var XSD.ID v_cseName := PX_CSE_NAME; 
											   
						// 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_useShortcutInResourceId(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope));
												
						f_send(e_mca_port, 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 shortcut in 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 shortcut in 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_003		

					
					function f_CSE_GEN_CRE_004(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// Local variables
						var RequestPrimitive v_request;
						var template RequestPrimitive v_groupRequest := m_createGroupBase;
						var integer v_aeIndex := -1;
						var integer v_groupIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
											   
						// 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); 
					
						v_groupRequest.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_resourceIndex].resource)};
						
						v_groupIndex := f_cse_createResource(int9, v_groupRequest, v_aeIndex); 
					
						// Test Body
						v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
						//Force usage of Hybrid Hierarchical addressing method
					  	v_addressingMethod := e_nonHierarchical;
					  	v_request.to_ := f_getResourceAddress(v_groupIndex, v_addressingMethod, p_primitiveScope);
						v_request.to_ := v_request.to_ & "/fopt"; 
												
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Fanout operation performed successfully by using hybrid addressing");
							}
							[] 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_004				
							
				
			} // end of group Create
			
			group Retrieve {

					function f_CSE_GEN_RET_001(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// 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;
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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 Hierarchical addressing method
						v_addressingMethod := e_hierarchical;
						v_primitiveScope := p_primitiveScope;
						
						f_send(e_mca_port, 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				
				
					function f_CSE_GEN_RET_003(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// 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;
						
						f_send(e_mca_port, m_request(m_retrieve(f_useShortcutInResourceId(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 shortcut in 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 shortcut in 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_003				

					function f_CSE_GEN_RET_004(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// Local variables
						var integer v_aeIndex := -1;
						var integer v_groupIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
						var RequestPrimitive v_request;
						var template RequestPrimitive v_groupRequest := m_createGroupBase;
											   
						// 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); 
					
						v_groupRequest.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_resourceIndex].resource)};
												
						v_groupIndex := f_cse_createResource(int9, v_groupRequest, v_aeIndex); 

						// Test Body
						//Force usage of Hybrid Hierarchical addressing method
					  	v_addressingMethod := e_nonHierarchical;
						v_request := valueof(m_retrieve(f_getResourceAddress(v_groupIndex, v_addressingMethod, p_primitiveScope), f_getOriginator(v_groupIndex)));
						v_request.to_ := v_request.to_ & "/fopt"; 
												
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Fanout operation performed successfully by using hybrid addressing");
							}
							[] 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_RET_004				

			} // end of group Retrieve
			
			group Update {
								
					function f_CSE_GEN_UPD_001(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// 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);
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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 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);
						
						f_send(e_mca_port, 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				
				
					function f_CSE_GEN_UPD_003(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// 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_useShortcutInResourceId(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope));
						
						f_send(e_mca_port, 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 shortcut in 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 shortcut in 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_003				

					function f_CSE_GEN_UPD_004(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// Local variables
						var template RequestPrimitive v_groupRequest := m_createGroupBase;
						var RequestPrimitive v_updateRequest := valueof(m_updateContainerBase);
						var integer v_aeIndex := -1;
						var integer v_groupIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
											   
						// 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); 
					
						v_groupRequest.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_resourceIndex].resource)};
						
						v_groupIndex := f_cse_createResource(int9, v_groupRequest, v_aeIndex); 
					
						// Test Body
						v_updateRequest := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateRequest);
						v_updateRequest.primitiveContent.container.labels := {"MyLabel"};
						//Force usage of Hybrid Hierarchical addressing method
					  	v_addressingMethod := e_nonHierarchical;
						v_updateRequest.to_ := f_getResourceAddress(v_groupIndex, v_addressingMethod, p_primitiveScope);
						v_updateRequest.to_ := v_updateRequest.to_ & "/fopt"; 
												
						f_send(e_mca_port, m_request(v_updateRequest));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Fanout operation performed successfully by using hybrid addressing");
							}
							[] 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_UPD_004				

			} // end of group Update
			
			group Delete {

					function f_CSE_GEN_DEL_001(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// 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)));
												
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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 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)));
						
						f_send(e_mca_port, 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				
				
					function f_CSE_GEN_DEL_003(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// 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_useShortcutInResourceId(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope)), f_getOriginator(v_resourceIndex)));
						
						f_send(e_mca_port, 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 shortcut in 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 shortcut in 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_003				

					function f_CSE_GEN_DEL_004(in PrimitiveScope p_primitiveScope) runs on AeSimu system CseSystem {
    				
						// Local variables
						var RequestPrimitive v_request;
						var template RequestPrimitive v_groupRequest := m_createGroupBase;
						var integer v_aeIndex := -1;
						var integer v_groupIndex := -1;
						var integer v_resourceIndex := -1;
						var AddressingMethod v_addressingMethod;
											   
						// 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); 
					
						v_groupRequest.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_resourceIndex].resource)};
						
						v_groupIndex := f_cse_createResource(int9, v_groupRequest, v_aeIndex); 
					
						// Test Body
						//Force usage of Hybrid Hierarchical addressing method
					  	v_addressingMethod := e_nonHierarchical;
						v_request := valueof(m_delete(f_getResourceAddress(v_groupIndex, v_addressingMethod, p_primitiveScope), f_getOriginator(v_resourceIndex)));
						v_request.to_ := v_request.to_ & "/fopt"; 
												
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Fanout operation performed successfully by using hybrid addressing");
							}
							[] 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_DEL_004				

			} // end of group Delete
		
		} // end of group Generic
		
		group Registration {
			
			group Create{
				
				function f_CSE_REG_CRE_001(in XSD.ID p_aeIdStem) runs on AeSimu system CseSystem {
		  	  	
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
					var universal charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AE-ID is allowed to register: " & p_aeIdStem;
	                
					//Test control
					if(p_aeIdStem[0] == "S") {
						if(not(PICS_IN_CSE)) {
							setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case");
							stop;
						}
					}
					
					// Test component configuration
					f_cf01Up();
	                
					//Preamble
					action(v_action);
					f_sleepIgnoreDef(PX_TCONFIG_IUT);
					
					//Test Body
					v_request := valueof(m_createAe(PX_TS_AE1.appId, omit, PX_CSE_ID & "/" & p_aeIdStem));	
					
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
					
					f_send(e_mca_port, 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_aeIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
						
				}

				function f_CSE_REG_CRE_002(in XSD.ID v_aeIdStem) runs on AeSimu system CseSystem {
		  	  	
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
					
					//Test control
					if(v_aeIdStem[0] == "S") {
						if(not(PICS_IN_CSE)) {
							setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case");
							stop;
						}
					}
	                
					// Test component configuration
					f_cf01Up();
		  	  	
					//Preamble
					
					//Test Body
					v_request := valueof(m_createAe(PX_TS_AE1.appId, omit, v_aeIdStem));				
	    									
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
	
					f_send(e_mca_port, 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_aeIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
						
				}

				function f_CSE_REG_CRE_012(in template RequestPrimitive p_createAe) runs on AeSimu system CseSystem {
				
					//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);
					
					f_send(e_mca_port, 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_aeIndex := 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 system CseSystem {
				
					// 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);
				
					f_send(e_mcc_port, 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 system CseSystem {
					
					//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);
					
					f_send(e_mca_port, 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 system CseSystem {
  
					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_cse_sendUtPrimitive_cseSimu(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
							f_send(e_mcc_in_port, m_response(v_responsePrimitive));
						}
						[] mccPortIn.receive {
							tc_ac.stop;
							setverdict(fail, __SCOPE__&":INFO: Unexpected message received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
						}
					}

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf04Down();

				}
				
				function f_CSE_REG_CRE_028(RequestPrimitive p_request, template PrimitiveContent p_contentResponse) runs on CseSimu system CseSystem {
					//Local variables
					var ResourceType v_resourceType := int16;	//remoteCSE	
					// Test control

					// Test component configuration
					f_cf04Up();

					// Test adapter configuration

					// Preamble
					
					
					//Test Body					
					vc_remoteCseIndex := f_cse_registerRemoteCse(p_request, p_contentResponse);
					
					//Check if the resource has been deleted or not
					if(f_cse_isResourcePresent_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 system CseSystem {
						//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);
						 
						 f_send(e_mca_port, 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 system CseSystem {
						//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);
		 
             f_send(e_mca_port, 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 system CseSystem {
						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);
						f_send(e_mcc_port, 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 system CseSystem {
						//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);
	
						f_send(e_mcc_port, 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 system CseSystem {
						// 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 for 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_cse_sendUtPrimitive_cseSimu(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 system CseSystem {
    				
				// 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_getLocalPoA()}));
				
				vc_ae1.start(f_cse_preamble_registerAe());				
				f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
				
				//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);
						f_send(e_mcc_in_port, 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);
						f_send(e_mcc_in_port, 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);
						f_send(e_mcc_in_port, 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);
						f_send(e_mcc_in_port, m_response(vc_response.primitive.responsePrimitive));
					}
					[] mccPortIn.receive(mw_request(?)) -> value vc_request {
						tc_ac.stop;
						setverdict(fail, __SCOPE__ & ": Wrong request received");
						f_send(e_mcc_in_port, 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 system CseSystem {
    				
				// 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_getLocalPoA()})));
				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));
				}

				f_send(e_mca_port, 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 system CseSystem 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 template RequestPrimitive v_parentRequestPrimitive;
					
					// Test control
				
					// Test component configuration
					f_cf01Up(true);
					
					// Test adapter configuration
				
					// Preamble
					
					if(ispresent(p_parentRequestPrimitive)) {
						v_parentRequestPrimitive := p_parentRequestPrimitive;
						if(match(int23, p_parentRequestPrimitive.resourceType)){
							f_cse_preamble_subscriptionVerification(v_ae2Index, v_parentRequestPrimitive, int23, -);
						}
						if(ischosen(p_parentRequestPrimitive.primitiveContent.group_)) {
							f_cse_preamble_registerAe();
						}
						v_parentIndex := f_cse_createResource(valueof(v_parentRequestPrimitive.resourceType), v_parentRequestPrimitive, v_parentIndex);
						
						if(vc_ae2.running) {
							vc_ae2.stop;
						}
						
					} else {//Resource under CSEBase
					
						if(p_resourceType != int1) {
												
							f_cse_createAccessControlPolicyAux(-, -, -);
											
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[vc_acpIndex].resource.accessControlPolicy.resourceID});
						}
						
						if(ischosen(p_requestPrimitive.primitiveContent.group_)){
						
							f_cse_preamble_registerAe();
						
						}
											
					}															
									
					// Test Body
					if(match(int23, p_requestPrimitive.resourceType)){
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, int23, -);
					}
					
					v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_parentIndex);
					
					f_send(e_mca_port, 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 system CseSystem {
    				
						// 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 PoaList v_poaList := { f_getLocalPoA(PX_TS_AE1.mcaPortIn) };
										   
						// 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_createAccessControlPolicyAux("SubscriptionVerificationAcp", -, int63));
							f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
							vc_ae1.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_TS_AE1.appId, -, PX_TS_AE1.aeIdStem, "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);
					
						f_send(e_mcc_port, 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 system CseSystem 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);
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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){
							if(vc_ae2.running) {
								f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
							}
							vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
						}
    					
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4105))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource already exists");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while creating an already existing resource");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Creating a resource that already exists");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource");
							}
						}	
    								
						// Postamble
						f_cse_postamble_deleteResources();
    					
						// Tear down
						f_cf01Down();
    				
					}//end f_CSE_DMR_CRE_003
    				
					function f_CSE_DMR_CRE_004(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on AeSimu system CseSystem {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						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) {
							f_cse_createAccessControlPolicyAux(-, -, int62);//c_RUDNDi)
						} else {
							f_cse_createAccessControlPolicyAux(-, -, int60);//c_UDNDi);
						}	
												
						v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
						
						// Test Body
						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex);
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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);
						
						f_send(e_mca_port, 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 system CseSystem 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);
					
						f_send(e_mca_port, 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 system CseSystem {
						//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

						f_send(e_mca_port, 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 system CseSystem {
						//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
	
						f_send(e_mca_port, 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 system CseSystem {
    				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_containerIndex := -1;
						var integer v_parentIndex := -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) {
							f_cse_createAccessControlPolicyAux();//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") {
							f_send(e_mca_port, m_request(v_request, {{v_myOptionalAttribute, omit}}));
						} else {
							f_send(e_mca_port, 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 system CseSystem {
						// 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);
	
						f_send(e_mca_port, 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 system CseSystem {
						// 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); 
	
						f_send(e_mca_port, 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
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						
						f_send(e_mca_port, 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 system CseSystem {
			
						// 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;
						f_send(e_mca_port, 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, template PrimitiveContent p_contentResponse) runs on AeSimu system CseSystem {
    				
						// 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 := int1;//Attributes
						
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Only attributes provided with RC set to 1");
							
							}
							[] 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 1");
							}
							[] 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_019

					function f_CSE_DMR_CRE_020(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu system CseSystem {
    				
						// 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 := int9;//Modified Attributes
						
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Only modified attributes provided with RC set to 9");
							
							}
							[] 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 9");
							}
							[] 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_020

					function f_CSE_DMR_CRE_021(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive) runs on CseSimu system CseSystem {
	    				
						// 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_TS_CSE1.cseId, PX_TS_CSE1.cseId), vc_remoteCseIndex); //AEAnnnc under RemoteCSE
		
						// Test Body
	
						v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aEAnncIndex);
	
						f_send(e_mcc_port, 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_021
    				
					function f_CSE_DMR_CRE_022(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template (present) RequestPrimitive p_requestAnnc) runs on AeSimu system CseSystem {
    				
						// 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);
						
						f_send(e_mca_port, m_request(v_request));
						
						vc_cse1.start(f_cse_receiveCreateRequest_cseSimu(p_requestAnnc));
						f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);	
    								
						// Postamble
						f_cse_postamble_deleteResources();
					
						// Tear down
						f_cf02Down();
    				
					}//end f_CSE_DMR_CRE_022
    				
					function f_CSE_DMR_CRE_023(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template (present) RequestPrimitive p_requestAnnc) runs on AeSimu system CseSystem{
	
						// 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));
						}	
						f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);						
						
						vc_cse1.start(f_cse_announcementProcedure_createHandler());						
						v_resourceIndex := f_cse_createResource(int2, m_createAe(PX_TS_AE1.appId, omit, omit));						
						f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
		
						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));						
						f_send(e_mca_port, m_request(v_request));
						f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);	
    								
						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_023
	
			}//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 system CseSystem 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
						f_send(e_mca_port, 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 system CseSystem {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -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) {
							f_cse_createAccessControlPolicyAux(-, -, int61);//c_CRUDNDi)
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {f_getResourceId(vc_resourcesList[vc_acpIndex].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
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						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) {
							
							f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[vc_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));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
								
						}
						
						// Test Body
						f_send(e_mca_port, 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 system CseSystem {
    				
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -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) {
							
							f_cse_createAccessControlPolicyAux(-, -, int61);
					
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[vc_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));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
							
						}
								
						// Test Body
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						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) {
							
							f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[vc_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
    									
						} else {
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						// Test Body
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						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) {
							
							f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[vc_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
    									
						}else{
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						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) {
							
							f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[vc_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
    									
						}else{
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						f_send(e_mca_port,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 system CseSystem {
    				
						// 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
						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) {
							
							f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[vc_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
    									
						}else{
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						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) {
							
							f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[vc_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
    									
						}else{
							vc_cse1.start(f_cse_registerRemoteCse(p_requestPrimitive));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);
						}
						
						f_send(e_mca_port, 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 system CseSystem {
		
					// 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;
					f_send(e_mca_port, 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 system CseSystem {
		
						// 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
						f_send(e_mca_port, 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 system CseSystem {
		
						// 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
						f_send(e_mca_port, 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 system CseSystem {
		
						// 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
						f_send(e_mca_port, 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 system CseSystem {
		
						// 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
						f_send(e_mca_port, 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 system CseSystem {
		
						// 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
						f_send(e_mca_port, 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 system CseSystem 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);
						
						f_send(e_mca_port, 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 system CseSystem 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);
						
						f_send(e_mca_port, 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 system CseSystem 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);
						
						f_send(e_mca_port, 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 system CseSystem 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);
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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
						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
						f_cse_createAccessControlPolicyAux(-, -, int59);//c_CRDNDi)
						
						v_aeIndex := f_cse_preamble_registerAe(-, -);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
						
						if(p_resourceType != int1) {
							p_createRequestPrimitive := f_setAcpId(p_createRequestPrimitive,{f_getResourceId(vc_resourcesList[vc_acpIndex].resource)});//c_CRDNDi);
						}
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); 				
																
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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);
						
						f_send(e_mca_port, 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 system CseSystem {
    				
						// 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);
						
						f_send(e_mca_port, 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 system CseSystem {
	    				
						// 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);
	
						f_send(e_mca_port, 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 system CseSystem {
	    				
						// 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);
					
						f_send(e_mca_port, 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 system CseSystem {
						//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);

						f_send(e_mca_port, 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, in boolean p_acpsRequired := false) runs on AeSimu system CseSystem {
	
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_resourceIndex := -1;
						var integer v_ae2Index := -1;
						var integer v_acp1Index := -1;
						var integer v_acp2Index := -1;
							   
						// Test control
	
						// Test component configuration
						f_cf01Up(true);
	
						// Test adapter configuration
	
						// Preamble
						vc_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
		
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
		
						if (p_acpsRequired) {
							v_acp1Index := f_cse_createResource(int1, m_createAcp("MyAcp1"), vc_aeIndex); 				
							v_acp2Index := f_cse_createResource(int1, m_createAcp("MyAcp2"), vc_aeIndex); 				
						
							p_createRequestPrimitive := f_setAcpId(p_createRequestPrimitive,{f_getResourceId(vc_resourcesList[v_acp1Index].resource)});
							p_updateRequestPrimitive := f_setAcpId(p_updateRequestPrimitive,{f_getResourceId(vc_resourcesList[v_acp2Index].resource)});
						
						}
						
						v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, vc_aeIndex); 				
						
						// Test Body
						v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
		
						f_send(e_mca_port, 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 system CseSystem {
						//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_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 != int1) {
							f_cse_createAccessControlPolicyAux(-, -, -);
							p_createRequestPrimitive := f_setAcpId(p_createRequestPrimitive, {vc_resourcesList[vc_acpIndex].resource.accessControlPolicy.resourceID});
						}
						
						if((p_resourceType != int2) and (p_resourceType != int1)) {
							v_aeIndex := f_cse_preamble_registerAe({vc_resourcesList[vc_acpIndex].resource.accessControlPolicy.resourceID});//c_CRUDNDi);
						}

						
						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};
							
							if(p_resourceType == int9){
								if(ispresent(p_updateRequestPrimitive.primitiveContent.group_.membersAccessControlPolicyIDs)) {
									p_updateRequestPrimitive.primitiveContent.group_.membersAccessControlPolicyIDs := v_acpi;
								} else {
									p_updateRequestPrimitive := f_setAcpId(p_updateRequestPrimitive, v_acpi);
								}
							} else {
								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));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
							
							v_resourceIndex := f_getRemoteCseResource(vc_cse1);	
						}
					 
						//Test Body
						vc_request.primitive.requestPrimitive := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
 
						f_send(e_mca_port, 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 system CseSystem {
						 //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;
							   
						 // 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_getLocalPoA(PX_TS_AE1.mcaPortIn, "")});//c_CRUDNDi);
						}
						
						if(p_resourceType != int1) {
							
							f_cse_createAccessControlPolicyAux(-, -, -);
						
							p_createRequestPrimitive := f_setAcpId(p_createRequestPrimitive, {vc_resourcesList[vc_acpIndex].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));
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
							
							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)};							
						}
						
						if(p_resourceType == int9) {
							vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_TS_AE2.appId, {vc_resourcesList[vc_acpIndex].resource.accessControlPolicy.resourceID}, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, {f_getLocalPoA(PX_TS_AE2.mcaPortIn, "")}), -1)); // AE2 is registred
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
					
							v_ae2Index := f_getResourceFromAeSimu(vc_ae2);
					
							if(ispresent(v_request.primitiveContent.group_.memberIDs)) {
								v_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_ae2Index].resource)};
							}
						}
						
						f_send(e_mca_port, 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;
								f_send(e_mca_in_port, 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 system CseSystem {
					// 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_TS_AE1.appId, omit, omit);
					v_create.primitiveContent.aE.announceTo := {PX_TS_CSE1.cseId};
		   
					//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 system CseSystem {
					// 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_TS_AE1.appId, omit, omit);
					
					v_create.primitiveContent.aE.announceTo := {PX_TS_CSE1.cseId};
   
					//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_TS_CSE1.cseId;
							v_responsePrimitive.to_ := v_request.primitive.requestPrimitive.from_;
							f_send(e_mcc_in_port, 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
				
				function f_CSE_DMR_UPD_019(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, ResultContent p_resultContent) runs on AeSimu system CseSystem {
		
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_updateRequest := valueof(m_updateContainerBase);
					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_updateRequest.primitiveContent.container.labels := {"VALUE_1"};
					v_updateRequest := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, v_updateRequest);
					v_updateRequest.resultContent := p_resultContent;
					f_send(e_mca_port, m_request(v_updateRequest));
					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 UPDATE request ");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						}
					}	
						
					// Postamble
					f_cse_postamble_deleteResources();
		
					// Tear down
					f_cf01Down();
		
				}//end f_CSE_DMR_UPD_019
			  	
				function f_CSE_DMR_UPD_020(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu system CseSystem {
		
						// 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 := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						v_request.resultContent := int0;//Nothing
						if(valueof(p_childResourceType) == int23) {
							if (vc_ae2.running) {
								vc_ae2.stop;
							}
							vc_ae2.start(f_cse_notifyProcedure_defaultHandler());
						}
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004, omit))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Nothing provided with RCN set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] 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__ & ": Some content provided with RCN set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while updating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource");
							}
						}	
						
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_UPD_020

				function f_CSE_DMR_UPD_021(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu system CseSystem {
		
						// 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 := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						v_request.resultContent := int1;//Attributes
						if(valueof(p_childResourceType) == int23) {
							if (vc_ae2.running) {
								vc_ae2.stop;
							}
							vc_ae2.start(f_cse_notifyProcedure_defaultHandler());
						}
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": All attributes provided with RCN 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__ & ": Wrong content provided with RCN set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while updating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource");
							}
						}	
						
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_UPD_021

				function f_CSE_DMR_UPD_022(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive, template RequestPrimitive p_updateRequestPrimitive) runs on AeSimu system CseSystem {
		
						// 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 := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive);
						v_request.resultContent := int9;//Modified Attributes
						if(valueof(p_childResourceType) == int23) {
							if (vc_ae2.running) {
								vc_ae2.stop;
							}
							vc_ae2.start(f_cse_notifyProcedure_defaultHandler());
						}
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Only modified attributes provided with RCN 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__ & ": Wrong content provided with RCN set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while updating resource");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while updating resource");
							}
						}	
						
						// Postamble
						f_cse_postamble_deleteResources();
		
						// Tear down
						f_cf01Down();
		
					}//end f_CSE_DMR_UPD_022

			}//end group Update
			
			group Delete {
			
					function f_CSE_DMR_DEL_001(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive) runs on AeSimu system CseSystem {
						// 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
						if(p_resourceType == int23) {
							if (vc_ae2.running) {
								vc_ae2.stop;
							}
							vc_ae2.start(f_cse_notifyProcedure_noNotificationHandler());
						}
						
						v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						                		
						f_send(e_mca_port, 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 system CseSystem {
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var RequestPrimitive v_updateRequest;
						var integer v_aeIndex := -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_aeIndex := f_cse_preamble_registerAe(-, -);//c_CRUNDi);
						f_cse_createAccessControlPolicyAux(-, {f_getResourceId(vc_resourcesList[v_aeIndex].resource)},int55);//c_CRDNDi);
						
						f_cse_preamble_subscriptionVerification(v_ae2Index, p_createRequestPrimitive, p_resourceType);
                		
						//Adjustments for ACP resource type
						if(p_resourceType == int1) {
							p_createRequestPrimitive.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list := {m_createAcr({f_getResourceId(vc_resourcesList[v_aeIndex].resource)}, int55)};
						} else {
							p_createRequestPrimitive := f_setAcpId(p_createRequestPrimitive, {f_getResourceId(vc_resourcesList[vc_acpIndex].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);
                		
						f_send(e_mca_port, 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
						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 system CseSystem {
						// 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
						f_send(e_mca_port, 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 system CseSystem {
						//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
						f_send(e_mca_port, 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 system CseSystem {
						//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
					
				function f_CSE_DMR_DEL_011(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, ResultContent p_resultContent) runs on AeSimu system CseSystem {
		
					// 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_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
					v_request.resultContent := p_resultContent;
					
					f_send(e_mca_port, 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 DELETE request ");
						}
						[] 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_011
			  	
				function f_CSE_DMR_DEL_012(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive) runs on AeSimu system CseSystem {
		
						// 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_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						v_request.resultContent := int0;//Nothing
						
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002, omit))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Nothing provided with RCN set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] 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__ & ": Some content provided with RCN set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while deleting 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_012

				function f_CSE_DMR_DEL_013(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, template PrimitiveContent p_contentResponse, template ResourceType p_childResourceType, template RequestPrimitive p_childRequestPrimitive) runs on AeSimu system CseSystem {
		
						// 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_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)));
						v_request.resultContent := int1;//Attributes
						
						f_send(e_mca_port, m_request(v_request));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002, p_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": All attributes provided with RCN 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__ & ": Wrong content provided with RCN set to " & int2str(enum2int(v_request.resultContent)));
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Error while deleting 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_013

			}//end group Delete
						
		}//end group Data_Management_and_Repository
				
		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 system CseSystem {
						// Local variables
						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_membersAcpIds;
						var template RequestPrimitive v_createAcp := m_createAcpBase;
			
						// 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
	
						f_send(e_mca_port, m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation performed successfully by using fanOutPoint in the Group resource");
	                
								if(not ispresent(vc_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__ & ": Error, aggregatedResponse element not provided");
								}
								else {
									for(i:=0; i<lengthof(vc_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list); i := i+1){
										if(not match(vc_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 system CseSystem {
					   	//Local variables
						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(-, -, 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
	
						f_send(e_mca_port, m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation failed due to lack of privilege");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_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 system CseSystem {
						// Local variables
						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_acpIds;
						var template RequestPrimitive v_createAcp := m_createAcpBase;
						
						// 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
	
						f_send(e_mca_port, m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation performed successfully by using fanOutPoint in group resource");
	    
								if(not ispresent(vc_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__ & ": Error, aggregatedResponse element not provided");
								}
								else {
									for(i:=0; i<lengthof(vc_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list); i := i+1){
										if(not match(vc_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 system CseSystem {
					   	//Local variables
						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(-, -, 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
	
						f_send(e_mca_port, m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation failed due to lack of privilege");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Wrong response status code");
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_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 := omit) runs on AeSimu system CseSystem {
						//Local constants
						const integer c_numberOfResponsePrimitive := 2;
						
					   	//Local variables
						var integer v_acpIndex, v_aeIndex_1, v_aeIndex_2 := -1;
						var integer v_groupIndex := -1;
						var ListOfURIs v_memberIDs;
						var AcpType v_acpIds;
						var integer i;
						var template RequestPrimitive v_createAcp := m_createAcp("PermissionForEveryone", -, -);
						
						// 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_acpIndex := f_cse_createResource(int1, v_createAcp, -); // AE child resource
						
						v_acpIds := {f_getResourceId(vc_resourcesList[v_acpIndex].resource)};
						
						v_aeIndex_1 := f_cse_preamble_registerAe(v_acpIds, -); //c_CRUDNDi
						
						//vc_ae2.start(f_cse_createAccessControlPolicyAux("PermissionForAE1",{"all"}, int63));
						//f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);

						vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, v_acpIds, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, omit), -1)); // AE2 is registred
						f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);

						v_aeIndex_2 := f_getLatestResource(vc_ae2);

						v_memberIDs := {f_getResourceId(vc_resourcesList[v_aeIndex_1].resource), f_getResourceId(vc_resourcesList[v_aeIndex_2].resource)};
						v_groupIndex := f_cse_createResource(int9, m_createGroup(2, v_memberIDs, omit, int2, -, v_acpIds), v_aeIndex_1); // 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
	
						f_send(e_mca_port, m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation performed successfully by using fanOutPoint in group resource");
	                            
								if(not ispresent(vc_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__ & ": Error, aggregatedResponse element not provided");
								}
								else{
									if(lengthof(vc_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(vc_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 := omit) runs on AeSimu system CseSystem {
						//Local constants
						const integer c_numberOfResponsePrimitive := 2;
			
						// Local variables
						var integer v_aeIndex_1, v_aeIndex_2, v_acpIndex, v_containerIndex_1, v_ae2LocalIndex, v_groupIndex := -1;
						var integer i;
						var ListOfURIs v_memberIDs;
						var AcpType v_acpIds;
						var template RequestPrimitive v_createAcp := m_createAcp("PermissionForEveryone", -, -);
						var template RequestPrimitive v_createContainerInAE1 := m_createContainerBase;
						var template RequestPrimitive v_createContainerInAE2 := m_createContainerBase;
						
						// 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_acpIndex := f_cse_createResource(int1, v_createAcp, -); // AE child resource
						
						v_acpIds := {f_getResourceId(vc_resourcesList[v_acpIndex].resource)};
						
						v_aeIndex_1 := f_cse_preamble_registerAe(v_acpIds, -); //c_CRUDNDi
						
						//vc_ae2.start(f_cse_createAccessControlPolicyAux("PermissionForAE1",{"all"}, int63));
						//f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);

						vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, v_acpIds, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, omit), -1)); // AE2 is registred
						f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);

						v_aeIndex_2 := f_getLatestResourceIndex(vc_ae2);
						
						v_ae2LocalIndex := f_getLatestResource(vc_ae2); 
						
						v_createContainerInAE1 := f_setAcpId(v_createContainerInAE1, v_acpIds);
						v_containerIndex_1 := f_cse_createResource(int3, v_createContainerInAE1, v_aeIndex_1); // AE1 child resource
						
						v_createContainerInAE2 := f_setAcpId(v_createContainerInAE2, v_acpIds);
						vc_ae2.start(f_cse_createResource(int3, v_createContainerInAE2, v_aeIndex_2));
						f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
						
						
						v_memberIDs := {f_getResourceId(vc_resourcesList[v_aeIndex_1].resource), f_getResourceId(vc_resourcesList[v_ae2LocalIndex].resource)};
						//v_membersAcpIds := {f_getResourceId(vc_resourcesList[v_acpIndex].resource)};
						v_groupIndex := f_cse_createResource(int9, m_createGroup(2, v_memberIDs, omit, int2, -, v_acpIds, -), v_aeIndex_1);
	   
						p_requestPrimitive.to_ := f_getResourceAddress(v_groupIndex) & "/" & c_resourceShortNameFanOutPoint & "/" & c_defaultContainerResourceName;
						p_requestPrimitive.from_ := f_getOriginator(v_groupIndex); //TODO see if it is correct or if we have to use PX_SUPER_ADMIN
						p_requestPrimitive.requestIdentifier := p_requestPrimitive.requestIdentifier & f_rnd(1, 1000000);
	
						// Test Body
	
						f_send(e_mca_port, m_request(valueof(p_requestPrimitive)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value vc_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Operation performed successfully by using fanOutPoint in group resource");
	                
								if(not ispresent(vc_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
									setverdict(fail, __SCOPE__ & ": Error, aggregatedResponse attribute not provided");
								}
								else{
									if(lengthof(vc_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(vc_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_006

			}// End of Basic_Operations
            
		} // end group Group_Managment
		
		group Discovery {
			
			function f_CSE_DIS_008(in FilterCriteria p_filterCriteria) runs on AeSimu system CseSystem {
			
				//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));
				f_send(e_mca_port, m_request(v_request));
				tc_ac.start;
				alt {
	
					[] mcaPort.receive(mw_response(mw_responseDiscovery({}))) -> value v_response {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Expected no match due to conflicting filter criteria ");
					}
					[] 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 system CseSystem {
					//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(true);
	
					// 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
					f_send(e_mca_port, 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 system CseSystem {
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_aeIndex2 := -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(true);
	
							// 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)}, -);
							
							vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, -), -1)); // AE2 is registred
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
					
							v_aeIndex2 := f_getLatestResource(vc_ae2);
							
							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_ := f_getResourceId(vc_resourcesList[v_aeIndex2].resource);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
	
							f_send(e_mca_port, 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 system CseSystem {
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_acpIndex1 := -1;
							var integer v_acpIndex2 := -1;
							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, m_createAcp("MyAcp1")); // CSE child resource
							v_acpIndex2 := f_cse_createResource(int1, m_createAcp("MyAcp2")); // 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);
	
							f_send(e_mca_port, 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 system CseSystem{
							// 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( -, {"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);
							
							f_send(e_mca_port, 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";
							f_send(e_mca_port, 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 system CseSystem{
							// Local variables
							var MsgIn v_response;
							var integer v_aeIndex := -1;
							var integer v_aeIndex2 := -1;
							var integer v_acpIndex := -1;
							var RequestPrimitive v_createRequest;
			
							// Test control
	
							// Test component configuration
							f_cf01Up(true);
	
							// 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)}, -);
			
							vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, -), -1)); // AE2 is registred
							f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
					
							v_aeIndex2 := f_getLatestResource(vc_ae2);
				
							// Test Body
							p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex);
							p_requestPrimitive.from_ := f_getResourceId(vc_resourcesList[v_aeIndex2].resource);
							p_requestPrimitive.requestIdentifier := valueof(p_requestPrimitive.requestIdentifier) & f_rnd(1, 1000000);
			
							f_send(e_mca_port, 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 system CseSystem{
							// 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_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_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);
			
							f_send(e_mca_port, 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 system CseSystem{
							// 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_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_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);
			
							f_send(e_mca_port, 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 system CseSystem{
							// 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);
			
							f_send(e_mca_port, 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 system CseSystem{
							// 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);
			
							f_send(e_mca_port, 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 system CseSystem{
							// 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_TS_AE1.mcaPortIn)}, omit}, omit}};
							v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule};
							vc_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, {f_getLocalPoA(PX_TS_AE1.mcaPortIn)});
			
							// 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);
			
							f_send(e_mca_port, 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 system CseSystem{
							// 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_acpIndex := f_cse_createResource(int1, v_createRequest); // CSE child resource
							
							v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, {f_getLocalPoA(PX_TS_AE1.mcaPortIn)});
			
							// 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);
			
							f_send(e_mca_port, 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 system CseSystem {
							// 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);
	
							f_send(e_mca_port, 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 system CseSystem {
							// 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
							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);
								
							f_send(e_mca_port, 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_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 PollingChannel {
			
			/**
			 * @desc Check that the IUT rejects a <pollingChannel> OPERATION of the AE when AE-ID is not same as the AE-ID of the parent resource
			 * 
			*/			
			function f_CSE_PCH_005(template RequestPrimitive p_requestPrimitive) runs on AeSimu system CseSystem {
		
				//Local variables
				var integer v_aeIndex1 := -1;
				var integer v_aeIndex2 := -1;
				var integer v_resourceIndex := -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
				f_cse_createAccessControlPolicyAux(-, -, int63);//c_CUDNDi)
    
				v_aeIndex1 := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);//c_CRDNDi);
	
				vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, {f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, -), -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);	
				
				f_send(e_mca_port, 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 Response_Type {
			
			group Blocking_Requests {
		
				function f_CSE_RT_BR_001(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit, in ResponseStatusCode p_responseStatusCode) runs on AeSimu system CseSystem {
			
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex := -1;
						   
					// Test control
					if(not(PICS_BLOCKING_REQUEST)){
						setverdict(inconc, __SCOPE__ & ": It is required to support Blocking access resource 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 := {int3, omit};		//BlockingRequest
					
					// Test Body

					f_send(e_mca_port, 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 using Blocking Request");
						}
						[] 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 blocking request operation");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while executing blocking request operation");
						}
					}
	
					f_checkAeSimuStatus();
				
					// Postamble
					f_cse_postamble_deleteResources();
	
					// Tear down
					f_cf01Down();
			
				}//end f_CSE_RT_BR_001				
		
			}
		
			group Non_Blocking_Requests{
	
				group Synchronous{
	
					function f_CSE_RT_NBS_001(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit) runs on AeSimu system CseSystem{
				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -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
	
						f_send(e_mca_port, 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_RT_NBS_001
			
					function f_CSE_RT_NBS_002(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit) runs on AeSimu system CseSystem{
				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -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
	
						f_send(e_mca_port, 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");
							}
						}
	
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();
			
					}//end f_CSE_RT_NBS_002
			
					function f_CSE_RT_NBS_003(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit, in Operation p_operation) runs on AeSimu system CseSystem{
				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -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
	
						f_send(e_mca_port, 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;
							v_contentResponseRequestResource.request.primitiveContent := p_requestPrimitive.primitiveContent;
							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 := omit;
							}
							f_send(e_mca_port, 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);
										f_send(e_mca_port, 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_RT_NBS_003
				}//end Group Synchronous
	
				group Asynchronous{
			
					function f_CSE_RT_NBA_001(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit) runs on AeSimu system CseSystem{
				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -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
	
						f_send(e_mca_port, 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");
							}
						}
	
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();
			
					}//end f_CSE_RT_NBA_001
					
					function f_CSE_RT_NBA_002(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit) runs on AeSimu system CseSystem{
				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -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
	
						f_send(e_mca_port, 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");
							}
						}
	
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();
			
					}//end f_CSE_RT_NBA_002
					
					function f_CSE_RT_NBA_003(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit, in ResponseStatusCode p_responseStatusCode) runs on AeSimu system CseSystem{
				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -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_getLocalPoA(PX_TS_AE1.mcaPortIn, "")});//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"
	
						f_send(e_mca_port, 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_RT_NBA_003
					
					function f_CSE_RT_NBA_004(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit) runs on AeSimu system CseSystem{
				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex := -1;
						var integer v_resourceIndex := -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_getLocalPoA(PX_TS_AE1.mcaPortIn, "")});//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
	
						f_send(e_mca_port, 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_RT_NBA_004
					
					function f_CSE_RT_NBA_005(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit, in ResponseStatusCode p_responseStatusCode) runs on AeSimu system CseSystem{
				
						// Local variables
						var MsgIn v_response;
						var RequestPrimitive v_request;
						var integer v_aeIndex, v_ae2Index := -1;
						var integer v_resourceIndex := -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_getLocalPoA(PX_TS_AE1.mcaPortIn, "")});//c_CRUDNDi);
	
						f_checkAeSimuStatus();
						
						vc_ae2.start(f_cse_createAccessControlPolicyAux("PermissionForNotificationAcp",{"all"}, int63)); // Permissions for NOTIFY 
						f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
						
						vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, {f_getLocalPoA(PX_TS_AE2.mcaPortIn, "")}))); // 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
	
						f_send(e_mca_port, 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));
						
						f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
	
						// Postamble
						f_cse_postamble_deleteResources();
	
						// Tear down
						f_cf01Down();
	
					}//end f_CSE_RT_NBA_005
					
	
				}//end Group Asynchronous
	
			}//end group Non_Blocking_Requests
		
		}//end of group Response_Type
	
	}//end group CSE

	
}