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

	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 OneM2M_PermutationFunctions all;
	import from XSD all;
	
	
	//Demos used for validation purposes
	group oneM2M_demos {
	
		group helpingTestCases {//These are not part of the test suite, just for verification purposes
			
			testcase TC_DELETE_RESOURCES() runs on Tester system CseSystem {
				// Local variables
				                        
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
				v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
				v_ae1.done;
	            
				v_ae1.start(f_DELETE_RESOURCES());
				v_ae1.done;
			}
			
			function f_DELETE_RESOURCES() runs on AeSimu system CseSystem {
				
				timer t_ac := 5.0;
				var integer i; 
				var XSD.ID v_resourceAddress;
				var RequestPrimitive v_request;
				map(self:mcaPort, system:mcaPort); 
					
				for (i:=0; i<lengthof(PX_RESOURCES_TO_BE_DELETED); i:= i+1) {  
					
					v_resourceAddress := f_getResourceAddress() & "/" & PX_RESOURCES_TO_BE_DELETED[i]; 
						
					v_request := valueof(m_delete(v_resourceAddress, PX_SUPER_AE_ID));
					    
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					
					t_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
							t_ac.stop;
							log(__SCOPE__ & ":Resource deleted");
							//setverdict(pass);
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
							t_ac.stop;
							log(__SCOPE__ & ":Error while deleting resource");
							//setverdict(fail);
						}
						[] mcaPort.receive {
							t_ac.stop;
							log(__SCOPE__ & ":Unexpected message received");
							//setverdict(inconc);
						}
						[] t_ac.timeout {
							log(__SCOPE__ & ":No answer while deleting resource");
							//setverdict(inconc);
						}	
					}	
				}
			
				unmap(self:mcaPort, system:mcaPort); 
				stop;
			}	
		
		}//end group helpingTestCases
	
	}//end group oneM2M_demos
	
	group CSE {
		
		group Generic {
			
			group Create {
				group g_CSE_GEN_CRE_001 {

					/**
					 * @desc Check that the IUT accepts the creation of a  resource using unstructured resource identifier
					 * 
					 */
					testcase TC_CSE_GEN_CRE_001_CSR() runs on Tester system CseSystem {
						// Local variables
						                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_CRE_001(e_cseRelative));
						v_ae1.done;
					}

					testcase TC_CSE_GEN_CRE_001_SPR() runs on Tester system CseSystem {
						// Local variables
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GEN_CRE_001(e_spRelative));
						v_ae1.done;
					}
					
					testcase TC_CSE_GEN_CRE_001_ABS() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_CRE_001(e_absolute));
						v_ae1.done;
					}				
				
				} // end of group g_CSE_GEN_CRE_001
				
				group g_CSE_GEN_CRE_002 {

					/**
					 * @desc Check that the IUT accepts the creation of a  resource using structured resource identifier
					 * 
					 */
					testcase TC_CSE_GEN_CRE_002_CSR() runs on Tester system CseSystem {
						// Local variables
						                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_cseRelative));
						v_ae1.done;
					}

					testcase TC_CSE_GEN_CRE_002_SPR() runs on Tester system CseSystem {
						// Local variables
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_spRelative));
						v_ae1.done;
					}
					
					testcase TC_CSE_GEN_CRE_002_ABS() runs on Tester system CseSystem {
						// Local variables
							
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_CRE_002(e_absolute));
						v_ae1.done;
					}
				
				} // end of group g_CSE_GEN_CRE_002
				
			} // end of group Create
			
			group Retrieve {
				group g_CSE_GEN_RET_001 {

					/**
					 * @desc Check that the IUT accepts the retrieval of a <container>  resource using unstructured resource identifier
					 * 
					 */
					testcase TC_CSE_GEN_RET_001_CSR() runs on Tester system CseSystem {
						// Local variables
						                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_cseRelative));
						v_ae1.done;
					}

					testcase TC_CSE_GEN_RET_001_SPR() runs on Tester system CseSystem {
						// Local variables
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_spRelative));
						v_ae1.done;
					}
					
					testcase TC_CSE_GEN_RET_001_ABS() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_RET_001(e_absolute));
						v_ae1.done;
					}
								
				
				} // end of group g_CSE_GEN_RET_001
				
				group g_CSE_GEN_RET_002 {

					/**
					 * @desc Check that the IUT accepts the retrieval of a <container>  resource using structured resource identifier
					 * 
					 */
					testcase TC_CSE_GEN_RET_002_CSR() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_cseRelative));
						v_ae1.done;
					}

					testcase TC_CSE_GEN_RET_002_SPR() runs on Tester system CseSystem {
						// Local variables
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_spRelative));
						v_ae1.done;
					}
					
					testcase TC_CSE_GEN_RET_002_ABS() runs on Tester system CseSystem {
						// Local variables
							
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_RET_002(e_absolute));
						v_ae1.done;
					}
								
				} // end of group g_CSE_GEN_RET_002
				
			} // end of group Retrieve
			
			group Update {
				group g_CSE_GEN_UPD_001 {

					/**
					 * @desc Check that the IUT accepts the update of a <container>  resource using unstructured resource identifier
					 * 
					 */
					testcase TC_CSE_GEN_UPD_001_CSR() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_cseRelative));
						v_ae1.done;
					}

					testcase TC_CSE_GEN_UPD_001_SPR() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_spRelative));
						v_ae1.done;
					}
					
					testcase TC_CSE_GEN_UPD_001_ABS() runs on Tester system CseSystem {
						// Local variables
							
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_UPD_001(e_absolute));
						v_ae1.done;
					}
								
				} // end of group g_CSE_GEN_UPD_001
				
				group g_CSE_GEN_UPD_002 {

					/**
					 * @desc Check that the IUT accepts the update of a <container>  resource using structured resource identifier
					 * 
					 */
					testcase TC_CSE_GEN_UPD_002_CSR() runs on Tester system CseSystem {
						// Local variables
						                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_cseRelative));
						v_ae1.done;
					}

					testcase TC_CSE_GEN_UPD_002_SPR() runs on Tester system CseSystem {
						// Local variables
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_spRelative));
						v_ae1.done;
					}
					
					testcase TC_CSE_GEN_UPD_002_ABS() runs on Tester system CseSystem {
						// Local variables
							
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_UPD_002(e_absolute));
						v_ae1.done;
					}
								
				} // end of group g_CSE_GEN_UPD_002
				
			} // end of group Update
			
			group Delete {
				group g_CSE_GEN_DEL_001 {

					/**
					 * @desc Check that the IUT accepts the deletion of a <container>  resource using unstructured resource identifier
					 *  
					 */
					testcase TC_CSE_GEN_DEL_001_CSR() runs on Tester system CseSystem {
						// Local variables
						                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_cseRelative));
						v_ae1.done;
					}

					testcase TC_CSE_GEN_DEL_001_SPR() runs on Tester system CseSystem {
						// Local variables
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_spRelative));
						v_ae1.done;
					}
					
					testcase TC_CSE_GEN_DEL_001_ABS() runs on Tester system CseSystem {
						// Local variables
							
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_DEL_001(e_absolute));
						v_ae1.done;
					}
								
				} // end of group g_CSE_GEN_DEL_001
				
				group g_CSE_GEN_DEL_002 {

					/**
					 * @desc Check that the IUT accepts the deletion of a <container>  resource using structured resource identifier
					 * 
					 */
					testcase TC_CSE_GEN_DEL_002_CSR() runs on Tester system CseSystem {
						// Local variables
						                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_cseRelative));
						v_ae1.done;
					}

					testcase TC_CSE_GEN_DEL_002_SPR() runs on Tester system CseSystem {
						// Local variables
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_spRelative));
						v_ae1.done;
					}
					
					testcase TC_CSE_GEN_DEL_002_ABS() runs on Tester system CseSystem {
						// Local variables
							
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_GEN_DEL_002(e_absolute));
						v_ae1.done;
					}
								
				} // end of group g_CSE_GEN_DEL_002
				
			} // end of group Delete
		
		} // end of group Generic
		
		group Registration {
			
			group Create{
				
				/**
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned SP_relative_ AE_ID.  
				 * 
				 */
				testcase TC_CSE_REG_CRE_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
					
					v_ae1.start(f_CSE_REG_CRE_001());
		  	  	
		  	  		v_ae1.done;
		  	  		
				}
				
				function f_CSE_REG_CRE_001() runs on AeSimu {
		  	  	
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
					var universal charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AE-ID is allowed to register: " & PX_ALLOWED_C_AE_IDS[0];
	                
					//Test control
					if(not(PICS_IN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case");
						stop;
					}
	                
					// Test component configuration
					f_cf01Up();
	                
					//Preamble
					action(v_action);
					f_sleepIgnoreDef(PX_TCONFIG_IUT);
					
					//Test Body
					v_request := valueof(m_createAe(PX_APP_ID, omit, PX_CSE_ID & "/" & PX_ALLOWED_C_AE_IDS[0]));	
					
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
						
				}
		  	  	
				/**
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned AE_ID of AE-ID-Stem format.
				 * 
				 */
				testcase TC_CSE_REG_CRE_002() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
					v_ae1.start(f_CSE_REG_CRE_002());
			  	  	
					v_ae1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_002() runs on AeSimu {
		  	  	
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
					
					//Test control
	                
					// Test component configuration
					f_cf01Up();
		  	  	
					//Preamble
					
					//Test Body
					v_request := valueof(m_createAe(PX_APP_ID, omit, PX_ALLOWED_C_AE_IDS[0]));				
	    									
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
	
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
							tc_ac.stop;
							
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
						
				}

				/**
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided preprovisioned SP_relative_AE_ID. 
				 */
				
				testcase TC_CSE_REG_CRE_003() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
					v_cse1.done;
						
					v_cse1.start(f_CSE_REG_CRE_003());
			  	  	
					v_cse1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_003() runs on CseSimu {
					
					var integer v_remoteCseIndex := -1;
					
					//Test Configuration
					//f_cf02Up();
					
					//Preamble
					v_remoteCseIndex := f_cse_registrationRemoteCse();
					vc_ae1 := AeSimu.create("AE1") alive;
					vc_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					vc_ae1.done;
					vc_ae1.start(f_cse_preamble_registerAe());
					vc_ae1.done;
				
				}
		  	  	
				/**
				 * @desc Check that the IUT rejects an AE registration (allowed App-ID, not allowed C-AE-ID-STEM provided by AE) 
				 * 
				 */
				testcase TC_CSE_REG_CRE_004() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
					v_ae1.start(f_CSE_REG_CRE_004());
			  	  	
					v_ae1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_004() runs on AeSimu {
		  	  	
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
					var universal charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AE-ID is not allowed to register: " & PX_NOT_ALLOWED_C_AE_IDS[0];
					
					//Test control
	                
					// Test component configuration
					f_cf01Up();
		  	  	
					//Preamble
					//vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
					//TODO: create serviceSubscribedProfile, Node, and serviceSubscribedAppRule
					//v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"C*"}); //c_CRUDNDi);
					action(v_action);
					f_sleepIgnoreDef(PX_TCONFIG_IUT);
					
					//Test Body	
					//v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));				
	    											
					v_request := f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, PX_NOT_ALLOWED_C_AE_IDS[0]), -1);
			
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4107))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation rejected.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error, creating AE with not allowed AE-ID ");
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}
									
					// Postamble
					f_cse_postamble_deleteResources();
						
					// Tear down
					f_cf01Down();
						
				}
		  	  	
				/**
				 * @desc Check that the IUT accepts an AE registration (allowed App-ID, S-AE-ID-STEM not provided by AE) 
				 * 
				 */
				testcase TC_CSE_REG_CRE_005() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
					v_cse1.done;
						
					v_cse1.start(f_CSE_REG_CRE_005());
			  	  	v_cse1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_005() runs on CseSimu {
		  	  	
		  	  		var MsgIn v_request;
					var template RequestPrimitive v_requestPrimitive;
					
					//Test control
	                
					// Test component configuration
					f_cf02UpCseSimuMaster();
		  	  	
					//Preamble
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
		
					//Test Body
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, "S")));
					
					v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/S", -, -, -);
					v_requestPrimitive.primitiveContent.aEAnnc.app_ID := PX_APP_ID;
	    									
					tc_ac.start;
					alt{
						[] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
							f_cse_sendResponse_cseSimu(v_request);
						}
						[] mccPortIn.receive(mw_request(mw_createAEAnnc())) -> value v_request {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": AE creation redirected but wrong parameters");
							f_cse_sendResponse_cseSimu(v_request);
						}
						[] mccPortIn.receive(mw_request(?))-> value v_request {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Unexpected message received");
							f_cse_sendResponse_cseSimu(v_request);
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}
					
					vc_ae1.done;
									
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
					
					// Tear down
					f_cf02DownCseSimuMaster();
						
				}
				
				/**
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided character ‘S’ in AE_ID_Stem ask for a SP_relative_AE_ID 
				 * 
				 */
				testcase TC_CSE_REG_CRE_006() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
					v_cse1.done;
							
					v_cse1.start(f_CSE_REG_CRE_006());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_006() runs on CseSimu {

					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
	
					//Test control
					if(not(PICS_MN_CSE or PICS_ASN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE or ASN-CSE to run this test case");
						stop;
					}
    
					// Test component configuration
					f_cf02UpCseSimuMaster();

					//Preamble
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
					
					//Test Body
					vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S")));
					vc_ae1.done;
							
					tc_ac.start;

					alt {
						[] mccPortIn.receive(mw_request(mw_createAEAnnc_s_ae_id(PX_CSE_ID, f_getLocalResourceAddress(vc_cSEBaseIndex), -))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
					
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
	
					// Tear down
					f_cf02DownCseSimuMaster();
		
				}	// end of TC_CSE_REG_CRE_006
				
				/**
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and provided character ‘S’ in AE_ID_Stem ask for a SP_relative_AE_ID 
				 * 
				 */
				testcase TC_CSE_REG_CRE_007() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
					v_ae1.start(f_CSE_REG_CRE_007());
			  	  	
					v_ae1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_007() runs on AeSimu {

					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
					
					// Test component configuration
					f_cf02Up();
					
					//Preamble
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
					vc_cse1.done;
			
					mcaPort.send(f_getMsgOutPrimitive(m_request(f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S"),-1))));
					
					vc_cse1.start(f_cse_announcementProcedure_createHandler());
					vc_cse1.done;
					
					//Test Body
					tc_ac.start;
					
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							//continue to test the content
							if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
								if (v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID == PX_APP_ID){
									setverdict(pass, __SCOPE__ & ": AE creation success.");
								}else{
									setverdict(fail, __SCOPE__ & ": Error in AE content.");
								}
							}else{
								setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist");
							}
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf02Down();

				}	// end of TC_CSE_REG_CRE_007

				/**
				 * @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), transfer request to the IN-CSE 
				 * 
				 */
				testcase TC_CSE_REG_CRE_008() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
					v_cse1.done;
							
					v_cse1.start(f_CSE_REG_CRE_008());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_008() runs on CseSimu {
		  	  	
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
	                
					// Test component configuration
					f_cf02UpCseSimuMaster();
		  	  	
					//Preamble
					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
					
					f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
								
					
					//TODO:
					//v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)));
					//mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					
					//Test Body
					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
											
					tc_ac.start;
	
					alt {
						[] mccPortIn.receive(mw_request(mw_createAEAnnc_s_ae_id(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
						}
						[] mccPortIn.receive(mw_request(mw_createAEAnnc_s_ae_id(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
						}
						[] mccPortIn.receive {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
					
					// Tear down
					f_cf02DownCseSimuMaster();
						
				}
		  	  	
				/**
				 * @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), communication between MN-CSE and IN-CSE
				 *  
				 */
				testcase TC_CSE_REG_CRE_009() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
					v_cse1.done;
							
					v_cse1.start(f_CSE_REG_CRE_009());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_009() runs on CseSimu {
		  	  	
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeAnncIndex := -1;
					var ResourceType v_resourceType := int2;
					
					//Test control
					if(not(PICS_IN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case");
						stop;
					}
	                
					// Test component configuration
					f_cf04Up();
		  	  	
					//Preamble
					
					vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
									
					//Create AEAnnc				
					v_aeAnncIndex := f_cse_announcementProcedure_announceResource(int2, m_createAEAnnc(-, PX_CSE1_ID & "/" & "S", PX_APP_ID, PX_CSE1_ID & "/" & "S"));
					
					//Update AEAnnc to simulate deregistration of AE
					v_request := f_getUpdateRequestPrimitive(f_getAnnouncedResourceType(int2),v_aeAnncIndex, valueof(m_updateAEAnncBase));//TODO 
					//v_request.primitiveContent.aEAnnc.link := "";//TODO To fix when base specs are fixed
					
					f_cse_updateAnnouncedResource(v_request);
					
					//Test Body
					v_request := valueof(m_updateAEAnncBase);			
	    									
					v_request := f_getUpdateRequestPrimitive(f_getAnnouncedResourceType(int2),v_aeAnncIndex, v_request);//TODO 
					v_request.primitiveContent.aEAnnc.labels := {"Credential-ID:None"};
		  	  		
					mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
	
					alt {
						[] mccPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
							//continue to test the content
						}
						[] mccPort.receive {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					//v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex);	
									
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
					
					// Tear down
					f_cf04Down();
						
				}


				/**
				 * @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), transfer response to the AE
				 * 
				 */
				testcase TC_CSE_REG_CRE_010() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
					v_ae1.start(f_CSE_REG_CRE_010());
			  	  	
					v_ae1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_010() runs on AeSimu {
		  	  	
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					
					//Test control
					if(not(PICS_MN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
						stop;
					}
	                
					// Test component configuration
					f_cf02Up();
		  	  	
					//Preamble
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
					vc_cse1.done;
					
					v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, PX_ALLOWED_S_AE_IDS[0]));
					
					vc_cse1.start(f_cse_announcementProcedure_createHandler());
					vc_cse1.done;
					
					//TODO Deregister
					//f_cse_deleteResource(v_aeIndex);
					v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)));
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					
					//Test Body
					f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, f_getResourceId(vc_resourcesList[v_aeIndex].resource)));
					
					vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc_s_ae_id(PX_CSE_ID, -, -, -)));
					vc_cse1.done;

					tc_ac.start;
	
					alt {
						[] mcaPortIn.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							//continue to test the content
							if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
								if (v_response.primitive.responsePrimitive.primitiveContent.aE.app_ID == PX_APP_ID){
									setverdict(pass, __SCOPE__ & ": AE creation success.");
								}else{
									setverdict(fail, __SCOPE__ & ": Error in AE content.");
								}
							}else{
								setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist");
							}
						}
						[] mcaPortIn.receive {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf02Down();
						
				}; //end TC_CSE_REG_CRE_010

				/**
				 * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and asking an CSE relative AE_ID by indicating AE_ID_Stem with character ‘C’.  
				 * 
				 */
				testcase TC_CSE_REG_CRE_011() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
					v_ae1.start(f_CSE_REG_CRE_011());
			  	  	
					v_ae1.done;
			  	  		
				}
					
				function f_CSE_REG_CRE_011() runs on AeSimu {

					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
					
					//Test control
    
    
					// Test component configuration
					f_cf01Up();
    
					//Preamble

					//Test Body
					v_request := valueof(m_createAe(PX_APP_ID, omit, "C"));	
	
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
	
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
	
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
							
							if(v_response.primitive.responsePrimitive.primitiveContent.aE.resourceID[0] == "C"){
								setverdict(pass, __SCOPE__ & "Resource ID set correctly.");
							} else {
								setverdict(fail, __SCOPE__ & "Resource ID not set correctly.");
							}
							
							}
						[] 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();
		
				}

				/**
				  * @desc Check that the IUT accepts an AE registration with the optional attribute OPTIONAL_ATTRIBUTE provided   
				  * 
				 */
				group g_CSE_REG_CRE_012 {
					
					testcase TC_CSE_REG_CRE_012_AE_LBL() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, PX_AE1_ID_STEM);
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_create.primitiveContent.aE.labels := {"labels"};
						v_ae1.start(f_CSE_REG_CRE_012(v_create));
						v_ae1.done;
					}
					
					testcase TC_CSE_REG_CRE_012_AE_APN() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, PX_AE1_ID_STEM);
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_create.primitiveContent.aE.appName := "AeAppName";
						v_ae1.start(f_CSE_REG_CRE_012(v_create));
						v_ae1.done;
					}
					
					testcase TC_CSE_REG_CRE_012_AE_POA() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_create := m_createAe(PX_APP_ID, omit, PX_AE1_ID_STEM);
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_create.primitiveContent.aE.pointOfAccess := {PX_AE1_ADDRESS};
						v_ae1.start(f_CSE_REG_CRE_012(v_create));
						v_ae1.done;
					}
					
				}

				group g_CSE_REG_CRE_013 {
					
					/**
					 * @desc Check that the IUT accepts a create request of <remoteCSE> resource with OPTIONAL_ATTRIBUTE. 
					 * 
					 */
					testcase TC_CSE_REG_CRE_013_LBL() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;	
						const AttributeAux c_optionalAttribute := {"labels", omit};
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
                        						
						v_createRequest.primitiveContent.remoteCSE.labels := {"MyLabel"};
						
						v_cse1.start(f_CSE_REG_CRE_013(v_createRequest, c_optionalAttribute));
						v_cse1.done;
						
					}
					
					testcase TC_CSE_REG_CRE_013_CST() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;	
						const AttributeAux c_optionalAttribute := {"cseType", omit};
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
												
						v_createRequest.primitiveContent.remoteCSE.cseType := int1;
						
						v_cse1.start(f_CSE_REG_CRE_013(v_createRequest, c_optionalAttribute));
						v_cse1.done;
					}
					
					testcase TC_CSE_REG_CRE_013_POA() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;	
						const AttributeAux c_optionalAttribute := {"pointOfAccess", omit};
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
	
						v_createRequest.primitiveContent.remoteCSE.pointOfAccess := {"http://" & PX_CSE1_ADDRESS & "/"};
	
						v_cse1.start(f_CSE_REG_CRE_013(v_createRequest, c_optionalAttribute));
						v_cse1.done;

					}
					
					testcase TC_CSE_REG_CRE_013_NL() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;	
						const AttributeAux c_optionalAttribute := {"nodeLink", omit};
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;

						v_createRequest.primitiveContent.remoteCSE.nodeLink := c_defaultNodeID;

						v_cse1.start(f_CSE_REG_CRE_013(v_createRequest, c_optionalAttribute));
						v_cse1.done;

					}
					
				}// end group g_CSE_REG_CRE_BV_013	

				/**
				 * @desc Check that the IUT rejects an AE registration (not allowed App-ID) 
				 * 
				 */
				testcase TC_CSE_REG_CRE_016() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							
					v_ae1.start(f_CSE_REG_CRE_016());
				  	  	
					v_ae1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_016() runs on AeSimu {
		  	  	
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_cseBaseIndex := -1;
					var ResourceType v_resourceType := int2;
					var universal charstring v_action :=  __SCOPE__ & ": Please, make sure that the following AppId is not allowed to register: " & PX_APP_ID;
					
					//Test control
	                
					// Test component configuration
					f_cf01Up();
					
					//Preamble
					action(v_action);
					f_sleepIgnoreDef(PX_TCONFIG_IUT);
	    									
					// Test Body
					v_request := valueof(m_createAe(PX_NOT_ALLOWED_APP_ID, -, PX_AE1_ID_STEM, -, -));				
	    									
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, v_cseBaseIndex);
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4107))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation rejected.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error, creating AE with not allowed APP-ID ");
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
									
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
						
				}
				
				/**
				 * @desc Check that the IUT rejects a create request of <AE> resource that doesn’t include the MANDATORY_ATTRIBUTE
				 * 
				 */
				group g_CSE_REG_CRE_017 {
					testcase TC_CSE_REG_CRE_017_API() runs on Tester system CseSystem {
						
						//Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM);
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.aE.app_ID := omit;	//Mandatory app_ID field is being set empty
	
						v_ae1.start(f_CSE_REG_CRE_017(v_createRequest));
						v_ae1.done;
	
					}//end TC_CSE_REG_CRE_017_API
					testcase TC_CSE_REG_CRE_017_RR() runs on Tester system CseSystem {
	
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM);
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.aE.requestReachability := omit;	//Mandatory requestReachability field is being set empty
						
						v_ae1.start(f_CSE_REG_CRE_017(v_createRequest));
						v_ae1.done;

					}//end TC_CSE_REG_CRE_017_RR
					
				}//end g_CSE_REG_CRE_017

				/**
				 * @desc Check that the IUT accepts an create request of <remoteCSE> resource with attributes multiplicity equals to 1. 
				 *  
				 */
				testcase TC_CSE_REG_CRE_018() runs on Tester system CseSystem {
						
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
							
					v_cse1.start(f_CSE_REG_CRE_018());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_018() runs on CseSimu {
				
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var RequestPrimitive v_createRequestPrimitive := valueof(m_createRemoteCSEBase);	
					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, v_createRequestPrimitive, -1);
	
					mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mccPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
							f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16);
						}
						[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
						}
						[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating resource type remoteCSE");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type remoteCSE");
						}
					}	
			
					// Postamble
					f_cse_postamble_deleteResourcesCSE();
	
					// Tear down
					f_cf04Down();

				}//end TC_CSE_REG_CRE_018
				
				/**
				 * @desc Check that the IUT accepts an create request of <remoteCSE> resource with attributes multiplicity equals to 1 without the preconfigured CSE-ID
				 *
				 */
				testcase TC_CSE_REG_CRE_019() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
					v_cse1.done;
							
					v_cse1.start(f_CSE_REG_CRE_019());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_019() runs on CseSimu {
				
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var RequestPrimitive v_createRequestPrimitive := valueof(m_createRemoteCSEBase);	
					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, v_createRequestPrimitive, -1);

					mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
							f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16);
						}
						[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating resource type remoteCSE");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type remoteCSE");
						}
					}	

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf04Down();

				}//end TC_CSE_REG_CRE_019

				/**
	 			 * @desc Check that the IUT accepts a response from IN_CSE on the success update of AEAnnc during AE registration with preprovisioned SP_relative_AE_ID
				 * 
				 */
				 //TODO TO BE FINALIZED
				testcase TC_CSE_REG_CRE_020() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							
					v_ae1.start(f_CSE_REG_CRE_020());
				  	  	
					v_ae1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_020() runs on AeSimu {

					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var ResourceType v_resourceType := int2;
					
					//Test control
					if(not(PICS_MN_CSE or PICS_ASN_CSE)) {
					   setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE or ASN-CSE to run this test case");
					   stop;
					}
    
					// Test component configuration
					f_cf02Up();

					//Preamble
					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
					vc_cse1.done;
	
					v_request := valueof(m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM));				
						
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response{
							tc_ac.stop;
		
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
							setverdict(pass, __SCOPE__ & ": AE successfully created.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
	
					vc_cse1.start(f_cse_announcementProcedure_updateHandler());
					vc_cse1.done;
	
	                //Test body
					tc_ac.start;

					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							//continue to test the content
							if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
								if (v_response.primitive.responsePrimitive.primitiveContent.aE.app_ID == PX_APP_ID){
									setverdict(pass, __SCOPE__ & ": AE creation success.");
								}else{
									setverdict(fail, __SCOPE__ & ": Error in AE content.");
								}
							}else{
								setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist");
							}
						}
						[] mcaPort.receive {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating AE");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
						}
					}	
					
					// Postamble
					f_cse_postamble_deleteResources();
	
					// Tear down
					f_cf02Down();
		
				}; //end TC_CSE_REG_CRE_020

				/**
				 * @desc Check that the IUT rejects the create request of <CSEBase> resource.
				 * 
				 */
				testcase TC_CSE_REG_CRE_021() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							
					v_ae1.start(f_CSE_REG_CRE_021());
				  	  	
					v_ae1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_021() runs on AeSimu {
    				
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var ResourceType v_resourceType := int5;	//CSEBase
						   
					// 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(v_resourceType, m_createCSEBaseBase, -1); 
					v_request.from_ := f_getOriginator(v_aeIndex);
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": CSEBase creation rejected.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating CSEBase with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating CSEBase");
						}
					}	
				
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}//end TC_CSE_REG_CRE_021

				/**
				 * @desc Check that the IUT accepts an AE registration (allowed App-ID, C-AE-ID-STEM not provided by AE)  
				 * 
				 */
				testcase TC_CSE_REG_CRE_022() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							
					v_ae1.start(f_CSE_REG_CRE_022());
				  	  	
					v_ae1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_022() runs on AeSimu {				
					
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var ResourceType v_resourceType := int2;

					//Test control

					// Test component configuration
					f_cf01Up();

					//Preamble

					//Test Body
					v_request := valueof(m_createAe(PX_APP_ID, omit, "C"));	

					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
							vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);		
							setverdict(pass, __SCOPE__ & ": AE successfully registered.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while registering AE with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while registering AE");
						}
					}	
					
					//Check to see if the resource is present or not
				  	if (f_cse_isResourcePresent(vc_aeAuxIndex)){
					  	setverdict(pass, __SCOPE__ & ":INFO: Resource created");
				  	} else {
					  	setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
				  	}
				
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();
		
				}
								
				/**
				 * @desc Check that the IUT rejects registration of already registered AE (C-AE-ID-STEM provided by AE) 
				 * 
				 */
				testcase TC_CSE_REG_CRE_023() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							
					v_ae1.start(f_CSE_REG_CRE_023());
				  	  	
					v_ae1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_023() runs on AeSimu {
				  
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var ResourceType v_resourceType := int2;
					
					// Test control
	    				
					// Test component configuration
					f_cf01Up();
	    			
					// Test adapter configuration
	    			
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					//Test Body	
					v_request := valueof(m_createAe(PX_APP_ID, omit, vc_resourcesList[v_aeIndex].resource.aE.aE_ID));				
	    									
					v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1);
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4105))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE creation rejected.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4105))) -> 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();
				
				}

				/**
				 * @desc Check that IUT sends a CSE registration request with attributes multiplicity equals to 1 
				 * 
				 */
				testcase TC_CSE_REG_CRE_024() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
					v_cse1.done;
							
					v_cse1.start(f_CSE_REG_CRE_024());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_024() runs on CseSimu {
  
					// Local variables
					var ResponsePrimitive v_response;
					var MsgIn v_request;
					var PrimitiveContent v_localResource;
					var integer v_parentResourceIndex := -1;
					var integer v_localResourceIndex := -1;
					var boolean v_cseRegistered := false;
					var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
					var universal charstring v_action :=  __SCOPE__ & ": Please, send a CSE registration request with attributes multiplicity equals to 1";
	   
					//Test control
					if(not(PICS_MN_CSE or PICS_ASN_CSE)) {
						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE or ASN-CSE to run this test case");
						stop;
					}

					// Test component configuration
					f_cf04Up();

					// Test adapter configuration

					// Preamble
					//send triggering primitive to SUT
					f_sendUtPrimitive(v_utRequest,v_action);

					// Test Body
					tc_ac.start;
					alt {
						[not(v_cseRegistered)] mccPortIn.receive(mw_request(mw_createRemoteCSE)) -> value v_request {
							tc_ac.stop;
							setverdict(pass, __SCOPE__&":INFO: CREATE remoteCSE request received");
							v_parentResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_);
							if(v_parentResourceIndex == -1) {
								log(__SCOPE__&": ERROR: Target resource not found");
								v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier));
						
							} else {
								v_localResource := f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentResourceIndex, v_request.primitive.requestPrimitive.resourceType);
								vc_localRemoteCseIndex := f_setLocalResource(v_localResource, v_request.primitive.requestPrimitive.resourceType, v_parentResourceIndex);
	
								v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier));
								v_response.primitiveContent := vc_localResourcesList[vc_localRemoteCseIndex].resource;
								v_cseRegistered := true;
							}
							v_response.from_ := PX_CSE1_ID;
							v_response.to_ := v_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));	
							tc_ac.start(10.0);
							repeat;
						}
						[] tc_ac.timeout {
							if(not(v_cseRegistered)) {
								setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
							}
						}
					}	
					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf04Down();

				}

				/**
				 * @desc Check that IUT accepts a CSE registration request with attributes multiplicity equals to 1 
				 * 
				 */
				testcase TC_CSE_REG_CRE_025() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
					v_cse1.done;
							
					v_cse1.start(f_CSE_REG_CRE_025());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_025() runs on CseSimu {
	  
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_resourceIndex := -1;
					var integer v_localResourceIndex := -1;
					var PrimitiveContent v_remoteCSEResource;
	   
					// Test control

					// Test component configuration
					f_cf04Up();

					// Test adapter configuration

					// Preamble
					v_request := f_getCreateRequestPrimitive(int16, m_createRemoteCSEBase, -1);
					mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));

					// Test Body
					tc_ac.start;
					alt {
						[] mccPort.receive(mw_response(mw_responsePrimitiveOK(?))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly");
							f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
							v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16, -1);
						}
						[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
							tc_ac.stop;
							setverdict(inconc, __SCOPE__&":INFO: Error while creating resource type remoteCSE");
						}
						[] mccPort.receive {
							tc_ac.stop;
							setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
						}
						[] tc_ac.timeout {
							setverdict(inconc, __SCOPE__&":INFO: No answer while creating resource type remoteCSE");
						}
					}	
					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf04Down();
	
				}

				/**
				 * @desc Check that IUT sends a CSE registration request with OPTIONAL_ATTRIBUTE attribute 
				 * 
				 */
				
				group g_CSE_REG_CRE_026 {
					
					testcase TC_CSE_REG_CRE_026_RN() runs on Tester system CseSystem {
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
						var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
						var template RequestPrimitive v_request := mw_createRemoteCSE;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a CSE registration request with optional attribute resourceName";
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_utRequest.requestPrimitive.primitiveContent.remoteCSE.resourceName := "UNINITIALIZED";
						v_request.primitiveContent.remoteCSE.resourceName := ?;
						v_cse1.start(f_CSE_REG_CRE_026(v_utRequest,v_request,v_action));
						v_cse1.done;
					}
					
					testcase TC_CSE_REG_CRE_026_ET() runs on Tester system CseSystem {
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
						var template RequestPrimitive v_request := mw_createRemoteCSE;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a CSE registration request with optional attribute expirationTime";
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_utRequest.requestPrimitive.primitiveContent.remoteCSE.expirationTime := "20301231T012345";
						v_request.primitiveContent.remoteCSE.expirationTime := ?;
						v_cse1.start(f_CSE_REG_CRE_026(v_utRequest,v_request,v_action));
						v_cse1.done;
					}
					
					testcase TC_CSE_REG_CRE_026_LBL() runs on Tester system CseSystem {
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
						var template RequestPrimitive v_request := mw_createRemoteCSE;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a CSE registration request with optional attribute labels";
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_utRequest.requestPrimitive.primitiveContent.remoteCSE.labels := {"UNINITIALIZED"};
						v_request.primitiveContent.remoteCSE.labels := ?;
						v_cse1.start(f_CSE_REG_CRE_026(v_utRequest,v_request,v_action));
						v_cse1.done;
					}
					
					testcase TC_CSE_REG_CRE_026_POA() runs on Tester system CseSystem {
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
						var template RequestPrimitive v_request := mw_createRemoteCSE;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a CSE registration request with optional attribute pointOfAccess";
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_utRequest.requestPrimitive.primitiveContent.remoteCSE.pointOfAccess := {"UNINITIALIZED"};
						v_request.primitiveContent.remoteCSE.pointOfAccess := ?;
						v_cse1.start(f_CSE_REG_CRE_026(v_utRequest,v_request,v_action));
						v_cse1.done;
					}
					
					testcase TC_CSE_REG_CRE_026_NL() runs on Tester system CseSystem {
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
						var template RequestPrimitive v_request := mw_createRemoteCSE;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a CSE registration request with optional attribute nodeLink";
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_utRequest.requestPrimitive.primitiveContent.remoteCSE.nodeLink := "UNINITIALIZED";
						v_request.primitiveContent.remoteCSE.nodeLink := ?;
						v_cse1.start(f_CSE_REG_CRE_026(v_utRequest,v_request,v_action));
						v_cse1.done;
					}
					
					testcase TC_CSE_REG_CRE_026_CST() runs on Tester system CseSystem {
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
						var template RequestPrimitive v_request := mw_createRemoteCSE;
						var universal charstring v_action :=  __SCOPE__ & ": Please, send a CSE registration request with optional attribute cseType";
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_utRequest.requestPrimitive.primitiveContent.remoteCSE.cseType := int1;//TODO It should be marked as "UNITIALIZED"
						v_request.primitiveContent.remoteCSE.cseType := ?;
						v_cse1.start(f_CSE_REG_CRE_026(v_utRequest,v_request,v_action));
						v_cse1.done;
					}
					
				}

				/**
				 * @desc Check that IUT accepts a CSE registration request with cseType attribute set to ‘MN_CSE’
				 * 
				 */
				testcase TC_CSE_REG_CRE_027() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
							
					v_cse1.start(f_CSE_REG_CRE_027());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_CRE_027() runs on CseSimu {
					//Local variables
					var ResourceType v_resourceType := int16;	//remoteCSE	
					var RequestPrimitive v_request;
					var template PrimitiveContent v_contentResponse;
					// Test control

					// Test component configuration
					f_cf04Up();

					// Test adapter configuration

					// Preamble
					v_request := valueof(m_createRemoteCSEBase);
					v_request.primitiveContent.remoteCSE.cseType := int2;	//MN_CSE

					v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
					v_contentResponse.remoteCSE.cseType := int2;	//MN_CSE					
					
					//Test Body					
					vc_remoteCseIndex := f_cse_registerRemoteCse(v_request, v_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_027	

				/**
				 * @desc Check that IUT accepts  a CSE registration request with OPTIONAL_ATTRIBUTE attribute
				 * 
				 */
				group g_CSE_REG_CRE_028 {
				
					testcase TC_CSE_REG_CRE_028_LBL() runs on Tester system CseSystem {
						 //Local variables
						 var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
						 var RequestPrimitive v_request;
						 var template PrimitiveContent v_contentResponse;
						 var Labels v_labels_1 := {"VALUE_1"};
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						 v_request := valueof(m_createRemoteCSEBase);
						 v_request.primitiveContent.remoteCSE.cseType := int2;	//MN_CSE
						 v_request.primitiveContent.remoteCSE.labels := v_labels_1;
		
						 v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
						 v_contentResponse.remoteCSE.cseType := int2;	//MN_CSE
						 v_contentResponse.remoteCSE.labels := v_labels_1;
		
						 v_cse1.start(f_CSE_REG_CRE_028(v_request, v_contentResponse));
						 v_cse1.done;
		
					}
					
					testcase TC_CSE_REG_CRE_028_POA() runs on Tester system CseSystem {
						 //Local variables
						 var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
						 var RequestPrimitive v_request;
						 var template PrimitiveContent v_contentResponse;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						 v_request := valueof(m_createRemoteCSEBase);
						 v_request.primitiveContent.remoteCSE.cseType := int2;	//MN_CSE
						 v_request.primitiveContent.remoteCSE.pointOfAccess := {"http://" & PX_CSE1_ADDRESS & "/"};
		
						 v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
						 v_contentResponse.remoteCSE.cseType := int2;	//MN_CSE
						 v_contentResponse.remoteCSE.pointOfAccess := {"http://" & PX_CSE1_ADDRESS & "/"};
		
						 v_cse1.start(f_CSE_REG_CRE_028(v_request, v_contentResponse));
						 v_cse1.done;
		
					}
					
					testcase TC_CSE_REG_CRE_028_NL() runs on Tester system CseSystem {
						 //Local variables
						 var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
						 var RequestPrimitive v_request;
						 var template PrimitiveContent v_contentResponse;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						 v_request := valueof(m_createRemoteCSEBase);
						 v_request.primitiveContent.remoteCSE.cseType := int2;	//MN_CSE
						 v_request.primitiveContent.remoteCSE.nodeLink := c_defaultNodeID;
	
						 v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
						 v_contentResponse.remoteCSE.cseType := int2;	//MN_CSE
						 v_contentResponse.remoteCSE.nodeLink := c_defaultNodeID;
	
						 v_cse1.start(f_CSE_REG_CRE_028(v_request, v_contentResponse));
						 v_cse1.done;
	
					}
					
				}//end g_CSE_REG_CRE_028
			
			}	//end group Create
			
			group Retrieve{

				/**
				 * @desc Check that the IUT accepts an retrieval request of <CSEBase> resource and responds with all  attributes that have multiplicity equals to 1.
				 * 
				 */
				testcase TC_CSE_REG_RET_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
								
					v_ae1.start(f_CSE_REG_RET_001());
					  	  	
					v_ae1.done;
					  	  		
				}
							
				function f_CSE_REG_RET_001() runs on AeSimu {
    				
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var template PrimitiveContent v_contentResponse;
	    										   
					// Test control
	
					// Test component configuration
					f_cf01Up();
	
					// Test adapter configuration
	
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					// Test Body
					v_contentResponse.cSEBase := mw_contentCSEBase_rc1;
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(v_aeIndex)))));//TODO Maybe PX_SUPER_AE_ID
	
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse), {"parentID"})) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_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 TC_CSE_REG_RET_001
				
				/**
				 * @desc Check that the IUT accepts a retrieval request of <CSEBase> resource with the optional ATTRIBUTE
				 * 
				 */
				group g_CSE_REG_RET_002 {
					
					testcase TC_CSE_REG_RET_002_CST() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.cSEBase := mw_contentCSEBase_rc1;
						v_contentResponse.cSEBase.cseType := ?;
						    
						v_ae1.start(f_CSE_REG_RET_002(v_contentResponse));
						v_ae1.done;
					}
					
					testcase TC_CSE_REG_RET_002_NL() runs on Tester system CseSystem {
						//Local variables
						 var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						 var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						 v_contentResponse.cSEBase := mw_contentCSEBase_rc1;
						 v_contentResponse.cSEBase.nodeLink := ?;
	    
						 v_ae1.start(f_CSE_REG_RET_002(v_contentResponse));
						 v_ae1.done;
					}
					
				} //end g_CSE_REG_RET_002
				
				/**
				 * @desc Check that the IUT accepts a retrieval request of <AE> resource with attributes multiplicity equals to 1
				 * 
				 */
				 
				testcase TC_CSE_REG_RET_003() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;			
					v_ae1.start(f_CSE_REG_RET_003());
						  	  	
					v_ae1.done;
						  	  		
				}
								
				function f_CSE_REG_RET_003() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var template PrimitiveContent v_contentResponse;
								   
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
	
					// Test Body
					v_contentResponse.aE := mw_contentAeBase;
	
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)))));//TODO Maybe PX_SUPER_AE_ID

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_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 TC_CSE_REG_RET_003

				/**
				 * @desc Check that the IUT accepts a retrieval request of <AE> resource with optional ATTRIBUTE
				 * 
				 */
				 
				group g_CSE_REG_RET_004 {
					
					testcase TC_CSE_REG_RET_004_LBL() runs on Tester system CseSystem {
						// Local variables
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM);
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.aE.labels := v_labels_1;
	
						v_contentResponse.aE := mw_contentAeBase;
						v_contentResponse.aE.labels := ?;
		    
						v_ae1.start(f_CSE_REG_RET_004(v_createRequest, v_contentResponse));
						v_ae1.done;
					}
	
					testcase TC_CSE_REG_RET_004_APN() runs on Tester system CseSystem {
						//Local variables
						 var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						 var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM);
						 var template PrimitiveContent v_contentResponse;
						 v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						 v_createRequest.primitiveContent.aE.appName := "AeAppName";

						 v_contentResponse.aE := mw_contentAeBase;
						 v_contentResponse.aE.appName := ?;

						 v_ae1.start(f_CSE_REG_RET_004(v_createRequest,v_contentResponse));
						 v_ae1.done;
					}
					
					testcase TC_CSE_REG_RET_004_POA() runs on Tester system CseSystem {
						//Local variables
						 var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						 var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM);
						 var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						 v_createRequest.primitiveContent.aE.pointOfAccess := {PX_AE1_ADDRESS};

						 v_contentResponse.aE := mw_contentAeBase;
						 v_contentResponse.aE.pointOfAccess := ?;

						 v_ae1.start(f_CSE_REG_RET_004(v_createRequest, v_contentResponse));
						 v_ae1.done;
					}
						
				} //end g_CSE_REG_RET_004

				/**
				 * @desc Check that the IUT accepts a retrieval request of <CSEBase> resource including the cseType attribute
				 * 
				 */
				testcase TC_CSE_REG_RET_005() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;			
					v_ae1.start(f_CSE_REG_RET_005());
						  	  	
					v_ae1.done;
						  	  		
				}
								
				function f_CSE_REG_RET_005() runs on AeSimu {
    				
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var template PrimitiveContent v_contentResponse_MN;
					var template PrimitiveContent v_contentResponse_IN;

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
	
					// Test Body
					v_contentResponse_MN.cSEBase := mw_contentCSEBase_rc1;
					v_contentResponse_IN.cSEBase := mw_contentCSEBase_rc1;
					v_contentResponse_IN.cSEBase.cseType := int1;
	
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(v_aeIndex)))));//TODO Maybe PX_SUPER_AE_ID 
					
					tc_ac.start;
					alt {
						[PX_IN_CSE] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse_IN), {"parentID"})) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": cseType attribute is set to 1 (IN_CSE)");
						}
						[PX_MN_CSE] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse_MN), {"parentID"})) -> value v_response {
							tc_ac.stop;
							if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.cSEBase.cseType)) {
								if(v_response.primitive.responsePrimitive.primitiveContent.cSEBase.cseType == int2) {
									setverdict(pass, __SCOPE__ & ": cseType attribute is set to 2 (MN_CSE)");
								} else {
									setverdict(fail, __SCOPE__ & ": cseType attribute is set to other than 2 (MN_CSE)");
								}
							}
							
						}
						[PX_IN_CSE] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse_IN))) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Wrong response status code");
						}
						[PX_MN_CSE] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse_MN))) -> 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 TC_CSE_REG_RET_BV_005

				/**
				 * @desc Check that the IUT accepts a retrieval request of <remoteCSE> resource
				 * 
				 */
				testcase TC_CSE_REG_RET_006() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
							
					v_cse1.start(f_CSE_REG_RET_006());
				  	  	
					v_cse1.done;
				  	  		
				}
						
				function f_CSE_REG_RET_006() runs on CseSimu {
					//Local variables
					 //Local variables
					 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(m_createRemoteCSEBase);
				    
					 v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
 
					 mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex)))));
					 tc_ac.start;
					 alt {
						 [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {
							 tc_ac.stop;
							 setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
						 }
						 [] mccPort.receive(mw_response(mw_responsePrimitiveOK(v_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();
				 
				}//end TC_CSE_REG_RET_006
				
				/**
				 * @desc Check that the IUT accepts an retrieval request of <remoteCSE> resource with optional ATTRIBUTE
				 * 
				 */
				group g_CSE_REG_RET_007 {
					
					testcase TC_CSE_REG_RET_007_LBL() runs on Tester system CseSystem {
						// Local variables
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;
						var template PrimitiveContent v_contentResponse;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_createRequest.primitiveContent.remoteCSE.labels := v_labels_1;

						v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
						v_contentResponse.remoteCSE.labels := ?;

						v_cse1.start(f_CSE_REG_RET_007(v_createRequest, v_contentResponse));
						v_cse1.done;
					}
					
					testcase TC_CSE_REG_RET_007_CST() runs on Tester system CseSystem {
						// Local variables
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;
						var template PrimitiveContent v_contentResponse;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_createRequest.primitiveContent.remoteCSE.cseType := int1;

						v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
						v_contentResponse.remoteCSE.cseType := ?;

						v_cse1.start(f_CSE_REG_RET_007(v_createRequest, v_contentResponse));
						v_cse1.done;
					}
					
					testcase TC_CSE_REG_RET_007_POA() runs on Tester system CseSystem {
						// Local variables
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;
						var template PrimitiveContent v_contentResponse;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_createRequest.primitiveContent.remoteCSE.pointOfAccess := {"http://" & PX_CSE1_ADDRESS & "/"};

						v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
						v_contentResponse.remoteCSE.pointOfAccess := ?;

						v_cse1.start(f_CSE_REG_RET_007(v_createRequest, v_contentResponse));
						v_cse1.done;
					}
					
					testcase TC_CSE_REG_RET_007_NL() runs on Tester system CseSystem {
						// Local variables
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						
						var template RequestPrimitive v_createRequest := m_createRemoteCSEBase;
						var template PrimitiveContent v_contentResponse;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						v_createRequest.primitiveContent.remoteCSE.nodeLink := c_defaultNodeID;

						v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
						v_contentResponse.remoteCSE.nodeLink := ?;

						v_cse1.start(f_CSE_REG_RET_007(v_createRequest, v_contentResponse));
						v_cse1.done;
					}
					
				} //end g_CSE_REG_RET_007

				/**
				 * @desc Check that the IUT accepts a retrieval request of <CSEBase> resource and responds with supportedResourceTypes attribute containing a list of the supported resources and pointOfAccess containing the list of physical addresses to be used by Registree to connect to this CSE (e.g. IP address, FQDN).
				 * 
				 */
				testcase TC_CSE_REG_RET_008() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
									
					v_ae1.start(f_CSE_REG_RET_008());
						  	  	
					v_ae1.done;
						  	  		
				}
								
				function f_CSE_REG_RET_008() runs on AeSimu {
    				
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var template PrimitiveContent v_contentResponse;
				   
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

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

					// Test Body
					v_contentResponse.cSEBase := mw_contentCSEBase_rc1;

					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(), f_getOriginator(v_aeIndex)))));//TODO Maybe PX_SUPER_AE_ID

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse), {"parentID"})) -> value v_response {
							tc_ac.stop;
							
							if (v_response.primitive.responsePrimitive.primitiveContent.cSEBase.supportedResourceType == PX_SRT) {
								setverdict(pass, __SCOPE__ & ": supportedResourceTypes attribute is set according to PX_SRT");
							}else{
								setverdict(fail, __SCOPE__ & ": supportedResourceTypes attribute is not set according to PX_SRT");
							}
							
							if (v_response.primitive.responsePrimitive.primitiveContent.cSEBase.pointOfAccess==PX_POA){
								setverdict(pass, __SCOPE__ & ": supportedResourceTypes attribute is set according to PX_POA");
							}else{
								setverdict(fail, __SCOPE__ & ": supportedResourceTypes attribute is not set according to PX_POA");
							}
			
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_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 TC_CSE_REG_RET_008

				/**
				 * @desc Check that the IUT sends a <remoteCSE> retrieve request on TARGET_REMOTE_CSE_ADDRESS
				 * 
				 */
				testcase TC_CSE_REG_RET_009() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
								
					v_cse1.start(f_CSE_REG_RET_009());
					  	  	
					v_cse1.done;
					  	  		
				}
							
				function f_CSE_REG_RET_009() runs on CseSimu {
					 //Local variables
					 var MsgIn v_request;
					 var ResourceType v_resourceType := int16;	//remoteCSE
					 var ResponsePrimitive v_response;
					 var template PrimitiveContent v_contentResponse;
					 var template UtTriggerPrimitive v_utRequest;
					 var integer v_localResourceIndex := -1;
					 var universal charstring v_action := __SCOPE__ & ": Please, send a valid RETRIEVE Request for remoteCSE to ";
	 		
					 // 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 := m_utRetrieve(f_getLocalResourceAddress(vc_localRemoteCseIndex));
 				     f_sendUtPrimitive(v_utRequest, v_action & f_getLocalResourceAddress(vc_localRemoteCseIndex));
					 
					 tc_ac.start;
					 alt {
 						[] mccPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request {
							tc_ac.stop;
							v_localResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_);
							if(v_localResourceIndex == -1)
							{ 
								setverdict(fail, __SCOPE__ & ": ERROR: Retrieve request target not found");
								v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier));
							} else if(v_localResourceIndex != vc_localRemoteCseIndex) { 
								setverdict(fail, __SCOPE__ & ": ERROR: Retrieve request target not expected");
								v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier));
							} else {
								setverdict(pass, __SCOPE__ & ": Retrieve Request received successfully");
								v_response := valueof(m_responsePrimitive(int2000,v_request.primitive.requestPrimitive.requestIdentifier));
								v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
							}
							v_response.from_ := PX_CSE1_ID;
							v_response.to_ := v_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
						}
						[] mccPortIn.receive(mw_request(?)) {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": ERROR: Unexpected request received");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while waiting to receive Retrieve request");
						}
	  				 }
					 // Postamble
					 f_cse_postamble_deleteResourcesCSE();
	
					 // Tear down
					 f_cf04Down();
 
				}//end TC_CSE_REG_RET_009

				/**
				 * @desc Check that IUT accepts a <remoteCSE> retrieve request
				 * 
				 */
				testcase TC_CSE_REG_RET_010() runs on Tester system CseSystem {
						
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
								
					v_cse1.start(f_CSE_REG_RET_010());
					  	  	
					v_cse1.done;
					  	  		
				}
							
				function f_CSE_REG_RET_010() runs on CseSimu {
					 //Local variables
					 var MsgIn v_response;
					 var RequestPrimitive v_request;
					 var ResourceType v_resourceType := int16;	//remoteCSE
					 var template PrimitiveContent v_contentResponse;
					 var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
	
					 // Test control
	
					 // Test component configuration
					 f_cf04Up();
	
					 // Test adapter configuration
	
					 // Preamble
                     vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
					 
 					 v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
	 
					 mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex)))));
					 tc_ac.start;
					 alt {
						[] mccPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
						}
						[] mccPort.receive(mw_response(mw_responsePrimitiveOK(v_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();
	 
				}//end TC_CSE_REG_RET_010
				
			}//end group Retrieve
			
			group Update{
			
				/**
				 * @desc Check that the IUT rejects the update request of <CSEBase> resource.
				 * 
				 */
				testcase TC_CSE_REG_UPD_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
									
					v_ae1.start(f_CSE_REG_UPD_001());
						  	  	
					v_ae1.done;
						  	  		
				}
								
				function f_CSE_REG_UPD_001() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var Labels v_labels_1 := {"VALUE_1"};
					var template RequestPrimitive v_updateRequest := m_updateCSEBaseBase;
					const integer c_cseBaseIndex := -1;
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

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

					// Test Body
					v_updateRequest.primitiveContent.cSEBase.labels := v_labels_1;
					v_request := f_getUpdateRequestPrimitive(int5, c_cseBaseIndex, v_updateRequest);
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": CSEBase update rejected.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while updating CSEBase with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating CSEBase");
						}
					}					    

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}; //end TC_CSE_REG_UPD_001

				/**
				 * @desc Check that the IUT accepts an update request of <remoteCSE> resource with OPTIONAL_ATTRIBUTE.
				 * 
				 */
				 
				group g_CSE_REG_UPD_002 {
					
					testcase TC_CSE_REG_UPD_002_LBL() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;	
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
    						
						v_updateRequest.primitiveContent.remoteCSE.labels := {"MyLabel"};
	
						v_cse1.start(f_CSE_REG_UPD_002(v_updateRequest));
						v_cse1.done;
	
					}
					
					testcase TC_CSE_REG_UPD_002_POA() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;	
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
    					
						v_updateRequest.primitiveContent.remoteCSE.pointOfAccess := {"http://" & PX_CSE1_ADDRESS & "/"};
	
						v_cse1.start(f_CSE_REG_UPD_002(v_updateRequest));
						v_cse1.done;
	
					}
					
					testcase TC_CSE_REG_UPD_002_NL() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;	
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
    						
						v_updateRequest.primitiveContent.remoteCSE.nodeLink := c_defaultNodeID;
	
						v_cse1.start(f_CSE_REG_UPD_002(v_updateRequest));
						v_cse1.done;

					}
					
				} //end g_CSE_REG_UPD_002
			    
				/**
				  * @desc Check that IUT sends a <remoteCSE> update request with OPTIONAL_ATTRIBUTE attribute.
			   	  * 
				 */
			    group g_CSE_REG_UPD_003 {
	
					testcase TC_CSE_REG_UPD_003_LBL() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;	
						var AttributeList c_optionalAttribute;
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
			
						v_updateRequest.primitiveContent.remoteCSE.labels := {"MyLabel"};
						c_optionalAttribute := {"labels"};

						v_cse1.start(f_CSE_REG_UPD_003(v_updateRequest, c_optionalAttribute));
						v_cse1.done;

					}
	
					testcase TC_CSE_REG_UPD_003_POA() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;	
						var AttributeList c_optionalAttribute;
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
		
						v_updateRequest.primitiveContent.remoteCSE.pointOfAccess := {"http://" & PX_CSE1_ADDRESS & "/"};
						c_optionalAttribute := {"pointofAccess"};

						v_cse1.start(f_CSE_REG_UPD_003(v_updateRequest, c_optionalAttribute));
						v_cse1.done;

					}
	
					testcase TC_CSE_REG_UPD_003_NL() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;	
						var AttributeList c_optionalAttribute;
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
			
						v_updateRequest.primitiveContent.remoteCSE.nodeLink := c_defaultNodeID;
						c_optionalAttribute := {"nodeLink"};

						v_cse1.start(f_CSE_REG_UPD_003(v_updateRequest, c_optionalAttribute));
						v_cse1.done;

					}

					testcase TC_CSE_REG_UPD_003_ET() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;	
						var AttributeList c_optionalAttribute;
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
			
						v_updateRequest.primitiveContent.remoteCSE.expirationTime := "20301231T012345";
						c_optionalAttribute := {"expirationTime"};
	
						v_cse1.start(f_CSE_REG_UPD_003(v_updateRequest, c_optionalAttribute));
						v_cse1.done;
		
					}
	
					testcase TC_CSE_REG_UPD_003_RR() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;	
						var AttributeList c_optionalAttribute;
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
	
						v_updateRequest.primitiveContent.remoteCSE.requestReachability := true;
						c_optionalAttribute := {"requestReachability"};
	
						v_cse1.start(f_CSE_REG_UPD_003(v_updateRequest, c_optionalAttribute));
						v_cse1.done;
	
					}
					
				} //end g_CSE_REG_UPD_003
	
			}//end group Update
			
			group Delete {

				/**
				 * @desc Check that the IUT rejects the delete request of <CSEBase> resource.
				 * 
				 */
				testcase TC_CSE_REG_DEL_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
									
					v_ae1.start(f_CSE_REG_DEL_001());
						  	  	
					v_ae1.done;
						  	  		
				}
								
				function f_CSE_REG_DEL_001() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
			   
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
		
					// Test Body
					v_request := valueof(m_delete(f_getResourceAddress(), f_getOriginator()));
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": CSEBase deletion rejected.");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4005))) -> value v_response{
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while deleting CSEBase with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while deleting CSEBase");
						}
					}					    
	
					// Postamble
					f_cse_postamble_deleteResources();

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

				/**
				 * @desc Check that IUT accepts a <remoteCSE> delete request on TARGET_REMOTE_CSE_ADDRESS, and deletes the <remoteCSE> resource
				 * 
				 */
				testcase TC_CSE_REG_DEL_002() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
								
					v_cse1.start(f_CSE_REG_DEL_002());
					  	  	
					v_cse1.done;
					  	  		
				}
							
				function f_CSE_REG_DEL_002() runs on CseSimu {
					//Local variables	
					var RequestPrimitive v_request;
					// Test control

					// Test component configuration
					f_cf04Up();

					// Test adapter configuration

					// Preamble
				    vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
                    
					// Test Body
					v_request := valueof(m_delete(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex)));

					mccPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mccPort.receive(mw_response(mw_responsePrimitive(int2002))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Deletion of <remoteCSE> resource has been accepted");
							f_removeElementFromList(vc_resourcesIndexToBeDeleted, vc_remoteCseIndex);							
						}
						[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
							f_removeElementFromList(vc_resourcesIndexToBeDeleted, vc_remoteCseIndex);
						}
						[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while deleting <remoteCSE> resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
						}
					}
					
