From 4c86c036ca1240f0c9bd2f950fa4b32b77eea6d1 Mon Sep 17 00:00:00 2001
From: oneM2MTester Develop Team <novamartin@keti.re.kr>
Date: Fri, 7 Oct 2016 14:20:57 -0700
Subject: [PATCH] add new LOC test cases

---
 LibOneM2M/OneM2M_Functions.ttcn      |   9 +
 LibOneM2M/OneM2M_Pixits.ttcn         |  19 +-
 LibOneM2M/OneM2M_Templates.ttcn      |  65 +++-
 LibOneM2M/OneM2M_Types.ttcn          |  35 +-
 LibOneM2M/OneM2M_TypesAndValues.ttcn |   1 +
 OneM2M_Testcases.ttcn                | 495 ++++++++++++++++++++++++++-
 6 files changed, 588 insertions(+), 36 deletions(-)

diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn
index 7f7a224..98ab278 100644
--- a/LibOneM2M/OneM2M_Functions.ttcn
+++ b/LibOneM2M/OneM2M_Functions.ttcn
@@ -441,6 +441,7 @@ module OneM2M_Functions {
 		 * @verdict 
 		 */
 		function f_getCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_request, integer p_parentIndex) runs on CseTester return RequestPrimitive {
+    		var integer p_locresourceIndex := p_parentIndex;
     		
 			p_request.from_ := f_getOriginator(p_parentIndex);
                 
@@ -452,6 +453,14 @@ module OneM2M_Functions {
 			if (p_resourceType == int9) {//group
 				p_request.primitiveContent.any_1[0].Group_optional.memberIDs := {f_getResourceAddress(p_parentIndex)};
 			}
+			//@Martin
+			if(p_resourceType == int3){//container
+			  	//when a container is created by hosting cse for storing location information, the container is seen as a location container
+				if(PX_IS_LOC_CONTAINER){
+			    	p_request.primitiveContent.any_1[0].Container_optional.locationID := f_getResourceId(vc_resourcesList[p_locresourceIndex].resource);//resourceID of the locationPolicy
+				}		  
+			}
+			
     		
 			if (p_resourceType == int15) {//pollingChannel
 				p_request.from_ := vc_aeAux.aE_ID;
diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn
index 5894bba..5426229 100644
--- a/LibOneM2M/OneM2M_Pixits.ttcn
+++ b/LibOneM2M/OneM2M_Pixits.ttcn
@@ -51,16 +51,23 @@ module OneM2M_Pixits {
 	modulepar XSD.ID PX_CSE_ID 					:= "in-cse";
 	
 	modulepar boolean PX_FROM_IS_AE_ID 				:= false;
+	//@Martin
+	//for checking whether the locationPolicy creation request is originated from a ASN-AE
+	//NOTE: Apply to Device-based location request, and this requires Testing System to activate ASN-AE mode to test IUT  
+	modulepar boolean PX_FROM_ASN_AE				:= false; //default
+	modulepar boolean PX_IUT_IS_ASN_CSE				:= false; //default //set it to true when running Device-based location testcases 
+	modulepar boolean PX_FROM_ADN_AE				:= true; //default 
+	modulepar boolean PX_IUT_IS_MN_CSE				:= false; //default //set it to true when running Share-based location testcases
 	
 	//@Martin
-	//constant parameters for LOC 
-	modulepar LocationSource PX_LOCATION_SOURCE				:= int1;//network-defined 
+	//constant parameters for LOC  
 	modulepar XSD.Token PX_LOCATION_TARGET_ID				:= "{LOCATION-TARGET-ID}"; //SUPPOSE TO BE RECEIVED FROM LOCATION SERVER
-	modulepar XSD.AnyURI PX_LOCATION_SERVER_ADDRESS			:= "{LOCATION-SERVER-ADDRESS}";
+	modulepar XSD.AnyURI PX_LOCATION_SERVER_ADDRESS		:= "{LOCATION-SERVER-ADDRESS}";
+	
 	modulepar charstring PX_LOCATION_UPDATE_PERIOD			:= "PT10M10S" ;//10 Minute 10 Seconds
-	modulepar charstring PX_LOCATION_UPDATE_PERIOD_INVALID 	:= "-PT30M10S" ;//duration set to invalid value  (minus value)
-	modulepar charstring PX_LOCATION_CONTAINER_NAME			:= "myLoContainer";
+	modulepar charstring PX_LOCATION_CONTAINER_NAME		:= "myLoContainer";
 	
-	modulepar Labels LABELS := {"VALUE_1"}; 
+	modulepar Labels LABELS := {"VALUE_1"}; 	
+	modulepar boolean PX_IS_LOC_CONTAINER	:= false;//default //set it to true when the container is created to store location information
 	
 }  // end of module
diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn
index c01f43c..410519b 100644
--- a/LibOneM2M/OneM2M_Templates.ttcn
+++ b/LibOneM2M/OneM2M_Templates.ttcn
@@ -569,14 +569,24 @@ module OneM2M_Templates {
         	};
         	
         	//@Martin
-        	template (value) RequestPrimitive m_createLocationPolicy(in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod, in template (omit) NodeID locationTargetID, in template (omit) XSD.AnyURI locationServerAddress) modifies m_create := {
-        	  	requestIdentifier	:= "m_createLocationPolicy", //the requestIdentifier is supposed to be set similar as "C190XX7T/001"  by prepending the AE-ID-Stem and slash(‘/’) in front of it
+        	template (value) RequestPrimitive m_createLocationPolicy(in template (value) LocationSource locationSource, in template (omit) AcpType p_accessControlPolicyIDs, in template (omit) XSD.Duration locationUpdatePeriod, in template (omit) NodeID locationTargetID, in template (omit) XSD.AnyURI locationServerAddress) modifies m_create := {
+        	  	requestIdentifier	:= "m_createLocationPolicy" & f_rnd(1, 1000000), //the requestIdentifier is supposed to be set similar as "C190XX7T/001"  by prepending the AE-ID-Stem and slash(‘/’) in front of it
         	  	resourceType		:= int10,
         	  	primitiveContent	:= {        	    
-        	    			any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }}
+        	    			any_1 := {{ LocationPolicy_optional := m_contentCreateLocationPolicy(locationSource, p_accessControlPolicyIDs, locationUpdatePeriod, locationTargetID, locationServerAddress) }}
         	  	},
 			  	resultContent := int1//default
         	};
+        	//@Martin
+        	template (value) RequestPrimitive m_createNotification(in template (value) XSD.AnyType resourcePresentation, in template (omit)NotificationEventType notifEventType, in template (omit) XSD.AnyURI subscriptionReference, in template (omit) XSD.AnyURI notifForwardingURI) modifies m_create := {
+        	  requestIdentifier	:= "m_createNotification" & f_rnd(1, 1000000),
+        	  primitiveContent	:= {	
+        	    			any_1 :=	{{ Notification_optional := m_contentCreateNotification(resourcePresentation, notifEventType, subscriptionReference, notifForwardingURI)}}        	    
+        	  },
+        	  resultContent		:= int1 //default
+        	  
+        	};
+       
         	
     	}//end group Create
     	
@@ -945,30 +955,55 @@ module OneM2M_Templates {
     	};
     	
     	//@Martin
-    	template (value) LocationPolicy_optional m_contentCreateLocationPolicy (in template (omit) AcpType p_accessControlPolicyIDs, in template (value) XSD.Duration locationUpdatePeriod, in template (value) NodeID locationTargetID, in template (value) XSD.AnyURI locationServerAddress) := {
-    	  	resourceName 			:= c_defaultResourceName, //O
-    	  	resourceType			:= omit, //NP
-    	    resourceID				:= omit, //NP
-    	    parentID				:= omit, //NP
-    	  	creationTime			:= omit, //NP
-    	  	lastModifiedTime		:= omit, //NP
-    	  	labels 					:= LABELS,//O
+    	template (value) LocationPolicy_optional m_contentCreateLocationPolicy (in template (value) LocationSource locationSource, in template (omit) AcpType p_accessControlPolicyIDs, in template (value) XSD.Duration locationUpdatePeriod, in template (value) NodeID locationTargetID, in template (value) XSD.AnyURI locationServerAddress) := {
+    	  	resourceName 				:= c_defaultResourceName, //O
+    	  	resourceType				:= omit, //NP
+    	    resourceID					:= omit, //NP
+    	    parentID					:= omit, //NP
+    	  	creationTime				:= omit, //NP
+    	  	lastModifiedTime			:= omit, //NP
+    	  	labels 						:= LABELS,//O
     	  	accessControlPolicyIDs 	:= p_accessControlPolicyIDs, //O
  	  	  	expirationTime 			:= omit, //O
       		dynamicAuthorizationConsultationIDs := omit, //O
     	  	announceTo 				:= omit, 				   //O
     	  	announcedAttribute		:= omit, 			      //O
-    		locationSource 			:= PX_LOCATION_SOURCE, //M
-    		locationUpdatePeriod 	:= locationUpdatePeriod, //O
-    		locationTargetID 		:= locationTargetID, 	//O
+    		locationSource 			:= locationSource, //M
+    		locationUpdatePeriod 		:= locationUpdatePeriod, //O
+    		locationTargetID 			:= locationTargetID, 	//O
     		locationServer 			:= locationServerAddress,//O
     		locationContainerID		:= omit,    		   //NP
     		locationContainerName 	:= PX_LOCATION_CONTAINER_NAME,//O    		
-    	  	locationStatus			:= omit,              //NP
+    	  	locationStatus				:= omit,              //NP
     	    choice 					:= omit  	         //NP
     	   	  	
     	};
     	
+    	//@Martin
+    	template (value) Notification_optional m_contentCreateNotification (in template (value) XSD.AnyType resourcePresentation, 
+    	in template (omit)NotificationEventType notifEventType, 
+    	in template (omit) XSD.AnyURI subReference, 
+    	in template (omit) XSD.AnyURI notifForwardingURI) := 
+    	{
+    	  notificationEvent := {
+    	    	representation 			:= resourcePresentation,
+        	    operationMonitor 			:= {
+        	      operation 	:= omit,
+        	      originator	:= omit
+        	    },
+        	    notificationEventType	:= notifEventType    	    
+    	  },
+    	  verificationRequest 			:= omit,
+    	  subscriptionDeletion			:= omit,
+    	  subscriptionReference			:= subReference,
+         creator							:= omit,
+    	  notificationForwardingURI		:= notifForwardingURI,
+    	  iPEDiscoveryRequest				:= {
+    	    	originator			:= omit,
+    	    	filterCriteria		:= omit
+    	  }    	  
+    	};
+    	
 	}//end group ContentCreate
 	
 	group ContentUpdate {
diff --git a/LibOneM2M/OneM2M_Types.ttcn b/LibOneM2M/OneM2M_Types.ttcn
index 87dec84..1b86f9b 100644
--- a/LibOneM2M/OneM2M_Types.ttcn
+++ b/LibOneM2M/OneM2M_Types.ttcn
@@ -6924,7 +6924,38 @@ group optionalResourceTypes {
 	  variant (choice.choice_list[-]) "untagged";
 	};
 	
-}
+	//@Martin
+	type record Notification_optional
+	{
+	  record {
+			XSD.AnyType representation optional,
+    		record {
+    			Operation operation optional,
+    			XSD.ID originator optional
+    		} operationMonitor optional,
+			NotificationEventType notificationEventType optional
+      	} notificationEvent optional,
+      	XSD.Boolean verificationRequest optional,
+      	XSD.Boolean subscriptionDeletion optional,
+      	XSD.AnyURI subscriptionReference optional,
+      	XSD.ID creator optional,
+      	XSD.AnyURI notificationForwardingURI optional,
+      	record {
+      		XSD.ID originator optional,
+      		FilterCriteria filterCriteria optional
+      	} iPEDiscoveryRequest optional
+     }
+     with {
+        variant "name as 'notification'";
+        //variant (verificationRequest) "text 'true' as '1'";
+        //variant (verificationRequest) "text 'false' as '0'";
+        //variant (subscriptionDeletion) "text 'true' as '1'";
+        //variant (subscriptionDeletion) "text 'false' as '0'";
+        variant (iPEDiscoveryRequest) "name as capitalized";
+	};
+	
+}//end group
+
 	
 group invalidTypes {
 		
@@ -7073,6 +7104,6 @@ with {
   encode "XML";
   variant "namespace as 'http://www.onem2m.org/xml/protocols' prefix 'm2m'";
   variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
-  extension "anytype ServiceSubscribedAppRule_optional, charstring, AnyURI, AttributeList, AE, AccessControlPolicy, AccessControlPolicy_optional, ACP_update_invalid, AE_optional, AE_update_invalid,AEAnnc_optional, Container_optional, CSEBase_optional, Container_update_invalid, ContentInstance_optional, Group_optional, Group_update_invalid, Schedule_optional, Schedule_update_invalid, Subscription_optional, Subscription_update_invalid, PollingChannel_optional, PollingChannel_update_invalid, LocationPolicy_optional, LocationPolicy_update_invalid"
+  extension "anytype ServiceSubscribedAppRule_optional, charstring, AnyURI, AttributeList, AE, AccessControlPolicy, AccessControlPolicy_optional, ACP_update_invalid, AE_optional, AE_update_invalid,AEAnnc_optional, Container_optional, CSEBase_optional, Container_update_invalid, ContentInstance_optional, Group_optional, Group_update_invalid, Schedule_optional, Schedule_update_invalid, Subscription_optional, Subscription_update_invalid, PollingChannel_optional, PollingChannel_update_invalid, LocationPolicy_optional, LocationPolicy_update_invalid, Notification, Notification_optional"
 }
 
diff --git a/LibOneM2M/OneM2M_TypesAndValues.ttcn b/LibOneM2M/OneM2M_TypesAndValues.ttcn
index 31b408e..580c8fa 100644
--- a/LibOneM2M/OneM2M_TypesAndValues.ttcn
+++ b/LibOneM2M/OneM2M_TypesAndValues.ttcn
@@ -22,6 +22,7 @@ module OneM2M_TypesAndValues {
 	const XSD.String c_defaultResourceName := "MyResource";
 	const XSD.ID c_aeAuxName := "MyAe";
 	const XSD.String c_acpAuxName := "MyAcp";
+	const charstring c_invalid_location_update_period	:= "-PT30M10S" ;//duration set to invalid value  (minus value)
 	
 	//AccessControlOperations
 	const XSD.Integer c_C   := 1;
diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn
index 270ec20..2084e2d 100644
--- a/OneM2M_Testcases.ttcn
+++ b/OneM2M_Testcases.ttcn
@@ -3842,6 +3842,7 @@ module OneM2M_Testcases {
      	    	var integer v_aeAuxIndex 		:= -1;	  	      	     	
      	     	var RequestPrimitive v_request;
      	     	var MsgIn v_response;
+     	     	var LocationSource v_locationSource := int1;//Network-based
      	     	
      	     	//Test component configuration
      	     	f_cf01Up();
@@ -3850,7 +3851,7 @@ module OneM2M_Testcases {
      	     	v_aeAuxIndex := f_cse_preamble_registerAe();
      	     	     	     	
      	     	//Set requestPrimitive
-     	     	v_request	 := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(omit, omit, omit, omit), v_aeAuxIndex);
+     	     	v_request	 := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, omit, omit, omit), v_aeAuxIndex);
      	     	
      	     	//Test Body
      	     	mcaPort.send(m_request(v_request));
@@ -3886,7 +3887,8 @@ module OneM2M_Testcases {
 		group g_CSE_LOC_BV_002{  	    
 		    testcase TC_CSE_LOC_BV_002() runs on CseTester system CseSystem {
 				
-				var integer v_aeAuxIndex 				:= -1;	
+				var integer v_aeAuxIndex 				:= -1;
+				var LocationSource v_locationSource		:= int1;//Network-based	
 				var XSD.Duration locationUpdatePeriod 	:= PX_LOCATION_UPDATE_PERIOD;  
 				var XSD.Token locationTargetID			:= PX_LOCATION_TARGET_ID;
 				var XSD.AnyURI locationServerAddress	:= PX_LOCATION_SERVER_ADDRESS;
@@ -3900,7 +3902,7 @@ module OneM2M_Testcases {
      	     	v_aeAuxIndex := f_cse_preamble_registerAe();
      	     	     	     	
      	     	//Set requestPrimitive
-     	     	v_request	 := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex);
+     	     	v_request	 := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex);
      	     	    									
     			// Test Body					
     			mcaPort.send(m_request(v_request));
@@ -3935,11 +3937,12 @@ module OneM2M_Testcases {
 		    testcase TC_CSE_LOC_BO_001() runs on CseTester system CseSystem {//the originator has no privileges to create a locationPolicy resource!!
 		      	
 		      	var integer v_aeAuxIndex 				:= -1;
+		      	var LocationSource v_locationSource		:= int1;//Network-based
 				var XSD.Duration locationUpdatePeriod 	:= PX_LOCATION_UPDATE_PERIOD;    
 				var XSD.Token locationTargetID			:= PX_LOCATION_TARGET_ID;
 				var XSD.AnyURI locationServerAddress	:= PX_LOCATION_SERVER_ADDRESS;
 				var RequestPrimitive v_request;	
-				var MsgIn v_response;
+				var MsgIn v_response;				
 				     	     	
      	     	//Test component configuration
      	     	f_cf01Up();
@@ -3948,7 +3951,7 @@ module OneM2M_Testcases {
      	     	v_aeAuxIndex 			:= f_cse_preamble_registerAe(int62);//c_RUDNDi //No resource creation privilege
      	     	     	     	
      	     	//Set requestPrimitive
-     	     	v_request				:= f_getCreateRequestPrimitive(int10, m_createLocationPolicy(omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex);
+     	     	v_request				:= f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource,omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex);
      	        									
     			// Test Body					
     			mcaPort.send(m_request(v_request));
@@ -3981,7 +3984,8 @@ module OneM2M_Testcases {
 		group g_CSE_LOC_BO_002{  	
 		    testcase TC_CSE_LOC_BO_002() runs on CseTester system CseSystem {
 		      	
-		      	var integer v_aeAuxIndex 				:= -1;		        
+		      	var integer v_aeAuxIndex 				:= -1;
+		      	var LocationSource v_locationSource		:= int1;//Netwok-based		        
 				var XSD.Duration locationUpdatePeriod 	:= PX_LOCATION_UPDATE_PERIOD;  
 				var XSD.Token locationTargetID			:= PX_LOCATION_TARGET_ID;
 				var XSD.AnyURI locationServerAddress	:= PX_LOCATION_SERVER_ADDRESS;
@@ -3995,7 +3999,7 @@ module OneM2M_Testcases {
      	     	v_aeAuxIndex 	:= f_cse_preamble_registerAe();
      	     	
      	     	//Set requestPrimitive
-     	     	v_request		:= f_getCreateRequestPrimitive(int10, m_createLocationPolicy(omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex);
+     	     	v_request		:= f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex);
      	    							
     			// Test Body					
     			mcaPort.send(m_request(v_request));
@@ -4030,10 +4034,11 @@ module OneM2M_Testcases {
 		    testcase TC_CSE_LOC_BI_001() runs on CseTester system CseSystem {//reject an invalid update request with invalid attribtue locationUpdatePeriod
 		      
 		      	var integer v_aeAuxIndex 						:= -1;
-		      	var integer v_locPolicyResourceIndex			:= -1;		      	
-				var XSD.Duration locationUpdatePeriod_invalid 	:= PX_LOCATION_UPDATE_PERIOD_INVALID;
+		      	var integer v_locPolicyResourceIndex			:= -1;
+		      	var LocationSource v_locationSource				:= int1;//Netwok-based		      	
+				var XSD.Duration locationUpdatePeriod_invalid 	:= c_invalid_location_update_period;
 				var RequestPrimitive v_request;
-				var RequestPrimitive v_request_preamble;
+				var RequestPrimitive v_locpolicy_request_preamble;
 				var MsgIn v_response;
 								    				
     			//Test component configuration
@@ -4042,8 +4047,8 @@ module OneM2M_Testcases {
      	     	//Preamble - register AE
      	     	v_aeAuxIndex 				:= f_cse_preamble_registerAe();
      	     	//Preamble - create a valid locationPolicy resource for later update use
-     	     	v_request_preamble			:= valueof(m_createLocationPolicy(omit, PX_LOCATION_UPDATE_PERIOD, PX_LOCATION_TARGET_ID, PX_LOCATION_SERVER_ADDRESS));
-     	     	v_locPolicyResourceIndex	:= f_cse_createResource(int10, v_request_preamble, v_aeAuxIndex);     	     	
+     	     	v_locpolicy_request_preamble			:= valueof(m_createLocationPolicy(v_locationSource, omit, PX_LOCATION_UPDATE_PERIOD, PX_LOCATION_TARGET_ID, PX_LOCATION_SERVER_ADDRESS));
+     	     	v_locPolicyResourceIndex	:= f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);     	     	
      	     	
      	     	//Set requestPrimitive
      	     	v_request					:= f_getUpdateRequestPrimitive(int10, v_locPolicyResourceIndex, m_updateLocationPolicy(f_getResourceAddress(v_locPolicyResourceIndex), omit, locationUpdatePeriod_invalid));
@@ -4074,8 +4079,472 @@ module OneM2M_Testcases {
 		    }//end testcase TC_CSE_LOC_BI_001
 		    
 		  }//end group g_CSE_LOC_BI_001
+		  		  
+		  group g_CSE_LOC_BV_003 {
+		    
+		    testcase TC_CSE_LOC_BV_003() runs on CseTester system CseSystem{
+		      //TO RETRIEVE a <container> resource that has created in cse and linked with a <locationPolicy> resource (network-based case)
+		     
+		      var integer v_aeAuxIndex				:=	-1;
+		      var integer v_locPolicyResourceIndex	:= 	-1;
+		      var integer v_locContainerResourceIndex	:= 	-1;
+		      var RequestPrimitive v_loc_request_preamble;
+		      var RequestPrimitive v_container_request_preamble;
+		      var MsgIn v_response;
+		      var LocationSource v_locationSource := int1;//Network-based      
+		      
+		 	  //Test component configuration
+		 	  f_cf01Up();
+		 	  
+		 	  //Preamble - register AE
+		 	  v_aeAuxIndex				:= f_cse_preamble_registerAe();
+		 	  //Preamble - create a valid locationPolicy resource for later container resource creation
+		 	  v_loc_request_preamble		:= valueof(m_createLocationPolicy(v_locationSource, omit, PX_LOCATION_UPDATE_PERIOD, PX_LOCATION_TARGET_ID, PX_LOCATION_SERVER_ADDRESS));
+		 	  v_container_request_preamble	:= valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided?
+		      v_locPolicyResourceIndex	:= f_cse_createResource(int10, v_loc_request_preamble, v_aeAuxIndex);//created locationpolicy index
+			  v_locContainerResourceIndex	:= f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index
+			  			  	
+			  //Test Body - retrieve the created container resource
+		      mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex))))); 
+		      tc_ac.start;
+		      alt{
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{
+		          tc_ac.stop;
+		          if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Container_optional.locationID)){		            
+		            	setverdict(fail, testcasename() & "No locationID is included in the response!");
+		          }else{
+		            	setverdict(pass, testcasename() & "Container resource associated with locationPolicy resource is successfully retrieved with locationID included in the response!");		            
+		          }		          
+		          
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{
+		          		tc_ac.stop;
+		          		setverdict(fail, testcasename() & "Requested container resource is not found!");
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+						tc_ac.stop;
+						setverdict(fail, testcasename() & ": Error while retrieving resource!");
+				}
+				[] tc_ac.timeout {
+						setverdict(inconc, testcasename() & ": No answer while retrieving resource!");
+				}
+		        
+		      }
+		      // Postamble
+    			f_cse_postamble_deleteResources();	 
+    			
+				// Tear down
+				f_cf01Down(); 		      
+		      
+		    }//end testcase TC_CSE_LOC_BV_003 		    
+		    
+		  }//end group g_CSE_LOC_BV_003
+		  		 
+		  group g_CSE_LOC_BV_004 {
+		    
+		    testcase TC_CSE_LOC_BV_004() runs on CseTester system CseSystem{
+		      //TO create a <locationPolicy> resource with locationSource set to Device-based
+		     
+		       var integer v_aeAuxIndex 					:= -1;	
+				var XSD.Duration locationUpdatePeriod 	:= PX_LOCATION_UPDATE_PERIOD;  
+				var RequestPrimitive v_request;
+				var MsgIn v_response;
+     	     	var LocationSource v_locationSource		:= int2;//Device-based
+     	     	//Test component configuration
+     	     	f_cf01Up();
+     	     	
+     	     	//Preamble
+     	     	if(PX_IUT_IS_ASN_CSE){
+     	     	  if(PX_FROM_ASN_AE){
+     	     		v_aeAuxIndex := f_cse_preamble_registerAe();
+     	     		//Set requestPrimitive
+     	     		v_request	  := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, locationUpdatePeriod, omit, omit), v_aeAuxIndex);
+     	     	  }
+     	     	}    									
+    			// Test Body					
+    			mcaPort.send(m_request(v_request));
+    			tc_ac.start;
+    			alt {
+    				[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+    					tc_ac.stop;
+    					setverdict(pass, testcasename() & ": Resource locationPolicy is created successfuly with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))&"!");
+    				}
+    				[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
+    					tc_ac.stop;
+    					setverdict(fail, testcasename() & ": Error occurrs with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)) & "while handling a valid locationPolicy resource create request!");
+    				}
+    				[] tc_ac.timeout {
+    					setverdict(inconc, testcasename() & ": Timeout due to no response from requested server!");
+    				}
+    			}	
+		      
+		      // Postamble
+    			f_cse_postamble_deleteResources();	 
+    			
+				// Tear down
+				f_cf01Down(); 		      
+		      
+		    }//end testcase TC_CSE_LOC_BV_004
+		    
+		  }//end group g_CSE_LOC_BV_004
+		  		
+		 group g_CSE_LOC_BV_005 {
+		    
+		    testcase TC_CSE_LOC_BV_005() runs on CseTester system CseSystem{
+		      //TO create a <locationPolicy> resource with locationSource set to Share-based
+		     
+		       var integer v_aeAuxIndex 				:= -1;	 
+		       var LocationSource v_locationSource		:= int3;//Share-based
+				var RequestPrimitive v_request;
+				var MsgIn v_response;
+     	     	
+     	     	//Test component configuration
+     	     	f_cf01Up();
+     	     	
+     	     	//Preamble
+     	     	if(PX_IUT_IS_MN_CSE){
+     	     	  if(PX_FROM_ADN_AE){
+     	     		v_aeAuxIndex := f_cse_preamble_registerAe();
+     	     		//Set requestPrimitive
+     	     		v_request	  := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource, omit, omit, omit, omit), v_aeAuxIndex);
+     	     	  }
+     	     	}    									
+    			// Test Body					
+    			mcaPort.send(m_request(v_request));
+    			tc_ac.start;
+    			alt {
+    				[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+    					tc_ac.stop;
+    					setverdict(pass, testcasename() & ": Resource locationPolicy is created successfuly with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))&"!");
+    				}
+    				[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
+    					tc_ac.stop;
+    					setverdict(fail, testcasename() & ": Error occurrs with response status code: " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode)) & "while handling a valid locationPolicy resource create request!");
+    				}
+    				[] tc_ac.timeout {
+    					setverdict(inconc, testcasename() & ": Timeout due to no response from requested server!");
+    				}
+    			}	
+		      
+		      // Postamble
+    			f_cse_postamble_deleteResources();	 
+    			
+				// Tear down
+				f_cf01Down(); 		      
+		      
+		    }//end testcase TC_CSE_LOC_BV_005
+		    
+		  }//end group g_CSE_LOC_BV_005
+		 		 		
+		 group g_CSE_LOC_BV_006 {
+		    
+		    testcase TC_CSE_LOC_BV_006_01() runs on CseTester system CseSystem{
+		      //TO NOTIFY a location information 
+		     
+		      var integer v_aeAuxIndex					:=	-1;
+		      var integer v_locPolicyResourceIndex		:= 	-1;
+		      var integer v_locContainerResourceIndex	:=	-1;
+		      var integer v_subscriptionResourceIndex	:= 	-1;
+		      var LocationSource v_locationSource	:= int1;//Netwok-based
+		      var RequestPrimitive v_locpolicy_request_preamble;
+		      var RequestPrimitive v_container_request_preamble;
+		      var RequestPrimitive v_subscription_request_preamble;
+		      var MsgIn v_response;
+		      		      
+		 	  //Test component configuration
+		 	  f_cf01Up();
+		 	  
+		 	  //Preamble - register AE
+				v_aeAuxIndex						:= f_cse_preamble_registerAe();
+		 	  //Preamble - create a valid locationPolicy resource 
+		 	  	v_locpolicy_request_preamble		:= valueof(m_createLocationPolicy(v_locationSource, omit, PX_LOCATION_UPDATE_PERIOD, PX_LOCATION_TARGET_ID, PX_LOCATION_SERVER_ADDRESS));
+		 	  	v_container_request_preamble		:= valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided?
+		 	  	
+		 	  	v_locPolicyResourceIndex			:= f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index
+			  	v_locContainerResourceIndex		:= f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index
+			    v_subscription_request_preamble	:= valueof(m_createSubscription(f_getResourceAddress(v_locContainerResourceIndex), c_defaultResourceName, omit));
+				v_subscriptionResourceIndex		:= f_cse_createResource(int23, v_subscription_request_preamble, v_locContainerResourceIndex);
+				
+			  //Test Body - retrieve the <latest> resource of the created container resource linked with the locationPolicy resource
+		      mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest")))); 
+		      tc_ac.start;
+		      alt{
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{
+		          tc_ac.stop;
+		          if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Notification_optional.notificationEvent)){		            
+		            	setverdict(fail, testcasename() & "No NotificationEvent is included in the response!");
+		          }else{
+		            	setverdict(pass, testcasename() & "Location information is successfully sent!");		            
+		          }		          
+		          
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{
+		          		tc_ac.stop;
+		          		setverdict(fail, testcasename() & "Requested container resource is not found!");
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+						tc_ac.stop;
+						setverdict(fail, testcasename() & ": Error while retrieving resource!");
+				}
+				[] tc_ac.timeout {
+						setverdict(inconc, testcasename() & ": No answer while retrieving resource!");
+				}		        
+		      }
+		      
+		      // Postamble
+    		  f_cse_postamble_deleteResources();	 
+    			
+			  // Tear down
+			  f_cf01Down(); 		      
+		      
+		    }//end testcase TC_CSE_LOC_BV_006_01
+		    
+		    testcase TC_CSE_LOC_BV_006_02() runs on CseTester system CseSystem{
+		      //TO NOTIFY a location information 
+		     
+		      var integer v_aeAuxIndex					:=	-1;
+		      var integer v_locPolicyResourceIndex		:= 	-1;
+		      var integer v_locContainerResourceIndex	:=	-1;
+		      var integer v_subscriptionResourceIndex	:= 	-1;
+		      var LocationSource v_locationSource	:= int2;//Device-based
+		      var RequestPrimitive v_locpolicy_request_preamble;
+		      var RequestPrimitive v_container_request_preamble;
+		      var RequestPrimitive v_subscription_request_preamble;
+		      var MsgIn v_response;
+		      		      
+		 	  //Test component configuration
+		 	  f_cf01Up();
+		 	  
+		 	  //Preamble - register AE
+				v_aeAuxIndex						:= f_cse_preamble_registerAe();
+		 	  //Preamble - create a valid locationPolicy resource
+		 	  	 
+		 	  	v_locpolicy_request_preamble		:= valueof(m_createLocationPolicy(v_locationSource, omit, PX_LOCATION_UPDATE_PERIOD, omit, omit));
+		 	  	v_container_request_preamble		:= valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided?
+		 	  	
+		 	  	v_locPolicyResourceIndex			:= f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index
+			  	v_locContainerResourceIndex		:= f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index
+			    v_subscription_request_preamble	:= valueof(m_createSubscription(f_getResourceAddress(v_locContainerResourceIndex), c_defaultResourceName, omit));
+				v_subscriptionResourceIndex		:= f_cse_createResource(int23, v_subscription_request_preamble, v_locContainerResourceIndex);
+				
+			  //Test Body - retrieve the <latest> resource of the created container resource linked with the locationPolicy resource
+		      mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest")))); 
+		      tc_ac.start;
+		      alt{
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{
+		          tc_ac.stop;
+		          if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Notification_optional.notificationEvent)){		            
+		            	setverdict(fail, testcasename() & "No NotificationEvent is included in the response!");
+		          }else{
+		            	setverdict(pass, testcasename() & "Location information is successfully sent!");		            
+		          }		          
+		          
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{
+		          		tc_ac.stop;
+		          		setverdict(fail, testcasename() & "Requested container resource is not found!");
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+						tc_ac.stop;
+						setverdict(fail, testcasename() & ": Error while retrieving resource!");
+				}
+				[] tc_ac.timeout {
+						setverdict(inconc, testcasename() & ": No answer while retrieving resource!");
+				}		        
+		      }
+		      
+		      // Postamble
+    		  f_cse_postamble_deleteResources();	 
+    			
+			  // Tear down
+			  f_cf01Down(); 		      
+		      
+		    }//end testcase TC_CSE_LOC_BV_006_02 		    
+		    
+		    testcase TC_CSE_LOC_BV_006_03() runs on CseTester system CseSystem{
+		      //TO NOTIFY a location information 
+		     
+		      var integer v_aeAuxIndex					:=	-1;
+		      var integer v_locPolicyResourceIndex		:= 	-1;
+		      var integer v_locContainerResourceIndex	:=	-1;
+		      var integer v_subscriptionResourceIndex	:= 	-1;
+		      var LocationSource v_locationSource	:= int3;//Sharing-based
+		      var RequestPrimitive v_locpolicy_request_preamble;
+		      var RequestPrimitive v_container_request_preamble;
+		      var RequestPrimitive v_subscription_request_preamble;
+		      var MsgIn v_response;
+		      		      
+		 	  //Test component configuration
+		 	  f_cf01Up();
+		 	  
+		 	  //Preamble - register AE
+				v_aeAuxIndex						:= f_cse_preamble_registerAe();
+		 	  //Preamble - create a valid locationPolicy resource
+		 	  	 
+		 	  	v_locpolicy_request_preamble		:= valueof(m_createLocationPolicy(v_locationSource, omit, omit, omit, omit));
+		 	  	v_container_request_preamble		:= valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided?
+		 	  	
+		 	  	v_locPolicyResourceIndex			:= f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index
+			  	v_locContainerResourceIndex		:= f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index
+			    v_subscription_request_preamble	:= valueof(m_createSubscription(f_getResourceAddress(v_locContainerResourceIndex), c_defaultResourceName, omit));
+				v_subscriptionResourceIndex		:= f_cse_createResource(int23, v_subscription_request_preamble, v_locContainerResourceIndex);
+				
+			  //Test Body - retrieve the <latest> resource of the created container resource linked with the locationPolicy resource
+		      mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest")))); 
+		      tc_ac.start;
+		      alt{
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{
+		          tc_ac.stop;
+		          if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Notification_optional.notificationEvent)){		            
+		            	setverdict(fail, testcasename() & "No NotificationEvent is included in the response!");
+		          }else{
+		            	setverdict(pass, testcasename() & "Location information is successfully sent!");		            
+		          }		          
+		          
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{
+		          		tc_ac.stop;
+		          		setverdict(fail, testcasename() & "Requested container resource is not found!");
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+						tc_ac.stop;
+						setverdict(fail, testcasename() & ": Error while retrieving resource!");
+				}
+				[] tc_ac.timeout {
+						setverdict(inconc, testcasename() & ": No answer while retrieving resource!");
+				}		        
+		      }
+		      
+		      // Postamble
+    		  f_cse_postamble_deleteResources();	 
+    			
+			  // Tear down
+			  f_cf01Down(); 		      
+		      
+		    }//end testcase TC_CSE_LOC_BV_006_03 
+		  }//end group g_CSE_LOC_BV_006
+		  
+		  /*group g_CSE_LOC_BV_007 {
+    		  testcase TC_CSE_LOC_BV_007() runs on CseTester system CseSystem{		    
+    		    //TODO
+    		  }//end testcase TC_CSE_LOC_BV_007
+		  }//end group g_CSE_LOC_BV_007
 		  
-		 
+		  group g_CSE_LOC_BV_008 {
+    		  testcase TC_CSE_LOC_BV_008() runs on CseTester system CseSystem{		    
+    		    //TODO
+    		  }//end testcase TC_CSE_LOC_BV_008
+		  }//end group g_CSE_LOC_BV_008
+		  */
+
+		  group g_CSE_LOC_BV_009 {
+    		  testcase TC_CSE_LOC_BV_009() runs on CseTester system CseSystem{		    
+    		    //To CREATE a <subscription> resource as a child resource of the created <container> 
+    		    
+        		   var integer v_aeAuxIndex					:=	-1;
+    		      var integer v_locPolicyResourceIndex		:= 	-1;
+    		      var integer v_locContainerResourceIndex	:=	-1;
+    		      var LocationSource v_locationSource	:= int1;//Netwok-based
+    		      var RequestPrimitive v_locpolicy_request_preamble;
+    		      var RequestPrimitive v_container_request_preamble;
+    		      var RequestPrimitive v_subscription_request_preamble;
+    		      var MsgIn v_response;
+    		      		      
+    		 	  //Test component configuration
+    		 	  f_cf01Up();
+    		 	  
+    		 	  //Preamble - register AE
+    				v_aeAuxIndex						:= f_cse_preamble_registerAe();
+    		 	  //Preamble - create a valid locationPolicy resource 
+    		 	  	v_locpolicy_request_preamble		:= valueof(m_createLocationPolicy(v_locationSource, omit, PX_LOCATION_UPDATE_PERIOD, PX_LOCATION_TARGET_ID, PX_LOCATION_SERVER_ADDRESS));
+    		 	  	v_container_request_preamble		:= valueof(m_createContainer(f_getResourceAddress(v_aeAuxIndex), omit));//no location-container name provided?
+    		 	  	
+    		 	  	v_locPolicyResourceIndex			:= f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index
+    			  	v_locContainerResourceIndex		:= f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index
+    			    v_subscription_request_preamble	:= valueof(m_createSubscription(f_getResourceAddress(v_locContainerResourceIndex), c_defaultResourceName, omit));
+    				    				
+    			  //Test Body
+    		      mcaPort.send(m_request(valueof(f_getCreateRequestPrimitive(int23, v_subscription_request_preamble, v_locContainerResourceIndex)))); 
+    		      tc_ac.start;
+    		      alt{
+    		        [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{
+    		          tc_ac.stop;    		         
+    		          setverdict(pass, testcasename() & "Subscription resource is successfully!");
+    		        }
+    		        [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{
+    		          		tc_ac.stop;
+    		          		setverdict(fail, testcasename() & "Requested container resource is not found!");
+    		        }    		        
+    				[] tc_ac.timeout {
+    						setverdict(inconc, testcasename() & ": No answer while creating subscription resource!");
+    				}		        
+    		      }
+    		      
+    		      // Postamble
+        		  f_cse_postamble_deleteResources();	 
+        			
+    			  // Tear down
+    			  f_cf01Down(); 		
+    		    
+    		  }//end testcase TC_CSE_LOC_BV_009
+		  }//end group g_CSE_LOC_BV_009
+		
+		  group g_CSE_LOC_BV_010 {
+		    
+		    testcase TC_CSE_LOC_BV_010() runs on CseTester system CseSystem{
+		      //TO RETRIEVE a <locationPolicy> resource that has created in cse
+		     
+		      var integer v_aeAuxIndex				:=	-1;
+		      var integer v_locPolicyResourceIndex	:= 	-1;
+		      var RequestPrimitive v_locpolicy_request_preamble;
+		      var MsgIn v_response;
+		      var LocationSource v_locationSource	:= int1;//Netwok-based
+		      
+		 	  //Test component configuration
+		 	  f_cf01Up();
+		 	  
+		 	  //Preamble - register AE
+		 	  v_aeAuxIndex				:= f_cse_preamble_registerAe();
+		 	  //Preamble - create a valid locationPolicy resource for later container resource creation
+		 	  v_locpolicy_request_preamble		:= valueof(m_createLocationPolicy(v_locationSource, omit, PX_LOCATION_UPDATE_PERIOD, PX_LOCATION_TARGET_ID, PX_LOCATION_SERVER_ADDRESS));
+		      v_locPolicyResourceIndex	:= f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index
+				
+			  //Test Body - retrieve the created locationpolicy resource
+		      mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locPolicyResourceIndex))))); 
+		      tc_ac.start;
+		      alt{
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{
+		          tc_ac.stop;
+		          if(not ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].LocationPolicy_optional.locationContainerID)){		            
+		            	setverdict(fail, testcasename() & "No locationContainerID is included in the response!");
+		          }else{
+		            	setverdict(pass, testcasename() & "LocationPolicy resource is successfully retrieved with locationContainerID included in the response!");		            
+		          }		          
+		          
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response{
+		          		tc_ac.stop;
+		          		setverdict(fail, testcasename() & "Requested locationPolicy is not found!");
+		        }
+		        [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+						tc_ac.stop;
+						setverdict(fail, testcasename() & ": Error while retrieving resource!");
+				}
+				[] tc_ac.timeout {
+						setverdict(inconc, testcasename() & ": No answer while retrieving resource!");
+				}
+		        
+		      }
+		      
+		      // Postamble
+    		  f_cse_postamble_deleteResources();	 
+    			
+			  // Tear down
+			  f_cf01Down(); 		      
+		      
+		    }//end testcase TC_CSE_LOC_BV_010 		    
+		    
+		  }//end group g_CSE_LOC_BV_010
 		  
 		  
 		}//end group Location
-- 
GitLab