//					Check if the resource has been deleted or not
					if(f_cse_isResourcePresent_cseSimu(vc_remoteCseIndex)) {
						setverdict(fail, __SCOPE__ & ":INFO: Resource not deleted");
					} else {
						setverdict(pass, __SCOPE__ & ":INFO: Resource deleted");
					}					    

					// Postamble
					
					// Tear down
					f_cf04Down();

				}//end TC_CSE_REG_DEL_002	
				
				/**
				 * @desc Check that the IUT accepts an AE de-registration
				 * 
				 */
				testcase TC_CSE_REG_DEL_003() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
										
					v_ae1.start(f_CSE_REG_DEL_003());
							  	  	
					v_ae1.done;
							  	  		
				}
								
				function f_CSE_REG_DEL_003() runs on AeSimu {
					//Local variables
					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 := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)));

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": AE has been de-registered successfully");
							f_removeElementFromList(vc_resourcesIndexToBeDeleted, v_aeIndex);
						}
						[] 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 de-registering AE");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while de-registering AE");
						}
					}					    

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}//end TC_CSE_REG_DEL_003	

				/**
				 * @desc Check that IUT sends a <remoteCSE> delete request on TARGET_REMOTE_CSE_ADDRESS
				 * 
				 */
				testcase TC_CSE_REG_DEL_004() runs on Tester system CseSystem {
					
					var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
					v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
								
					v_cse1.start(f_CSE_REG_DEL_004());
					  	  	
					v_cse1.done;
					  	  		
				}
							
				function f_CSE_REG_DEL_004() runs on CseSimu {
					//Local variables
					var MsgIn v_request;
					var template UtTriggerPrimitive v_utRequest := m_utDelete;
					var UtTriggerAckPrimitive v_trigger_response;
					var ResponsePrimitive v_response;
					var integer v_auxInteger;
					var integer v_localResourceIndex := -1;
					var universal charstring v_action := __SCOPE__ & ": Please, send a valid DELETE Request for remoteCSE to ";
					
					//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_getLocalResourceAddress(vc_localRemoteCseIndex);
					f_sendUtPrimitive(v_utRequest, v_action & f_getLocalResourceAddress(vc_localRemoteCseIndex));	

					// Test Body
					tc_ac.start;
					alt {
						[] mccPortIn.receive(mw_request(mw_delete(?, PX_CSE_ID))) -> value v_request {
							tc_ac.stop;
							v_localResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_);
							if(v_localResourceIndex == -1)
							{ 
								setverdict(fail, __SCOPE__&": ERROR: Delete request target not found");
								v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier));
							} else if(v_localResourceIndex != vc_localRemoteCseIndex) { 
								setverdict(fail, __SCOPE__&": ERROR: Delete request target not expected");
								v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier));
							} else {
								setverdict(pass, __SCOPE__ & ": <remoteCSE> delete request has been received");
								v_response := valueof(m_responsePrimitive(int2002,v_request.primitive.requestPrimitive.requestIdentifier));
							}	
							v_response.from_ := PX_CSE1_ID;
							v_response.to_ := v_request.primitive.requestPrimitive.from_;
							mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
						}
						[] mccPortIn.receive(mw_request(?)) {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while receiving <remoteCSE> delete request");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while receiving <remoteCSE> delete request");
						}
					}					    

					// Postamble
					f_cse_postamble_deleteResourcesCSE();

					// Tear down
					f_cf04Down();

				}//end TC_CSE_REG_DEL_004	
							
			}// end group Delete
	  	  	
		}//end Registration
		
		group Data_Management_and_Repository {
						
			group Create {
				
				group g_CSE_DMR_CRE_001 {
					
					/**
					 * @desc Check that the IUT accepts the creation of a RESOURCE_TYPE resource on the TARGET_RESOURCE_ADDRESS of type PARENT_RESOURCE_TYPE with resource name not provided
					 * 
					 */
					testcase TC_CSE_DMR_CRE_001_CNT_CB() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.container.resourceName := omit;
						v_ae1.start(f_CSE_DMR_CRE_001(int3, v_createRequest, -)); //Container
						v_ae1.done;
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.container.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							}
						}
						
					}
						
					testcase TC_CSE_DMR_CRE_001_CNT_AE() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.container.resourceName := omit;
						v_ae1.start(f_CSE_DMR_CRE_001(int3, v_createRequest, m_createAeAux(omit,omit)));//Container
						v_ae1.done;
						
						 
																			
							if(getverdict == pass){ 
								v_responsePrimitive := f_getResponsePrimitive(v_ae1);
								if(not ispresent(v_responsePrimitive.primitiveContent.container.resourceName)){
									setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
								}
							}
						
						}  
					
					testcase TC_CSE_DMR_CRE_001_CNT_CNT() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.container.resourceName := omit;

						v_ae1.start(f_CSE_DMR_CRE_001(int3, v_createRequest, m_createContainerBase));//Container
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.container.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
					}
						}

					}
					
					testcase TC_CSE_DMR_CRE_001_GRP_CB() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.group_.resourceName := omit;

						v_ae1.start(f_CSE_DMR_CRE_001(int9, v_createRequest, -));//Group
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.group_.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
						}
						}
						
					}
						
					testcase TC_CSE_DMR_CRE_001_GRP_AE() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.group_.resourceName := omit;

						v_ae1.start(f_CSE_DMR_CRE_001(int9, v_createRequest, m_createAeAux(omit,omit)));//Group
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.group_.resourceName)){
									setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
								}
							}
						
						}
					
					testcase TC_CSE_DMR_CRE_001_ACP_CB() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.accessControlPolicy.resourceName := omit;

						v_ae1.start(f_CSE_DMR_CRE_001(int1, v_createRequest, -));//AccessControlPolicy
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.accessControlPolicy.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
						}
						}
						
					}
					
					testcase TC_CSE_DMR_CRE_001_ACP_AE() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.accessControlPolicy.resourceName := omit;

						v_ae1.start(f_CSE_DMR_CRE_001(int1, v_createRequest, m_createAeAux(omit,omit)));//AccessControlPolicy
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.accessControlPolicy.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							}
						}
						
						}
				
					testcase TC_CSE_DMR_CRE_001_SUB_CB() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.subscription.resourceName := omit;
						v_ae1.start(f_CSE_DMR_CRE_001(int23, v_createRequest, -));//Subscription
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.subscription.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							}
						}
					
					}
					
					testcase TC_CSE_DMR_CRE_001_SUB_AE() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.subscription.resourceName := omit;
						v_ae1.start(f_CSE_DMR_CRE_001(int23, v_createRequest, m_createAeAux(omit,omit)));//Subscription
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.subscription.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							}
						}
	
					}
						
					testcase TC_CSE_DMR_CRE_001_SUB_CNT() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.subscription.resourceName := omit;
						v_ae1.start(f_CSE_DMR_CRE_001(int23, v_createRequest, m_createContainerBase));//Subscription
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.subscription.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							}
						}

					}
					
					testcase TC_CSE_DMR_CRE_001_SUB_ACP() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.subscription.resourceName := omit;
						v_ae1.start(f_CSE_DMR_CRE_001(int23, v_createRequest, m_createAcpBase));//Subscription
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.subscription.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							}
						}
					}
					
					testcase TC_CSE_DMR_CRE_001_SUB_CSR() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
						v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
						v_cse1.done;
						
						v_createRequest.primitiveContent.subscription.resourceName := omit;
						v_cse1.start(f_CSE_DMR_CRE_001_cseSimu(int23, v_createRequest));//Subscription
						v_cse1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_cse1);
							if(not ispresent(v_responsePrimitive.primitiveContent.subscription.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							}
						}		
					}
					
					testcase TC_CSE_DMR_CRE_001_CIN_CNT() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContentInstanceBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.contentInstance.resourceName := omit;
						v_ae1.start(f_CSE_DMR_CRE_001(int4, v_createRequest, m_createContainerBase));//ContentInstance
						v_ae1.done;
						
						 
												
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.contentInstance.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							}
						}

					}
					    				
				} // end g_CSE_DMR_CRE_001
								
				
				group g_CSE_DMR_CRE_002 {
					
					/**
					 * @desc Check that the IUT accepts the creation of a RESOURCE_TYPE resource with a non-existing resource name provided by AE
					 * 
					 */
					testcase TC_CSE_DMR_CRE_002_CNT() runs on Tester system CseSystem {
						// Local variables
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
			
						v_ae1.start(f_CSE_DMR_CRE_002(int3, m_createContainerBase));//container
						v_ae1.done;
						
						 
						
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.container.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							} else {
								if(v_responsePrimitive.primitiveContent.container.resourceName != c_defaultContainerResourceName){
									setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not correct");
								}
							}
						}
						
					}

					testcase TC_CSE_DMR_CRE_002_GRP() runs on Tester system CseSystem {
						// Local variables
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
			
						v_ae1.start(f_CSE_DMR_CRE_002(int9, m_createGroupBase));//group
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.group_.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							} else {
								if(v_responsePrimitive.primitiveContent.group_.resourceName != c_defaultGroupResourceName){
									setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not correct");
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_CRE_002_ACP() runs on Tester system CseSystem {
						// Local variables
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
			
						v_ae1.start(f_CSE_DMR_CRE_002(int1, m_createAcpBase ));//accessControlPolicy
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.accessControlPolicy.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							} else {
								if(v_responsePrimitive.primitiveContent.accessControlPolicy.resourceName != c_defaultAccessControlPolicyResourceName){
									setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not correct");
								}
							}
						}
					}

					testcase TC_CSE_DMR_CRE_002_SUB() runs on Tester system CseSystem {
						// Local variables
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
			
						v_ae1.start(f_CSE_DMR_CRE_002(int23, m_createSubscriptionBase));//Subscription
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.subscription.resourceName)){
								setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not provided");
							} else {
								if(v_responsePrimitive.primitiveContent.subscription.resourceName != c_defaultSubscriptionResourceName){
									setverdict(fail, __SCOPE__ & ": Error, resourceName attribute not correct");
								}
							}
						}
					}
					
				}// end group g_CSE_DMR_CRE_002
				
				group g_CSE_DMR_CRE_003 {
					
					/**
					 * @desc Check that the IUT rejects the creation of a RESOURCE_TYPE resource with an existing resource name provided by AE
					 * 
					 */
					testcase TC_CSE_DMR_CRE_003_CNT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_DMR_CRE_003(int3, m_createContainerBase));//container
						v_ae1.done;
					}

					testcase TC_CSE_DMR_CRE_003_GRP() runs on Tester system CseSystem {
						// Local variables
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_DMR_CRE_003(int9, m_createGroupBase));//group
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_CRE_003_ACP() runs on Tester system CseSystem {
						// Local variables
                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_DMR_CRE_003(int1, m_createAcpBase));//accessControlPolicy
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_CRE_003_SUB() runs on Tester system CseSystem {
						// Local variables
                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_DMR_CRE_003(int23, m_createSubscriptionBase));//Subscription
						v_ae1.done;
					}
					
				}// end group g_CSE_DMR_CRE_003
				
				group g_CSE_DMR_CRE_004 {
					
					/**
					 * @desc Check that the IUT rejects the creation of a RESOURCE_TYPE resource when AE has no privileges
					 * 
					 */
					testcase TC_CSE_DMR_CRE_004_CNT() runs on Tester system CseSystem {
						// Local variables
                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_DMR_CRE_004(int3, m_createContainerBase));//container
						v_ae1.done;
					}

					testcase TC_CSE_DMR_CRE_004_GRP() runs on Tester system CseSystem {
						// Local variables
						
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_DMR_CRE_004(int9, m_createGroupBase));//group
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_CRE_004_ACP() runs on Tester system CseSystem {
						// Local variables
                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_DMR_CRE_004(int1, m_createAcpBase));//accessControlPolicy
						v_ae1.done;
					}

					testcase TC_CSE_DMR_CRE_004_SUB() runs on Tester system CseSystem {
						// Local variables
                        
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_DMR_CRE_004(int23, m_createSubscriptionBase));//Subscription
						v_ae1.done;
					}
					
				}// end group g_CSE_DMR_CRE_004
				
				group g_CSE_DMR_CRE_005 {
			
					/**
					 * @desc Check that the IUT rejects the CREATE Request of container resource when the RW ATTRIBUTE is provided with an invalid value
					 * 
					 */
					testcase TC_CSE_DMR_CRE_005_MNI() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContainerBaseInvalid;
						var AttributeAux v_invalidAttribute;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
						v_createRequest.primitiveContent.container_update_invalid.maxNrOfInstances := -1;
						v_invalidAttribute := {name := "maxNrOfInstances", value_ := "-1"};
						
						v_ae1.start(f_CSE_DMR_CRE_005(int3, v_createRequest, v_invalidAttribute));			
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_CRE_005_MBS() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContainerBaseInvalid;
						var AttributeAux v_invalidAttribute;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.container_update_invalid.maxByteSize := -1;
						v_invalidAttribute := {name := "maxByteSize", value_ := "-1"};
						
						v_ae1.start(f_CSE_DMR_CRE_005(int3, v_createRequest, v_invalidAttribute));
						v_ae1.done;
						  
					}
					
					testcase TC_CSE_DMR_CRE_005_MIA() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContainerBaseInvalid;
						var AttributeAux v_invalidAttribute;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_createRequest.primitiveContent.container_update_invalid.maxInstanceAge := -1;
						v_invalidAttribute := {name := "maxInstanceAge", value_ := "-1"};
						
						v_ae1.start(f_CSE_DMR_CRE_005(int3, v_createRequest, v_invalidAttribute));
						v_ae1.done;
						
					}
				
				}// end group g_CSE_DMR_CRE_005
				
				group g_CSE_DMR_CRE_006 {
					
					/**
					 * @desc Check that the IUT returns a default value to RW ATTRIBUTE in the response of a <container> CREATE Request where no a RW ATTRIBUTE is provided by AE
					 * 
					 */
					testcase TC_CSE_DMR_CRE_006_MNI() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_ae1.start(f_CSE_DMR_CRE_006(int3, v_createRequest));		
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.container.maxNrOfInstances)){
								setverdict(fail, __SCOPE__ & ": Error, maxNrOfInstances attribute not provided");
							} 
						}	
					}
					
					testcase TC_CSE_DMR_CRE_006_MBS() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_ae1.start(f_CSE_DMR_CRE_006(int3, v_createRequest));
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.container.maxByteSize)){
								setverdict(fail, __SCOPE__ & ": Error, maxByteSize attribute not provided");
							} 
						}	
						  
					}
					
					testcase TC_CSE_DMR_CRE_006_MIA() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
						v_ae1.start(f_CSE_DMR_CRE_006(int3, v_createRequest));
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(not ispresent(v_responsePrimitive.primitiveContent.container.maxInstanceAge)){
								setverdict(fail, __SCOPE__ & ": Error, maxInstanceAge attribute not provided");
							} 
						}	
					}
				
				}// end group g_CSE_DMR_CRE_006
				
				/**
				 * @desc Check that the IUT responds with error when the newly created <contentInstance> results in that the field value of attribute currentNrOfInstances exceeds the field value of maxNrOfInstances in the parent container resource.
				 * 
				 */
				testcase TC_CSE_DMR_CRE_007() runs on Tester system CseSystem {
				
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
								
					v_ae1.start(f_CSE_DMR_CRE_007());
					  	  	
					v_ae1.done;
					  	  		
				}
				
				function f_CSE_DMR_CRE_007() runs on AeSimu {
					// Local variables
					var template RequestPrimitive v_createRequestContainer := m_createContainerBase;
					var template RequestPrimitive v_createRequestContentInstance := m_createContentInstanceBase;
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex := -1;
					const integer c_maxNumberOfInstances := 1;				   
					// Test control
			
					// Test component configuration
					f_cf01Up();
			
					// Test adapter configuration
			
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					v_createRequestContainer.primitiveContent.container.maxNrOfInstances := c_maxNumberOfInstances;
											
					v_containerIndex := f_cse_createResource(int3, v_createRequestContainer, v_aeIndex);		//Container
					
					v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex);	//ContentInstance
				
					// Test Body
					
					v_createRequestContentInstance.primitiveContent.contentInstance.resourceName := c_defaultContentInstanceResourceName & "2";	//ContentInstance 2
					v_request := f_getCreateRequestPrimitive(int4, v_createRequestContentInstance, v_containerIndex);
				
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": ContentInstance 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 contentInstance");
							
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type contentInstance");
						}
					}	
							
					f_checkAeSimuStatus();
				
					//Check to see if the resource is NOT present
					if(f_cse_isResourceNotPresent(v_containerIndex, c_defaultContentInstanceResourceName)){
					  setverdict(pass, __SCOPE__ & ":INFO: Oldest contentInstance has been removed to allow the creation of the new contentInstance");
					} else {
					  setverdict(fail, __SCOPE__ & ":ERROR: Oldest contentInstance has not been removed to allow the creation of the new contentInstance");
					}
											
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
				    				
				}//end f_CSE_DMR_CRE_007
						
				/**
				 * @desc Checks that the IUT accepts a newly created contentInstance when the currentByteSize exceeds the field value set in maxByteSize in the parent container resource by removing enough of the oldest <contentInstance> resources to allow the creation of the new <contentInstance> resource.
				 * 
				 */
				testcase TC_CSE_DMR_CRE_008() runs on Tester system CseSystem {
				
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
								
					v_ae1.start(f_CSE_DMR_CRE_008());
					  	  	
					v_ae1.done;
					  	  		
				}		
				function f_CSE_DMR_CRE_008() runs on AeSimu {
					//Local variables
					var template RequestPrimitive v_createRequestContainer := m_createContainerBase;
					var template RequestPrimitive v_createRequestContentInstance := m_createContentInstanceBase;
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex := -1;
					const integer c_maxByteSize := 10;	
					const XSD.String c_primitiveContent1 := "Content1";
					const XSD.String c_primitiveContent2 := "Content2";			   
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

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

					v_createRequestContainer.primitiveContent.container.maxByteSize := c_maxByteSize;
						
					v_containerIndex := f_cse_createResource(int3, v_createRequestContainer, v_aeIndex);		//Container

					v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstance(f_getResourceAddress(v_containerIndex), c_primitiveContent1), v_containerIndex);//ContentInstance

					// Test Body

					v_createRequestContentInstance.primitiveContent.contentInstance.content := c_primitiveContent2;	//ContentInstance 2
					v_createRequestContentInstance.primitiveContent.contentInstance.resourceName := c_defaultContentInstanceResourceName & "2";
					v_request := f_getCreateRequestPrimitive(int4, v_createRequestContentInstance, v_containerIndex);

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": ContentInstance 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 contentInstance");
		
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type contentInstance");
						}
					}	
		
					f_checkAeSimuStatus();

					//Check to see if the resource is NOT present
					if(f_cse_isResourceNotPresent(v_containerIndex, c_defaultContentInstanceResourceName)){
					  setverdict(pass, __SCOPE__ & ":INFO: Oldest contentInstance has been removed to allow the creation of the new contentInstance");
					} else {
					  setverdict(fail, __SCOPE__ & ":ERROR: Oldest contentInstance has not been removed to allow the creation of the new contentInstance");
					}
						
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();
				    				
				}//end f_CSE_DMR_CRE_008
						
				/**
				 * @desc Check that the IUT increaments and then copies the field value of attribute stateTag in parent container resource when contentInstance resource is created as the direct child of the parent container
				 * 
				 */
				testcase TC_CSE_DMR_CRE_009() runs on Tester system CseSystem {
				
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
								
					v_ae1.start(f_CSE_DMR_CRE_009());
					  	  	
					v_ae1.done;
					  	  		
				}
				
				function f_CSE_DMR_CRE_009() runs on AeSimu {
					// Local variables
					var template RequestPrimitive v_createRequest := m_createContainerBase;
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex := -1;
					var template PrimitiveContent v_contentResponse;
				
					// Test control
			
					// Test component configuration
					f_cf01Up();
			
					// Test adapter configuration
			
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					v_containerIndex := f_cse_createResource(int3, v_createRequest, v_aeIndex);
					
					v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex);
				
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(v_containerIndex), f_getOriginator(v_containerIndex)))));
					
					v_contentResponse.container := mw_contentContainerBase;
					
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
							if(v_response.primitive.responsePrimitive.primitiveContent.container.stateTag == vc_resourcesList[v_containerIndex].resource.container.stateTag + 1) {
								setverdict(pass, __SCOPE__ & ": stateTag attribute increased after creation of contentInstance resource");
							} else {
								setverdict(fail, __SCOPE__ & ": stateTag attribute not incremented correctly after creation of contentInstance resource");
							}
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_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_DMR_CRE_009
					
				/**
				 * @desc Check that the IUT rejects the CREATE Request of a container resource named “la” as a direct child of a container resource 
				 * 
				 */
				testcase TC_CSE_DMR_CRE_010() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_CRE_010());
				  	  	
					v_ae1.done;
				  	  		
				}					
				
				function f_CSE_DMR_CRE_010() runs on AeSimu {
					// Local variables
					var template RequestPrimitive v_createRequest := m_createContainerBase;
					var MsgIn v_response;
					var RequestPrimitive v_request;
					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();//c_CRUDNDi);
					
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
				
					// Test Body
					v_createRequest.primitiveContent.container.resourceName := c_resourceShortNameLatest;
					
					v_request := f_getCreateRequestPrimitive(int3, v_createRequest, v_containerIndex);
				
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Not allowed to create a contentInstance resource named 'la'");
							
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Rejected creation of contentInstance named 'la' with wrong ResponseStatusCode");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Accepted creation of contentInstance named 'la'");
							
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type 4");
						}
					}	
							
					f_checkAeSimuStatus();
					
					//Check to see if the resource is NOT present
					if(f_cse_isResourceNotPresent(v_containerIndex, 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_010
						
				/**
				 * @desc Check that the IUT rejects the CREATE Request of a container resource named “ol” as a direct child of a container resource 
				 * 
				 */
				testcase TC_CSE_DMR_CRE_011() runs on Tester system CseSystem {
				
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
								
					v_ae1.start(f_CSE_DMR_CRE_011());
					  	  	
					v_ae1.done;
					  	  		
				}
				
				function f_CSE_DMR_CRE_011() runs on AeSimu {
					// Local variables
					var template RequestPrimitive v_createRequest := m_createContainerBase;
					var MsgIn v_response;
					var RequestPrimitive v_request;
					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();//c_CRUDNDi);
					
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
				
					// Test Body
					v_createRequest.primitiveContent.container.resourceName := c_resourceShortNameOldest;
					
					v_request := f_getCreateRequestPrimitive(int3, v_createRequest, v_containerIndex);
				
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Not allowed to create a contentInstance resource named 'ol'");
							
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Rejected creation of contentInstance named 'ol' with wrong ResponseStatusCode");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Accepted creation of contentInstance named 'ol'");
							
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type 4");
						}
					}	
							
					f_checkAeSimuStatus();
					
					//Check to see if the resource is NOT present
					if(f_cse_isResourceNotPresent(v_containerIndex, 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_011
						
				group g_CSE_DMR_CRE_012 {
					
					/**
					 * @desc Check that the IUT accepts the creation of a RESOURCE_TYPE resource with the optional attribute OPTIONAL_ATTRIBUTE provided
					 * 
					 */
					testcase TC_CSE_DMR_CRE_012_CNT_ACPI() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						const AttributeList c_optionalAttribute := {"accessControlPolicyIDs"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.accessControlPolicyIDs := {"NotInitialized"};
						
						v_ae1.start(f_CSE_DMR_CRE_012(int3, v_createRequest, c_optionalAttribute));			
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_CRE_012_CNT_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						const AttributeList c_optionalAttribute := {"labels"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.labels := {"MyLabel"};
						
						v_ae1.start(f_CSE_DMR_CRE_012(int3, v_createRequest, c_optionalAttribute));
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_CRE_012_CNT_MNI() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						const AttributeList c_optionalAttribute := {"maxNrOfInstances"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.maxNrOfInstances := 0;
						
						v_ae1.start(f_CSE_DMR_CRE_012(int3, v_createRequest, c_optionalAttribute));
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_CRE_012_CNT_MBS() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						const AttributeList c_optionalAttribute := {"maxByteSize"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.maxByteSize := 0;
						
						v_ae1.start(f_CSE_DMR_CRE_012(int3, v_createRequest, c_optionalAttribute));
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_CRE_012_CNT_MIA() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						const AttributeList c_optionalAttribute := {"maxInstanceAge"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.maxInstanceAge := 0;
						
						v_ae1.start(f_CSE_DMR_CRE_012(int3, v_createRequest, c_optionalAttribute));
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_CRE_012_CNT_CR() runs on Tester system CseSystem { 
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var AttributeList v_optionalAttribute := {"creator"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.creator := "NullValue";
						
						v_ae1.start(f_CSE_DMR_CRE_012(int3, v_createRequest, v_optionalAttribute));
						v_ae1.done;
						
					}					
					
					testcase TC_CSE_DMR_CRE_012_CIN_LBL() runs on Tester system CseSystem {//TODO
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createContentInstanceBase;
						const AttributeList c_optionalAttribute := {"labels"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.contentInstance.labels := {"MyLabel"};
						
						v_ae1.start(f_CSE_DMR_CRE_012(int4, v_createRequest, c_optionalAttribute));
						v_ae1.done;
						  
					}
					
					testcase TC_CSE_DMR_CRE_012_CIN_CR() runs on Tester system CseSystem {//TODO
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createContentInstanceBase;
						var AttributeList v_optionalAttribute := {"creator"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.contentInstance.creator := "NullValue";
						
						v_ae1.start(f_CSE_DMR_CRE_012(int4, v_createRequest, v_optionalAttribute));
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_CRE_012_CIN_CNF() runs on Tester system CseSystem {//TODO
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createContentInstanceBase;
						const AttributeList c_optionalAttribute := {"contentInfo"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.contentInstance.contentInfo := "MyContentInfo";
						
						v_ae1.start(f_CSE_DMR_CRE_012(int4, v_createRequest, c_optionalAttribute));
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_CRE_012_ACP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createAcpBase;
						const AttributeList c_optionalAttribute := {"labels"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.accessControlPolicy.labels := {"MyLabel"};
						
						v_ae1.start(f_CSE_DMR_CRE_012(int1, v_createRequest, c_optionalAttribute));
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_CRE_012_SUB_ACPI() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						const AttributeList c_optionalAttribute := {"accessControlPolicyIDs"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.subscription.accessControlPolicyIDs := {"NotInitialized"};
						
						v_ae1.start(f_CSE_DMR_CRE_012(int23, v_createRequest, c_optionalAttribute));			
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_CRE_012_SUB_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						const AttributeList c_optionalAttribute := {"labels"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.subscription.labels := {"MyLabel"};
						
						v_ae1.start(f_CSE_DMR_CRE_012(int23, v_createRequest, c_optionalAttribute));
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_CRE_012_SUB_CR() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var AttributeList v_optionalAttribute := {"creator"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.subscription.creator := "NullValue";
						
						v_ae1.start(f_CSE_DMR_CRE_012(int23, v_createRequest, v_optionalAttribute));
						v_ae1.done;
						
					}
					
				}// end group g_CSE_DMR_CRE_012	

				/**
				 * @desc Check that the IUT rejects the CREATE Request of a contentInstance resource with error “NOT_ACCEPTABLE” when contentSize exceeds maxByteSize
				 * 
				 */
				testcase TC_CSE_DMR_CRE_013() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_CRE_013());
				  	  	
					v_ae1.done;
				  	  		
				}
				
				function f_CSE_DMR_CRE_013() runs on AeSimu {
					// Local variables
					var template RequestPrimitive v_createRequest := m_createContainerBase;
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					const integer c_maxByteSize := 1;				   
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
	
					v_createRequest.primitiveContent.container.maxByteSize := c_maxByteSize;
							
					v_containerIndex := f_cse_createResource(int3, v_createRequest, v_aeIndex);

					// Test Body
					v_request := f_getCreateRequestPrimitive(int4, m_createContentInstanceBase, v_containerIndex);

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int5207))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Maximum byte size exceeded");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Bad responseStatusCode in response");
						}
		
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Accepted creation of contentInstance exceding maximum byte size");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type 4");
						}
					}	
			
					// Postamble
					f_cse_postamble_deleteResources();
	
					// Tear down
					f_cf01Down();
    				
				}//end f_CSE_DMR_CRE_013
		
				group g_CSE_DMR_CRE_014 {
				
					/**
					 * @desc Check that the IUT updates the currentByteSize attribute in a <container> parent resource when a new <contentInstance> resource is created. 
					 * 
					 */
					testcase TC_CSE_DMR_CRE_014_CNT_CIN() runs on Tester system CseSystem {
						// Local variables
						var template RequestPrimitive v_parentResourceRequest := m_createContainerBase;
						var template RequestPrimitive v_childResourceRequest := m_createContentInstanceBase;//Default content: "AnyValue" (8 bytes length)
						var ResponsePrimitive v_responsePrimitive;
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						const integer c_maxByteSize := 512;	
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_parentResourceRequest.primitiveContent.container.maxByteSize := c_maxByteSize;
						
						v_ae1.start(f_CSE_DMR_CRE_014(int3, v_parentResourceRequest, int4, v_childResourceRequest));		
						v_ae1.done;
						
					}
				}
				
				
			}//end group Create
			
			group Retrieve {
				
				group g_CSE_DMR_RET_001 {
					
					/**
					 * @desc Check that the IUT returns successfully the TARGET_RESOURCE_ADDRESS resource 
					 * 
					 */
					testcase TC_CSE_DMR_RET_001_CNT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var ResponsePrimitive v_responsePrimitive;
						var template PrimitiveContent v_contentResponse;
						v_contentResponse.container := mw_contentContainer_rc1;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done; 
						v_ae1.start(f_CSE_DMR_RET_001(int3, m_createContainerBase, v_contentResponse));//Container
						v_ae1.done;
						
					}

					testcase TC_CSE_DMR_RET_001_GRP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var ResponsePrimitive v_responsePrimitive;
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.group_ := mw_contentGroup_rc1;
                        
						v_ae1.start(f_CSE_DMR_RET_001(int9, m_createGroupBase, v_contentResponse));//Group
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_RET_001_ACP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var ResponsePrimitive v_responsePrimitive;
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.accessControlPolicy := mw_contentAcp_rc1;
							
						v_ae1.start(f_CSE_DMR_RET_001(int1, m_createAcpBase, v_contentResponse));//AccessControlPolicy
						v_ae1.done;
						
					}
				
					testcase TC_CSE_DMR_RET_001_SUB() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var ResponsePrimitive v_responsePrimitive;
						var template PrimitiveContent v_contentResponse;
					
						v_contentResponse.subscription := mw_contentSubscription_rc1;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_DMR_RET_001(int23, m_createSubscriptionBase, v_contentResponse));//Subscription
						v_ae1.done;
					
					}
				
					testcase TC_CSE_DMR_RET_001_CIN() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var ResponsePrimitive v_responsePrimitive;
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.contentInstance := mw_contentContentInstance_rc1;
	
						v_ae1.start(f_CSE_DMR_RET_001(int4, m_createContentInstanceBase, v_contentResponse));//ContentInstance
						v_ae1.done;

					}
				
				} // end g_CSE_DMR_RET_001
				
				
				group g_CSE_DMR_RET_003 {
					
					/**
					 * @desc Check that the IUT responds with an error when the AE tries to retrieve a resource TARGET_RESOURCE_ADDRESS under AE without having privileges for the RETRIEVE operation
					 * 
					 */
					testcase TC_CSE_DMR_RET_003_CNT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_DMR_RET_003(int3, m_createContainerBase));//Container
						v_ae1.done;
					}

					testcase TC_CSE_DMR_RET_003_GRP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_ae1.start(f_CSE_DMR_RET_003(int9, m_createGroupBase));//Group
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_RET_003_ACP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template RequestPrimitive v_requestPrimitive := m_createAcpBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_requestPrimitive.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list[0].accessControlOperations := int61;
						
						v_ae1.start(f_CSE_DMR_RET_003(int1, v_requestPrimitive));//AccessControlPolicy
						v_ae1.done;
					}
				
					testcase TC_CSE_DMR_RET_003_SUB() runs on Tester system CseSystem {
							// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
	
						v_ae1.start(f_CSE_DMR_RET_003(int23, m_createSubscriptionBase));//Subscription
						v_ae1.done;
					}
				
				} // end g_CSE_DMR_RET_003

				/**
				 * @desc Check that the IUT accepts the RETRIEVE Request of the oldest contentInstance target to a <container> resource
				 * 
				 */
				testcase TC_CSE_DMR_RET_010() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_RET_010());
				  	  	
					v_ae1.done;
				  	  		
				}
				
				function f_CSE_DMR_RET_010() runs on AeSimu {
					// Local variables
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex1 := -1; 
					var integer v_contentInstanceIndex2 := -1;
					var template PrimitiveContent v_contentResponse;                        
					    										   
					// Test control
				
					// Test component configuration
					f_cf01Up();
				
					// Test adapter configuration
				
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 	
					
					v_contentInstanceIndex1 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex);
					
					v_contentInstanceIndex2 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex);  
					
					v_contentResponse.contentInstance := mw_contentContentInstanceBase;
					v_contentResponse.contentInstance.resourceName := vc_resourcesList[v_contentInstanceIndex1].resource.contentInstance.resourceName;
									
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(v_containerIndex) & "/" & c_resourceShortNameOldest, f_getOriginator(v_containerIndex)))));

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": resourceName attribute of <oldest> resource retrieved successfully");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))){
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Wrong response status code");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)){
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error, resourceName attribute of <oldest> resource value not expected");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)){
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while retrieving <oldest> resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while retrieving <oldest> resource");
						}
					}	
								
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();

				}//end f_CSE_DMR_RET_010

				/**
				 * @desc Check that the IUT accepts the RETRIEVE Request of the latest contentInstance target to a <container> resource7
				 * 
				 */
				testcase TC_CSE_DMR_RET_012() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_RET_012());
				  	  	
					v_ae1.done;
				  	  		
				}

				function f_CSE_DMR_RET_012() runs on AeSimu {
					// Local variables
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex1 := -1; 
					var integer v_contentInstanceIndex2 := -1;
					var template PrimitiveContent v_contentResponse;                        
					// Test control
				
					// Test component configuration
					f_cf01Up();
				
					// Test adapter configuration
				
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 	
					
					v_contentInstanceIndex1 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex);
					
					f_sleep(1.0);
					
					v_contentInstanceIndex2 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex);  
					
					v_contentResponse.contentInstance := mw_contentContentInstanceBase;
					v_contentResponse.contentInstance.resourceName := vc_resourcesList[v_contentInstanceIndex2].resource.contentInstance.resourceName;
					 
					
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(v_containerIndex) & "/" & c_resourceShortNameLatest, f_getOriginator(v_containerIndex)))));

					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))){
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": resourceName attribute of <latest> resource retrieved successfully");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))){
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Wrong response status code");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)){
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error, retrieved contentInstance with incorrect attributes");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)){
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while retrieving <latest> resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while retrieving <latest> resource");
						}
					}	
								
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();

				}//end f_CSE_DMR_RET_012

				group g_CSE_DMR_RET_013 {
					
					/**
					 * @desc Check that the IUT returns successfully the TARGET_RESOURCE_ADDRESS resource under CSEBase
					 * 
					 */
					testcase TC_CSE_DMR_RET_013_ACP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.accessControlPolicy := mw_contentAcp_rc1;
							
						v_ae1.start(f_CSE_DMR_RET_013(int1, m_createAcpBase, v_contentResponse));//AccessControlPolicy
						v_ae1.done;
						
					}
					
					testcase TC_CSE_DMR_RET_013_AE() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.aE := mw_contentAeBase;
							
						v_ae1.start(f_CSE_DMR_RET_013(int2, m_createAe(PX_APP_ID,-,PX_AE1_ID_STEM), v_contentResponse));//AE
						v_ae1.done;
						
					}
										
					testcase TC_CSE_DMR_RET_013_CNT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.container := mw_contentContainer_rc1;
						    
						v_ae1.start(f_CSE_DMR_RET_013(int3, m_createContainerBase, v_contentResponse));//Container
						v_ae1.done;
						
					}

					testcase TC_CSE_DMR_RET_013_GRP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.group_ := mw_contentGroup_rc1;
                        
						v_ae1.start(f_CSE_DMR_RET_013(int9, m_createGroupBase, v_contentResponse));//Group
						v_ae1.done;
						
					}
				
					testcase TC_CSE_DMR_RET_013_CSR() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
							
						v_ae1.start(f_CSE_DMR_RET_013(int16, m_createRemoteCSEBase, v_contentResponse));//RemoteCSE
						v_ae1.done;
						
					}
				
					testcase TC_CSE_DMR_RET_013_SUB() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.subscription := mw_contentSubscription_rc1;
						
						v_ae1.start(f_CSE_DMR_RET_013(int23, m_createSubscriptionBase, v_contentResponse));//Subscription
						v_ae1.done;
					
					}
				
				} // end g_CSE_DMR_RET_013

				group g_CSE_DMR_RET_014 {
					
					/**
					 * @desc Check that the IUT responds with an error when the AE tries to retrieve a resource TARGET_RESOURCE_ADDRESS under CSEBase without having privileges for the RETRIEVE operation
					 * 
					 */
					testcase TC_CSE_DMR_RET_014_ACP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template RequestPrimitive v_requestPrimitive := m_createAcpBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_requestPrimitive.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list[0].accessControlOperations := int61;
						
						v_ae1.start(f_CSE_DMR_RET_014(int1, v_requestPrimitive));//AccessControlPolicy
						v_ae1.done;
					}
				
					testcase TC_CSE_DMR_RET_014_AE() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
	
						v_ae1.start(f_CSE_DMR_RET_014(int2, m_createAe(PX_APP_ID,-,PX_AE1_ID_STEM)));//AE
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_RET_014_CNT() runs on Tester system CseSystem {
						// Local variables
 						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                        
						v_ae1.start(f_CSE_DMR_RET_014(int3, m_createContainerBase));//Container
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_RET_014_CSR() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
		
						v_ae1.start(f_CSE_DMR_RET_014(int16, m_createRemoteCSEBase));//RemoteCSE
						v_ae1.done;
	
					}

					testcase TC_CSE_DMR_RET_014_GRP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_ae1.start(f_CSE_DMR_RET_014(int9, m_createGroupBase));//Group
						v_ae1.done;
					}
					
					testcase TC_CSE_DMR_RET_014_SUB() runs on AeSimu system CseSystem {
							// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
	
						v_ae1.start(f_CSE_DMR_RET_014(int23, m_createSubscriptionBase));//Subscription
						v_ae1.done;
					}
				
				} // end g_CSE_DMR_RET_014

			}//end group Retrieve
			
			group Update {
				group g_CSE_DMR_UPD_001 {
					
					/**
					 * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS resource 
					 * 
					 */
					testcase TC_CSE_DMR_UPD_001_CNT_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2:= {"VALUE_2"};
						var ResponsePrimitive v_responsePrimitive;
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.labels := v_labels_1;
						v_updateRequest.primitiveContent.container.labels := v_labels_2;
						
						v_ae1.start(f_CSE_DMR_UPD_001(int3, v_createRequest, v_updateRequest));//Container
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									if(v_responsePrimitive.primitiveContent.container.labels != v_labels_2){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
						
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
	
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.container)) {
								if(v_primitiveContentRetrieveResource.container.labels != v_labels_2){
									setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
								}
							}
						}
					}

					testcase TC_CSE_DMR_UPD_001_GRP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"VALUE_2"};
						var template RequestPrimitive v_createRequest := m_createGroupBase;
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.group_.labels := v_labels_1;
						v_updateRequest.primitiveContent.group_.labels := v_labels_2;

						v_ae1.start(f_CSE_DMR_UPD_001(int9, v_createRequest, v_updateRequest));//Group
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									if(v_responsePrimitive.primitiveContent.group_.labels != v_labels_2){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
						
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.group_)) {
								if(v_primitiveContentRetrieveResource.group_.labels != v_labels_2){
									setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_001_ACP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"VALUE_2"};
						var template RequestPrimitive v_createRequest := m_createAcpBase;
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.accessControlPolicy.labels := v_labels_1;
						v_updateRequest.primitiveContent.accessControlPolicy.labels := v_labels_2;

						v_ae1.start(f_CSE_DMR_UPD_001(int1, v_createRequest, v_updateRequest));//ACP
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									if(v_responsePrimitive.primitiveContent.accessControlPolicy.labels != v_labels_2){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
						
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
						
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
								if(v_primitiveContentRetrieveResource.accessControlPolicy.labels != v_labels_2){
									setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
								}
							}							
						}				
					}
				
					testcase TC_CSE_DMR_UPD_001_SUB_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"VALUE_2"};
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.subscription.labels := v_labels_1;
						v_updateRequest.primitiveContent.subscription.labels := v_labels_2;

						v_ae1.start(f_CSE_DMR_UPD_001(int23, v_createRequest, v_updateRequest));//Subscription
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									if(v_responsePrimitive.primitiveContent.subscription.labels != v_labels_2){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
						
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
								if(v_primitiveContentRetrieveResource.subscription.labels != v_labels_2){
									setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
								}		
							}
						}							
					
					}
					
				} // end g_CSE_DMR_UPD_001
				
				group g_CSE_DMR_UPD_002 {
					
					/**
					 * @desc Check that the IUT adds successfully the attribute ATTRIBUTE_NAME to the TARGET_RESOURCE_ADDRESS resource
					 * 
					 */
					testcase TC_CSE_DMR_UPD_002_CNT_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.container.labels := v_labels_1;
                        
						v_ae1.start(f_CSE_DMR_UPD_002(int3, m_createContainerBase, v_updateRequest));//Container
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									if(v_responsePrimitive.primitiveContent.container.labels != v_labels_1){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
						
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
								
							//Check that the resource has been udpated correctly
							 if(ischosen(v_primitiveContentRetrieveResource.container)) {
								  if(v_primitiveContentRetrieveResource.container.labels != v_labels_1){
									  setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
								}
							}
						}
					}

					testcase TC_CSE_DMR_UPD_002_GRP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.group_.labels := v_labels_1;
						
						v_ae1.start(f_CSE_DMR_UPD_002(int9, m_createGroupBase, v_updateRequest));//Group
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									if(v_responsePrimitive.primitiveContent.group_.labels != v_labels_1){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
								
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
								
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.group_)) {
								if(v_primitiveContentRetrieveResource.group_.labels != v_labels_1){
									setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_002_ACP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.accessControlPolicy.labels := v_labels_1;
							
						v_ae1.start(f_CSE_DMR_UPD_002(int1, m_createAcpBase,v_updateRequest));//AccessControlPolicy
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									if(v_responsePrimitive.primitiveContent.accessControlPolicy.labels != v_labels_1){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
						
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							  if(v_primitiveContentRetrieveResource.accessControlPolicy.labels != v_labels_1){
								  setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
								}
							}
						}
					}
				
					testcase TC_CSE_DMR_UPD_002_SUB_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.subscription.labels := v_labels_1;
						
						v_ae1.start(f_CSE_DMR_UPD_002(int23, m_createSubscriptionBase,v_updateRequest));//Subscription
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									if(v_responsePrimitive.primitiveContent.subscription.labels != v_labels_1){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
								if(v_primitiveContentRetrieveResource.subscription.labels != v_labels_1){
									setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
								}
							}
						}
					}
					
				} // end g_CSE_DMR_UPD_002
				
				group g_CSE_DMR_UPD_003 {
					
					/**
					 * @desc Check that the IUT deletes successfully the attribute ATTRIBUTE_NAME from the TARGET_RESOURCE_ADDRESS resource 
					 * 
					 */
					testcase TC_CSE_DMR_UPD_003_CNT_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"To be deleted"};
						var AttributeAux_list v_nullFields;
						var ResponsePrimitive v_responsePrimitive;
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.labels := v_labels_1;
						v_updateRequest.primitiveContent.container.labels := v_labels_2;
						
						v_nullFields := {{"labels", omit}};
                        
						v_ae1.start(f_CSE_DMR_UPD_003(int3, v_createRequest, v_updateRequest, v_nullFields));//Container
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									if(ispresent(v_responsePrimitive.primitiveContent.container.labels)){ 
										if(not(match(v_responsePrimitive.primitiveContent.container.labels,{""}))) {
											setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly");
										}
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.container)) {
								  if(ispresent(v_primitiveContentRetrieveResource.container.labels)) {
									if(not(match(v_primitiveContentRetrieveResource.container.labels,{""}))){
									  setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
										}
									}
								  }
							}
					}

					testcase TC_CSE_DMR_UPD_003_GRP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"To be deleted"};
						var AttributeAux_list v_nullFields;
						var ResponsePrimitive v_responsePrimitive;
						var template RequestPrimitive v_createRequest := m_createGroupBase;
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.group_.labels := v_labels_1;
						v_updateRequest.primitiveContent.group_.labels := v_labels_2;
						
						v_nullFields := {{"labels", omit}};
						
						v_ae1.start(f_CSE_DMR_UPD_003(int9, v_createRequest, v_updateRequest, v_nullFields));//Group
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									if(ispresent(v_responsePrimitive.primitiveContent.group_.labels)){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.group_)) {
								if(ispresent(v_primitiveContentRetrieveResource.group_.labels)) {
								  if(not(match(v_primitiveContentRetrieveResource.group_.labels,{""}))){
									setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
									}
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_003_ACP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"To be deleted"};
						var AttributeAux_list v_nullFields;
						var ResponsePrimitive v_responsePrimitive;
						var template RequestPrimitive v_createRequest := m_createAcpBase;
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.accessControlPolicy.labels := v_labels_1;
						v_updateRequest.primitiveContent.accessControlPolicy.labels := v_labels_2;
						
						v_nullFields := {{"labels", omit}};
							
						v_ae1.start(f_CSE_DMR_UPD_003(int1, v_createRequest, v_updateRequest, v_nullFields));//AccessControlPolicy
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									if(ispresent(v_responsePrimitive.primitiveContent.accessControlPolicy.labels)){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
						 //Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							  if(ispresent(v_primitiveContentRetrieveResource.accessControlPolicy.labels)) {
								if(not(match(v_primitiveContentRetrieveResource.accessControlPolicy.labels,{""}))){
								  setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
						}
					}
						  }
						}
					}
				
					testcase TC_CSE_DMR_UPD_003_SUB_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"To be deleted"};
						var AttributeAux_list v_nullFields;
						var ResponsePrimitive v_responsePrimitive;
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.subscription.labels := v_labels_1;
						v_updateRequest.primitiveContent.subscription.labels := v_labels_2;
						
						v_nullFields := {{"labels", omit}};
						
						v_ae1.start(f_CSE_DMR_UPD_003(int23, v_createRequest, v_updateRequest, v_nullFields));//Subscription
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									if(ispresent(v_responsePrimitive.primitiveContent.subscription.labels)){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
								if(ispresent(v_primitiveContentRetrieveResource.subscription.labels)) {
								  if(not(match(v_primitiveContentRetrieveResource.subscription.labels,{""}))){
									setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
						}
					}
							}
						}
					}
					
				} // end g_CSE_DMR_UPD_003
				
				group g_CSE_DMR_UPD_004 {
					
					/**
					 * @desc Check that the IUT updates  the value of the attribute ATTRIBUTE_NAME_1, and creates the ATTRIBUTE_NAME_2 and deletes the ATTRIBUTE_NAME_3 of the TARGET_RESOURCE_ADDRESS resource
					 * 
					 */
					testcase TC_CSE_DMR_UPD_004_CNT_ET_MNI_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"To be deleted"};
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var AttributeAux_list v_nullFields;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.labels := v_labels_1;//Attribute 3
						v_updateRequest.primitiveContent.container.expirationTime := "20301231T012345";//Attribute 1
						v_updateRequest.primitiveContent.container.maxNrOfInstances := 5;//Attribute 2
						v_updateRequest.primitiveContent.container.labels := v_labels_2;//Attribute 3
						
						v_nullFields := {{"labels", omit}};
						
						v_ae1.start(f_CSE_DMR_UPD_004(int3, v_createRequest, v_updateRequest, v_nullFields));//Container
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									//Check attribute 1
									if(v_responsePrimitive.primitiveContent.container.expirationTime != valueof(v_updateRequest.primitiveContent.container.expirationTime)){
										setverdict(fail, __SCOPE__ & ": Error: Expiration Time attribute not updated correctly")
									}
									//Check attribute 2
									if(v_responsePrimitive.primitiveContent.container.maxNrOfInstances != valueof(v_updateRequest.primitiveContent.container.maxNrOfInstances)){
										setverdict(fail, __SCOPE__ & ": Error: MaxNrOfInstances attribute not updated correctly")
									}
									//Check attribute 3
									if(ispresent(v_responsePrimitive.primitiveContent.container.labels)){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.container)) {
								  //Check attribute 1
								  if(v_primitiveContentRetrieveResource.container.expirationTime != valueof(v_updateRequest.primitiveContent.container.expirationTime)){
									  setverdict(fail, __SCOPE__ & ": Error: Expiration Time attribute not updated correctly")
						}
								  //Check attribute 2
								  if(v_primitiveContentRetrieveResource.container.maxNrOfInstances != valueof(v_updateRequest.primitiveContent.container.maxNrOfInstances)){
									  setverdict(fail, __SCOPE__ & ": Error: MaxNrOfInstances attribute not updated correctly")
					}
								  //Check attribute 3
								  if(ispresent(v_primitiveContentRetrieveResource.container.labels)){
									  setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
								  }
							  }
						}
					}

					testcase TC_CSE_DMR_UPD_004_GRP_ET_GN_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.String v_groupName_1 := "VALUE_1";
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"To be deleted"};
						
						var AttributeAux_list v_nullFields;
						var template RequestPrimitive v_createRequest := m_createGroupBase;
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;					
						v_createRequest.primitiveContent.group_.labels := v_labels_1;//Attribute 3
						v_updateRequest.primitiveContent.group_.expirationTime := "20301231T012345";//Attribute 1
						v_updateRequest.primitiveContent.group_.groupName:= v_groupName_1;//Attribute 2
						v_updateRequest.primitiveContent.group_.labels := v_labels_2;//Attribute 3
						
						v_nullFields := {{"labels", omit}};
                        
						v_ae1.start(f_CSE_DMR_UPD_004(int9, v_createRequest, v_updateRequest, v_nullFields));//Group
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									//Check attribute 1
									if(not match(v_responsePrimitive.primitiveContent.group_.groupName, valueof(v_updateRequest.primitiveContent.group_.groupName))){
										setverdict(fail, __SCOPE__ & ": Error: groupName attribute not updated correctly")
									}
									//Check attribute 2
									if(not match(v_responsePrimitive.primitiveContent.group_.expirationTime, valueof(v_updateRequest.primitiveContent.group_.expirationTime))){
										setverdict(fail, __SCOPE__ & ": Error: expirationTime attribute not updated correctly")
									}
									//Check attribute 3
									if(ispresent(v_responsePrimitive.primitiveContent.group_.labels)){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.group_)) {
								//Check attribute 1
								if(v_primitiveContentRetrieveResource.group_.groupName != valueof(v_updateRequest.primitiveContent.group_.groupName)){
									setverdict(fail, __SCOPE__ & ": Error: groupName attribute not updated correctly")
								}
								//Check attribute 2
								if(v_primitiveContentRetrieveResource.group_.expirationTime != valueof(v_updateRequest.primitiveContent.group_.expirationTime)){
									setverdict(fail, __SCOPE__ & ": Error: expirationTime attribute not updated correctly")
								}
								//Check attribute 3
								if(ispresent(v_primitiveContentRetrieveResource.group_.labels)){
									setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_004_ACP_PVS_PV_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"To be deleted"};
						var SetOfAcrs v_privileges_1 := {accessControlRule_list := {valueof(m_createAcr({"all"}, int63))}};
						var SetOfAcrs v_selfprivileges_2 := {accessControlRule_list := {valueof(m_createAcr({"all"}, int62))}};
						var AttributeAux_list v_nullFields;
						var template RequestPrimitive v_createRequest := m_createAcpBase;// privileges set by default to 63 for *
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.accessControlPolicy.labels := v_labels_1;//Attribute 3
						v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {};//Attribute 2
						v_updateRequest.primitiveContent.accessControlPolicy.selfPrivileges := v_selfprivileges_2; //Attribute 1
						v_updateRequest.primitiveContent.accessControlPolicy.privileges := v_privileges_1;//Attribute 2
						v_updateRequest.primitiveContent.accessControlPolicy.labels := v_labels_2;//Attribute 3
						
						v_nullFields := {{"labels", omit}};
      							
						v_ae1.start(f_CSE_DMR_UPD_004(int1, v_createRequest, v_updateRequest, v_nullFields));//AccessControlPolicy
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									//Check attribute 1
									if(not match(v_responsePrimitive.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list[0].accessControlOperations, v_selfprivileges_2.accessControlRule_list[0].accessControlOperations)){
										setverdict(fail, __SCOPE__ & ": Error: SelfPrivileges attribute not updated correctly")
									}
									//Check attribute 2
									if(not match(v_responsePrimitive.primitiveContent.accessControlPolicy.privileges, valueof(v_updateRequest.primitiveContent.accessControlPolicy.privileges))){
										setverdict(fail, __SCOPE__ & ": Error: Privileges attribute not added correctly")
									}
									//Check attribute 3
									if(ispresent(v_responsePrimitive.primitiveContent.accessControlPolicy.labels)){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
						  	if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							  //Check attribute 1
							  if(not match (v_primitiveContentRetrieveResource.accessControlPolicy.selfPrivileges.accessControlRule_list[0].accessControlOperations, v_selfprivileges_2.accessControlRule_list[0].accessControlOperations)){
								  setverdict(fail, __SCOPE__ & ": Error: SelfPrivileges attribute not updated correctly")
							  }
							  //Check attribute 2
							  if(not match (v_primitiveContentRetrieveResource.accessControlPolicy.privileges, valueof(v_updateRequest.primitiveContent.accessControlPolicy.privileges))){
								  setverdict(fail, __SCOPE__ & ": Error: Privileges attribute not added correctly")
							  }
							  //Check attribute 3
							  if(ispresent(v_primitiveContentRetrieveResource.accessControlPolicy.labels)){
								  setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
							  }
						  	}
						}
					}
					
					testcase TC_CSE_DMR_UPD_004_ACP_PV_AT_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"To be deleted"};
						var SetOfAcrs v_privileges_2 := {accessControlRule_list := {valueof(m_createAcr({PX_SUPER_AE_ID}, int61))}};
						var AttributeAux_list v_nullFields;
						var template RequestPrimitive v_createRequest := m_createAcpBase;// privileges set by default to 63 for *
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.accessControlPolicy.labels := v_labels_1;//Attribute 3
						v_updateRequest.primitiveContent.accessControlPolicy.privileges := v_privileges_2; //Attribute 1
						v_updateRequest.primitiveContent.accessControlPolicy.announceTo := {f_getCompletePoA()};//Attribute 2
						v_updateRequest.primitiveContent.accessControlPolicy.labels := v_labels_2;//Attribute 3
						
						v_nullFields := {{"labels", omit}};
      							
						v_ae1.start(f_CSE_DMR_UPD_004(int1, v_createRequest, v_updateRequest, v_nullFields));//AccessControlPolicy
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									//Check attribute 1
									if(not match(v_responsePrimitive.primitiveContent.accessControlPolicy.privileges.accessControlRule_list[0].accessControlOperations, v_privileges_2.accessControlRule_list[0].accessControlOperations)){
										setverdict(fail, __SCOPE__ & ": Error: Privileges attribute not updated correctly")
									}
									//Check attribute 2
									if(not match(v_responsePrimitive.primitiveContent.accessControlPolicy.announceTo, valueof(v_updateRequest.primitiveContent.accessControlPolicy.announceTo))){
										setverdict(fail, __SCOPE__ & ": Error: Announce_to attribute not updated correctly")
									}
									//Check attribute 3
									if(ispresent(v_responsePrimitive.primitiveContent.accessControlPolicy.labels)){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							  //Check attribute 1
							  if(not match (v_primitiveContentRetrieveResource.accessControlPolicy.privileges.accessControlRule_list[0].accessControlOperations, v_privileges_2.accessControlRule_list[0].accessControlOperations)){
								  setverdict(fail, __SCOPE__ & ": Error: Privileges attribute not updated correctly")
						}
							  //Check attribute 2
							  if(not match (v_primitiveContentRetrieveResource.accessControlPolicy.announceTo, valueof(v_updateRequest.primitiveContent.accessControlPolicy.announceTo))){
								  setverdict(fail, __SCOPE__ & ": Error: Announce_to attribute not updated correctly")
					}
							  //Check attribute 3
							  if(ispresent(v_primitiveContentRetrieveResource.accessControlPolicy.labels)){
								  setverdict(fail, __SCOPE__ & ": Error: Labels attribute not deleted correctly")
							  }
						  }
						}
					}
				
					testcase TC_CSE_DMR_UPD_004_SUB_ET_LBL_EXC() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var AttributeAux_list v_nullFields;
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.subscription.expirationCounter := 10;//Attribute 3
						v_updateRequest.primitiveContent.subscription.expirationTime := "20301231T012345";//Attribute 1
						v_updateRequest.primitiveContent.subscription.labels := v_labels_1;//Attribute 2
						v_updateRequest.primitiveContent.subscription.expirationCounter := 5;//Attribute 3
						
						v_nullFields := {{"expirationCounter", omit}};
      							
						v_ae1.start(f_CSE_DMR_UPD_004(int23, v_createRequest, v_updateRequest, v_nullFields));//Subscription
						v_ae1.done;
						
						 
																		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									//Check attribute 1
									if(not match(v_responsePrimitive.primitiveContent.subscription.labels, valueof(v_updateRequest.primitiveContent.subscription.labels))){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
									//Check attribute 2
									if(not match(v_responsePrimitive.primitiveContent.subscription.expirationTime, valueof(v_updateRequest.primitiveContent.subscription.expirationTime))){
										setverdict(fail, __SCOPE__ & ": Error: expirationTime attribute not updated correctly")
									}
									//Check attribute 3
									if(ispresent(v_responsePrimitive.primitiveContent.subscription.expirationCounter)){
										setverdict(fail, __SCOPE__ & ": Error: expirationCounter attribute not deleted correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
						  //Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
							  //Check attribute 1
							  if(not match (v_primitiveContentRetrieveResource.subscription.labels, valueof(v_updateRequest.primitiveContent.subscription.labels))){
								  setverdict(fail, __SCOPE__ & ": Error: Label attribute not updated correctly")
						}
							  //Check attribute 2
							  if(not match (v_primitiveContentRetrieveResource.subscription.expirationTime, valueof(v_updateRequest.primitiveContent.subscription.expirationTime))){
								  setverdict(fail, __SCOPE__ & ": Error: expirationTime attribute not updated correctly")
					}
							  //Check attribute 3
							  if(ispresent(v_primitiveContentRetrieveResource.subscription.expirationCounter)){
								  setverdict(fail, __SCOPE__ & ": Error: expirationCounter attribute not deleted correctly")
							  }
						  }
						}
					}
					
				} // end g_CSE_DMR_UPD_004				
					
				/**
				 * @desc Check that the IUT responds with an error when the AE tries to update an attribute of a TARGET_RESOURCE_ADDRESS resource when the resource does not exist
				 * 
				 */
				testcase TC_CSE_DMR_UPD_005() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
					v_ae1.start(f_CSE_DMR_UPD_005());
			  	  	
					v_ae1.done;
			  	  		
				}
					
				function f_CSE_DMR_UPD_005() runs on AeSimu {
					//Local variables
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var ResourceType v_resourceType := int3;	//container
					var template RequestPrimitive v_updateRequest := m_updateContainerBase;
					var XSD.ID v_resourceId := "nonExistingId";
					var XSD.ID v_resourceName := "nonExistingName";
					var XSD.ID v_targetResourceAddress;
										   
					// Test control
					
					// Test component configuration
					f_cf01Up();
					
					// Test adapter configuration
					
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
									
					// Test Body
					if((PX_ADDRESSING_METHOD == e_nonHierarchical) and (PX_PRIMITIVE_SCOPE == e_cseRelative)) {
						v_targetResourceAddress := v_resourceId;
					} else if (PX_ADDRESSING_METHOD == e_nonHierarchical) {
						v_targetResourceAddress := f_getResourceAddress() & "/" & v_resourceId;
					} else {
						v_targetResourceAddress := f_getResourceAddress(v_aeIndex) & "/" & v_resourceName;
					}
					
					v_request := f_getUpdateRequestPrimitive(v_resourceType, v_aeIndex, v_updateRequest);
					v_request.to_ := v_targetResourceAddress;
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))){
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Operation not allowed because resource does not exist");
						}
						[] 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__ & ": Attribute has been updated in a non existing resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(v_resourceType)));
						}
					}	
								
					f_checkAeSimuStatus();
					
					// Postamble
					f_cse_postamble_deleteResources();
					
					// Tear down
					f_cf01Down();
				}
				
				group g_CSE_DMR_UPD_006{
					
					/**
					 * @desc Check that the IUT responds with an error when the AE tries to update the attribute ATTRIBUTE_NAME of a TARGET_RESOURCE_ADDRESS resource without having privileges for the UPDATE operation
					 * 
					 */
					testcase TC_CSE_DMR_UPD_006_CNT_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.container.labels := v_labels_1;
						
						v_ae1.start(f_CSE_DMR_UPD_006(int3, m_createContainerBase, v_updateRequest));//Container
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							//Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.container)) {
							   if(v_primitiveContentRetrieveResource.container.labels == v_labels_1){
								setverdict(fail, __SCOPE__ & ": Error: Labels attribute updated")
								}
							}
						}
					}

					testcase TC_CSE_DMR_UPD_006_GRP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.group_.labels := v_labels_1;
						
						v_ae1.start(f_CSE_DMR_UPD_006(int9, m_createGroupBase, v_updateRequest));//Group
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							//Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.group_)) {
							   if(v_primitiveContentRetrieveResource.group_.labels == v_labels_1){
								setverdict(fail, __SCOPE__ & ": Error: Labels attribute updated")
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_006_ACP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var template RequestPrimitive v_requestPrimitive := m_createAcpBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_requestPrimitive.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list[0].accessControlOperations := int59;

						v_updateRequest.primitiveContent.accessControlPolicy.labels := v_labels_1;
								
						v_ae1.start(f_CSE_DMR_UPD_006(int1, v_requestPrimitive, v_updateRequest));//AccessControlPolicy
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							//Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							   if(v_primitiveContentRetrieveResource.accessControlPolicy.labels == v_labels_1){
								 setverdict(fail, __SCOPE__ & ": Error: Labels attribute updated")
								}
							}
						}
					}
				
					testcase TC_CSE_DMR_UPD_006_SUB_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.subscription.labels := v_labels_1;
								
						v_ae1.start(f_CSE_DMR_UPD_006(int23, m_createSubscriptionBase, v_updateRequest));//Subscription
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							//Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
							   if(v_primitiveContentRetrieveResource.subscription.labels == v_labels_1){
								 setverdict(fail, __SCOPE__ & ": Error: Labels attribute updated")
								}
							}
						}
					}
					
				} // end g_CSE_DMR_UPD_006				
								
				group g_CSE_DMR_UPD_007{
					
					/**
					 * @desc Check that the IUT responds with an error when the AE tries to update a non-RW attribute ATTRIBUTE_NAME of a TARGET_RESOURCE_ADDRESS resource
					 * 
					 */
					testcase TC_CSE_DMR_UPD_007_CNT_CT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_creationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent := {container_update_invalid := m_contentUpdateContainer_invalid};
						v_updateRequest.primitiveContent.container_update_invalid.creationTime := v_creationTime;
						
						v_ae1.start(f_CSE_DMR_UPD_007(int3, m_createContainerBase, v_updateRequest));//Container
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							//Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.container_update_invalid)) {
							   if(v_primitiveContentRetrieveResource.container_update_invalid.creationTime == v_creationTime){
								 setverdict(fail, __SCOPE__ & ": Error: Creation Time attribute updated")
								}
							}
						}
					}

					testcase TC_CSE_DMR_UPD_007_GRP_CT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_creationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent := {group_update_invalid := m_contentUpdateGroup_invalid};
						v_updateRequest.primitiveContent.group_update_invalid.creationTime := v_creationTime;
						
						v_ae1.start(f_CSE_DMR_UPD_007(int9, m_createGroupBase, v_updateRequest));//Group
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							//Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.group_update_invalid)) {
							   if(v_primitiveContentRetrieveResource.group_update_invalid.creationTime == v_creationTime){
								 setverdict(fail, __SCOPE__ & ": Error: Creation Time attribute updated")
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_007_ACP_CT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_creationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent := {aCP_update_invalid := m_contentUpdateAcp_invalid};
						v_updateRequest.primitiveContent.aCP_update_invalid.creationTime := v_creationTime;
								
						v_ae1.start(f_CSE_DMR_UPD_007(int1, m_createAcpBase, v_updateRequest));//AccessControlPolicy
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							//Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.aCP_update_invalid)) {
							   if(v_primitiveContentRetrieveResource.aCP_update_invalid.creationTime == v_creationTime){
								 setverdict(fail, __SCOPE__ & ": Error: Creation Time attribute updated")
								}
							}
						}
					}
				
					testcase TC_CSE_DMR_UPD_007_SUB_CT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_creationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent := {subscription_update_invalid := m_contentUpdateSubscription_invalid};
						v_updateRequest.primitiveContent.subscription_update_invalid.creationTime := v_creationTime;
								
						v_ae1.start(f_CSE_DMR_UPD_007(int23, m_createSubscriptionBase, v_updateRequest));//Subscription
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							//Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.subscription_update_invalid)) {
							   if(v_primitiveContentRetrieveResource.subscription_update_invalid.creationTime == v_creationTime){
								 setverdict(fail, __SCOPE__ & ": Error: Creation Time attribute updated")
								}
							}
						}
					}
					
				} // end g_CSE_DMR_UPD_007			
				
				group g_CSE_DMR_UPD_008{
					
					/**
					 * @desc Check that the IUT responds with an error when the AE tries to delete a mandatory RW attribute ATTRIBUTE_NAME of a TARGET_RESOURCE_ADDRESS resource
					 * 
					 */

					testcase TC_CSE_DMR_UPD_008_GRP_MNM() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var AttributeAux_list v_nullFields;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_nullFields := {{"maxNrOfMembers", omit}};
						
						v_updateRequest.primitiveContent.group_.maxNrOfMembers := 1;
						
						v_ae1.start(f_CSE_DMR_UPD_008(int9, m_createGroupBase, v_updateRequest, v_nullFields));//Group
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							  //Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.group_)) {
							   if(v_primitiveContentRetrieveResource.group_.maxNrOfMembers == 0){
								 setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute updated")
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_008_ACP_PVS() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var SetOfAcrs v_selfPrivileges:= {{valueof(m_createAcr({"all"}, int63))}};
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var AttributeAux_list v_nullFields;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_nullFields := {{"selfPrivileges", omit}};
						
						v_updateRequest.primitiveContent.accessControlPolicy.selfPrivileges := v_selfPrivileges;
								
						v_ae1.start(f_CSE_DMR_UPD_008(int1, m_createAcpBase, v_updateRequest, v_nullFields));//AccessControlPolicy
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
						  	//Check that the resource has NOT been udpated
						  	if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							   	if(v_primitiveContentRetrieveResource.accessControlPolicy.selfPrivileges == v_selfPrivileges) {
									setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute updated")
								}
							}	
						}
					}
				
					testcase TC_CSE_DMR_UPD_008_SUB_NU() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var AttributeAux_list v_nullFields;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_nullFields := {{"notificationURI", omit}};
						
						v_updateRequest.primitiveContent.subscription.notificationURI := {"NullTarget"};
								
						v_ae1.start(f_CSE_DMR_UPD_008(int23, m_createSubscriptionBase, v_updateRequest, v_nullFields));//Subscription
						v_ae1.done;
						
						if(getverdict == pass){ 
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							  //Check that the resource has NOT been udpated
							  if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
							   if(v_primitiveContentRetrieveResource.subscription.notificationURI == {"NullTarget"}){
								 setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute updated")
								}
						   }
						}
					}
					
				} // end g_CSE_DMR_UPD_008				
				
				group g_CSE_DMR_UPD_009{
					
					/**
					 * @desc Check that the IUT responds with an error when the AE tries to update a RW attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS resource with an UNACCEPTABLE_VALUE
					 * 
					 */
					testcase TC_CSE_DMR_UPD_009_CNT_EXC() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.PositiveInteger v_expirationCounter := 1;
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent := {container_update_invalid := m_contentUpdateContainer_invalid};

						v_updateRequest.primitiveContent.container_update_invalid.expirationCounter := v_expirationCounter;
	
						v_ae1.start(f_CSE_DMR_UPD_009(int3, v_createRequest, v_updateRequest));//Container
						v_ae1.done;
					}

					testcase TC_CSE_DMR_UPD_009_GRP_EXC() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.PositiveInteger v_expirationCounter := 1;
						var template RequestPrimitive v_createRequest := m_createGroupBase;
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent := {group_update_invalid := m_contentUpdateGroup_invalid};
	
						v_updateRequest.primitiveContent.group_update_invalid.expirationCounter := v_expirationCounter;
	
						v_ae1.start(f_CSE_DMR_UPD_009(int9, v_createRequest, v_updateRequest));//Group
						v_ae1.done;
					}

					testcase TC_CSE_DMR_UPD_009_ACP_EXC() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.PositiveInteger v_expirationCounter := 1;
						var template RequestPrimitive v_createRequest := m_createAcpBase;
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent := {aCP_update_invalid := m_contentUpdateAcp_invalid};
	
						v_updateRequest.primitiveContent.aCP_update_invalid.expirationCounter := v_expirationCounter;
			
						v_ae1.start(f_CSE_DMR_UPD_009(int1, v_createRequest, v_updateRequest));//AccessControlPolicy
						v_ae1.done;
					}

					testcase TC_CSE_DMR_UPD_009_SUB_MNI() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.NonNegativeInteger v_maxNrOfInstances := 5;
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent := {subscription_update_invalid := m_contentUpdateSubscription_invalid};
	
						v_updateRequest.primitiveContent.subscription_update_invalid.maxNrOfInstances := v_maxNrOfInstances;
			
						v_ae1.start(f_CSE_DMR_UPD_009(int23, v_createRequest, v_updateRequest));//Subscription
						v_ae1.done;
					}
	
				} // end g_CSE_DMR_UPD_009	
				
				/**
				 * @desc Check that the stateTag attribute of a container resource is increased when an update operation has been performed on its child resource
				 * 
				 */
				testcase TC_CSE_DMR_UPD_010() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_UPD_010());
				  	  	
					v_ae1.done;
				  	  		
				}
				function f_CSE_DMR_UPD_010() runs on AeSimu {
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var RequestPrimitive v_updateRequest := valueof(m_updateContainerBase);
					var Labels v_labels_1:= {"VALUE_1"};
					v_updateRequest.primitiveContent.container.labels := v_labels_1;
			   
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
	
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
	
					// Test Body
					if(ispresent(vc_resourcesList[v_containerIndex].resource.container.stateTag)) { 
	
						f_cse_updateResource(int3, v_containerIndex, v_updateRequest);

						mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(v_containerIndex), f_getOriginator(v_containerIndex)))));

						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								if(v_response.primitive.responsePrimitive.primitiveContent.container.stateTag == 1) { //(Create and Delete)
									setverdict(pass, __SCOPE__ & ": The stateTag attribute is incremented");	
								}
								else{
									setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is not incremented");
								}
							}
							[] 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");
							}
						}	
			
					}//end if
					else{
						setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is empty");
					}
	
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();
		
				}//end f_CSE_DMR_UPD_010
					
				/**
				 * @desc Check that the IUT rejects the UPDATE Request of an existing contentInstance resource with error “OPERATION_NOT_ALLOWED”
				 * 
				 */
				testcase TC_CSE_DMR_UPD_011() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_UPD_011());
				  	  	
					v_ae1.done;
				  	  		
				}
				function f_CSE_DMR_UPD_011() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex := -1; 
					var template RequestPrimitive v_updateRequest := m_updateContentInstanceBase;
					var Labels v_labels:= {"LABEL"};
					var PrimitiveContent v_primitiveContentRetrieveResource;
					
					v_updateRequest.primitiveContent.contentInstance.labels := v_labels;
							   
					// Test control
        
					// Test component configuration
					f_cf01Up();
        
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
					v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex); 
					
					//Test Body
					v_request := f_getUpdateRequestPrimitive(int4, v_contentInstanceIndex, v_updateRequest);

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response {
						   tc_ac.stop;
						   setverdict(pass, __SCOPE__ & ": Not allowed to update a contentInstance 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 contentInstance");
					   }
					   [] tc_ac.timeout {
						   setverdict(fail, __SCOPE__ & ": No answer while updating contentInstance");
					   }
					}	
			
					v_primitiveContentRetrieveResource:=f_cse_retrieveResource(v_contentInstanceIndex);
					if(getverdict == pass){ 
						//Check that the resource has NOT been udpated
							if(ischosen(v_primitiveContentRetrieveResource.contentInstance)) {
							 if(v_primitiveContentRetrieveResource.contentInstance.labels == v_labels){
							   setverdict(fail, __SCOPE__ & ": Error: Labels attribute updated")
						  }
					   }
					}
			
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}//end f_CSE_DMR_UPD_011
				
				/**
				 * @desc Check that the IUT rejects the UPDATE Request of a latest resource as a direct child of a <container> resource with error “OPERATION_NOT_ALLOWED”
				 * 
				 */
				testcase TC_CSE_DMR_UPD_012() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_UPD_012());
				  	  	
					v_ae1.done;
				  	  		
				}
				function f_CSE_DMR_UPD_012() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex := -1; 
					var template RequestPrimitive v_updateRequest := m_updateContentInstanceBase;
					var Labels v_labels := {"LABEL"};					  	
					var PrimitiveContent v_primitiveContentRetrieveResource;					  	
	
					v_updateRequest.primitiveContent.contentInstance.labels := v_labels;
			   
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
	
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
	
					v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex); 
	
					//Test Body
					v_request := f_getUpdateRequestPrimitive(int4, v_containerIndex, v_updateRequest);
				  	
					v_request.to_ := v_request.to_ & "/" & c_resourceShortNameLatest;		//<latest>

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Not allowed to update a latest resource 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 a latest resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating a latest resource");
						}
					}	

					v_primitiveContentRetrieveResource:=f_cse_retrieveResource(v_contentInstanceIndex);
					if(getverdict == pass){ 
						//Check that the resource has NOT been udpated
							if(ischosen(v_primitiveContentRetrieveResource.contentInstance)) {
							 if(v_primitiveContentRetrieveResource.contentInstance.labels == v_labels){
							   setverdict(fail, __SCOPE__ & ": Error: Labels attribute updated")
						  }
					   }
					}	

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}//end f_CSE_DMR_UPD_012
			  	
				/**
				 * @desc Check that the IUT rejects the UPDATE Request of an oldest resource as a direct child of a <container> resource with error “OPERATION_NOT_ALLOWED”
				 * 
				 */
				testcase TC_CSE_DMR_UPD_013() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_UPD_013());
				  	  	
					v_ae1.done;
				  	  		
				}
				function f_CSE_DMR_UPD_013() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex := -1; 
					var template RequestPrimitive v_updateRequest := m_updateContentInstanceBase;
					var Labels v_labels:= {"LABEL"};
					var PrimitiveContent v_primitiveContentRetrieveResource;

					v_updateRequest.primitiveContent.contentInstance.labels := v_labels;
   
						// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

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

					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 

					v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex); 

					//Test Body
					v_request := f_getUpdateRequestPrimitive(int4, v_containerIndex, v_updateRequest);
				  	
					v_request.to_ := v_request.to_ & "/" & c_resourceShortNameOldest;		//<oldest>

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Not allowed to update an oldest resource 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 an oldest resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating an oldest resource");
						}
					}	

					v_primitiveContentRetrieveResource:=f_cse_retrieveResource(v_contentInstanceIndex);
					if(getverdict == pass){ 
						//Check that the resource has NOT been udpated
							if(ischosen(v_primitiveContentRetrieveResource.contentInstance)) {
							 if(v_primitiveContentRetrieveResource.contentInstance.labels == v_labels){
							   setverdict(fail, __SCOPE__ & ": Error: Labels attribute updated")
						  }
					   }
					}	
					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();

				}//end f_CSE_DMR_UPD_013

				group g_CSE_DMR_UPD_014 {
					
					testcase TC_CSE_DMR_UPD_014_ACP_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"VALUE_2"};
						var template RequestPrimitive v_createRequest := m_createAcpBase;
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.accessControlPolicy.labels := v_labels_1;
						v_updateRequest.primitiveContent.accessControlPolicy.labels := v_labels_2;

						v_ae1.start(f_CSE_DMR_UPD_014(int1, v_createRequest, v_updateRequest));//ACP
						v_ae1.done;
						
						 
	
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									if(v_responsePrimitive.primitiveContent.accessControlPolicy.labels != v_labels_2){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
						}
	
					}
					
					testcase TC_CSE_DMR_UPD_014_CNT_ACPI() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var AcpType v_accessControlPolicyIDs_1 := {"NotInitialized_1"};
						var AcpType v_accessControlPolicyIDs_2 := {"NotInitialized_2"};
						var ResponsePrimitive v_responsePrimitive;

						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.accessControlPolicyIDs := v_accessControlPolicyIDs_1;
						v_updateRequest.primitiveContent.container.accessControlPolicyIDs := v_accessControlPolicyIDs_2;

						v_ae1.start(f_CSE_DMR_UPD_014(int3, v_createRequest, v_updateRequest));//Container
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									if(v_responsePrimitive.primitiveContent.container.accessControlPolicyIDs != v_accessControlPolicyIDs_2){
										setverdict(fail, __SCOPE__ & ": Error: AccessControlPolicyIDs attribute not updated correctly")
									}
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_014_CNT_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"VALUE_2"};
						var ResponsePrimitive v_responsePrimitive;
		
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.labels := v_labels_1;
						v_updateRequest.primitiveContent.container.labels := v_labels_2;
		
						v_ae1.start(f_CSE_DMR_UPD_014(int3, v_createRequest, v_updateRequest));//Container
						v_ae1.done;
						
						 
		
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									if(v_responsePrimitive.primitiveContent.container.labels != v_labels_2){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_014_CNT_MBS() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.NonNegativeInteger v_maxByteSize_1 := 256;
						var XSD.NonNegativeInteger v_maxByteSize_2 := 512;
						var ResponsePrimitive v_responsePrimitive;
	
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.maxByteSize := v_maxByteSize_1;
						v_updateRequest.primitiveContent.container.maxByteSize := v_maxByteSize_2;
	
						v_ae1.start(f_CSE_DMR_UPD_014(int3, v_createRequest, v_updateRequest));//Container
						v_ae1.done;
						
						 
	
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									if(v_responsePrimitive.primitiveContent.container.maxByteSize != v_maxByteSize_2){
										setverdict(fail, __SCOPE__ & ": Error: MaxByteSize attribute not updated correctly")
									}
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_014_CNT_MIA() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.NonNegativeInteger v_maxInstanceAge_1 := 60;
						var XSD.NonNegativeInteger v_maxInstanceAge_2 := 120;
						var ResponsePrimitive v_responsePrimitive;

						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.maxInstanceAge := v_maxInstanceAge_1;
						v_updateRequest.primitiveContent.container.maxInstanceAge := v_maxInstanceAge_2;

						v_ae1.start(f_CSE_DMR_UPD_014(int3, v_createRequest, v_updateRequest));//Container
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									if(v_responsePrimitive.primitiveContent.container.maxInstanceAge != v_maxInstanceAge_2){
										setverdict(fail, __SCOPE__ & ": Error: MaxInstanceAge attribute not updated correctly")
									}
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_014_CNT_MNI() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.NonNegativeInteger v_maxNrOfInstances_1 := 1;
						var XSD.NonNegativeInteger v_maxNrOfInstances_2 := 2;
						var ResponsePrimitive v_responsePrimitive;
	
						var template RequestPrimitive v_createRequest := m_createContainerBase;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.container.maxNrOfInstances := v_maxNrOfInstances_1;
						v_updateRequest.primitiveContent.container.maxNrOfInstances := v_maxNrOfInstances_2;
	
						v_ae1.start(f_CSE_DMR_UPD_014(int3, v_createRequest, v_updateRequest));//Container
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									if(v_responsePrimitive.primitiveContent.container.maxNrOfInstances != v_maxNrOfInstances_2){
										setverdict(fail, __SCOPE__ & ": Error: MaxNrOfInstances attribute not updated correctly")
									}
								}
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_014_SUB_ACPI() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var AcpType v_accessControlPolicyIDs_1 := {"NotInitialized_1"};
						var AcpType v_accessControlPolicyIDs_2 := {"NotInitialized_2"};
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.subscription.accessControlPolicyIDs := v_accessControlPolicyIDs_1;
						v_updateRequest.primitiveContent.subscription.accessControlPolicyIDs := v_accessControlPolicyIDs_2;

						v_ae1.start(f_CSE_DMR_UPD_014(int23, v_createRequest, v_updateRequest));//Subscription
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									if(v_responsePrimitive.primitiveContent.subscription.accessControlPolicyIDs != v_accessControlPolicyIDs_2){
										setverdict(fail, __SCOPE__ & ": Error: AccessControlPolicyIDs attribute not updated correctly")
									}
								}
							}
						}

					}
					
					testcase TC_CSE_DMR_UPD_014_SUB_LBL() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels_1 := {"VALUE_1"};
						var Labels v_labels_2 := {"VALUE_2"};
						var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_createRequest.primitiveContent.subscription.labels := v_labels_1;
						v_updateRequest.primitiveContent.subscription.labels := v_labels_2;

						v_ae1.start(f_CSE_DMR_UPD_014(int23, v_createRequest, v_updateRequest));//Subscription
						v_ae1.done;
						
						 
	
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									if(v_responsePrimitive.primitiveContent.subscription.labels != v_labels_2){
										setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									}
								}
							}
						}

					}
					
	
				} // end g_CSE_DMR_UPD_014

				group g_CSE_DMR_UPD_015{
			  		
					/**
					 * @desc Check that the IUT updates successfully the value of the optional attribute OPTIONAL_ATTRIBUTE of the RESOURCE_TYPE resource under CSEBase
					 */
					testcase TC_CSE_DMR_UPD_015_CSR_LBL() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels := {"MyLabel"};
					   	var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;
					   	var ResponsePrimitive v_responsePrimitive;
					   	var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
					   v_updateRequest.primitiveContent.remoteCSE.labels := v_labels;
	
					   v_ae1.start(f_CSE_DMR_UPD_015(int16, m_createRemoteCSEBase, v_updateRequest));//Remote CSE
						v_ae1.done;
						
						 

					   if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
						   //Check attribute 1
						   if(ispresent(v_responsePrimitive.primitiveContent)) {
							   if(ischosen(v_responsePrimitive.primitiveContent.remoteCSE)) {
								   if(v_responsePrimitive.primitiveContent.remoteCSE.labels != v_labels){
									   setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
								   }
							   }
						   }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
						   
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.remoteCSE)) {
							 if(v_primitiveContentRetrieveResource.remoteCSE.labels != v_labels){
							  setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
							}
						  }
					   }
					}
					
					testcase TC_CSE_DMR_UPD_015_CSR_POA() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var PoaList v_poaList := {"http://" & PX_AE2_ADDRESS & "/"};
					   var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;
					   var ResponsePrimitive v_responsePrimitive;
					   var PrimitiveContent v_primitiveContentRetrieveResource;
					   v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
					   v_updateRequest.primitiveContent.remoteCSE.pointOfAccess := v_poaList;

					   v_ae1.start(f_CSE_DMR_UPD_015(int16, m_createRemoteCSEBase, v_updateRequest));//Remote CSE
						v_ae1.done;
						
						 

					   if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
						  //Check attribute 1
						  if(ispresent(v_responsePrimitive.primitiveContent)) {
							  if(ischosen(v_responsePrimitive.primitiveContent.remoteCSE)) {
								  if(v_responsePrimitive.primitiveContent.remoteCSE.pointOfAccess != v_poaList){
									  setverdict(fail, __SCOPE__ & ": Error: Point of access attribute not updated correctly")
								  }
							  }
						  }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
						  
						  //Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.remoteCSE)) {
						   if(v_primitiveContentRetrieveResource.remoteCSE.pointOfAccess != v_poaList){
							setverdict(fail, __SCOPE__ & ": Error: Point of access attribute not updated correctly")
						  }
						}
					  }
					}
					
					testcase TC_CSE_DMR_UPD_015_CSR_NL() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.AnyURI v_nodeLink := "MyNodeId";
					   	var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;
					   	var ResponsePrimitive v_responsePrimitive;
					   	var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
					   v_updateRequest.primitiveContent.remoteCSE.nodeLink := v_nodeLink;

					   v_ae1.start(f_CSE_DMR_UPD_015(int16, m_createRemoteCSEBase, v_updateRequest));//Remote CSE
						v_ae1.done;
						
						 

					   if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
						 //Check attribute 1
						 if(ispresent(v_responsePrimitive.primitiveContent)) {
							 if(ischosen(v_responsePrimitive.primitiveContent.remoteCSE)) {
								 if(v_responsePrimitive.primitiveContent.remoteCSE.nodeLink != v_nodeLink){
									 setverdict(fail, __SCOPE__ & ": Error: Node link attribute not updated correctly")
								 }
							 }
						 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
						 
						//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.remoteCSE)) {
							 if(v_primitiveContentRetrieveResource.remoteCSE.nodeLink != v_nodeLink){
							  setverdict(fail, __SCOPE__ & ": Error: Node link attribute not updated correctly")
							}
						  }
					  }
					}
			  		
					testcase TC_CSE_DMR_UPD_015_AE_LBL() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels := {"MyLabel"};
						var template RequestPrimitive v_updateRequest := m_updateAeBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.aE.labels := v_labels;
						
						v_ae1.start(f_CSE_DMR_UPD_015(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM), v_updateRequest));//AE
						v_ae1.done;
						
						 
	
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.aE)) {
									 if(v_responsePrimitive.primitiveContent.aE.labels != v_labels){
										 setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
	 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.aE)) {
							   if(v_primitiveContentRetrieveResource.aE.labels != v_labels){
								setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_AE_ACPI() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_updateRequest := m_updateAeBase;
						var RequestPrimitive v_updateRequestPrimitive;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_DMR_UPD_015(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM), v_updateRequest, true));//AE
						v_ae1.done;
						
						 

						if(getverdict == pass){ 
							v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							v_updateRequestPrimitive := f_getRequestPrimitive(v_ae1);	
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.aE)) {
									 if(v_responsePrimitive.primitiveContent.aE.accessControlPolicyIDs != valueof(v_updateRequestPrimitive.primitiveContent.aE.accessControlPolicyIDs)){
										 setverdict(fail, __SCOPE__ & ": Error: Access control policy IDs attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
 
							 //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.aE)) {
							   if(v_primitiveContentRetrieveResource.aE.accessControlPolicyIDs != valueof(v_updateRequestPrimitive.primitiveContent.aE.accessControlPolicyIDs)){
								setverdict(fail, __SCOPE__ & ": Error: Access control policy IDs attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_AE_APN() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.String v_appName := "MyAppName";
						var template RequestPrimitive v_updateRequest := m_updateAeBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.aE.appName := v_appName;
						v_ae1.start(f_CSE_DMR_UPD_015(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM), v_updateRequest));//AE
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.aE)) {
									 if(v_responsePrimitive.primitiveContent.aE.appName != v_appName){
										 setverdict(fail, __SCOPE__ & ": Error: AppName attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.aE)) {
							   if(v_primitiveContentRetrieveResource.aE.appName != v_appName){
								setverdict(fail, __SCOPE__ & ": Error: AppName attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_AE_POA() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var PoaList v_poaList := {"http://" & PX_AE2_ADDRESS & "/"};
						var template RequestPrimitive v_updateRequest := m_updateAeBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.aE.pointOfAccess := v_poaList;
						v_ae1.start(f_CSE_DMR_UPD_015(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM), v_updateRequest));//AE
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.aE)) {
									 if(v_responsePrimitive.primitiveContent.aE.pointOfAccess != v_poaList){
										 setverdict(fail, __SCOPE__ & ": Error: Point of Access attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.aE)) {
							   if(v_primitiveContentRetrieveResource.aE.pointOfAccess != v_poaList){
								setverdict(fail, __SCOPE__ & ": Error: Point of Access attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_CNT_LBL() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels := {"MyLabel"};
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.container.labels := v_labels;
						
						v_ae1.start(f_CSE_DMR_UPD_015(int3, m_createContainerBase, v_updateRequest));//Container
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									 if(v_responsePrimitive.primitiveContent.container.labels != v_labels){
										 setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
	 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.container)) {
							   if(v_primitiveContentRetrieveResource.container.labels != v_labels){
								setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
							  }
							}
						 }				
					}
					
					testcase TC_CSE_DMR_UPD_015_CNT_ACPI() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var RequestPrimitive v_updateRequestPrimitive;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_DMR_UPD_015(int3, m_createContainerBase, v_updateRequest, true));//Container
						v_ae1.done;
						
						 

						if(getverdict == pass){
							 v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 v_updateRequestPrimitive := f_getRequestPrimitive(v_ae1);	
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									 if(v_responsePrimitive.primitiveContent.container.accessControlPolicyIDs != valueof(v_updateRequestPrimitive.primitiveContent.container.accessControlPolicyIDs)){
										 setverdict(fail, __SCOPE__ & ": Error: Access Control Policy IDs attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
	 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.container)) {
							   if(v_primitiveContentRetrieveResource.container.accessControlPolicyIDs != valueof(v_updateRequestPrimitive.primitiveContent.container.accessControlPolicyIDs)){
								setverdict(fail, __SCOPE__ & ": Error: Access Control Policy IDs attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_CNT_MNI() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.NonNegativeInteger v_maxNrOfInstances := 5;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.container.maxNrOfInstances := v_maxNrOfInstances;
						
						v_ae1.start(f_CSE_DMR_UPD_015(int3, m_createContainerBase, v_updateRequest));//Container
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									 if(v_responsePrimitive.primitiveContent.container.maxNrOfInstances != v_maxNrOfInstances){
										 setverdict(fail, __SCOPE__ & ": Error: Maximum number of instances attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
	 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.container)) {
							   if(v_primitiveContentRetrieveResource.container.maxNrOfInstances != v_maxNrOfInstances){
								setverdict(fail, __SCOPE__ & ": Error: Maximum number of instances attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_CNT_MBS() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.NonNegativeInteger v_maxByteSize := 512;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.container.maxByteSize := v_maxByteSize;
						
						v_ae1.start(f_CSE_DMR_UPD_015(int3, m_createContainerBase, v_updateRequest));//Container
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									 if(v_responsePrimitive.primitiveContent.container.maxByteSize != v_maxByteSize){
										 setverdict(fail, __SCOPE__ & ": Error: Maximum Byte size attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.container)) {
							   if(v_primitiveContentRetrieveResource.container.maxByteSize != v_maxByteSize){
								setverdict(fail, __SCOPE__ & ": Error: Maximum Byte Size attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_CNT_MIA() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;					
						var XSD.NonNegativeInteger v_maxInstanceAge := 1;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.container.maxInstanceAge := v_maxInstanceAge;
						
						v_ae1.start(f_CSE_DMR_UPD_015(int3, m_createContainerBase, v_updateRequest));//Container
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									 if(v_responsePrimitive.primitiveContent.container.maxInstanceAge != v_maxInstanceAge){
										 setverdict(fail, __SCOPE__ & ": Error: Maximum Instance age attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.container)) {
							   if(v_primitiveContentRetrieveResource.container.maxInstanceAge != v_maxInstanceAge){
								setverdict(fail, __SCOPE__ & ": Error: Maximum Instance age attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_ACP_LBL() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels := {"MyLabel"};
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.accessControlPolicy.labels := v_labels;
						
						v_ae1.start(f_CSE_DMR_UPD_015(int1, m_createAcpBase, v_updateRequest));//AccessControlPolicy
						v_ae1.done;
						
						 
	
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									 if(v_responsePrimitive.primitiveContent.accessControlPolicy.labels != v_labels){
										 setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
 
																		  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							   if(v_primitiveContentRetrieveResource.accessControlPolicy.labels != v_labels){
								setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_SUB_ACPI() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var RequestPrimitive v_updateRequestPrimitive;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_DMR_UPD_015(int23, m_createSubscriptionBase, v_updateRequest, true));//Subscription
						v_ae1.done;
						
						 

						if(getverdict == pass){ 
							v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							v_updateRequestPrimitive := f_getRequestPrimitive(v_ae1);	
							  //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									 if(v_responsePrimitive.primitiveContent.subscription.accessControlPolicyIDs != valueof(v_updateRequestPrimitive.primitiveContent.subscription.accessControlPolicyIDs)){
										 setverdict(fail, __SCOPE__ & ": Error: Access Control Policy IDs attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
	 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
							   if(v_primitiveContentRetrieveResource.subscription.accessControlPolicyIDs != valueof(v_updateRequestPrimitive.primitiveContent.subscription.accessControlPolicyIDs)){
								setverdict(fail, __SCOPE__ & ": Error: Access Control Policy IDs attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_SUB_LBL() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels := {"MyLabel"};
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.subscription.labels := v_labels;
						v_ae1.start(f_CSE_DMR_UPD_015(int23, m_createSubscriptionBase, v_updateRequest));//Subscription
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									 if(v_responsePrimitive.primitiveContent.subscription.labels != v_labels){
										 setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
							   if(v_primitiveContentRetrieveResource.subscription.labels != v_labels){
								setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_GRP_LBL() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Labels v_labels := {"MyLabel"};
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.group_.labels := v_labels;
						v_ae1.start(f_CSE_DMR_UPD_015(int9, m_createGroupBase, v_updateRequest));//Group
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									 if(v_responsePrimitive.primitiveContent.group_.labels != v_labels){
										 setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
	 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.group_)) {
							   if(v_primitiveContentRetrieveResource.group_.labels != v_labels){
								setverdict(fail, __SCOPE__ & ": Error: Labels attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_GRP_ACPI() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var RequestPrimitive v_updateRequestPrimitive;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_DMR_UPD_015(int9, m_createGroupBase, v_updateRequest, true));//Group
						v_ae1.done;
						
						 

						if(getverdict == pass){
							 v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 v_updateRequestPrimitive := f_getRequestPrimitive(v_ae1);	
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									 if(v_responsePrimitive.primitiveContent.group_.accessControlPolicyIDs != valueof(v_updateRequestPrimitive.primitiveContent.group_.accessControlPolicyIDs)){
										 setverdict(fail, __SCOPE__ & ": Error: Access Control Policy IDs attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
 
							//Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.group_)) {
							   if(v_primitiveContentRetrieveResource.group_.accessControlPolicyIDs != valueof(v_updateRequestPrimitive.primitiveContent.group_.accessControlPolicyIDs)){
								setverdict(fail, __SCOPE__ & ": Error: Access Control Policy IDs attribute not updated correctly")
							  }
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_GRP_MACP() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var ListOfURIs v_membersAccessControlPolicyIDs := {"NotInitialized"};
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.group_.membersAccessControlPolicyIDs := v_membersAccessControlPolicyIDs;
						v_ae1.start(f_CSE_DMR_UPD_015(int9, m_createGroupBase, v_updateRequest));//Group
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									 if(v_responsePrimitive.primitiveContent.group_.membersAccessControlPolicyIDs != v_membersAccessControlPolicyIDs){
										 setverdict(fail, __SCOPE__ & ": Error: Members Access Control Policy IDs attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
	 
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.group_)) {
							   if(v_primitiveContentRetrieveResource.group_.membersAccessControlPolicyIDs != v_membersAccessControlPolicyIDs){
								setverdict(fail, __SCOPE__ & ": Error: Members Access Control Policy IDs attribute not updated correctly")
							  	}
							}
						 }
					}
					
					testcase TC_CSE_DMR_UPD_015_GRP_GN() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.String v_groupName:="MyGroupName";
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.group_.groupName := v_groupName;
						v_ae1.start(f_CSE_DMR_UPD_015(int9, m_createGroupBase, v_updateRequest));//Group
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							 //Check attribute 1
							 if(ispresent(v_responsePrimitive.primitiveContent)) {
								 if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									 if(v_responsePrimitive.primitiveContent.group_.groupName != v_groupName){
										 setverdict(fail, __SCOPE__ & ": Error: Group name attribute not updated correctly")
									 }
								 }
							 }
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
	 
							  //Check that the resource has been udpated correctly
							  if(ischosen(v_primitiveContentRetrieveResource.group_)) {
							   if(v_primitiveContentRetrieveResource.group_.groupName != v_groupName){
								setverdict(fail, __SCOPE__ & ": Error: Group name attribute not updated correctly")
							  }
							}
						 }
					}
					
				} // end group g_CSE_DMR_UPD_017
			  	
				group g_CSE_DMR_UPD_016 {
			  		
					/**
					 * @desc Check that the IUT updates successfully the value of the attribute MANDATORY_ATTRIBUTE of the RESOURCE_TYPE resource under CSEBase
					*/
					testcase TC_CSE_DMR_UPD_016_CSR_ET() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_expirationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.remoteCSE.expirationTime := v_expirationTime;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int16, m_createRemoteCSEBase, v_updateRequest));//Remote CSE
						v_ae1.done;
						
						 
						
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.remoteCSE)) {
									if(v_responsePrimitive.primitiveContent.remoteCSE.expirationTime != v_expirationTime){
										setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
						  //Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.remoteCSE)) {
							if(v_primitiveContentRetrieveResource.remoteCSE.expirationTime != v_expirationTime){
							  setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
							}
						  }
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_CSR_RR() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.Boolean v_requestReachability := true;
						var template RequestPrimitive v_updateRequest := m_updateRemoteCSEBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.remoteCSE.requestReachability := v_requestReachability;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int16, m_createRemoteCSEBase, v_updateRequest));//Remote CSE
						v_ae1.done;
						
						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.remoteCSE)) {
									if(v_responsePrimitive.primitiveContent.remoteCSE.requestReachability != v_requestReachability){
										setverdict(fail, __SCOPE__ & ": Error: Request Reachability attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.remoteCSE)) {
							  if(v_primitiveContentRetrieveResource.remoteCSE.requestReachability != v_requestReachability){
								setverdict(fail, __SCOPE__ & ": Error: Request Reachability attribute not updated correctly")
							  }
							}	
						}
					}
			  		
					testcase TC_CSE_DMR_UPD_016_AE_ET() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_expirationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateAeBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.aE.expirationTime := v_expirationTime;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM), v_updateRequest));//AE
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.aE)) {
									if(v_responsePrimitive.primitiveContent.aE.expirationTime != v_expirationTime){
										setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
									}
								}
							}
						v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
				
						 //Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.aE)) {
							if(v_primitiveContentRetrieveResource.aE.expirationTime != v_expirationTime){
							  setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
							}
						  }	
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_AE_RR() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.Boolean v_requestReachability := true;
						var template RequestPrimitive v_updateRequest := m_updateAeBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.aE.requestReachability := v_requestReachability;

						v_ae1.start(f_CSE_DMR_UPD_016(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM), v_updateRequest));//AE
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.aE)) {
									if(v_responsePrimitive.primitiveContent.aE.requestReachability != v_requestReachability){
										setverdict(fail, __SCOPE__ & ": Error: Request Reachability attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
						   //Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.aE)) {
							  if(v_primitiveContentRetrieveResource.aE.requestReachability != v_requestReachability){
								setverdict(fail, __SCOPE__ & ": Error: Request Reachability attribute not updated correctly")
							  }
							}	
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_CNT_ET() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_expirationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.container.expirationTime := v_expirationTime;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int3, m_createContainerBase, v_updateRequest));//Container
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.container)) {
									if(v_responsePrimitive.primitiveContent.container.expirationTime != v_expirationTime){
										setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
						  //Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.container)) {
							if(v_primitiveContentRetrieveResource.container.expirationTime != v_expirationTime){
							  setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
							}
						  }
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_ACP_ET() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_expirationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.accessControlPolicy.expirationTime := v_expirationTime;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int1, m_createAcpBase, v_updateRequest));//AccessControlPolicy
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									if(v_responsePrimitive.primitiveContent.accessControlPolicy.expirationTime != v_expirationTime){
										setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							  if(v_primitiveContentRetrieveResource.accessControlPolicy.expirationTime != v_expirationTime){
								setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
							  }
							}	
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_ACP_PV() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var SetOfAcrs v_privileges_1 := {{valueof(m_createAcr({PX_SUPER_AE_ID}, int61))}};
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.accessControlPolicy.privileges := v_privileges_1;
						v_ae1.start(f_CSE_DMR_UPD_016(int1, m_createAcpBase, v_updateRequest));//AccessControlPolicy
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									if(v_responsePrimitive.primitiveContent.accessControlPolicy.privileges != v_privileges_1){
										setverdict(fail, __SCOPE__ & ": Error: Privileges attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
						 //Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							if(v_primitiveContentRetrieveResource.accessControlPolicy.privileges != v_privileges_1){
							  setverdict(fail, __SCOPE__ & ": Error: Privileges attribute not updated correctly")
							}
						  }
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_ACP_PVS() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var SetOfAcrs v_privileges_1 := {{valueof(m_createAcr({PX_SUPER_AE_ID}, int61))}};
						var template RequestPrimitive v_updateRequest := m_updateAcpBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.accessControlPolicy.selfPrivileges := v_privileges_1;
						v_ae1.start(f_CSE_DMR_UPD_016(int1, m_createAcpBase, v_updateRequest));//AccessControlPolicy
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.accessControlPolicy)) {
									if(v_responsePrimitive.primitiveContent.accessControlPolicy.selfPrivileges != v_privileges_1){
										setverdict(fail, __SCOPE__ & ": Error: Self Privileges attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.accessControlPolicy)) {
							  if(v_primitiveContentRetrieveResource.accessControlPolicy.selfPrivileges != v_privileges_1){
								setverdict(fail, __SCOPE__ & ": Error: Self Privileges attribute not updated correctly")
							  }
							}	
						}
					}
				    
					testcase TC_CSE_DMR_UPD_016_SUB_ET() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_expirationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.subscription.expirationTime := v_expirationTime;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int23, m_createSubscriptionBase, v_updateRequest));//Subscription
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									if(v_responsePrimitive.primitiveContent.subscription.expirationTime != v_expirationTime){
										setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
									}
								}
							}
							
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
	 						
	 						//Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
							if(v_primitiveContentRetrieveResource.subscription.expirationTime != v_expirationTime){
							  setverdict(fail, __SCOPE__ & ": Error: Expiration time attribute not updated correctly")
							}
						  }
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_SUB_NU() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var ListOfURIs v_notificationURI := {"NotReachableNotificationURI"};
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;					
						v_updateRequest.primitiveContent.subscription.notificationURI := v_notificationURI;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int23, m_createSubscriptionBase, v_updateRequest));//Subscription
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									if(v_responsePrimitive.primitiveContent.subscription.notificationURI != v_notificationURI){
										setverdict(fail, __SCOPE__ & ": Error: Notification URI attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
							  if(v_primitiveContentRetrieveResource.subscription.notificationURI != v_notificationURI){
								setverdict(fail, __SCOPE__ & ": Error: Notification URI attribute not updated correctly")
							  }
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_SUB_NCT() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var NotificationContentType v_notificationContentType := int2;
						var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.subscription.notificationContentType := v_notificationContentType;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int23, m_createSubscriptionBase, v_updateRequest));//Subscription
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.subscription)) {
									if(v_responsePrimitive.primitiveContent.subscription.notificationContentType != v_notificationContentType){
										setverdict(fail, __SCOPE__ & ": Error: Notification Content Type attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
						  //Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.subscription)) {
							if(v_primitiveContentRetrieveResource.subscription.notificationContentType != v_notificationContentType){
							  setverdict(fail, __SCOPE__ & ": Error: Notification Content Type attribute not updated correctly")
							}
						  }
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_GRP_ET() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var Timestamp v_expirationTime := "21001231T012345";
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.group_.expirationTime := v_expirationTime;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int9, m_createGroupBase, v_updateRequest));//Group
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									if(v_responsePrimitive.primitiveContent.group_.expirationTime != v_expirationTime){
										setverdict(fail, __SCOPE__ & ": Error: Expiration Time attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.group_)) {
							  if(v_primitiveContentRetrieveResource.group_.expirationTime != v_expirationTime){
								setverdict(fail, __SCOPE__ & ": Error: Expiration Time attribute not updated correctly")
							  }
							}
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_GRP_MNM() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var XSD.PositiveInteger v_maxNrOfMembers := 10;
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.group_.maxNrOfMembers := v_maxNrOfMembers;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int9, m_createGroupBase, v_updateRequest));//Group
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									if(v_responsePrimitive.primitiveContent.group_.maxNrOfMembers != v_maxNrOfMembers){
										setverdict(fail, __SCOPE__ & ": Error: Maximum Number of Members attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);							

						  //Check that the resource has been udpated correctly
						  if(ischosen(v_primitiveContentRetrieveResource.group_)) {
							if(v_primitiveContentRetrieveResource.group_.maxNrOfMembers != v_maxNrOfMembers){
							  setverdict(fail, __SCOPE__ & ": Error: Maximum Number of Members attribute not updated correctly")
							}
						  }
						}
					}
					
					testcase TC_CSE_DMR_UPD_016_GRP_MID() runs on Tester system CseSystem {
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var ListOfURIs v_memberIDs := {"NotInitialized"};
						var template RequestPrimitive v_updateRequest := m_updateGroupBase;
						var ResponsePrimitive v_responsePrimitive;
						var PrimitiveContent v_primitiveContentRetrieveResource;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_updateRequest.primitiveContent.group_.memberIDs := v_memberIDs;
						
						v_ae1.start(f_CSE_DMR_UPD_016(int9, m_createGroupBase, v_updateRequest));//Group
						v_ae1.done;
						
						 

						if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1);
							//Check attribute 1
							if(ispresent(v_responsePrimitive.primitiveContent)) {
								if(ischosen(v_responsePrimitive.primitiveContent.group_)) {
									if(v_responsePrimitive.primitiveContent.group_.memberIDs != v_memberIDs){
										setverdict(fail, __SCOPE__ & ": Error: Member IDs attribute not updated correctly")
									}
								}
							}
							v_primitiveContentRetrieveResource := f_getPrimitiveContentRetrievedResource(v_ae1);
							
							//Check that the resource has been udpated correctly
							if(ischosen(v_primitiveContentRetrieveResource.group_)) {
							  if(v_primitiveContentRetrieveResource.group_.memberIDs != v_memberIDs){
								setverdict(fail, __SCOPE__ & ": Error: Member IDs attribute not updated correctly")
							  }
							}
						}
					}
					
				} // end group g_CSE_DMR_UPD_016

			}//end group Update
			
			group Delete {
			
				group g_CSE_DMR_DEL_001{

					/**
					 * @desc Check that the IUT accepts the deletion of a RESOURCE_TYPE resource
					 * 
					 */
					testcase TC_CSE_DMR_DEL_001_CNT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                		
						v_ae1.start(f_CSE_DMR_DEL_001(int3, m_createContainerBase));//Container
						v_ae1.done;
                		
						if(getverdict == pass){ 
							//check if "MyRessource" container resource isn't present in the IUT (for exemple attempt to update the resource)
						};
					};
                
					testcase TC_CSE_DMR_DEL_001_GRP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                		
						v_ae1.start(f_CSE_DMR_DEL_001(int9, m_createGroupBase));//Group
						v_ae1.done;
					};
                
					testcase TC_CSE_DMR_DEL_001_ACP() runs on Tester system CseSystem {
						// Local variables
 						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                
						v_ae1.start(f_CSE_DMR_DEL_001(int1, m_createAcpBase));//AccessControlPolicy
						v_ae1.done;
					};
                
					testcase TC_CSE_DMR_DEL_001_SUB() runs on Tester system CseSystem {
							// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                
						v_ae1.start(f_CSE_DMR_DEL_001(int23, m_createSubscriptionBase));//Subscription
						v_ae1.done;
					};	
                
					testcase TC_CSE_DMR_DEL_001_CIN() runs on AeSimu system CseSystem {
							// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                
						v_ae1.start(f_CSE_DMR_DEL_001(int4, m_createContentInstanceBase));//ContentInstance
						v_ae1.done;
					};	
                
				};//end of group g_CSE_DMR_DEL_001
                
				group g_CSE_DMR_DEL_002{
                
					/**
					 * @desc Check that the IUT responds with an error when the AE tries to delete the resource TARGET_RESOURCE_ADDRESS without having privileges for the DELETE operation
					 * 
					 */
					testcase TC_CSE_DMR_DEL_002_CNT() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                		
						v_ae1.start(f_CSE_DMR_DEL_002(int3, m_createContainerBase));//Container
						v_ae1.done;
					};
                
					testcase TC_CSE_DMR_DEL_002_GRP() runs on Tester system CseSystem {
						// Local variables
 						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                		
						v_ae1.start(f_CSE_DMR_DEL_002(int9, m_createGroupBase));//Group
						v_ae1.done;
					};
                
					testcase TC_CSE_DMR_DEL_002_ACP() runs on Tester system CseSystem {
						// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                
						v_ae1.start(f_CSE_DMR_DEL_002(int1, m_createAcpBase));//AccessControlPolicy
						v_ae1.done;
					};
                
					testcase TC_CSE_DMR_DEL_002_SUB() runs on Tester system CseSystem {
							// Local variables
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
                
						v_ae1.start(f_CSE_DMR_DEL_002(int23, m_createSubscriptionBase));//Subscription
						v_ae1.done;
					};
                
                
				};//end of group g_CSE_DMR_DEL_002

				/**
				 * @desc Check that the stateTag attribute of a container resource is increased when a child resource is deleted
				 * 
				 */
				testcase TC_CSE_DMR_DEL_005() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_DEL_005());
				  	  	
					v_ae1.done;
				  	  		
				}

				function f_CSE_DMR_DEL_005() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex := -1;
					var integer v_childResourceIndex := -1; 
					const ResourceType c_containerResourceType := int3;          			
        					   
					// Test control
        
					// Test component configuration
					f_cf01Up();
        
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					v_resourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_aeIndex); 
        			
					if(ispresent(vc_resourcesList[v_resourceIndex].resource.container.stateTag)) {
        				
						v_childResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_resourceIndex); 
        				
						// Test Body
						mcaPort.send(f_getMsgOutPrimitive(m_request(m_delete(f_getResourceAddress(v_childResourceIndex), f_getOriginator(v_childResourceIndex)))));
						            	
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_containerResourceType)) & " delete 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(c_containerResourceType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource type " & int2str(enum2int(c_containerResourceType)));
							}
						}
        	
        	
        	
						mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)))));
        
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
								tc_ac.stop;
								if(v_response.primitive.responsePrimitive.primitiveContent.container.stateTag == 2) { //(Create and Delete)
									setverdict(pass, __SCOPE__ & ": The stateTag attribute is incremented");	
								}
								else{
									setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is not incremented");
								}
							}
							[] 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");
							}
						}	
        					
					}//end if
					else{
						setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is empty");
					}
        			
					// Postamble
					f_cse_postamble_deleteResources();
        
					// Tear down
					f_cf01Down();
        				
				}//end f_CSE_DMR_DEL_005
				
				/**
				 * @desc Check that the IUT decreases the field value of attribute currentNrOfInstances and currentByteSize of parent container when a latest contentInstance resource is deleted successfully
				 * 
				 */
				testcase TC_CSE_DMR_DEL_006() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_DEL_006());
				  	  	
					v_ae1.done;
				  	  		
				}
				
				function f_CSE_DMR_DEL_006() runs on AeSimu {
					// Local variables
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex := -1; 
					var PrimitiveContent v_attributesContainer, v_attributesContainer_afterDeletion;
							   
					// Test control
        
					// Test component configuration
					f_cf01Up();
        
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
					v_contentInstanceIndex := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex); 
					
					v_attributesContainer := f_cse_retrieveResource(v_containerIndex);
        			
					if(not(ispresent(v_attributesContainer.container.currentNrOfInstances))) {
						setverdict(fail, __SCOPE__ & ": Error the currentNrOfInstances attribute is empty");
						f_checkAeSimuStatus();
					}
						
					// Test Body
					f_cse_deleteResource(v_contentInstanceIndex);
				
					v_attributesContainer_afterDeletion := f_cse_retrieveResource(v_containerIndex);
					
					if(not(ispresent(v_attributesContainer.container.currentNrOfInstances))) {
						setverdict(fail, __SCOPE__ & ": Error the currentNrOfInstances attribute is empty");
						f_checkAeSimuStatus();
					}
					
					if((v_attributesContainer.container.currentNrOfInstances > v_attributesContainer_afterDeletion.container.currentNrOfInstances) and
						(v_attributesContainer.container.currentByteSize > v_attributesContainer_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");
					}
						
					// Postamble
					f_cse_postamble_deleteResources();
        
					// Tear down
					f_cf01Down();
        				
				}//end f_CSE_DMR_DEL_006

				/**
				 * @desc Check that the IUT accepts the DELETE Request of the latest contentInstance resource target to a container resource
				 * 
				 */
				testcase TC_CSE_DMR_DEL_007() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_DEL_007());
				  	  	
					v_ae1.done;
				  	  		
				}
				
				function f_CSE_DMR_DEL_007() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex_1 := -1;
					var integer v_contentInstanceIndex_2 := -1; 
					const ResourceType c_containerResourceType := int3;
							   
					// Test control
        
					// Test component configuration
					f_cf01Up();
        
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
					v_contentInstanceIndex_1 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex); 
					
					f_sleep(1.0);
					
					v_contentInstanceIndex_2 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex);
						
					// Test Body
					v_request := valueof(m_delete(f_getResourceAddress(v_containerIndex) & "/" & c_resourceShortNameLatest, f_getOriginator(v_containerIndex)));
					            	
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_containerResourceType)) & " deleted successfuly");
						}
						[] 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(c_containerResourceType)));
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while deleting resource type " & int2str(enum2int(c_containerResourceType)));
						}
					}
					
					f_checkAeSimuStatus();
		       		            	
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve((f_getResourceAddress(v_contentInstanceIndex_2)), f_getOriginator(v_contentInstanceIndex_2)))));
				            
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Resource type" & int2str(enum2int(c_containerResourceType)) & " has already been deleted");	
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Error while retrieving resource attributes as" & int2str(enum2int(c_containerResourceType)) & " has been deleted");
						}
						[] 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_DEL_007

				/**
				 * @desc Check that the IUT accepts the DELETE Request of the oldest contentInstance resource target to a container resource
				 * 
				 */
				testcase TC_CSE_DMR_DEL_009() runs on Tester system CseSystem {
			
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
					v_ae1.done;
							
					v_ae1.start(f_CSE_DMR_DEL_009());
				  	  	
					v_ae1.done;
				  	  		
				}

				function f_CSE_DMR_DEL_009() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_contentInstanceIndex_1 := -1;
					var integer v_contentInstanceIndex_2 := -1; 
					const ResourceType c_containerResourceType := int3;
							   
					// Test control
        
					// Test component configuration
					f_cf01Up();
        
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
					
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); 
					
					v_contentInstanceIndex_1 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex); 
					
					f_sleep(1.0);
											
					v_contentInstanceIndex_2 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex);
						
					// Test Body
					v_request := valueof(m_delete(f_getResourceAddress(v_containerIndex) & "/" & c_resourceShortNameOldest, f_getOriginator(v_containerIndex)));
					            	
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_containerResourceType)) & " deleted successfuly");
							}
							[] 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(c_containerResourceType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while deleting resource type " & int2str(enum2int(c_containerResourceType)));
							}
					   }
					   
					f_checkAeSimuStatus();
					   
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve((f_getResourceAddress(v_contentInstanceIndex_1)), f_getOriginator(v_contentInstanceIndex_1)))));
				            
					tc_ac.start;
					alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
							   tc_ac.stop;
							   setverdict(fail, __SCOPE__ & ": Resource type" & int2str(enum2int(c_containerResourceType)) & " has already been deleted");	
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
							   tc_ac.stop;
							   setverdict(pass, __SCOPE__ & ": Error while retrieving resource attributes as " & int2str(enum2int(c_containerResourceType)) & " has been deleted");
							}
							[] 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_DEL_009
				
			}//end group Delete
			
		}//end group Data_Management_and_Repository
				
		group Subscription_And_Notification {
	
			group Create {
				
				/**
				 * @desc Check that the IUT rejects the creation of the <subscription> resource when the target subscribed-to RESOURCE_TYPE resource is not subscribable. 
				 *  
				 */
				testcase TC_CSE_SUB_CRE_001_SUB() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							
					v_ae1.start(f_CSE_SUB_CRE_001_SUB());
				  	  	
					v_ae1.done;
				  	  		
				}
						
				function f_CSE_SUB_CRE_001_SUB() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex := -1;
					var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
					var RequestPrimitive v_request;
					var integer v_ae2Index := -1;
									
					// Test control

					// Test component configuration
					f_cf01Up(true);

					// Test adapter configuration

					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//AE1 is registred;
					
					f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23);
					
					v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription resource is created			

					v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_resourceIndex);
			
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int5203))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": <Subscription> Resource 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 <Subscription> 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_resourceIndex, 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 TC_CSE_SUB_CRE_001_SUB
				
				testcase TC_CSE_SUB_CRE_001_CIN() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
								
					v_ae1.start(f_CSE_SUB_CRE_001_CIN());
					  	  	
					v_ae1.done;
					  	  		
				}
							
				function f_CSE_SUB_CRE_001_CIN() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_containerResourceIndex := -1;
					var integer v_contentInstanceResourceIndex := -1;
					var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
					var RequestPrimitive v_request;
					
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

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

					v_containerResourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);//Container 				

					v_contentInstanceResourceIndex := f_cse_createResource(int4, m_createContentInstance(f_getResourceAddress(v_aeIndex), "Random Value"), v_containerResourceIndex);//ContentInstance

					v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_contentInstanceResourceIndex);
					
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int5203))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": <Subscription> Resource 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 <Subscription> 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_contentInstanceResourceIndex, 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 TC_CSE_SUB_CRE_001_CIN
								
				/**
				 * @desc Check that the IUT rejects the creation of the <subscription> resource when the originator does not have privileges for retrieving the subscribed-to resource.
				 * 
				 */
				testcase TC_CSE_SUB_CRE_002() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
								
					v_ae1.start(f_CSE_SUB_CRE_002());
					  	  	
					v_ae1.done;
					  	  		
				}
							
				function f_CSE_SUB_CRE_002() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_acpAuxIndex := -1;
					var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
					var RequestPrimitive v_request;
						
					// 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_acpAuxIndex := f_cse_preamble_createAcpAux(-, int61);//c_CUDNDi)
						
					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//c_CRDNDi);
				
					v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription 
					
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": No privilege for subscribing to the 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__ & ": Subscription successful whereas it doesn't have privilege");
						}
						[] 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 TC_CSE_SUB_CRE_002
								
				/**
				 * @desc Check that the IUT rejects the creation of the <subscription> resource when the notificationURI is not the originator and the IUT cannot send the Notify request to the notificationURI
				 * 
				 */
				testcase TC_CSE_SUB_CRE_003() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
								
					v_ae1.start(f_CSE_SUB_CRE_003());
					  	  	
					v_ae1.done;
					  	  		
				}
							
				function f_CSE_SUB_CRE_003() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
					var RequestPrimitive v_request;
			
					// Test control

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);		
					
					v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription 
					v_request.primitiveContent.subscription.notificationURI := {"NotReachableNotificationURI"};
					
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int5204))) -> value v_response { //SUBSCRIPTION_VERIFICATION_INITIATION_FAILED
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": OK : Subscription verification initiation failed");
						}
						[] 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 Subscription verification failed");
						}
						[] 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 TC_CSE_SUB_CRE_003
				
				/**
				 * @desc Check that the IUT stores Originator ID in the notification creator attribute when a <SUBSCRIPTION> creation request which needs verification is received and the notificationURI is not the Originator.
				 * 
				 */
				testcase TC_CSE_SUB_CRE_004() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
								
					v_ae1.start(f_CSE_SUB_CRE_004());
					  	  	
					v_ae1.done;
					  	  		
				}
							
				function f_CSE_SUB_CRE_004() runs on AeSimu {
					//Local variables
					 var template RequestPrimitive v_request := m_createSubscriptionBase;
					 var RequestPrimitive v_notificationRequest;
					 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, v_request, int23);
				
					v_request := f_getCreateRequestPrimitive(int23, m_createSubscriptionBase, v_aeIndex);
					v_request.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)};
	
					v_resourceIndex := f_cse_createResource(int23, v_request, v_aeIndex);//Subscription 				
					
					if(vc_ae2.running) {
						vc_ae2.stop;
					};
					
					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
					
					// Test Body
					v_notificationRequest := f_getRequestPrimitive(vc_ae2);
					
					if(f_compareURIs(v_aeIndex, v_notificationRequest.primitiveContent.notification.creator)) {
						setverdict(pass, __SCOPE__ & ": Creator set to originator of the subscription creation primitive");
					} else {
						setverdict(fail, __SCOPE__ & ": Creator not set to originator of the subscription creation primitive");
					}
					 
					 // Postamble
					 f_cse_postamble_deleteResources();
	
					 // Tear down
					 f_cf01Down();					
				
				} // end TC_CSE_SUB_CRE_004
				
				/**
				 * @desc Check that the IUT sends a Notify request to the subscriber resource when eventType attribute is set to "Create_of_Direct_Child_Resource"  and an create operation has been performed on the subscribed-to resource
				 * 
				 */
				testcase TC_CSE_SUB_CRE_005() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
								
					v_ae1.start(f_CSE_SUB_CRE_005());
					  	  	
					v_ae1.done;
					  	  		
				}
							
				function f_CSE_SUB_CRE_005() runs on AeSimu {
					
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex := -1;
					var template RequestPrimitive v_createRequest := omit; 
					var template PrimitiveContent v_contentNotification := {container := mw_contentContainer_rc1};// all attributes expected   
					var RequestPrimitive v_request;
					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);
					
					v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, m_eventNotificationCriteria({int3}), -, omit, omit, omit, -, omit); 
				
					f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23);

					v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription 				
					
					if(vc_ae2.running) {
						vc_ae2.stop;
					};
	
					// Test Body
					v_request:= f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
					
					vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentNotification)); // check if the notification is well received and if its content matchs
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource type int3 (Container) created 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 creating resource type int3 (Container)");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource type int3 (Container)");
						}
					}
    				
					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
										
					//Postamble
					f_cse_postamble_deleteResources();

					//Tear down
					f_cf01Down();
				} // end TC_CSE_SUB_CRE_005
	
			}//end group Create
			
			group Update {
				
				/**
				 * @desc Check that the IUT sends Notify request to the subscriber resource when an update operation has been performed on the subscribed-to resource
				 * 
				 */
				testcase TC_CSE_SUB_UPD_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
								
					v_ae1.start(f_CSE_SUB_UPD_001());
					  	  	
					v_ae1.done;
					  	  		
				}
							
				function f_CSE_SUB_UPD_001() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var Labels v_labels_1:= {"VALUE_1"};
					var integer v_aeIndex := -1;
					var integer v_resourceIndex := -1;
					var template RequestPrimitive v_createRequest := m_createSubscriptionBase; 
					var template PrimitiveContent v_contentResponse;
					var template RequestPrimitive v_updateRequest := m_updateAeBase;
					var RequestPrimitive v_request;
					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, v_createRequest, int23);
					
					v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription

					if(vc_ae2.running) {
						vc_ae2.stop;
					};
					
					// Test Body
					v_contentResponse.aE := mw_contentAeBase; // all attributes expected
					
					vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs
					
					v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request
					v_request.primitiveContent.aE.labels := v_labels_1; 

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Attribute of resource type int2 (Ae) updated 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 updating resource type int2 (Ae)");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource type int2 (Ae)");
						}
					};
					
					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);

					//Postamble
					f_cse_postamble_deleteResources();

					//Tear down
					f_cf01Down();

				} // end TC_CSE_SUB_UPD_001
				
			}//end group Update
			
			group Delete {
				
				/**
				 * @desc Check that the IUT sends a Notify request to the AE2_RESOURCE_ADDRESS of the subscriberURI attribute when the SUBSCRIPTION_RESOURCE_ADDRESS <subscription> resource is deleted
				 * 
				 */
				testcase TC_CSE_SUB_DEL_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
									
					v_ae1.start(f_CSE_SUB_DEL_001());
						  	  	
					v_ae1.done;
						  	  		
				}
								
				function f_CSE_SUB_DEL_001() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_resourceIndex := -1;
					var template RequestPrimitive v_createRequest := omit;
					var RequestPrimitive v_request;
					var integer v_ae2Index := -1;
					var template Notification v_notificationContent := mw_contentNotificationBase;
					var RequestPrimitive v_notificationRequest;
					
					// 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_createRequest, int23);
					
					v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, omit, omit, omit, omit,f_getResourceAddress(v_ae2Index), -, omit); // SubscriberURI ="ResourceID"
	
					v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); // Subscription
					
					v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); // Subscription resource deletion request
										
					if(vc_ae2.running) {
						vc_ae2.stop;
					};

					// Test Body
					v_notificationContent.subscriptionReference := ?;
					v_notificationContent.notificationEvent := omit;
					vc_ae2.start(f_cse_notifyProcedure_subscriptionDeletionHandler(v_notificationContent)); // check that no notification is received
					
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Subscription resource 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 int23 (Subscription)");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while deleting resource type int23 (Subscription)");
						}
					}	
					
					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);

					v_notificationRequest := f_getRequestPrimitive(vc_ae2);
					
					if(f_compareURIs(v_resourceIndex, v_notificationRequest.primitiveContent.notification.subscriptionReference)) {
						setverdict(pass, __SCOPE__ & ": Creator set to originator of the subscription creation primitive");
					} else {
						setverdict(fail, __SCOPE__ & ": Creator not set to originator of the subscription creation primitive");
					}

					//Postamble
					f_cse_postamble_deleteResources();

					//Tear down
					f_cf01Down();

				} // end TC_CSE_SUB_DEL_001
				
			}//end group Delete
			
		}//end group Subscription_And_Notification
		
		group Security {
	
			group Access_Control_Policy {
				
				group Create {
	
					/**
					 * @desc Check that the IUT accepts the creation of a accessControlPolicy resource with privileges attribute having multiple access control rules
					 * 
					 */
					testcase TC_CSE_SEC_ACP_CRE_001() runs on Tester system CseSystem {
					
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
									
						v_ae1.start(f_CSE_SEC_ACP_CRE_001());
						  	  	
						v_ae1.done;
						  	  		
					}
								
					function f_CSE_SEC_ACP_CRE_001() runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpIndex := -1;
						var template PrimitiveContent v_contentResponse;
						var RequestPrimitive v_createRequest := valueof(m_createAcpBase);
						var AccessControlRule v_accessControlRule_1 := valueof(m_createAcr({PX_SUPER_AE_ID}, int63));
						var AccessControlRule v_accessControlRule_2 := valueof(m_createAcr({"Temporary"}, int55));
						const ResourceType c_accessControlPolicyType := int1;

						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_aeIndex := f_cse_preamble_registerAe(-, -); // Use for setting the ACR_2's accessControlOriginators attribute to AE_ID

						v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule_1,v_accessControlRule_2};
						v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list[1].accessControlOriginators := {f_getOriginator(v_aeIndex)};

						v_contentResponse.accessControlPolicy := mw_contentAcp_rc1;
						v_contentResponse.accessControlPolicy.privileges.accessControlRule_list := {v_accessControlRule_1,v_accessControlRule_2};// TODO To handle reverse order of acrs
						v_contentResponse.accessControlPolicy.privileges.accessControlRule_list[1].accessControlOriginators := {f_getOriginator(v_aeIndex)};

						// Test Body
						v_createRequest := f_getCreateRequestPrimitive(c_accessControlPolicyType, v_createRequest, v_aeIndex);
						
						mcaPort.send(f_getMsgOutPrimitive(m_request(v_createRequest)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " created successfully");
								f_checkAttributesToBeSaved(c_accessControlPolicyType, v_createRequest, v_response.primitive.responsePrimitive);
								v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1, 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 creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
							}
						}

						f_checkAeSimuStatus();
    						
						//Check to see if the resource is present or not
						if(f_cse_isResourcePresent(v_acpIndex)) {
							setverdict(pass, __SCOPE__ & ":INFO: Resource created");
						} else {
							setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
						}

						//Postamble
						f_cse_postamble_deleteResources();

						//Tear down
						f_cf01Down();

					}//end TC_CSE_SEC_ACP_CRE_001
							
					/**
					* @desc Check that the IUT accepts the creation of a  accessControlPolicy resource with selfPrivileges attribute having multiple access control rules
					*/
					testcase TC_CSE_SEC_ACP_CRE_002() runs on Tester system CseSystem {
					
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
										
						v_ae1.start(f_CSE_SEC_ACP_CRE_002());
							  	  	
						v_ae1.done;
							  	  		
					}
									
					function f_CSE_SEC_ACP_CRE_002() runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpIndex := -1;
						var template PrimitiveContent v_contentResponse;
						var RequestPrimitive v_createRequest := valueof(m_createAcpBase);
						var AccessControlRule v_accessControlRule_1 := valueof(m_createAcr({PX_SUPER_AE_ID}, int63));
						var AccessControlRule v_accessControlRule_2 := valueof(m_createAcr({"Temporary"}, int55));
						const ResourceType c_accessControlPolicyType := int1;

						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_aeIndex := f_cse_preamble_registerAe(-, -); // Only use for setting the ACR_2's accessControlOriginators attribute to AE_ID

						v_createRequest.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list := {v_accessControlRule_1,v_accessControlRule_2};
						v_createRequest.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list[1].accessControlOriginators := {f_getOriginator(v_aeIndex)};

						v_contentResponse.accessControlPolicy := mw_contentAcp_rc1;
						v_contentResponse.accessControlPolicy.selfPrivileges.accessControlRule_list := {v_accessControlRule_1,v_accessControlRule_2};//TODO To handle reverse order of acrs
						v_contentResponse.accessControlPolicy.selfPrivileges.accessControlRule_list[1].accessControlOriginators := {f_getOriginator(v_aeIndex)};

						// Test Body
						v_createRequest := f_getCreateRequestPrimitive(c_accessControlPolicyType, v_createRequest, v_aeIndex);// CSE child resource
						
						mcaPort.send(f_getMsgOutPrimitive(m_request(v_createRequest)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " created successfully");
								f_checkAttributesToBeSaved(c_accessControlPolicyType, v_createRequest, v_response.primitive.responsePrimitive);
								v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, c_accessControlPolicyType, 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 creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
							}
						}

						f_checkAeSimuStatus();
    						
						//Check to see if the resource is present or not
						if(f_cse_isResourcePresent(v_acpIndex)) {
							setverdict(pass, __SCOPE__ & ":INFO: Resource created");
						} else {
							setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
						}

						//Postamble
						f_cse_postamble_deleteResources();

						//Tear down
						f_cf01Down();

					}//end TC_CSE_SEC_ACP_CRE_002

					/**
					 * @desc Check that the IUT accepts the creation of a accessControlPolicy resource with privileges attribute having empty rules
					 * 
					 */
					testcase TC_CSE_SEC_ACP_CRE_003() runs on Tester system CseSystem {
					
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
										
						v_ae1.start(f_CSE_SEC_ACP_CRE_003());
							  	  	
						v_ae1.done;
							  	  		
					}
									
					function f_CSE_SEC_ACP_CRE_003() runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var integer v_acpIndex := -1;
						var template PrimitiveContent v_contentResponse;
						var RequestPrimitive v_createRequest := valueof(m_createAcpBase);
						const ResourceType c_accessControlPolicyType := int1;

						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_createRequest.primitiveContent.accessControlPolicy.privileges.accessControlRule_list := {};
						
						v_contentResponse.accessControlPolicy := mw_contentAcp_rc1;
						v_contentResponse.accessControlPolicy.privileges.accessControlRule_list := {};
						
						// Test Body
						v_createRequest := f_getCreateRequestPrimitive(c_accessControlPolicyType, v_createRequest, -1);
						
						mcaPort.send(f_getMsgOutPrimitive(m_request(v_createRequest)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, v_contentResponse))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " created successfully");
								f_checkAttributesToBeSaved(c_accessControlPolicyType, v_createRequest, v_response.primitive.responsePrimitive);
								v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1, -, -);
							}
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
								tc_ac.stop;
								setverdict(fail, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " created successfully, but wrong ACP representation");
								f_checkAttributesToBeSaved(c_accessControlPolicyType, v_createRequest, v_response.primitive.responsePrimitive);
								v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1, -, -);
							}
							[] 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 creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
							}
						}

						f_checkAeSimuStatus();
    						
						//Check to see if the resource is present or not
						if(f_cse_isResourcePresent(v_acpIndex)) {
							setverdict(pass, __SCOPE__ & ":INFO: Resource created");
						} else {
							setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
						}

						//Postamble
						f_cse_postamble_deleteResources();

						//Tear down
						f_cf01Down();

					}//end TC_CSE_SEC_ACP_CRE_003

					/**
					 * @desc Check that the IUT responds with an error when the creation of a accessControlPolicy resource with selfPrivileges attribute having empty rules
					 * 
					 */
					testcase TC_CSE_SEC_ACP_CRE_004() runs on Tester system CseSystem {
					
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
										
						v_ae1.start(f_CSE_SEC_ACP_CRE_004());
							  	  	
						v_ae1.done;
							  	  		
					}
									
					function f_CSE_SEC_ACP_CRE_004() runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var integer v_acpIndex := -1;
						var RequestPrimitive v_createRequest := valueof(m_createAcpBase);
						const ResourceType c_accessControlPolicyType := int1;

						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_createRequest.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list := {};
						
						// Test Body
						v_createRequest := f_getCreateRequestPrimitive(c_accessControlPolicyType, v_createRequest, -1);
						
						mcaPort.send(f_getMsgOutPrimitive(m_request(v_createRequest)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " creation correctly rejected due to empty selfPriviles accessControlRules");
							}
							[] 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 creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
								f_checkAttributesToBeSaved(c_accessControlPolicyType, v_createRequest, v_response.primitive.responsePrimitive);
								v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1, -, -);
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while creating resource type " & int2str(enum2int(c_accessControlPolicyType)));
							}
						}

						f_checkAeSimuStatus();
    						
						//Check to see if the resource is present or not
						if(f_cse_isResourceNotPresent(-1, v_createRequest.primitiveContent.accessControlPolicy.resourceName)) {
							setverdict(pass, __SCOPE__ & ":INFO: Resource not created");
						} else {
							setverdict(fail, __SCOPE__ & ":ERROR: Resource created");
						}

						//Postamble
						f_cse_postamble_deleteResources();

						//Tear down
						f_cf01Down();

					}//end TC_CSE_SEC_ACP_CRE_004
				
				}// end of group Create
			
				group Update {
				
					/**
					 * @desc Check that the IUT updates successfully the accessControlPolicyIDs attribute of the <AE> resource when the AE has privileges for UPDATE operation in any selfPrivileges of the <accessControlPolicy> resources which this attribute originally indicates.
					 * 
					 */
					testcase TC_CSE_SEC_ACP_UPD_001() runs on Tester system CseSystem {
					
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
										
						v_ae1.start(f_CSE_SEC_ACP_UPD_001());
							  	  	
						v_ae1.done;
							  	  		
					}
									
					function f_CSE_SEC_ACP_UPD_001() runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpIndex1 := -1;
						var integer v_acpIndex2 := -1;
						var RequestPrimitive v_createRequestAcp1 := valueof(m_createAcp(f_getResourceAddress(-1), omit));
						var RequestPrimitive v_createRequestAcp2 := valueof(m_createAcp(f_getResourceAddress(-1), omit));
						var RequestPrimitive v_updateRequest;
						var AccessControlRule v_accessControlRule_1;
						var AccessControlRule v_accessControlRule_2;
						var SetOfAcrs v_setOfArcs_1;
						var SetOfAcrs v_setOfArcs_2;
						var PrimitiveContent v_primitiveContentRetrievedResource;

						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_acpIndex1 := f_cse_createResource(int1, v_createRequestAcp1); // CSE child resource
						
						v_acpIndex2 := f_cse_createResource(int1, v_createRequestAcp2); // CSE child resource
						
						v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex1].resource)}, -);

						v_accessControlRule_1 := valueof(m_createAcr({f_getOriginator(v_aeIndex)}, int59)); // c_CRDNDi
						v_accessControlRule_2 := valueof(m_createAcr({PX_SUPER_AE_ID, f_getOriginator(v_aeIndex)}, int63)); // c_CRUDNDi 
						v_setOfArcs_1.accessControlRule_list := {v_accessControlRule_1};
						v_setOfArcs_2.accessControlRule_list := {v_accessControlRule_2};
						v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs_1, v_setOfArcs_2));
						f_cse_updateResource(int1, v_acpIndex1, v_updateRequest);
						
						// Test Body
						v_updateRequest := valueof(m_updateAeBase);
						v_updateRequest.primitiveContent.aE.accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[v_acpIndex2].resource)};
						v_updateRequest := f_getUpdateRequestPrimitive(int1, v_aeIndex, v_updateRequest);
						
						mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));
						tc_ac.start;
						alt {
							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
								tc_ac.stop;
								setverdict(pass, __SCOPE__ & ": Successful Update 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 Update operation on resource type int2 (Ae)");
							}
							[] tc_ac.timeout {
								setverdict(fail, __SCOPE__ & ": No answer while executing update operation on resource type int2 (Ae)");
							}
						}

						v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_aeIndex);
						if(getverdict == pass){ 
							if(ischosen(v_primitiveContentRetrievedResource.aE)) {
								 if(not match (f_resourceIdCleaner(v_primitiveContentRetrievedResource.aE.accessControlPolicyIDs[0]), v_updateRequest.primitiveContent.aE.accessControlPolicyIDs[0])){
									  setverdict(fail, __SCOPE__ & ": Error: Access Control policy ID attribute not updated correctly");
							}
						  }
						}

						//Postamble
						f_cse_postamble_deleteResources();

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

					/**
					 * @desc Check that the IUT responds with an error when the AE tries an UPDATE operation on the accessControlPolicyIDs attribute without having privileges for such operation in any selfPrivileges of the <accessControlPolicy> resources which this attribute originally indicates.
					 * 
					 */
					testcase TC_CSE_SEC_ACP_UPD_002() runs on Tester system CseSystem {
					
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
										
						v_ae1.start(f_CSE_SEC_ACP_UPD_002());
							  	  	
						v_ae1.done;
							  	  		
					}
									
					function f_CSE_SEC_ACP_UPD_002() runs on AeSimu {
						// Local variables
						var MsgIn v_response;
						var integer v_aeIndex := -1;
						var integer v_acpIndex1 := -1;
						var integer v_acpIndex2 := -1;
						var RequestPrimitive v_createRequestAcp1 := valueof(m_createAcp(f_getResourceAddress(-1), omit));
						var RequestPrimitive v_createRequestAcp2 := valueof(m_createAcp(f_getResourceAddress(-1), omit));
						var RequestPrimitive v_updateRequest;
						var AccessControlRule v_accessControlRule_1;
						var AccessControlRule v_accessControlRule_2;
						var SetOfAcrs v_setOfArcs_1;
						var SetOfAcrs v_setOfArcs_2;
						var PrimitiveContent v_primitiveContentRetrievedResource;

						// Test control

						// Test component configuration
						f_cf01Up();

						// Test adapter configuration

						// Preamble
						v_acpIndex1 := f_cse_createResource(int1, v_createRequestAcp1); // CSE child resource
						
						v_acpIndex2 := f_cse_createResource(int1, v_createRequestAcp2); // CSE child resource
						
						v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex1].resource)}, -);

						v_accessControlRule_1 := valueof(m_createAcr({f_getOriginator(v_aeIndex)}, int63)); // c_CRDNDi
						v_accessControlRule_2 := valueof(m_createAcr({PX_SUPER_AE_ID, f_getOriginator(v_aeIndex)}, int59)); // c_CRUDNDi 
						v_setOfArcs_1.accessControlRule_list := {v_accessControlRule_1};
						v_setOfArcs_2.accessControlRule_list := {v_accessControlRule_2};
						v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs_1, v_setOfArcs_2));
						f_cse_updateResource(int1, v_acpIndex1, v_updateRequest);
						
						// Test Body
						v_updateRequest := valueof(m_updateAeBase);
						v_updateRequest.primitiveContent.aE.accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[v_acpIndex2].resource)};
						v_updateRequest := f_getUpdateRequestPrimitive(int1, v_aeIndex, v_updateRequest);

						mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));
						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)");
							}
						}

						v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_aeIndex);
						if(getverdict == pass){
							if(ischosen(v_primitiveContentRetrievedResource.aE)) {
								 if(match(v_primitiveContentRetrievedResource.aE.accessControlPolicyIDs, valueof(v_updateRequest.primitiveContent.aE.accessControlPolicyIDs))){
									  setverdict(fail, __SCOPE__ & ": Error: Access Control policy ID attribute updated")
							}
						  }
						}

						//Postamble
						f_cse_postamble_deleteResources();

						//Tear down
						f_cf01Down();
						
					}//end TC_CSE_SEC_ACP_UPD_002
					
				}// end of group Update
				
				group Basic_Operations {
				
					group g_CSE_SEC_ACP_001{
						
						/**
						 * @desc Check that the IUT responds with an error when an ORIGINATOR tries an OPERATION without having privileges for performing the OPERATION on the TARGET_RESOURCE_TYPE resource.
						 * 
						 */
						testcase TC_CSE_SEC_ACP_001_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_001(m_createContainerBase));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_001_CRE
	
						testcase TC_CSE_SEC_ACP_001_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;

							v_ae1.start(f_CSE_SEC_ACP_001(v_updateRequest));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_001_UPD
	
						testcase TC_CSE_SEC_ACP_001_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_001(m_retrieve("Temporary", "Temporary")));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_001_RET
	
						testcase TC_CSE_SEC_ACP_001_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_001(m_delete("Temporary", "Temporary")));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_001_DEL
	
					} //end g_CSE_SEC_ACP_001
					
					group g_CSE_SEC_ACP_002{
						
						/**
						 * @desc Check that the IUT responds successfully when the AE tries an OPERATION on its <AE> resource which has multiple accessControlPolicyID attribute
						 * 
						 */
						testcase TC_CSE_SEC_ACP_002_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_002(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_002_CRE
	
						testcase TC_CSE_SEC_ACP_002_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_002(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_002_UPD
	
						testcase TC_CSE_SEC_ACP_002_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_002(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_002_RET
	
						testcase TC_CSE_SEC_ACP_002_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_002(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_002_DEL
	
					} //end g_CSE_SEC_ACP_002
					
					group g_CSE_SEC_ACP_003 {
						 
						/**
						 * @desc Check that the IUT responds successfully when an allowed DOMAIN tries an OPERATION on a AE_RESOURCE_TYPE resource.
						 * 
						 */
						testcase TC_CSE_SEC_ACP_003_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_003(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_003_CRE
						
						testcase TC_CSE_SEC_ACP_003_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;

							v_ae1.start(f_CSE_SEC_ACP_003(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_003_02
						
						testcase TC_CSE_SEC_ACP_003_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_003(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_003_03
						
						testcase TC_CSE_SEC_ACP_003_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_003(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_003_04
		
					}//end g_CSE_SEC_ACP_003
					
					group g_CSE_SEC_ACP_004 {
						
						/**
						 * @desc Check that the IUT responds successfully when any ORIGINATOR tries an OPERATION on a AE_RESOURCE_TYPE resource for which all originators are allowed
						 * 
						 */
						testcase TC_CSE_SEC_ACP_004_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_004(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_004_CRE
		
						testcase TC_CSE_SEC_ACP_004_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;

							v_ae1.start(f_CSE_SEC_ACP_004(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_004_UPD
		
						testcase TC_CSE_SEC_ACP_004_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_004(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_004_RET
		
						testcase TC_CSE_SEC_ACP_004_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_004(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_004_DEL
	
					}//end g_CSE_SEC_ACP_004
					
					group g_CSE_SEC_ACP_005 {
						
						/**
						 * @desc Check that the IUT responds successfully when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource and that the request is within accessControlTimeWindow context.
						 * 
						 */
						testcase TC_CSE_SEC_ACP_005_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_005(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_005_CRE
		
						testcase TC_CSE_SEC_ACP_005_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_005(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_005_UPD
		
						testcase TC_CSE_SEC_ACP_005_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_005(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_005_RET
		
						testcase TC_CSE_SEC_ACP_005_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_005(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_005_DEL
	
					}//end g_CSE_SEC_ACP_005
					
					group g_CSE_SEC_ACP_006 {
						
						/**
						 * @desc Check that the IUT responds with an error when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource out of accessControlTimeWindow context.
						 * 
						 */
						testcase TC_CSE_SEC_ACP_006_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_006(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_006_CRE
		
						testcase TC_CSE_SEC_ACP_006_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_006(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_006_UPD
		
						testcase TC_CSE_SEC_ACP_006_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_006(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_006_RET
		
						testcase TC_CSE_SEC_ACP_006_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_006(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_006_DEL
	
					}//end g_CSE_SEC_ACP_006

					group g_CSE_SEC_ACP_007 {
						
						/**
						 * @desc Check that the IUT responds successfully when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource and that the request is within accessControlLocationRegion context.
						 * 
						 */
						testcase TC_CSE_SEC_ACP_007_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_007(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_007_CRE
		
						testcase TC_CSE_SEC_ACP_007_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_007(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_007_UPD
		
						testcase TC_CSE_SEC_ACP_007_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_007(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_007_RET
		
						testcase TC_CSE_SEC_ACP_007_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_007(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_007_DEL
	
					}//end g_CSE_SEC_ACP_007
					
					group g_CSE_SEC_ACP_008 {
						
						/**
						 * @desc Check that the IUT responds with an error when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource out of accessControlLocationRegion context
						 * 
						 */
						testcase TC_CSE_SEC_ACP_008_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_008(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_008_CRE
		
						testcase TC_CSE_SEC_ACP_008_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_008(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_008_UPD
		
						testcase TC_CSE_SEC_ACP_008_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_008(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_008_RET
		
						testcase TC_CSE_SEC_ACP_008_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_008(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_008_DEL
	
					}//end g_CSE_SEC_ACP_008

					group g_CSE_SEC_ACP_009 {
						
						/**
						 * @desc Check that the IUT responds successfully when the AE tries an OPERATION on a TARGET_RESOURCE_TYPE resource and that the request is within accessControlIpAddresses context.
						 * 
						 */
						testcase TC_CSE_SEC_ACP_009_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_009(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_009_CRE
		
						testcase TC_CSE_SEC_ACP_009_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_009(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_009_UPD
		
						testcase TC_CSE_SEC_ACP_009_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_009(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_009_RET
		
						testcase TC_CSE_SEC_ACP_009_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_009(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_009_DEL
	
					}//end g_CSE_SEC_ACP_009
					
					group g_CSE_SEC_ACP_010 {
						
						/**
						 * @desc Check that the IUT responds with an error when the AE tries an OPERATION on a AE_RESOURCE_TYPE resource out of accessControlIpAddresses context.
						 * 
						 */
						testcase TC_CSE_SEC_ACP_010_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_010(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_010_CRE
		
						testcase TC_CSE_SEC_ACP_010_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateAeBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_updateRequest.primitiveContent.aE.labels := v_labels_1;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_010(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_010_UPD
		
						testcase TC_CSE_SEC_ACP_010_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_010(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_010_RET
		
						testcase TC_CSE_SEC_ACP_010_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_010(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_010_DEL
	
					}//end g_CSE_SEC_ACP_010

					group g_CSE_SEC_ACP_011 {
						
						/**
						 * @desc Check that the IUT responds successfully when the AE tries an OPERATION on its child <container> resource whose accessControlPolicyID attribute is not set and  AE has privileges for such OPERATION on its associated accessControlPolicy resource
						 * 
						 */
						testcase TC_CSE_SEC_ACP_011_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_011(m_createContainerBase, int2001));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_011_CRE
	
						testcase TC_CSE_SEC_ACP_011_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateContainerBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_updateRequest.primitiveContent.container.labels := v_labels_1;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_011(v_updateRequest, int2004));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_011_UPD
	
						testcase TC_CSE_SEC_ACP_011_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_011(m_retrieve("Temporary", "Temporary"), int2000));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_011_RET
	
						testcase TC_CSE_SEC_ACP_011_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_011(m_delete("Temporary", "Temporary"), int2002));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_011_DEL
	
					} //end g_CSE_SEC_ACP_011
					
					group g_CSE_SEC_ACP_012 {
						
						/**
						 * @desc Check that the IUT responds with an error when an ORIGINATOR tries an OPERATION on a <Container>  resource with no accessControlPolicyID associated and such ORIGINATOR having no privileges for performing the OPERATION on the <Container> resource.
						 * 
						 */
						testcase TC_CSE_SEC_ACP_012_CRE() runs on Tester system CseSystem { //Create
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_012(m_createContainerBase, int62));	
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_012_CRE
	
						testcase TC_CSE_SEC_ACP_012_UPD() runs on Tester system CseSystem { //Update
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
							var template RequestPrimitive v_updateRequest := m_updateContainerBase;
							var Labels v_labels_1:= {"VALUE_1"};
							v_updateRequest.primitiveContent.container.labels := v_labels_1;
							v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
							v_ae1.start(f_CSE_SEC_ACP_012(v_updateRequest, int59));
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_012_UPD
	
						testcase TC_CSE_SEC_ACP_012_RET() runs on Tester system CseSystem { //Retrieve
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_012(m_retrieve("Temporary", "Temporary"), int61));
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_012_RET
	
						testcase TC_CSE_SEC_ACP_012_DEL() runs on Tester system CseSystem { //Delete
							var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

							v_ae1.start(f_CSE_SEC_ACP_012(m_delete("Temporary", "Temporary"), int55));
							v_ae1.done;
						}//end TC_CSE_SEC_ACP_012_DEL
	
					} //end g_CSE_SEC_ACP_012
					
				}// end of Basic_Operations
				
			}//end group AccessControlPolicy
			
		}//end group Security
		
		group Discovery {
        	
			/**
			 * @desc Check that the IUT returns successfully a list all discovered resource addresses
			 * 
			 */
			testcase TC_CSE_DIS_001() runs on Tester system CseSystem {
					
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
										
				v_ae1.start(f_CSE_DIS_001());
							  	  	
				v_ae1.done;
							  	  		
			}
									
			function f_CSE_DIS_001() runs on AeSimu {
				// Local variables
				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_retrieveFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1));
				mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responseDiscovery)){
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": URI List Representation available");
					}
					[] 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 retrieving resource");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
					}
				 }	
								
				// Postamble
				f_cse_postamble_deleteResources();
				
				// Tear down
				f_cf01Down();
			} // end TC_CSE_DIS_001
			        		
			/**
			 * @desc Check that the IUT returns successfully appropriate list of discovered resource when the filter criteria is provided in the request
			 * 
			 */
			testcase TC_CSE_DIS_002() runs on Tester system CseSystem {
					
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
											
				v_ae1.start(f_CSE_DIS_002());
								  	  	
				v_ae1.done;
								  	  		
			}
										
			function f_CSE_DIS_002() runs on AeSimu {
				// Local variables
				var MsgIn v_response;
				var integer v_aeIndex := -1;
				var integer v_resourceIndex := -1;
				var RequestPrimitive v_request;
				var integer v_childResourceIndex := -1;
				const ResourceType c_containerResourceType := int3; 
				var Labels v_labels := {"VALUE_1"};
				var template RequestPrimitive v_createRequest := m_createContainerBase;

				// 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_createRequest.primitiveContent.container.labels := v_labels;
				v_childResourceIndex := f_cse_createResource(c_containerResourceType, v_createRequest, v_resourceIndex);
				v_request := valueof(m_retrieveFilterUsageOptionLabel(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1, v_labels));
				mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responseDiscovery)) -> value v_response {
						tc_ac.stop;
						if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.uRIList) == 1){
						  setverdict(pass, __SCOPE__ & ": List of discovered resources successfully returned");	
						}
						else
						{
						  setverdict(fail, __SCOPE__ & ": Wrong content available in URIList element");
						}
					}
					[] 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 retrieving resource");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
					}
				 }	
				
				// Postamble
				f_cse_postamble_deleteResources();

				// Tear down
				f_cf01Down();
			} // end TC_CSE_DIS_002
			        		
			/**
			 * @desc Check that the IUT returns the empty address list when no result matching with filter criteria is discovered
			 * 
			 */
			testcase TC_CSE_DIS_003() runs on Tester system CseSystem {
					
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
											
				v_ae1.start(f_CSE_DIS_003());
								  	  	
				v_ae1.done;
								  	  		
			}
										
			function f_CSE_DIS_003() runs on AeSimu {
				// Local variables
				var MsgIn v_response;
				var integer v_aeIndex := -1;
				var integer v_resourceIndex := -1;
				var RequestPrimitive v_request;
				var integer v_childResourceIndex := -1;
				const ResourceType c_containerResourceType := int3; 
				var Labels v_labels := {"NotFoundLabel"};
			
				// 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_retrieveResourceFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1));
				v_request := valueof(m_retrieveFilterUsageOptionLabel(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1, v_labels));
				mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responseDiscovery)) -> value v_response {
						tc_ac.stop;
						if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.uRIList) == 0){
						  setverdict(pass, __SCOPE__ & ": No Content is present");	
						}
						else
						{
						  setverdict(fail, __SCOPE__ & ": Wrong content available in URIList element");
						}
					}
					[] 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 retrieving resource");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
					}
				 }	
							
				// Postamble
				f_cse_postamble_deleteResources();
			
				// Tear down
				f_cf01Down();
			} // end TC_CSE_DIS_003
		
			/**
			 * @desc Check that the IUT returns successfully a list of discovered resource addresses with Non-hierarchical addressing form when the Discovery Result Type is provided in the request
			 *  
			 */
			testcase TC_CSE_DIS_004() runs on Tester system CseSystem {
					
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
											
				v_ae1.start(f_CSE_DIS_004());
								  	  	
				v_ae1.done;
								  	  		
			}
										
			function f_CSE_DIS_004() runs on AeSimu {
				// Local variables
				var MsgIn v_response;
				var integer v_aeIndex := -1;
				var integer v_resourceIndex := -1;
				var RequestPrimitive v_request;
				var integer v_childResourceIndex := -1;
				const ResourceType c_containerResourceType := int3; 
				var integer v_i_cont := 0;
				
				// 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_retrieveDiscResTypeFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int2, int1));
				mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responseDiscovery)) -> value v_response {
						tc_ac.stop;
						while (v_i_cont<lengthof(v_response.primitive.responsePrimitive.primitiveContent.uRIList)){
							if (f_isNonHierarchical(v_response.primitive.responsePrimitive.primitiveContent.uRIList[v_i_cont])) {
							  setverdict(pass, __SCOPE__ & ": Non-hierarchical address form present in URIList[" & int2str(v_i_cont) & "] element");
							} else {
							  setverdict(fail, __SCOPE__ & ": Non-hierarchical address form absent in URIList[" & int2str(v_i_cont) & "] element"); 
							}
							v_i_cont := v_i_cont + 1;
						}
					}
					[] 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 retrieving resource");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
					}
				 }	
								
				// Postamble
				f_cse_postamble_deleteResources();
				
				// Tear down
				f_cf01Down();
			} // end TC_CSE_DIS_004
							
			/**
			 * @desc Check that the IUT rejects the discovery requests to the resource TARGET_RESOURCE_ADDRESS when AE has no privilege to perform the discovery request for the resource TARGET_RESOURCE_ADDRESS
			 * 
			 */
			testcase TC_CSE_DIS_005() runs on Tester system CseSystem {
					
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
											
				v_ae1.start(f_CSE_DIS_005());
								  	  	
				v_ae1.done;
								  	  		
			}
										
			function f_CSE_DIS_005() runs on AeSimu {
				// Local variables
				var integer v_aeIndex := -1;
				var integer v_resourceIndex := -1;
				var RequestPrimitive v_request;
				var integer v_childResourceIndex := -1;
				var integer v_acpAuxIndex := -1;
				const ResourceType c_containerResourceType := int3; 
				
				// 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();
	
				// Test adapter configuration
	
				// Preamble
				v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int31);//c_CRUDN)
				
				v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)});//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_retrieveFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1));
				mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))) {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Access denied to discovery operation for resource " & f_getResourceAddress(v_resourceIndex));
					}
					[] 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__ & ": Discovering " & f_getResourceAddress(v_resourceIndex) & " without having privileges");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while discovering resource");
					}
				 }	
								
				// Postamble
				f_cse_postamble_deleteResources();
				
				// Tear down
				f_cf01Down();
			} // end TC_CSE_DIS_005
        							
			/**
			 * @desc Check that the IUT responds with an error when the AE sends requests to discover the resource TARGET_RESOURCE_ADDRESS which does not exist in the Hosting CSE
			 * 
			 */
			testcase TC_CSE_DIS_006() runs on Tester system CseSystem {
					
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
											
				v_ae1.start(f_CSE_DIS_006());
								  	  	
				v_ae1.done;
								  	  		
			}
										
			function f_CSE_DIS_006() runs on AeSimu {
				// Local variables
				var MsgIn v_response;
				var integer v_aeIndex := -1;
				var integer v_resourceIndex := -1;
				var RequestPrimitive v_request;
				var XSD.ID v_resourceId := "nonexisting";
			
				// Test control

				// Test component configuration
				f_cf01Up();

				// Test adapter configuration

				// Preamble
				v_aeIndex := f_cse_preamble_registerAe();//AE1 is registred;
				
				if(PX_ADDRESSING_METHOD == e_nonHierarchical and (PX_PRIMITIVE_SCOPE == e_cseRelative)) {
					v_request := valueof(m_retrieveFilterUsageOption(v_resourceId, f_getOriginator(v_aeIndex), int1));
				} else {
					v_request := valueof(m_retrieveFilterUsageOption(f_getResourceAddress(v_aeIndex) & "/" & v_resourceId, f_getOriginator(v_resourceIndex), int1));
				}
			
				mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
				tc_ac.start;
				alt {
				
					[] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Resource not found");
					}
					[] 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__ & ": 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 TC_CSE_DIS_006
		
			/**
			 * @desc Check that the IUT responds the originator with an error when the originator sends a request including an invalid format of filter criteria to discover the resource TARGET_RESOURCE_ADDRESS 
			 * 
			 */
			testcase TC_CSE_DIS_007() runs on Tester system CseSystem {
					
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
											
				v_ae1.start(f_CSE_DIS_007());
								  	  	
				v_ae1.done;
								  	  		
			}
										
			function f_CSE_DIS_007() runs on AeSimu {
				// Local variables
				var MsgIn v_response;
				var integer v_aeIndex := -1;
				var integer v_resourceIndex := -1;
				var RequestPrimitive v_request;
				var integer v_childResourceIndex := -1;
				const ResourceType c_containerResourceType := int3; 
				var AttributeAux v_invalidAttribute;
			
				// 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_retrieveFilterUsageOption(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex), int1));
				v_invalidAttribute := {name := "filterCriteria.sizeBelow", value_ := "-1"};
				mcaPort.send(f_getMsgOutPrimitive(m_request(v_request, {v_invalidAttribute})));
				tc_ac.start;
				alt {
				
					[] mcaPort.receive(mw_response(mw_responsePrimitive(int4102))) -> value v_response {
						tc_ac.stop;
						setverdict(pass, __SCOPE__ & ": Contents Unacceptable");
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { 
						tc_ac.stop;
						setverdict(fail, __SCOPE__ & ": Wrong response status code while retrieving resource");
					}
					[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { 
						tc_ac.stop;
						setverdict(fail, __SCOPE__ & ": Wrong response while retrieving resource");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
					}
				 }	
							
				// Postamble
				f_cse_postamble_deleteResources();
			
				// Tear down
				f_cf01Down();
			} // end TC_CSE_DIS_007	
				
			group g_CSE_DIS_008{
			
				/**
				 * @desc Check that the IUT responds the originator with an error when the originator sends a request to discover the resource TARGET_RESOURCE_ADDRESS including two conflicted filter criteria of different type FILTER_CRITERIA_CONDITION_1 and FILTER_CRITERIA_CONDITION_2 (E.G. createBefore < createdAfter)
				 * 
				 */
				testcase TC_CSE_DIS_008_CRB_CRA() runs on Tester system CseSystem {
					
					//Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
					var FilterCriteria v_filterCriteria := valueof(m_filterCriteria);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
					v_filterCriteria.createdBefore := "20171231T012345";
					v_filterCriteria.createdAfter := "20181231T012345";
					v_filterCriteria.filterUsage := int1;
					
					v_ae1.start(f_CSE_DIS_008(v_filterCriteria));
					v_ae1.done;
					
				}
					
				testcase TC_CSE_DIS_008_MS_US() runs on Tester system CseSystem {
					
					//Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
					var FilterCriteria v_filterCriteria := valueof(m_filterCriteria);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
					v_filterCriteria.unmodifiedSince := "20171231T012345";
					v_filterCriteria.modifiedSince := "20181231T012345";
					v_filterCriteria.filterUsage := int1;
	
					v_ae1.start(f_CSE_DIS_008(v_filterCriteria));
					v_ae1.done;
	
				}
				
				testcase TC_CSE_DIS_008_STS_STB() runs on Tester system CseSystem {
					
					//Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
					var FilterCriteria v_filterCriteria := valueof(m_filterCriteria);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
					v_filterCriteria.stateTagSmaller := 1;
					v_filterCriteria.stateTagBigger := 2;
					v_filterCriteria.filterUsage := int1;
	
					v_ae1.start(f_CSE_DIS_008(v_filterCriteria));
					v_ae1.done;
	
				}
				
				testcase TC_CSE_DIS_008_EXB_EXA() runs on Tester system CseSystem {
					
					//Local variables
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
					var FilterCriteria v_filterCriteria := valueof(m_filterCriteria);
					v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
					v_filterCriteria.expireBefore := "20171231T012345";
					v_filterCriteria.expireAfter := "20181231T012345";
					v_filterCriteria.filterUsage := int1;

					v_ae1.start(f_CSE_DIS_008(v_filterCriteria));
					v_ae1.done;

				}
					
			}	// end TC_CSE_DIS_008
			
			/**
			 * @desc Check that the IUT returns the empty address list when resources match the filter criteria but they do not include DISCOVERY permission
			 * 
			 */
			testcase TC_CSE_DIS_009() runs on Tester system CseSystem {
					
				var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
											
				v_ae1.start(f_CSE_DIS_009());
								  	  	
				v_ae1.done;
								  	  		
			}
										
			function f_CSE_DIS_009() runs on AeSimu {
				// Local variables
				var MsgIn v_response;
				var integer v_aeIndex := -1;
				var integer v_resourceIndex := -1;
				var integer v_acpAuxIndex := -1;
				var RequestPrimitive v_request;
				const ResourceType c_containerResourceType := int3; 
				var Labels v_labels := {"VALUE_1"};
				var template RequestPrimitive v_createRequest := m_createContainerBase;

				// Test control

				// Test component configuration
				f_cf01Up();

				// Test adapter configuration

				// Preamble
				v_acpAuxIndex := f_cse_preamble_createAcpAux(-, -);//c_CRUDNDi)
				
				//v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)});
				v_aeIndex := f_cse_preamble_registerAe();
				
				f_cse_updateAcpAuxResource(int31); //Not include DISCOVERY permission

				v_createRequest.primitiveContent.container.accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)};
				v_createRequest.primitiveContent.container.labels := v_labels;
				v_resourceIndex := f_cse_createResource(c_containerResourceType, v_createRequest, v_aeIndex);
				
				v_request := valueof(m_retrieveFilterUsageOptionLabel(f_getResourceAddress(v_aeIndex), f_getOriginator(v_resourceIndex), int1, v_labels));
				mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
				tc_ac.start;
				alt {
					[] mcaPort.receive(mw_response(mw_responseDiscovery)) -> value v_response {
						tc_ac.stop;
						if(ispresent(v_response.primitive.responsePrimitive.primitiveContent)){
						  setverdict(fail, __SCOPE__ & ": Content is not empty");	
						}
						else
						{
						  setverdict(pass, __SCOPE__ & ": Content is empty");
						}
					}
					[] 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 retrieving resource");
					}
					[] tc_ac.timeout {
						setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
					}
				 }	
	
				// Postamble
				f_cse_postamble_deleteResources();

				// Tear down
				f_cf01Down();
			} // end TC_CSE_DIS_009
				
		} //end group Group Discovery

		group Group_Managment {
        
			group Create {
                
				/**
				 * @desc Check that the IUT rejects the creation of the group resource when member ID exceed max number of members. 
				 * 
				 */
				testcase TC_CSE_GMG_CRE_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
											
					v_ae1.start(f_CSE_GMG_CRE_001());
								  	  	
					v_ae1.done;
								  	  		
				}
										
				function f_CSE_GMG_CRE_001() runs on AeSimu {
					// Local constants
					const XSD.NonNegativeInteger c_maxNrOfMembers := 1;
					
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_containerIndex_1, v_containerIndex_2 := -1;
					var RequestPrimitive v_request;
					var ListOfURIs v_memberIDs;             
					var template RequestPrimitive v_createRequest;
					var template RequestPrimitive v_createContainerRequest_1 := m_createContainer_noResourceName;
					var template RequestPrimitive v_createContainerRequest_2 := m_createContainer_noResourceName;
					
					//  Test control
                    
					// Test component configuration
					f_cf01Up();
                    
					// Test adapter configuration
                                        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
                    
					v_containerIndex_1 := f_cse_createResource(int3, v_createContainerRequest_1, v_aeIndex); // AE child resource
					v_containerIndex_2 := f_cse_createResource(int3, v_createContainerRequest_2, v_aeIndex); // AE child resource
					
					v_memberIDs := {f_getResourceId(vc_resourcesList[v_containerIndex_1].resource), f_getResourceId(vc_resourcesList[v_containerIndex_2].resource)};
					
					v_createRequest := valueof(m_createGroup(c_maxNrOfMembers, v_memberIDs, omit, int3));
                                
					// Test Body
					v_request := f_getCreateRequestPrimitive(int9, v_createRequest, v_aeIndex);
                
                                                                         
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int6010))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Creation failed because member ID exceed max number of member");
						}
						[] 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 resource created while member ID exceed max number of member");
						}
						[] 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();
                    
				}
            
				/**
				 * @desc Check that the IUT rejects the creation of the group resource when the memberType cannot be retrieved due to lack of privilege.
				 * 
				 */
				testcase TC_CSE_GMG_CRE_002() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
					v_ae1.start(f_CSE_GMG_CRE_002());
									  	  	
					v_ae1.done;
									  	  		
				}
											
				function f_CSE_GMG_CRE_002() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_acpIndex := -1;
					var RequestPrimitive v_request;
					var template RequestPrimitive v_containerCreateRequest := m_createContainerBase;
					var template RequestPrimitive v_createRequest;
					var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyACP", -, int61); //c_CUDNDi
                	
					// 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_containerCreateRequest.primitiveContent.container.accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[v_acpIndex].resource)};
					v_containerIndex := f_cse_createResource(int3, v_containerCreateRequest, v_aeIndex); // AE child resource
					
					v_createRequest := m_createGroup(1, {f_getResourceId(vc_resourcesList[v_containerIndex].resource)}, omit, int3);
					v_request := f_getCreateRequestPrimitive(int9, v_createRequest, v_aeIndex);	// creating group
                	                		   
					// Test Body
                	
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int5105))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": creation failed due to lack of privilege");                            
						}
						[] 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 creation successful while doesn't have privileges for retrieving resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while retrieving 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();        
				}
                
				/**
				 * @desc Check that the IUT detects the presence of duplicate member IDs during the creation of the  <group> resource and removes the duplicate member IDs prior to creation of the <group> resource. 
				 *
				 */
				testcase TC_CSE_GMG_CRE_003() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
					v_ae1.start(f_CSE_GMG_CRE_003());
									  	  	
					v_ae1.done;
									  	  		
				}
											
				function f_CSE_GMG_CRE_003() runs on AeSimu {                   
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var RequestPrimitive v_createRequest;
					var XSD.AnyURI v_memberID;
                    
					// Test control
                    
					// Test component configuration
					f_cf01Up();
                    
					// Test adapter configuration
                                        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi.
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); // AE child resource
					v_memberID :=  f_getResourceId(vc_resourcesList[v_containerIndex].resource);
					v_createRequest := valueof(m_createGroup(2, {v_memberID, v_memberID}, omit, int3));
					v_createRequest := f_getCreateRequestPrimitive(int9, v_createRequest, v_aeIndex);
            		
					// Test Body                                              
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_createRequest)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource created successfully");
						
							if(not match({v_memberID}, v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs)){
								setverdict(fail, __SCOPE__ & ": Error, presence of duplicate member IDs ");
							}
							if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs) != 1) {
							   setverdict(fail, __SCOPE__ & ": Error, wrong number of memberIDs attribute");      
							} 
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							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();
                    
				}
            				
				/**
				 * @desc Check that the IUT validates the resource type during the creation of the  <group> resource when memberType attribute is not ‘mixed’. 
				 */
				testcase TC_CSE_GMG_CRE_004() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
					v_ae1.start(f_CSE_GMG_CRE_004());
									  	  	
					v_ae1.done;
									  	  		
				}
											
				function f_CSE_GMG_CRE_004() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_createRequest;
					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(); //c_CRUDNDi
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); // AE child resource
					v_createRequest := valueof(m_createGroup(2, {f_getResourceId(vc_resourcesList[v_containerIndex].resource)}, omit, int3)); //Member type is set to Container
					v_createRequest := f_getCreateRequestPrimitive(int9, v_createRequest, v_aeIndex);
                	
					// Test Body       
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_createRequest)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource created successfully");
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated)){
								setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not provided");
							}
							else {
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated == false){
									setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not correct");
								}
							}     
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							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();
                                        
				}
            
			   /**
				* @desc Check that the IUT handles unsuccessful validation of the resource type during the creation of the  <group> resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is SET_MIXED.
				* 
				*/
				testcase TC_CSE_GMG_CRE_005() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
					v_ae1.start(f_CSE_GMG_CRE_005());
									  	  	
					v_ae1.done;
									  	  		
				}
											
				function f_CSE_GMG_CRE_005() runs on AeSimu {
					//Local variables
					var MsgIn v_response;
					var RequestPrimitive v_createRequest;
					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(); //c_CRUDNDi
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); // AE child resource
					v_createRequest := valueof(m_createGroup(2, {f_getResourceId(vc_resourcesList[v_containerIndex].resource)}, omit, int2, int3)); //Member type is set to AE and consistencyStrategy is set to MIXED
					v_createRequest := f_getCreateRequestPrimitive(int9, v_createRequest, v_aeIndex);                                                            
                    
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_createRequest)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource created successfully");
							
							// check for memberTypeValidated
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated)){
								setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not provided");
							}
							else {
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated == false){
									setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not correct");
								}
							}
							// check for memberType (MIXED)
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberType)){
								setverdict(fail, __SCOPE__ & ": Error, memberType attribute not provided");
							} 
							else {
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberType != int0){ 
									setverdict(fail, __SCOPE__ & ": Error, memberType attribute not correct");
								}
							}
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							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();                   
                    
				}
                
			   /**
				* @desc Check that the IUT handles unsuccessful validation of the resource type during the creation of the  <group> resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is ABANDON_MEMBER,.
				* 
				*/
				testcase TC_CSE_GMG_CRE_006() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
					v_ae1.start(f_CSE_GMG_CRE_006());
									  	  	
					v_ae1.done;
									  	  		
				}
											
				function f_CSE_GMG_CRE_006() runs on AeSimu {
					//Local variables
					var MsgIn v_response;
					var RequestPrimitive v_createRequest;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_groupIndex := -1;
					var ListOfURIs v_memberIDs;
                
					// Test control
                    
					// Test component configuration
					f_cf01Up();
                    
					// Test adapter configuration
                                        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
					v_containerIndex := f_cse_createResource(int3, m_createContainer("NotInitialized", "MyContainer"), v_aeIndex);
					v_groupIndex :=  f_cse_createResource(int9, m_createGroupBase, v_aeIndex);
					v_memberIDs := {f_getResourceId(vc_resourcesList[v_groupIndex].resource), f_getResourceId(vc_resourcesList[v_containerIndex].resource)};
					v_createRequest := valueof(m_createGroup(2, v_memberIDs, omit, int3, -, -, -)); //Member type is set to container and consistencyStrategy is set to ABANDON MEMBER (default value)
					v_createRequest := f_getCreateRequestPrimitive(int9, v_createRequest, v_aeIndex);                                                       
                    
					// Test Body               
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_createRequest)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Resource created successfully");
							
							// check for memberTypeValidated
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated)){
								setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not provided");
							} else {
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated == false){
									setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not correct");
								}
							}
							// check for membersId
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs)){
								setverdict(fail, __SCOPE__ & ": Error, memberIDs attribute not provided");
							} 
							else {
								if(not match({f_getResourceId(vc_resourcesList[v_containerIndex].resource)}, v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs)){
									setverdict(fail, __SCOPE__ & ": Error, memberIDs attribute not correct");
								}
							}
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
							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();                    
                    
				}

                
				/**
				 * @desc Check that the IUT handles unsuccessful validation of the resource type during the creation of the group resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is ABANDON_GROUP.
				 * 
				 */
				testcase TC_CSE_GMG_CRE_007() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
					v_ae1.start(f_CSE_GMG_CRE_007());
									  	  	
					v_ae1.done;
									  	  		
				}
											
				function f_CSE_GMG_CRE_007() runs on AeSimu {
					//Local variables
					var MsgIn v_response;
					var RequestPrimitive v_createRequest;
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_groupIndex := -1;
					var ListOfURIs v_memberIDs;

					// Test control
    
					// Test component configuration
					f_cf01Up();
    
					// Test adapter configuration
                        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
					v_containerIndex := f_cse_createResource(int3, m_createContainer("NotInitialized", "MyContainer"), v_aeIndex);
					v_groupIndex :=  f_cse_createResource(int9, m_createGroupBase, v_aeIndex);
					v_memberIDs := {f_getResourceId(vc_resourcesList[v_groupIndex].resource), f_getResourceId(vc_resourcesList[v_containerIndex].resource)};
					v_createRequest := valueof(m_createGroup(2, v_memberIDs, omit, int3, int2, -, -)); //Member type is set to container and consistencyStrategy is set to ABANDON GROUP
					v_createRequest := f_getCreateRequestPrimitive(int9, v_createRequest, v_aeIndex);                                                       
                    
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_createRequest)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4110))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": unsuccessful validation of the resource type during the creation of the group");
						}
						[] 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 create succesfull while the operation should be aborted");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource");
						}
					}
                    
					// Postamble
					f_cse_postamble_deleteResources();
                    
					// Tear down
					f_cf01Down();
					
				}
                                    
			} // end group Create
			
			group Retrieve {
            	
				/**
				 * @desc Check that the IUT generates a request primitive for each resource in memberIDs with a relative address appended to fanOutPoint that includes a virtual resource.
				 * 
				 */
				testcase TC_CSE_GMG_RET_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
					v_ae1.start(f_CSE_GMG_RET_001());
									  	  	
					v_ae1.done;
									  	  		
				}
											
				function f_CSE_GMG_RET_001() runs on AeSimu {
					//Local constants
					const integer c_numberOfResponsePrimitive := 2;

					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex_1, v_acpIndex, v_containerIndex_1, v_containerIndex_2, v_groupIndex, v_contentInstanceIndex_1, v_contentInstanceIndex_2 := -1;
					var integer i;
					var ListOfURIs v_memberIDs;
					var ListOfURIs v_membersAcpIds;
					var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyACP", -, -);
					var template PrimitiveContent v_contentResponse;
					var XSD.AnyURI v_fanoutPointAddress;
					var RequestPrimitive v_containerRequestPrimitive := valueof(m_createContainer_noResourceName);
		
					v_contentResponse.contentInstance := mw_contentContentInstanceBase;
		
					// Test control
					if(not(PICS_ACP_SUPPORT)) {
						setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
						stop;
					}

					// Test component configuration
					f_cf01Up();

					// Test adapter configuration

					// Preamble
					v_aeIndex_1 := f_cse_preamble_registerAe(-, -); //c_CRUDNDi
					v_acpIndex := f_cse_createResource(int1, v_createAcp, -1); // AE child resource
					v_containerRequestPrimitive := f_setAcpId(v_containerRequestPrimitive, {f_getResourceId(vc_resourcesList[v_acpIndex].resource)});
					v_containerIndex_1 := f_cse_createResource(int3, v_containerRequestPrimitive, v_aeIndex_1); // AE1 child resource
					v_containerIndex_2 := f_cse_createResource(int3, v_containerRequestPrimitive, v_aeIndex_1); // AE2 child resource
					v_contentInstanceIndex_1 := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex_1); // Container_1 child resource
					v_contentInstanceIndex_2 := f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex_2); // Container_2 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), -1);
   
					v_fanoutPointAddress := f_getResourceAddress(v_groupIndex) & "/" & c_resourceShortNameFanOutPoint & "/" & c_resourceShortNameLatest;
					
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(v_fanoutPointAddress, f_getOriginator(v_aeIndex_1))))); //TODO see if it is correct or if we have to use PX_SUPER_ADMIN
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": creation successfull by using fanOutPoint in group resource");
    
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list)){
								setverdict(fail, __SCOPE__ & ": Error, aggregatedResponse attribute not provided");
							}
							else{
								if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list) != c_numberOfResponsePrimitive){
									setverdict(fail, __SCOPE__ & ": Error, length of aggregatedResponse is not valid");
								}
								else{
									for(i:=0; i<c_numberOfResponsePrimitive; i:=i+1){
										if(not match(v_response.primitive.responsePrimitive.primitiveContent.aggregatedResponse.responsePrimitive_list[i].primitiveContent, v_contentResponse)){
											setverdict(fail, __SCOPE__ & ": Error, aggregatedResponse doesn't match with template expected");
										}
									}
								}
							}                            
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Wrong response status code");
						}
						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
							tc_ac.stop;
							setverdict(fail, __SCOPE__ & ": Error while creating resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource");
						}
					}

					// Postamble
					f_cse_postamble_deleteResources();

					// Tear down
					f_cf01Down();                    

				} // end TC_CSE_GMG_RET_001

			} // end group Retrieve

			group Update {
            	
			   /**
				* @desc Check that the IUT rejects the update of the  group resource when the memberType cannot be retrieved due to lack of privilege.
				* 
				*/
				testcase TC_CSE_GMG_UPD_001() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
												
					v_ae1.start(f_CSE_GMG_UPD_001());
									  	  	
					v_ae1.done;
									  	  		
				}
											
				function f_CSE_GMG_UPD_001() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_containerIndex_1 := -1;
					var integer v_containerIndex_2 := -1;
					var integer v_acpIndex := -1;
					var integer v_groupIndex := -1;
					var RequestPrimitive v_request;
					var template RequestPrimitive v_containerCreateRequest := m_createContainer_noResourceName;
					var template RequestPrimitive v_updateRequest := m_updateGroupBase;
					var template RequestPrimitive v_createAcp := m_createAcp("NotInitialized", "MyAcp", -, int61); //c_CUDNDi
                
					// 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_groupIndex := f_cse_createResource(int9, m_createGroup(2, {f_getResourceId(vc_resourcesList[v_containerIndex_1].resource)}, omit, int3, -, - , -), v_aeIndex);
					
					v_containerCreateRequest := f_setAcpId(v_containerCreateRequest, {f_getResourceId(vc_resourcesList[v_acpIndex].resource)});
					v_containerIndex_2 := f_cse_createResource(int3, v_containerCreateRequest, v_aeIndex); // AE child resource
					
					v_updateRequest.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_containerIndex_2].resource)};
					v_request := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateRequest);	// creating group
                	    
					// Test Body
                	
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int5105))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": Update failed due to lack of privilege");                            
						}
						[] 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 update successful while doesn't have privileges for retrieving resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						}
					}
                					
					// Postamble
					f_cse_postamble_deleteResources();
                	
					// Tear down
					f_cf01Down();             
				}

			   
			   /**
				* @desc Check that the IUT detects the presence of duplicate member IDs during an update of the  <group> resource and removes the duplicate member IDs prior to updating the <group> resource. 
				*  
				*/
			  testcase TC_CSE_GMG_UPD_002() runs on Tester system CseSystem {
					
				  var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
													
				  v_ae1.start(f_CSE_GMG_UPD_002());
										  	  	
				  v_ae1.done;
										  	  		
			  }
												
			  function f_CSE_GMG_UPD_002() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_containerIndex_1 := -1;
					var integer v_containerIndex_2 := -1;
					var integer v_groupIndex := -1;
					var RequestPrimitive v_updateRequest := valueof(m_updateGroupBase);
					var XSD.AnyURI v_memberId_1;
					var XSD.AnyURI v_memberId_2;
					var PrimitiveContent v_primitiveContentRetrievedResource;
					
					// Test control
                    
					// Test component configuration
					f_cf01Up();
                
					// Test adapter configuration
                    
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
					v_containerIndex_1 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
					v_containerIndex_2 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
					v_memberId_1 :=  f_getResourceId(vc_resourcesList[v_containerIndex_1].resource);
					v_memberId_2 :=  f_getResourceId(vc_resourcesList[v_containerIndex_2].resource);
					v_groupIndex := f_cse_createResource(int9, m_createGroup(2, {v_memberId_1, v_memberId_2}, omit, int3, -, -, -), v_aeIndex); // AE child resource
					
					v_updateRequest.primitiveContent.group_.memberIDs := {v_memberId_2, v_memberId_2}; 
					v_updateRequest := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateRequest);
					
					//Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));
					tc_ac.start;
					alt {
						 [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
							 tc_ac.stop;
							 setverdict(pass, __SCOPE__ & ": update successful"); 
     
							// check for membersId
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs)){
								setverdict(fail, __SCOPE__ & ": Error, memberIDs attribute not provided");
							} 
							else {
								if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs) != 1) {
								   setverdict(fail, __SCOPE__ & ": Error, wrong number of memberIDs attribute");      
								}                               
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs[0] != v_memberId_2){
									setverdict(fail, __SCOPE__ & ": Error, memberIDs attribute not correct");
								}
							}
						 }
						 [] 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 updating resource");
						 }
						 [] tc_ac.timeout {
							 setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						 }
					 }
                    
					 v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_groupIndex);
					 if(getverdict == pass){ 
						 if(ischosen(v_primitiveContentRetrievedResource.group_)){
							if(v_primitiveContentRetrievedResource.group_.memberIDs[0] != v_memberId_2){
								setverdict(fail, __SCOPE__ & ": Error, memberIDs attribute not updated");
							}
						  }
					 }
                    
					//Postamble
					f_cse_postamble_deleteResources();
    
					// Tear down
					f_cf01Down();
				}
                
				/**
				 * @desc Check that the IUT validates the resource type during an UPDATE of the  <group> resource when memberType attribute is not ‘mixed’. 
				 * 
				 */
				testcase TC_CSE_GMG_UPD_003() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
													
					v_ae1.start(f_CSE_GMG_UPD_003());
										  	  	
					v_ae1.done;
										  	  		
				}
												
				function f_CSE_GMG_UPD_003() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var integer v_aeIndex := -1;
					var integer v_containerIndex_1 := -1;
					var integer v_containerIndex_2 := -1;
					var integer v_groupIndex := -1;
					var RequestPrimitive v_updateRequest := valueof(m_updateGroupBase);
					var PrimitiveContent v_primitiveContentRetrievedResource;
					
					// Test control
                    
					// Test component configuration
					f_cf01Up();
                
					// Test adapter configuration
                    
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
					v_containerIndex_1 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
					v_containerIndex_2 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
					v_groupIndex := f_cse_createResource(int9, m_createGroup(2, {f_getResourceId(vc_resourcesList[v_containerIndex_1].resource)}, omit, int3, -, -, -), v_aeIndex);
					
					v_updateRequest.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_containerIndex_2].resource)};
					v_updateRequest := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateRequest);
					
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));// TODO see if the memberTypeValidated is present in the update response
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": update successful"); 
                             
							 if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated)) {
								setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not provided");    
							 } 
							 else {
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated == false) {
									setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated wrong value");  
								}
							 }
						}
						[] 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 updating resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						}
					 }
        
					v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_groupIndex);
					if(getverdict == pass){ 
						 if(ischosen(v_primitiveContentRetrievedResource.group_)){
							if(v_primitiveContentRetrievedResource.group_.memberTypeValidated == false){
								setverdict(fail, __SCOPE__ & ": Error,  memberTypeValidated attribute not updated");
							}
						  }
					 } 
        
					//Postamble
					f_cse_postamble_deleteResources();
    
					// Tear down
					f_cf01Down();
				}
              
			   /**
				* @desc Check that the IUT handles unsuccessful validation of the resource type during an UPDATE of the <group> resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is SET_MIXED. 
				* 
				*/
				testcase TC_CSE_GMG_UPD_004() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
													
					v_ae1.start(f_CSE_GMG_UPD_004());
										  	  	
					v_ae1.done;
										  	  		
				}
												
				function f_CSE_GMG_UPD_004() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_updateRequest := valueof(m_updateGroupBase);
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_groupIndex := -1;
					var integer v_subGroupIndex := -1;
					var XSD.AnyURI v_memberId_1;
					var XSD.AnyURI v_memberId_2;
					var PrimitiveContent v_primitiveContentRetrievedResource;
                
					// Test control
        
					// Test component configuration
					f_cf01Up();
    
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
					v_subGroupIndex :=  f_cse_createResource(int9, m_createGroupBase, v_aeIndex);
					v_memberId_1 := f_getResourceId(vc_resourcesList[v_containerIndex].resource);
					v_memberId_2 := f_getResourceId(vc_resourcesList[v_subGroupIndex].resource);
					v_groupIndex := f_cse_createResource(int9, m_createGroup(2, {v_memberId_1}, omit, int3, int3, -, -), v_aeIndex); //Member type is set to Container (int3) and consistencyStrategy is set to MIXED (int3)
                	
					v_updateRequest.primitiveContent.group_.memberIDs := {v_memberId_1, v_memberId_2};
					v_updateRequest := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateRequest);
					
					// Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));// TODO see if the memberTypeValidated is present in the update response
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": update successful");                              
                             
							//memberTypeValidated attribute set to FALSE
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated)) {
								setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not provided");    
							}
							else {
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated != true) {
									setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated must be TRUE");
								}
							}
                                
							//memberType attribute set to MIXED
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberType)) {
								setverdict(fail, __SCOPE__ & ": Error, memberType attribute not provided");    
							}
							else {
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberType != int0) { //Mixed is int0 in release 2 and int24 in release 1
									setverdict(fail, __SCOPE__ & ": Error, memberType was not set to MIXED");
								}
							}
                                
						}
						[] 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 retrieving resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
						}
					}
        
					v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_groupIndex);
					if(getverdict == pass){ 
						 if(ischosen(v_primitiveContentRetrievedResource.group_)){
							if(v_primitiveContentRetrievedResource.group_.memberTypeValidated == false){
								setverdict(fail, __SCOPE__ & ": Error,  memberTypeValidated attribute not updated");
							}
							
							if(v_primitiveContentRetrievedResource.group_.memberType != int0){
								setverdict(fail, __SCOPE__ & ": Error,  memberType attribute not set to MIXED");
							}
						  }
					 }
        
					//Postamble
					f_cse_postamble_deleteResources();
    
					// Tear down
					f_cf01Down();
				}
      
				/**
				 * @desc Check that the IUT handles unsuccessful validation of the resource type during an UPDATE of the group resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is ABANDON_MEMBER.
				 * 
				 */
				testcase TC_CSE_GMG_UPD_005() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
													
					v_ae1.start(f_CSE_GMG_UPD_005());
										  	  	
					v_ae1.done;
										  	  		
				}
												
				function f_CSE_GMG_UPD_005() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_updateRequest := valueof(m_updateGroupBase);
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_groupIndex := -1;
					var integer v_subGroupIndex := -1;
					var XSD.AnyURI v_memberId_1;
					var XSD.AnyURI v_memberId_2;
					var PrimitiveContent v_primitiveContentRetrievedResource;
                
					// Test control
        
					// Test component configuration
					f_cf01Up();
    
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
					v_subGroupIndex :=  f_cse_createResource(int9, m_createGroupBase, v_aeIndex);
					v_memberId_1 := f_getResourceId(vc_resourcesList[v_containerIndex].resource);
					v_memberId_2 := f_getResourceId(vc_resourcesList[v_subGroupIndex].resource);
					v_groupIndex := f_cse_createResource(int9, m_createGroup(2, {v_memberId_1}, omit, int3, omit), v_aeIndex);  //Member type is set to Container (int3) and consistencyStrategy is set to ABANDON MEMBER (default value)
                	
					v_updateRequest.primitiveContent.group_.memberIDs := {v_memberId_2, v_memberId_1};
					v_updateRequest := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateRequest);
					
					//Test Body
                    
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": update successful"); 
                                                          
							//memberTypeValidated attribute set to TRUE
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated)) {
								setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not provided");    
							} 
							else {
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated != true) {
									setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated must be TRUE");
								}
							}

							//memberIDs attribute set to v_memberID1
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs)){
								setverdict(fail, __SCOPE__ & ": Error, memberIDs attribute not provided");
							}
							else {                               
								if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs) != 1) {
								   setverdict(fail, __SCOPE__ & ": Error, wrong number of memberIDs attribute");      
								}                               
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs[0] != v_memberId_1){
									setverdict(fail, __SCOPE__ & ": Error, memberIDs attribute not correct");
								}
							}                                   
						}
						[] 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 updating resource");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						}
					 }
        
					v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_groupIndex);
					if(getverdict == pass){ 
						 if(ischosen(v_primitiveContentRetrievedResource.group_)){
							if(v_primitiveContentRetrievedResource.group_.memberTypeValidated == false){
								setverdict(fail, __SCOPE__ & ": Error,  memberTypeValidated attribute not updated");
							}
		
							if(v_primitiveContentRetrievedResource.group_.memberIDs[0] != v_memberId_1){
								setverdict(fail, __SCOPE__ & ": Error,  memberIDs attribute not correct");
							}
						  }
					 }
        
					//Postamble
					f_cse_postamble_deleteResources();
    
					// Tear down
					f_cf01Down();
				}
                
				/**
				 * @desc Check that the IUT handles unsuccessful validation of the resource type during the creation of the  group resource when memberType attribute is not ‘mixed’ and the consistencyStrategy attribute is ABANDON_GROUP.
				 * 
				 */
				testcase TC_CSE_GMG_UPD_006() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
													
					v_ae1.start(f_CSE_GMG_UPD_006());
										  	  	
					v_ae1.done;
										  	  		
				}
												
				function f_CSE_GMG_UPD_006() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_updateRequest := valueof(m_updateGroupBase);
					var integer v_aeIndex := -1;
					var integer v_containerIndex := -1;
					var integer v_groupIndex := -1;
					var integer v_subGroupIndex := -1;
					var XSD.AnyURI v_memberId_1;
					var XSD.AnyURI v_memberId_2;
                                
					// Test control
                        
					// Test component configuration
					f_cf01Up();
                    
					// Test adapter configuration
                        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
					v_subGroupIndex :=  f_cse_createResource(int9, m_createGroupBase, v_aeIndex);
					v_memberId_1 := f_getResourceId(vc_resourcesList[v_containerIndex].resource);
					v_memberId_2 := f_getResourceId(vc_resourcesList[v_subGroupIndex].resource);
					v_groupIndex := f_cse_createResource(int9, m_createGroup(2, {v_memberId_1}, omit, int3, int2), v_aeIndex);  //Member type is set to Container(int3) and consistencyStrategy is set to ABANDON GROUP (default value)
                                	
					v_updateRequest.primitiveContent.group_.memberIDs := {v_memberId_2, v_memberId_1};
					v_updateRequest := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateRequest);
                					
					//Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int4110))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": unsuccessful validation of the resource type during the creation of the group");
						}
						[] 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 create succesfull while the operation should be aborted");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while creating resource");
						}
					}
        
					//Postamble
					f_cse_postamble_deleteResources();
    
					// Tear down
					f_cf01Down();
				}
               
			   /**
				* @desc Check that the IUT detects when the number of memberIDs exceeds the limitation of maxNrOfMembers.
				*  
				*/
				testcase TC_CSE_GMG_UPD_007() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
													
					v_ae1.start(f_CSE_GMG_UPD_007());
										  	  	
					v_ae1.done;
										  	  		
				}
												
				function f_CSE_GMG_UPD_007() runs on AeSimu {
					
					//Local constants
					const integer c_maxNrOfMembers := 2;
                    
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_groupIndex, v_containerIndex_1, v_containerIndex_2, v_containerIndex_3 := -1;
					var ListOfURIs v_memberIDs;
					var template RequestPrimitive v_createRequest;
					var PrimitiveContent v_primitiveContentRetrievedResource;
                    
					var template RequestPrimitive v_updateRequest := m_updateGroupBase;
         
					// Test control
        
					// Test component configuration
					f_cf01Up();
    
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
                    
					v_containerIndex_1 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
					v_containerIndex_2 := f_cse_createResource(int3, m_createContainer_noResourceName, v_aeIndex); // AE child resource
					v_containerIndex_3 := 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_createRequest := valueof(m_createGroup(c_maxNrOfMembers, v_memberIDs, omit, int3));
					
					v_groupIndex :=  f_cse_createResource(int9, v_createRequest, v_aeIndex);
    
					//Test Body
					v_request := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateRequest);
					v_memberIDs := v_memberIDs & {f_getResourceId(vc_resourcesList[v_containerIndex_3].resource)};
					v_request.primitiveContent.group_.memberIDs := v_memberIDs;
        
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int6010))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": operation is not allowed");                             
						}
						[] 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 update successful while maxNrOfMembers has exceeded");
						}
						[] tc_ac.timeout {
							setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
						}
					 }
        
					v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_groupIndex);
					if(getverdict == pass){ 
						//Check that the resource has NOT been udpated
						  if(ischosen(v_primitiveContentRetrievedResource.group_)) {
						   if(v_primitiveContentRetrievedResource.group_.memberIDs == v_memberIDs){
							setverdict(fail, __SCOPE__ & ": Error: MemberIDs attribute updated")
						  }
						}
					}
        
					//Postamble
					f_cse_postamble_deleteResources();
    
					// Tear down
					f_cf01Down();
				}
               
				/**
				* @desc Check that the IUT detects when the value provided for maxNrOfMembers attribute is less than the value of the currentNrOfMembers attribute.
				*  
				*/
				testcase TC_CSE_GMG_UPD_008() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
													
					v_ae1.start(f_CSE_GMG_UPD_008());
										  	  	
					v_ae1.done;
										  	  		
				}
												
				function f_CSE_GMG_UPD_008() runs on AeSimu {
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_updateRequest := valueof(m_updateGroupBase);
					var integer v_aeIndex := -1;
					var integer v_containerIndex_1 := -1;
					var integer v_containerIndex_2 := -1;
					var integer v_groupIndex := -1;
					var ListOfURIs v_memberIDs;
					var XSD.PositiveInteger v_maxNrOfMembers:= 1;
					var PrimitiveContent v_primitiveContentRetrievedResource;
					
					v_updateRequest.primitiveContent.group_.maxNrOfMembers := v_maxNrOfMembers;
					
					// Test control
                    
					// Test component configuration
					f_cf01Up();
                    
					// Test adapter configuration
                                        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(-, -); //c_CRUDNDi
					v_containerIndex_1 := f_cse_createResource(int3, 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_groupIndex := f_cse_createResource(int9, m_createGroup(2, v_memberIDs, omit, int3), v_aeIndex);
					
					v_updateRequest := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateRequest);
					
					//Test Body
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int6010))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": max number of member exceeded");                             
						}
						 [] 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 update successful while operation is not allowed");
						 }
						 [] tc_ac.timeout {
							 setverdict(fail, __SCOPE__ & ": No answer while updating resource");
						 }
					 }
        
					v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_groupIndex);
					if(getverdict == pass){ 
						//Check that the resource has NOT been udpated
						  if(ischosen(v_primitiveContentRetrievedResource.group_)) {
						   if(v_primitiveContentRetrievedResource.group_.maxNrOfMembers == v_maxNrOfMembers){
							setverdict(fail, __SCOPE__ & ": Error: maxNrOfMembers attribute updated")
						  }
						}
					}
        
					//Postamble
					f_cse_postamble_deleteResources();
    
					// Tear down
					f_cf01Down();
				}
              
			   /**
				 * @desc Check that the IUT handles validation of the resource type during an UPDATE of the <group> resource when memberIDs contains a sub-group on a temporarily unreachable Hosting CSE.
				 * 
				 */
				testcase TC_CSE_GMG_UPD_009() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
													
					v_ae1.start(f_CSE_GMG_UPD_009());
										  	  	
					v_ae1.done;
										  	  		
				}
												
				function f_CSE_GMG_UPD_009() runs on AeSimu {
					//Local constants
					const integer c_maxNrOfMembers := 2;
					const ResourceType c_ResourceTypeGroup := int9;  
					
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_groupIndex := -1;
					var integer v_containerIndex_1 := -1;
					var integer v_containerIndex_2 := -1;
					
					var XSD.AnyURI v_memberId_1;
					var XSD.AnyURI v_memberId_2;
            
					var template RequestPrimitive v_createRequest := m_createGroupBase;
					var template RequestPrimitive v_updateRequest := m_updateGroupBase;
					var PrimitiveContent v_primitiveContentRetrievedResource;
         
					// Test control
        
					// Test component configuration
					f_cf01Up();
    
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
					//TODO: -> register IUT to the remoteCSE
					//TODO: Create one of the container in a remoteCSE
    				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_memberId_1 := f_getResourceId(vc_resourcesList[v_containerIndex_1].resource);
					v_memberId_2 := f_getResourceId(vc_resourcesList[v_containerIndex_2].resource);
					
					v_createRequest := valueof(m_createGroup(c_maxNrOfMembers, {v_memberId_1}, omit, int3));
					
					v_groupIndex :=  f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex);
        
					//Test Body
					v_updateRequest.primitiveContent.group_.memberIDs := {v_memberId_1, v_memberId_2};
        			v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest);

					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
							tc_ac.stop;
                            
							if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated)) {
								setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated attribute not provided");    
							 } else {
								if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberTypeValidated == false) {
									if(lengthof(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs) != 2) {
										setverdict(fail, __SCOPE__ & ": Error, wrong number of memberIDs attribute"); 
									} else {
										if(v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs[0] == v_memberId_1 and v_response.primitive.responsePrimitive.primitiveContent.group_.memberIDs[1] == v_memberId_2) {
											setverdict(pass, __SCOPE__ & ": update successful");       
										} else {
											setverdict(fail, __SCOPE__ & ": Error, wrong memberIDs");   
										}
									}
								} else {
									setverdict(fail, __SCOPE__ & ": Error, memberTypeValidated must be set to FALSE");  
								}   
							}                            
						}
						 [] 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");
						 }
					 }
        
					v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_groupIndex);
					if(getverdict == pass){ 
						 if(ischosen(v_primitiveContentRetrievedResource.group_)){
							if(v_primitiveContentRetrievedResource.group_.memberTypeValidated != false){
								setverdict(fail, __SCOPE__ & ": Error,  memberTypeValidated attribute not updated");
							}

							if((v_primitiveContentRetrievedResource.group_.memberIDs[0] != v_memberId_1) and (v_primitiveContentRetrievedResource.group_.memberIDs[1] != v_memberId_2)){
								setverdict(fail, __SCOPE__ & ": Error,  memberIDs attribute not correct");
							}
						  }
					 }
        
					//Postamble
					f_cse_postamble_deleteResources();
    
					// Tear down
					f_cf01Down();
				}
              
			  /**
				* @desc Check that the IUT handles validation of the resource type during an UPDATE of the group resource when memberIDs contains a sub-group on a  a previously unreachable Hosting CSE that has become reachable
				* @verdict 
				*/
				testcase TC_CSE_GMG_UPD_010() runs on Tester system CseSystem {
					
					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
													
					v_ae1.start(f_CSE_GMG_UPD_010());
										  	  	
					v_ae1.done;
										  	  		
				}
												
				function f_CSE_GMG_UPD_010() runs on AeSimu {
					//Local constants
					const ResourceType c_ResourceTypeGroup := int9;  
					const integer c_maxNrOfMembers := 2;
					
					// Local variables
					var MsgIn v_response;
					var RequestPrimitive v_request;
					var integer v_aeIndex := -1;
					var integer v_remoteCSEIndex := -1;
					var integer v_groupIndex := -1;
					var integer v_containerIndex_1 := -1;
					var integer v_containerIndex_2 := -1;
					var integer v_subscriptionIndex := -1;
					
					var template RequestPrimitive v_createRequest := m_createGroupBase;
					var template RequestPrimitive v_updateRequest := m_updateGroupBase;
					
					var XSD.AnyURI v_memberId_1;
					var XSD.AnyURI v_memberId_2;
					
					// Test control
        
					// Test component configuration
					f_cf01Up(true);
    
					// Test adapter configuration
        
					// Preamble
					v_aeIndex := f_cse_preamble_registerAe(); //c_CRUDNDi
					//TODO: -> register IUT to the remoteCSE
					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_memberId_1 := f_getResourceId(vc_resourcesList[v_containerIndex_1].resource);
					v_memberId_2 := f_getResourceId(vc_resourcesList[v_containerIndex_2].resource);
					
					v_createRequest := valueof(m_createGroup(c_maxNrOfMembers, {v_memberId_1, v_memberId_2}, omit, int3));
					
					v_groupIndex :=  f_cse_createResource(c_ResourceTypeGroup, v_createRequest, v_aeIndex);
					
					v_subscriptionIndex := f_cse_createResource(int23,m_createSubscriptionBase, v_groupIndex);
					
					vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler());

					//Test Body
					v_request := f_getUpdateRequestPrimitive(c_ResourceTypeGroup, v_groupIndex, v_updateRequest);
					//v_request.from_ := CSE-ID
					v_request.to_ := f_getResourceAddress(v_remoteCSEIndex);
					//Content set to <remoteCSE> resource containing onlineStatus := false;
        
					mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
					tc_ac.start;
					alt {
						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
							tc_ac.stop;
							setverdict(pass, __SCOPE__ & ": update successful");
                      	}
						 [] 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 group Update
            
            

            

			
			group Basic_Operations {
			
				group g_CSE_GMG_001 {
	            	
					/**
					 * @desc Check that the IUT allows a <group>/fanoutPoint OPERATION when the Originator has OPERATION_PERMISSION specified in membersAccessControlPolicyIDs attribute in the group resource.
					 * 
					 */
					testcase TC_CSE_GMG_001_CRE() runs on Tester system CseSystem { //Create
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_001(m_createContainerBase, int2001));
						v_ae1.done;
					}//end TC_CSE_GMG_001_CRE
	
					testcase TC_CSE_GMG_001_UPD() runs on Tester system CseSystem { //Update
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var Labels v_labels_1:= {"VALUE_1"};
						v_updateRequest.primitiveContent.container.labels := v_labels_1;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_GMG_001(v_updateRequest, int2004));
						v_ae1.done;
					}//end TC_CSE_GMG_001_UPD
	
					testcase TC_CSE_GMG_001_RET() runs on Tester system CseSystem { //Retrieve
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						
						v_ae1.start(f_CSE_GMG_001(m_retrieve("Temporary", "Temporary"), int2000));
						v_ae1.done;
					}//end TC_CSE_GMG_001_RET
	
					testcase TC_CSE_GMG_001_DEL() runs on Tester system CseSystem { //Delete
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_001(m_delete("Temporary", "Temporary"), int2002));	
						v_ae1.done;
					}//end TC_CSE_GMG_001_DEL
	
				} // end group g_CSE_GMG_001
			
				group g_CSE_GMG_002 {
	            	
					/**
					 * @desc Check that IUT denies a <group>/fanOutPoint OPERATION when the Originator does not have OPERATION_PERMISSION specified in membersAccessControlPolicyIDs in the group resource.
					 * 
					 */
					testcase TC_CSE_GMG_002_CRE() runs on Tester system CseSystem { //Create
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_002(m_createContainerBase, int62));	//c_RUDNDi
						v_ae1.done;
					}//end TC_CSE_GMG_002_CRE
	
					testcase TC_CSE_GMG_002_UPD() runs on Tester system CseSystem { //Update
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var Labels v_labels_1:= {"VALUE_1"};
						v_updateRequest.primitiveContent.container.labels := v_labels_1;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_GMG_002(v_updateRequest, int59));//c_CRDNDi
						v_ae1.done;
					}//end TC_CSE_GMG_002_UPD
	
					testcase TC_CSE_GMG_002_RET() runs on Tester system CseSystem { //Retrieve
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_002(m_retrieve("Temporary", "Temporary"), int61));//c_CUDNDi
						v_ae1.done;
					}//end TC_CSE_GMG_002_RET
	
					testcase TC_CSE_GMG_002_DEL() runs on Tester system CseSystem { //Delete
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_002(m_delete("Temporary", "Temporary"), int55)); //c_CRUNDi	
						v_ae1.done;
					}//end TC_CSE_GMG_002_DEL
		
				} // end group g_CSE_GMG_002			
			
				group g_CSE_GMG_003 {
	            	
					/**
					 * @desc Check that the IUT allows a <group>/fanoutPoint OPERATION when the Originator has OPERATION_PERMISSION specified in accessControlPolicyIDs and the membersAccessControlPolicyIDs is empty in the <group> resource.
					 * @verdict 
					 */
					testcase TC_CSE_GMG_003_CRE() runs on Tester system CseSystem { //Create
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_003(m_createContainerBase, int2001));
						v_ae1.done;
					}//end TC_CSE_GMG_003_CRE
	
					testcase TC_CSE_GMG_003_UPD() runs on Tester system CseSystem { //Update
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var Labels v_labels_1:= {"VALUE_1"};
						v_updateRequest.primitiveContent.container.labels := v_labels_1;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_GMG_003(v_updateRequest, int2004));
						v_ae1.done;
					}//end TC_CSE_GMG_003_UPD
	
					testcase TC_CSE_GMG_003_RET() runs on Tester system CseSystem { //Retrieve
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_003(m_retrieve("Temporary", "Temporary"), int2000));
						v_ae1.done;
					}//end TC_CSE_GMG_003_RET
	
					testcase TC_CSE_GMG_003_DEL() runs on Tester system CseSystem { //Delete
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_003(m_delete("Temporary", "Temporary"), int2002));	
						v_ae1.done;
					}//end TC_CSE_GMG_003_DEL
	
				} // end group g_CSE_GMG_003			
			
				group g_CSE_GMG_004 {
	            	
					/**
					 * @desc Check that IUT rejects a <group>/fanOutPoint OPERATION when the Originator does not have OPERATION_PERMISSION specified in accessControlPolicyIDs and the membersAccessControlPolicyIDs is empty in the group resource.
					 * 
					 */
					testcase TC_CSE_GMG_004_CRE() runs on Tester system CseSystem { //Create
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_004(m_createContainerBase, int62));	//c_RUDNDi
						v_ae1.done;
					}//end TC_CSE_GMG_004_CRE
	
					testcase TC_CSE_GMG_004_UPD() runs on Tester system CseSystem { //Update
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var Labels v_labels_1:= {"VALUE_1"};
						v_updateRequest.primitiveContent.container.labels := v_labels_1;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_GMG_004(v_updateRequest, int59));//c_CRDNDi
						v_ae1.done;
					}//end TC_CSE_GMG_004_UPD
	
					testcase TC_CSE_GMG_004_RET() runs on Tester system CseSystem { //Retrieve
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_004(m_retrieve("Temporary", "Temporary"), int61));//c_CUDNDi
						v_ae1.done;
					}//end TC_CSE_GMG_004_RET
	
					testcase TC_CSE_GMG_004_DEL() runs on Tester system CseSystem { //Delete
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;

						v_ae1.start(f_CSE_GMG_004(m_delete("Temporary", "Temporary"), int55)); //c_CRUNDi	
						v_ae1.done;
					}//end TC_CSE_GMG_004_DEL
	
				} // end group g_CSE_GMG_004

				group g_CSE_GMG_005 {
	            	
					/**
					 * @desc Check that IUT generates a request primitive for each resource in memberIDs with no relative address appended to it.
					 * 
					 */
					testcase TC_CSE_GMG_005_CRE() runs on Tester system CseSystem { //Create
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template PrimitiveContent v_contentResponse;
						v_contentResponse.container := mw_contentContainer_rc1;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_GMG_005(m_createContainerBase, v_contentResponse, int2001));
						v_ae1.done;
					}//end TC_CSE_GMG_005_CRE
	
					testcase TC_CSE_GMG_005_UPD() runs on Tester system CseSystem { //Update
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var template PrimitiveContent v_contentResponse;
						var Labels v_labels_1:= {"VALUE_1"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.container := mw_contentContainerBase;
						v_contentResponse.container.labels := ?;
						v_updateRequest.primitiveContent.container.labels := v_labels_1;
						
						v_ae1.start(f_CSE_GMG_005(v_updateRequest, v_contentResponse, int2004));
						v_ae1.done;
					}//end TC_CSE_GMG_005_UPD
	
					testcase TC_CSE_GMG_005_RET() runs on Tester system CseSystem { //Retrieve
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.container := mw_contentContainerBase;
						
						v_ae1.start(f_CSE_GMG_005(m_retrieve("Temporary", "Temporary"), v_contentResponse, int2000));
						v_ae1.done;
					}//end TC_CSE_GMG_005_RET
	
					testcase TC_CSE_GMG_005_DEL() runs on Tester system CseSystem { //Delete
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template PrimitiveContent v_contentResponse;
						v_contentResponse.container := mw_contentContainerBase;// TODO see with wath should it be matched
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_ae1.start(f_CSE_GMG_005(m_delete("Temporary", "Temporary"), v_contentResponse, int2002));	
						v_ae1.done;
					}//end TC_CSE_GMG_005_DEL
	
				} // end group g_CSE_GMG_005
			
				group g_CSE_GMG_006 {
	            	
					/**
					 * @desc Check that IUT generates a request primitive for each resource in memberIDs with no relative address appended to it.
					 * 
					 */
					testcase TC_CSE_GMG_006_CRE() runs on Tester system CseSystem { //Create
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.container := mw_contentContainer_rc1;
						
						v_ae1.start(f_CSE_GMG_006(m_createContainerBase, v_contentResponse, int2001));
						v_ae1.done;
					}//end TC_CSE_GMG_006_CRE
	
					testcase TC_CSE_GMG_006_UPD() runs on Tester system CseSystem { //Update
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						var template RequestPrimitive v_updateRequest := m_updateContainerBase;
						var template PrimitiveContent v_contentResponse;
						var Labels v_labels_1:= {"VALUE_1"};
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.container := mw_contentContainerBase;
						v_contentResponse.container.labels := ?;
						v_updateRequest.primitiveContent.container.labels := v_labels_1;
						
						v_ae1.start(f_CSE_GMG_006(v_updateRequest, v_contentResponse, int2004));
						v_ae1.done;
					}//end TC_CSE_GMG_006_UPD
	
					testcase TC_CSE_GMG_006_RET() runs on Tester system CseSystem { //Retrieve
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.container := mw_contentContainerBase;
						
						v_ae1.start(f_CSE_GMG_006(m_retrieve("Temporary", "Temporary"), v_contentResponse, int2000));
						v_ae1.done;
					}//end TC_CSE_GMG_006_RET
	
					testcase TC_CSE_GMG_006_DEL() runs on Tester system CseSystem { //Delete
						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
						
						var template PrimitiveContent v_contentResponse;
						v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
						v_ae1.done;
						v_contentResponse.container := mw_contentContainerBase;// TODO see with wath should it be matched
						
						v_ae1.start(f_CSE_GMG_006(m_delete("Temporary", "Temporary"), v_contentResponse, int2002));	
						v_ae1.done;
					}//end TC_CSE_GMG_006_DEL            	

				}//end group g_CSE_GMG_006
				
			}// End of Basic_Operations
            
		} // end group Group_Managment
	
	}//end group CSE

	
}