diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn
index 0ed5befc25c17883a43755fcbc9c726b6c104a00..e62697d46a2c5fd44d89f5cf4f3aff642ad2f129 100644
--- a/LibOneM2M/OneM2M_Templates.ttcn
+++ b/LibOneM2M/OneM2M_Templates.ttcn
@@ -788,10 +788,14 @@ module OneM2M_Templates {
 			template (value) RequestPrimitive m_updatePrimitiveProfileNonMutuallyExclusive modifies m_updatePrimitiveProfileBase := {
 				primitiveContent:= {primitveProfile := m_contentUpdatePrimitiveProfileNonMutuallyExclusive}
 			}
-			
+
 			template (value) RequestPrimitive m_updatePrimitiveProfileNonPermissibleParameters modifies m_updatePrimitiveProfileBase := {
 				primitiveContent:= {primitveProfile := m_contentUpdatePrimitiveProfileNonPermissibleParameters}
 			}
+            
+			template (value) RequestPrimitive m_updatePrimitiveProfileAddContainerMaxByteNegative modifies m_updatePrimitiveProfileBase := {
+				primitiveContent:= {primitveProfile := m_contentUpdatePrimitiveProfileNegativeMaxByteSize}
+			}            
         	
         	template (value) RequestPrimitive m_updateRemoteCSEBase modifies m_update := {
 			   requestIdentifier := "m_updateRemoteCSEBase",
@@ -813,7 +817,7 @@ module OneM2M_Templates {
 			template RequestPrimitive mw_updateAEAnnc(template XSD.ID p_from := *, template XSD.ID p_to := ?) modifies mw_update:= {
 				primitiveContent := {aEAnnc := ?}
 			};
-
+            
             /**
 			 * @desc Base Reception template for update ContainerAnnc
 			 */
@@ -1453,6 +1457,24 @@ module OneM2M_Templates {
 				resourceType := int59,
 				primitiveContent := {primitveProfile := m_contentCreatePrimitveProfileAddContainerMaxByte100(p_IDList) }
 			};
+
+            /**
+             * @desc CREATE request primitive for PrimitveProfile resource with primitive Add for Content resource
+             */
+            template (value) RequestPrimitive m_createPrimitiveProfileAddContainerMaxByteNegative(in template ListOfM2MID p_IDList := omit) modifies m_create:= {
+                requestIdentifier := testcasename() & "-m_createPrimitveProfile",
+                resourceType := int59,
+                primitiveContent := {primitveProfile := m_contentCreatePrimitiveProfileAddContainerMaxByteNegative(p_IDList) }
+            };           
+        
+			/**
+			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Add for Content resource
+			 */
+			template (value) RequestPrimitive m_createPrimitveProfileAddContainerMaxByte100ToResponse(in template ListOfM2MID p_IDList := omit) modifies m_create:= {
+				requestIdentifier := testcasename() & "-m_createPrimitveProfile",
+				resourceType := int59,
+				primitiveContent := {primitveProfile := m_contentCreatePrimitveProfileAddContainerMaxByte100ToResponse(p_IDList) }
+			};            
 			
 			/**
 			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Add for ResultContent=4, attribute and child resources
@@ -1462,6 +1484,24 @@ module OneM2M_Templates {
 				resourceType := int59,
 				primitiveContent := {primitveProfile := m_contentCreatePrimitveProfileAddResultContentTo4(p_IDList) }
 			};
+
+			/**
+			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Add for ResultContent=4, attribute and child resources
+			 */
+			template (value) RequestPrimitive m_createPrimitiveProfileAddResultContentTo4ToResponse(in template ListOfM2MID p_IDList := omit) modifies m_create:= {
+				requestIdentifier := testcasename() & "-m_createPrimitveProfile",
+				resourceType := int59,
+				primitiveContent := {primitveProfile := m_contentCreatePrimitveProfileAddResultContentTo4ToResponse(p_IDList) }
+			};
+
+			/**
+			 * @desc CREATE request primitive for PrimitiveProfile resource with primitive Add for ResultContent=4, attribute and child resources
+			 */
+			template (value) RequestPrimitive m_createPrimitiveProfileModifResultContentTo4ToResponse(in template ListOfM2MID p_IDList := omit) modifies m_create:= {
+				requestIdentifier := testcasename() & "-m_createPrimitveProfile",
+				resourceType := int59,
+				primitiveContent := {primitveProfile := m_contentCreatePrimitiveProfileModifResultContentTo4ToResponse(p_IDList) }
+			};
 			
 			/**
 			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Add for ResultContent=1, attribute and child resources
@@ -1472,6 +1512,15 @@ module OneM2M_Templates {
 				primitiveContent := {primitveProfile := m_contentCreatePrimitveProfileAddResultContentTo1(p_IDList) }
 			};
 			
+			/**
+			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Add for ResultContent=1, attribute and child resources
+			 */
+			template (value) RequestPrimitive m_createPrimitveProfileAddResultContentTo1ToResponse(in template ListOfM2MID p_IDList := omit) modifies m_create:= {
+				requestIdentifier := testcasename() & "-m_createPrimitveProfile",
+				resourceType := int59,
+				primitiveContent := {primitveProfile := m_contentCreatePrimitveProfileAddResultContentTo1ToResponse(p_IDList) }
+			};
+            
 			/**
 			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Delete for ResultContent
 			 */
@@ -1481,6 +1530,15 @@ module OneM2M_Templates {
 				primitiveContent := {primitveProfile := m_contentCreatePrimitveProfileDeleteResultContent(p_IDList) }
 			};
 
+			/**
+			 * @desc CREATE request primitive for PrimitiveProfile resource with primitive Add for non permissible attribute
+			 */
+			template (value) RequestPrimitive m_createPrimitiveProfileAddgmty(in template ListOfM2MID p_IDList := omit) modifies m_create:= {
+				requestIdentifier := testcasename() & "-m_createPrimitveProfile",
+				resourceType := int59,
+				primitiveContent := {primitveProfile := m_contentCreatePrimitiveProfileAddgmty(p_IDList) }
+			};
+
 			/**
 			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Add for non permissible attribute
 			 */
@@ -1525,6 +1583,24 @@ module OneM2M_Templates {
 				resourceType := int59,
 				primitiveContent := {primitveProfile := m_contentCreatePrimitveProfileAddMaxByte100ToResponse(p_IDList) }
 			};
+
+			/**
+			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Add for ResultContent=1 from response.
+			 */
+			template (value) RequestPrimitive m_createPrimitiveProfileAddResultContentTo1FromResponse(in template ListOfM2MID p_IDList := omit) modifies m_create:= {
+				requestIdentifier := testcasename() & "-m_createPrimitveProfile",
+				resourceType := int59,
+				primitiveContent := {primitveProfile := m_contentCreatePrimitiveProfileAddResultContentTo1FromResponse(p_IDList) }
+			};
+            
+			/**
+			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Add for ResultContent=1 from response.
+			 */
+			template (value) RequestPrimitive m_createPrimitiveProfileDeleteResultContentTo1FromResponse(in template ListOfM2MID p_IDList := omit) modifies m_create:= {
+				requestIdentifier := testcasename() & "-m_createPrimitveProfile",
+				resourceType := int59,
+				primitiveContent := {primitveProfile := m_contentCreatePrimitiveProfileDeleteResultContentTo1FromResponse(p_IDList) }
+			};            
 			
 			/**
 			 * @desc CREATE request primitive for PrimitveProfile resource with primitive Delete from response.
@@ -1580,7 +1656,7 @@ module OneM2M_Templates {
 			template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedAppIDs, in ListOfM2MID p_allowedAEs, in template (value) ListOfM2MID p_allowedUsers) modifies m_create := {
 				requestIdentifier := testcasename() & "-m_createServiceSubscribedAppRule",
 				resourceType := int19,
-				primitiveContent := {serviceSubscribedAppRule := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedAppIDs, p_allowedAEs, p_allowedUsers)}
+				primitiveContent := {serviceSubscribedAppRule := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedAppIDs, p_allowedAEs, valueof(p_allowedUsers))}
 			};
         	
 			/**
@@ -3477,6 +3553,42 @@ module OneM2M_Templates {
 			applicability := REQUESTS_TO_CSE
 		};
 		
+        /**
+		 * @desc Primitive Profile for adding MaxByte primitive of Content resource
+		 */
+		template PrimitveProfile_optional m_contentCreatePrimitiveProfileAddContainerMaxByteNegative(in template ListOfM2MID p_IDList) modifies m_contentCreatePrimitveProfileBase := {
+			resourceName := c_defaultPrimitiveProfileceResourceName, //O
+			IDList := p_IDList, //M
+			resourceTypes := {int3}, //O
+			operations := {int1, int2, int3, int4, int5},//O
+			additions := {{"maxByteSize", "-100"}}, //O
+			applicability := REQUESTS_TO_CSE
+		};
+
+        /**
+		 * @desc Primitive Profile for adding MaxByte primitive of Content resource
+		 */
+        template PrimitveProfile_optional m_contentCreatePrimitiveProfileAddgmty(in template ListOfM2MID p_IDList) modifies m_contentCreatePrimitveProfileBase := {
+			resourceName := c_defaultPrimitiveProfileceResourceName, //O
+			IDList := p_IDList, //M
+			resourceTypes := {int3}, //O
+			operations := {int1, int2, int3, int4, int5},//O
+            additions := {{"geoCoordinates", "type_:=1, coordinates:={-4.4216366, 36.7213028}"}},//6.3.5.69	m2m:geoCoordinates
+			applicability := REQUESTS_TO_CSE        
+        }; 
+            
+		/**
+		 * @desc Primitive Profile for adding MaxByte primitive of Content resource
+		 */
+		template PrimitveProfile_optional m_contentCreatePrimitveProfileAddContainerMaxByte100ToResponse(in template ListOfM2MID p_IDList) modifies m_contentCreatePrimitveProfileBase := {
+			resourceName := c_defaultPrimitiveProfileceResourceName, //O
+			IDList := p_IDList, //M
+			resourceTypes := {int3}, //O
+			operations := {int1, int2, int3, int4, int5},//O
+			additions := {{"maxByteSize", "100"}}, //O
+			applicability := RESPONSES_FROM_CSE
+		};
+        
 		/**
 		 * @desc Primitive Profile for adding resultContent primitive of container resource
 		 */
@@ -3488,6 +3600,30 @@ module OneM2M_Templates {
 			additions := {{"resultContent", "4"}}, //O
 			applicability := REQUESTS_TO_CSE
 		};
+        
+		/**
+		 * @desc Primitive Profile for adding resultContent primitive of container resource
+		 */
+		template PrimitveProfile_optional m_contentCreatePrimitveProfileAddResultContentTo4ToResponse(in template ListOfM2MID p_IDList) modifies m_contentCreatePrimitveProfileBase := {
+			resourceName := c_defaultPrimitiveProfileceResourceName, //O
+			IDList := p_IDList, //M
+			resourceTypes := {int3}, //O
+			operations := {int1, int2, int3, int4, int5},//O
+			additions := {{"resultContent", "4"}}, //O
+			applicability := RESPONSES_FROM_CSE
+		};
+        
+		/**
+		 * @desc Primitive Profile for modification of resultContent primitive of container resource
+		 */
+		template PrimitveProfile_optional m_contentCreatePrimitiveProfileModifResultContentTo4ToResponse(in template ListOfM2MID p_IDList) modifies m_contentCreatePrimitveProfileBase := {
+			resourceName := c_defaultPrimitiveProfileceResourceName, //O
+			IDList := p_IDList, //M
+			resourceTypes := {int3}, //O
+			operations := {int1, int2, int3, int4, int5},//O
+			modifications := {{"resultContent", "4"}}, //O
+			applicability := RESPONSES_FROM_CSE
+		};        
 		
 		/**
 		 * @desc Primitive Profile for adding resultContent primitive of container resource
@@ -3500,7 +3636,19 @@ module OneM2M_Templates {
 			additions := {{"resultContent", "1"}}, //O
 			applicability := REQUESTS_TO_CSE
 		};
-		
+        
+		/**
+		 * @desc Primitive Profile for adding resultContent primitive of container resource
+		 */
+		template PrimitveProfile_optional m_contentCreatePrimitveProfileAddResultContentTo1ToResponse(in template ListOfM2MID p_IDList) modifies m_contentCreatePrimitveProfileBase := {
+			resourceName := c_defaultPrimitiveProfileceResourceName, //O
+			IDList := p_IDList, //M
+			resourceTypes := {int3}, //O
+			operations := {int1, int2, int3, int4, int5},//O
+			additions := {{"resultContent", "1"}}, //O
+			applicability := RESPONSES_FROM_CSE
+		};
+
 		/**
 		 * @desc Primitive Profile for removing resultContent primitive of container resource
 		 */
@@ -3533,7 +3681,7 @@ module OneM2M_Templates {
 			IDList := p_IDList, //M
 			resourceTypes := {int3}, //O
 			operations := {int1, int2, int3, int4, int5},//O
-			deletions := {{"requestIdentifier"}}, //O
+			deletions := {"requestIdentifier"}, //O
 			applicability := REQUESTS_TO_CSE
 		};
 		
@@ -3598,6 +3746,30 @@ module OneM2M_Templates {
 			applicability := RESPONSES_FROM_CSE
 		};
     	
+        /**
+         * @desc Primitive Profile for adding resultContent primitive to Resoponse Content
+		 */
+        template PrimitveProfile_optional m_contentCreatePrimitiveProfileAddResultContentTo1FromResponse(in template ListOfM2MID p_IDList) modifies m_contentCreatePrimitveProfileBase := {
+            resourceName := c_defaultPrimitiveProfileceResourceName, //O
+            IDList := p_IDList, //M
+            resourceTypes := {int3}, //O
+            operations := {int1, int2, int3, int4, int5},//O
+            additions := {{"resultContent", "1"}}, //O
+            applicability := RESPONSES_FROM_CSE
+        };
+        
+        /**
+         * @desc Primitive Profile for deleting resultContent primitive to Response Content
+		 */
+        template PrimitveProfile_optional m_contentCreatePrimitiveProfileDeleteResultContentTo1FromResponse(in template ListOfM2MID p_IDList) modifies m_contentCreatePrimitveProfileBase := {
+            resourceName := c_defaultPrimitiveProfileceResourceName, //O
+            IDList := p_IDList, //M
+            resourceTypes := {int3}, //O
+            operations := {int1, int2, int3, int4, int5},//O
+            deletions := {"resultContent"}, //O
+            applicability := RESPONSES_FROM_CSE
+        };        
+        
     	/**
     	 * @desc Base primitiveContent for CREATE operation for Schedule resource
     	 * @param p_scheduleElement Schedule
@@ -4026,7 +4198,7 @@ module OneM2M_Templates {
 			subscriberURI := *,//O
 			associatedCrossResourceSub := *,//O
 			choice := *//O
-		};   	
+		};
 
 		template (value) Subscription_optional m_contentCreateSubscriptionAdvanced (in template (value) ListOfURIs p_notificationURI,
 																					in template (omit)  XSD.String p_name := c_defaultSubscriptionResourceName,
@@ -4044,7 +4216,7 @@ module OneM2M_Templates {
 			latestNotify := p_latestNotify,//O
 			notificationContentType := p_notificationContentType, //TODO Set to omit once xsd is fixed,//O
 			subscriberURI := p_subscriberURI//O
-		}; 
+		};
 		
 		template (value) EventNotificationCriteria m_eventNotificationCriteria ( in EventNotificationCriteria.notificationEventType_list p_notificationEventType_list := {}, template (omit) EventNotificationCriteria.attribute p_attribute_list := omit) := { //the parameter should be a list of NotificationEventTypeEventType
 			createdBefore := omit,
@@ -4065,12 +4237,46 @@ module OneM2M_Templates {
 			filterOperation := omit
 		};
         
+/*      template (value) EventNotificationCriteria m_eventNotificationCriteriaWithParams ( in EventNotificationCriteria.notificationEventType_list p_notificationEventType_list := {}, 
+                                                                                           template (omit) EventNotificationCriteria.attribute p_attribute_list := omit,
+                                                                                           Timestamp p_createdBefore := omit,
+                                                                                           Timestamp p_createdAfter := omit,
+                                                                                           Timestamp p_modifiedSince := omit,
+                                                                                           Timestamp p_unmodifiedSince := omit,
+                                                                                           XSD.PositiveInteger p_stateTagSmaller := omit,
+                                                                                           XSD.NonNegativeInteger p_stateTagBigger := omit,
+                                                                                           Timestamp p_expireBefore := omit,
+                                                                                           Timestamp p_expireAfter := omit,
+                                                                                           XSD.NonNegativeInteger p_sizeAbove := omit,
+                                                                                           XSD.PositiveInteger p_sizeBelow := omit,
+                                                                                           EventNotificationCriteria.operationMonitor p_operationMonitor_list := {},
+                                                                                           EventNotificationCriteria.resourceType p_childResourceType := {},
+                                                                                           template (omit) EventNotificationCriteria.missingData p_missingData := omit,
+                                                                                           template (omit) EventNotificationCriteria.filterOperation p_filterOperation := omit
+                                                                                           ) modifies m_eventNotificationCriteria := {
+			createdBefore := p_createdBefore,
+			createdAfter := p_createdAfter,
+			modifiedSince := p_modifiedSince,
+			unmodifiedSince := p_unmodifiedSince,
+			stateTagSmaller := p_stateTagSmaller,
+			stateTagBigger := p_stateTagBigger,
+			expireBefore := p_expireBefore,
+			expireAfter := p_expireAfter,
+			sizeAbove := p_sizeAbove,
+			sizeBelow := p_sizeBelow,
+			operationMonitor_list := p_operationMonitor_list,
+			attribute := p_attribute_list, 
+			notificationEventType_list := p_notificationEventType_list,// TODO this list should be able to be omited see 9.6.8 (TS0001)
+			childResourceType := p_childResourceType,
+			missingData := p_missingData,
+			filterOperation := p_filterOperation
+		};*/
+        
 		template (value) BatchNotify m_batchNotify (in XSD.NonNegativeInteger p_number, in XSD.Duration p_duration := "PT20S") := {
 			number := p_number,
 			duration := p_duration //TODO duration has to be set to 1s and match to the Duration regex 
 		};
-		//normaly duration can be omited
-		
+		//normaly duration can be omited		
 		
          	
     	
@@ -6451,6 +6657,10 @@ module OneM2M_Templates {
 		template (value) PrimitveProfile_optional m_contentUpdatePrimitiveProfileNonPermissibleParameters modifies m_contentUpdatePrimitiveProfile := {
 			additions := {{"releaseVersionIndicator", "3"}} //O
 		}
+        
+		template (value) PrimitveProfile_optional m_contentUpdatePrimitiveProfileNegativeMaxByteSize modifies m_contentUpdatePrimitiveProfile := {
+			additions := {{"maxByteSize", "-10"}}
+		}        
     	
 		template (value) AEAnnc_optional m_contentUpdateAEAnnc := {
 			resourceName := omit,
@@ -6732,7 +6942,42 @@ module OneM2M_Templates {
 			maxNumAEs                           := 0 // O
 		};
 		
-		
+		/**
+		 * @desc Base primitiveContent for UPDATE operation for SoftwareCampaign resource
+		 */
+		template (value) SoftwareCampaign_optional m_contentUpdateSoftwareCampaign := {
+                resourceName := omit,//O
+                resourceType := omit,//NP
+                resourceID := omit,//NP
+                parentID := omit,//NP
+                creationTime := omit,//NP
+                lastModifiedTime := omit,//NP
+                labels := omit,//O
+                accessControlPolicyIDs := omit, //O
+                expirationTime := omit,//O
+                dynamicAuthorizationConsultationIDs := omit, //O
+                holder := omit,//O           
+                announceTo := omit,//O
+                announceSyncType := omit,//O
+                announcedAttribute := omit,//O
+                version := omit,
+                name := omit,
+                uRL := omit,            
+                softwareTargets := omit,
+                softwareTriggerCriteria := omit,//O
+                softwareOperation := omit,//O
+                softwareLinks := omit,
+                aggregatedSoftwareStatus := omit,//M
+                individualSoftwareStatus := omit
+		};
+        
+        /**
+         * @desc Base UPDATE request primitive for SoftwareCampaign resource
+         */
+        template (value) RequestPrimitive m_updateSoftwareCampaign modifies m_update:= {
+            requestIdentifier := "m_updateSoftwareCampaign",
+            primitiveContent:= {softwareCampaign := m_contentUpdateSoftwareCampaign}
+        };        
 	}//end group ContentUpdate
 	
 	group ContentRetrieve {
@@ -7609,7 +7854,7 @@ module OneM2M_Templates {
 			choice := omit//O
 		}
 		
-		template (value) Subscription_optional m_contentSubscription modifies mw_contentSubscription_allOmit := {
+		template Subscription_optional m_contentSubscription modifies mw_contentSubscription_allOmit := {
 			resourceType := int23	//M
 		}
 		
@@ -9457,6 +9702,114 @@ module OneM2M_Templates {
 			}, 
 			forcedFields := omit
 		};
-	 }	
+	 }
+
+    group Software {
+            /**
+             * @desc Base primitiveContent for CREATE operation for softwareCampaign resource
+             * @param p_name Resource name
+             */
+            template (value) SoftwareCampaign_optional m_contentCreateSoftwareCampaign (in template (omit) XSD.String p_name := c_defaultRoleResourceName):= {
+                resourceName := p_name,//O
+                resourceType := omit,//NP
+                resourceID := omit,//NP
+                parentID := omit,//NP
+                creationTime := omit,//NP
+                lastModifiedTime := omit,//NP
+                labels := omit,//O
+                accessControlPolicyIDs := omit, //O
+                expirationTime := omit,//O
+                dynamicAuthorizationConsultationIDs := omit, //O
+                holder := omit,//O           
+                announceTo := omit,//O
+                announceSyncType := omit,//O
+                announcedAttribute := omit,//O
+                version := omit,
+                name := omit,
+                uRL := omit,            
+                softwareTargets := omit,
+                softwareTriggerCriteria := omit,//O
+                softwareOperation := omit,//O
+                softwareLinks := omit,
+                aggregatedSoftwareStatus := omit,//M
+                individualSoftwareStatus := omit
+            };     
+                
+            /**
+             * @desc base Software campaign creation
+             */
+            template SoftwareCampaign_optional m_contentCreateSoftwareCampaignBase := { //(in template ListOfM2MID p_softwareTargets := omit, template Action p_action) := {
+                resourceName := c_defaultSoftwareCampaignResourceName, //O
+                resourceType := omit,//NP
+                resourceID := omit,//NP
+                parentID := omit,//NP
+                creationTime := omit,//NP
+                lastModifiedTime := omit,//NP
+                labels := omit,//O
+                accessControlPolicyIDs := omit, //O
+                expirationTime := omit,//O
+                dynamicAuthorizationConsultationIDs := omit, //O
+                holder := omit,//O           
+                announceTo := omit,//O
+                announceSyncType := omit,//O
+                announcedAttribute := omit,//O
+                version := "version1", //
+                name := "name",
+                uRL := "PX_TS_ONTOLOGY_SERVER",
+                softwareTargets := {"UNINITIALIZED"},
+                softwareTriggerCriteria := omit,
+                softwareOperation := (int1,int2,int3,int4),
+                softwareLinks := omit,
+                aggregatedSoftwareStatus := (int1,int2,int3,int4,int5,int6,int7),
+                individualSoftwareStatus := omit
+            };
+
+            template SoftwareCampaign_optional m_contentCreateSoftwareCampaignNoSoftwareTargets(in template ListOfM2MID p_softwareTargets := omit, template Action p_action) modifies m_contentCreateSoftwareCampaignBase := {
+                resourceName := c_defaultSoftwareCampaignResourceName, //O
+                softwareTargets := {"UNINITIALIZED"},
+                softwareTriggerCriteria := p_action,
+                softwareOperation := int1,
+                softwareLinks := omit,
+                aggregatedSoftwareStatus := int1,//pending
+                individualSoftwareStatus := omit
+            };
+            
+            template SoftwareCampaign_optional m_contentCreateSoftwareCampaignNoSoftwareTriggerCriteria(in template ListOfM2MID p_softwareTargets := omit, template Action p_action) modifies m_contentCreateSoftwareCampaignBase := {
+                resourceName := c_defaultSoftwareCampaignResourceName, //O
+                softwareTargets := p_softwareTargets,
+                softwareTriggerCriteria := p_action,
+                softwareOperation := int1, 
+                softwareLinks := omit,
+                aggregatedSoftwareStatus := int1,//pending
+                individualSoftwareStatus := omit
+            };
+
+            /**
+             * @desc CREATE request primitive for Software campaign resource without attributes
+             */
+            template (value) RequestPrimitive m_createSoftwareCampaign modifies m_create := {
+                requestIdentifier := testcasename() & "-m_createSoftwareCampaign",
+                resourceType := int51,// ToDo Resource Type set to 61? (softwareCampaign) to be defined and ID to be verified on TS
+                primitiveContent := {softwareCampaign := m_contentCreateSoftwareCampaignBase}
+            };
+
+            /**
+             * @desc CREATE request primitive for Software campaign resource without attribute softwareTargets
+             */
+            template (value) RequestPrimitive m_createSoftwareCampaignNoSoftwareTargets(in template Action p_action) modifies m_create := {
+                requestIdentifier := testcasename() & "-m_createSoftwareCampaign",
+                resourceType := int51,// ToDo Resource Type set to 61? (softwareCampaign) to be defined and ID to be verified on TS
+                primitiveContent := {softwareCampaign := m_contentCreateSoftwareCampaignNoSoftwareTargets(omit, p_action)}
+            };
+            
+            /**
+             * @desc CREATE request primitive for Software campaign resource without attribute SoftwareTriggerCriteria
+             */
+            template (value) RequestPrimitive m_createSoftwareCampaignNoSoftwareTriggerCriteria(in template ListOfM2MID p_softwareTargets := omit) modifies m_create := {
+                requestIdentifier := testcasename() & "-m_createSoftwareCampaign",
+                resourceType := int51,// ToDo Resource Type set to 61? (softwareCampaign) to be defined and ID to be verified on TS
+                primitiveContent := {softwareCampaign := m_contentCreateSoftwareCampaignNoSoftwareTriggerCriteria(p_softwareTargets, omit)}
+            };
+    }     
 	
 }  // end of module
diff --git a/LibOneM2M/OneM2M_TypesAndValues.ttcn b/LibOneM2M/OneM2M_TypesAndValues.ttcn
index dbe01b90471c25b44e8eec3926c4d365f6f1615f..1906bab8250566a099921cdd43f6062804175dd8 100644
--- a/LibOneM2M/OneM2M_TypesAndValues.ttcn
+++ b/LibOneM2M/OneM2M_TypesAndValues.ttcn
@@ -56,6 +56,7 @@ module OneM2M_TypesAndValues {
 	const XSD.String c_defaultAe1ResourceName := "MyAe1";
 	const XSD.String c_defaultAe2ResourceName := "MyAe2";
 	const XSD.String c_defaultAcpResourceName := "MyAcp";
+    const XSD.String c_defaultSoftwareCampaignResourceName := "MySoftwareCampaign";
 		const charstring c_invalid_location_update_period	:= "-PT30M10S" ;//duration set to invalid value  (minus value)
 		const XSD.ID c_resourceShortNameLatest := "la";		//<latest>
 		const XSD.ID c_resourceShortNameOldest := "ol";		//<oldest>
@@ -4421,6 +4422,7 @@ group OtherTypes {
 	GenericInterworkingOperationInstance_optional genericInterworkingOperationInstance,
 	Role_optional role,
 	Token_optional token,
+    SoftwareCampaign_optional softwareCampaign, //added on Release-4    
 	//HAIM 
 	DeviceAirConditioner_optional deviceAirConditioner,
 	DeviceClothesWasherDryer_optional deviceClothesWasherDryer,
@@ -4486,7 +4488,7 @@ group OtherTypes {
 	Schedule_invalid schedule_invalid,
 	Subscription_invalid subscription_invalid,
 	LocationPolicy_invalid locationPolicy_invalid,
-	TimeSeries_invalid timeSeries_invalid 
+	TimeSeries_invalid timeSeries_invalid
 }
 	
 }
@@ -4678,6 +4680,66 @@ with {
   encode "adapter";
 } // End of group tsSettings
 	
-	
+ group Software {
+    type record Action
+    {
+        XSD.ID subjectResourceID,
+        EvalCriteria evalCriteria  
+    }
+
+    type record EvalCriteria
+    {
+        XSD.String  subject,
+        Operation   operator, // see type enumerated Operation
+        XSD.Integer threshold
+    }
+
+    //TODO To be removed/replaced by the type defined in XSDs
+    type enumerated AggregatedSoftwareStatus
+    {
+        int1(1), //pending
+        int2(2), //inProgress
+        int3(3), //installed
+        int4(4), //uninstalled
+        int5(5), //activated
+        int6(6), //deactivated
+        int7(7)  //error
+    }
+
+    type enumerated SoftwareOperation
+    {
+        int1(1), //install
+        int2(2), //uninstall
+        int3(3), //activate
+        int4(4)  //deactivate
+    }
+
+    type record SoftwareCampaign_optional //added on Release-4
+    {
+        ResourceName resourceName optional,
+        ResourceType resourceType optional,
+        XSD.ID resourceID optional,
+        NhURI parentID optional,
+        Timestamp creationTime optional,
+        Timestamp lastModifiedTime optional,
+        Labels labels optional,
+        AcpType accessControlPolicyIDs optional,
+        Timestamp expirationTime optional,
+        ListOfURIs dynamicAuthorizationConsultationIDs optional, 
+        XSD.ID holder optional,          
+        ListOfURIs announceTo optional,
+        XSD.ID announceSyncType optional,    
+        ListOfNCNames announcedAttribute optional,
+        XSD.String version optional,
+        XSD.NCName name optional,
+        XSD.AnyURI uRL optional,
+        ListOfM2MID softwareTargets optional,
+        Action softwareTriggerCriteria optional,
+        SoftwareOperation softwareOperation optional,
+        ListOfM2MID softwareLinks optional,
+        AggregatedSoftwareStatus aggregatedSoftwareStatus optional,
+        XSD.String individualSoftwareStatus optional //ToDo - complete with tuple if used
+    };
+ } // End of group Software   
 } 
 // end of module
diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn
index 284c99a499f700c94f3fead7a262a503e6a09cf5..4d1e7ef1fe302f149cd7e8a71867aa951f5a7a42 100644
--- a/OneM2M_PermutationFunctions.ttcn
+++ b/OneM2M_PermutationFunctions.ttcn
@@ -10088,6 +10088,65 @@ module OneM2M_PermutationFunctions {
 					//Tear down
 					f_cf01Down();
 				}// end f_CSE_SUB_CRE_001
+                
+				function f_CSE_SUB_CRE_006(template RequestPrimitive p_createRequest) runs on AeSimu system CseSystem {
+					// Local variables
+					var integer v_aeIndex := -1;
+                    var integer v_resourceIndex := -1;
+					var RequestPrimitive v_request;
+                    var MsgIn v_response;
+					
+					// Test control
+
+					// Test component configuration
+					f_cf01Up();
+
+					// Test adapter configuration
+
+					// Preamble
+					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi;
+
+					v_request := f_getCreateRequestPrimitive(int23, p_createRequest, v_aeIndex);//Subscription
+
+					// Test Body
+					f_send(e_mcaPort, m_request(v_request));
+					tc_ac.start;
+					alt {
+                        [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {  //CREATED - TS-004 - Table 6.6.3.3-1: RSCs for successful response class
+                            tc_ac.stop;
+                            setverdict(pass, __SCOPE__ & ": Resource created successfully");
+                            f_checkAttributesToBeSaved(int23, v_request, v_response.primitive.responsePrimitive);
+                            v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int23, vc_aeIndex);
+                        }
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
+							tc_ac.stop;
+                            setverdict(inconc, __SCOPE__&":INFO: Error while creating resource");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+							tc_ac.stop;
+                            setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while creating resource");
+						}
+					}
+
+					f_checkAeSimuStatus();
+    					
+					//Check to see if the resource is present or not
+					if (f_cse_isResourcePresent(v_resourceIndex)){
+						setverdict(pass, __SCOPE__ & ":INFO: Resource created");
+					} else {
+						setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
+					}	
+
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+
+				} // end f_CSE_SUB_CRE_006                
 
 				function f_CSE_SUB_CRE_009(in NotificationEventType p_notificationEventType) runs on AeSimu system CseSystem {
 					// Local variables
diff --git a/OneM2M_Testcases_CSE_Release_4.ttcn b/OneM2M_Testcases_CSE_Release_4.ttcn
index a868407dc5d9796f4cc33a17ecb66a62fd934f98..9071f0495b3f43b0edddd57cde0763f4ae7e8422 100644
--- a/OneM2M_Testcases_CSE_Release_4.ttcn
+++ b/OneM2M_Testcases_CSE_Release_4.ttcn
@@ -1769,7 +1769,8 @@ module OneM2M_Testcases_CSE_Release_4 {
 										var template RequestPrimitive v_groupRequest := m_createGroup(1, -, omit, int2, -, -, -);
 										var template RequestPrimitive v_createRequest := valueof(m_createAcpBase);
 										var integer v_state := 0; // Sequencing of received message
-										
+                                        var SignatureList v_authorSigns;
+                                        var template RequestPrimitive v_notifyRequest := m_notifyNotification(f_getResourceAddress(v_aeIndex), m_contentCreateNotification({ uRI := "" }, omit, omit, omit));
 										// Test control
 										if(not(PICS_ACP_SUPPORT)) {
 											setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
@@ -1825,10 +1826,7 @@ module OneM2M_Testcases_CSE_Release_4 {
 														if (
 																ispresent(vc_response.primitive.responsePrimitive.primitiveContent.securityInfo.dynAuthRelMapResponse.tokens) or
 																ispresent(vc_response.primitive.responsePrimitive.primitiveContent.securityInfo.dynAuthRelMapResponse.tokenIDs)
-														) {
-															var SignatureList v_authorSigns;
-															var template RequestPrimitive v_notifyRequest := m_notifyNotification(f_getResourceAddress(v_aeIndex), m_contentCreateNotification({ uRI := "" }, omit, omit, omit));
-															
+														) {															
 															setverdict(pass, __SCOPE__ & ": Tokens/TokenIDs were created");
 															v_state := v_state + 1;
 															// TODO Process signature of MIC???
@@ -4241,7 +4239,7 @@ module OneM2M_Testcases_CSE_Release_4 {
 													
 			function f_CSE_PP_006() runs on AeSimu system CseSystem {
 				// Local variables
-				var RequestPrimitive v_createPrimitveProfile;
+				var template RequestPrimitive v_createPrimitveProfile;
 				var RequestPrimitive v_requestContainerCreate;
 				var ResponsePrimitive v_responsePrimitive;
 				var integer v_aeIndex := -1;
@@ -4351,7 +4349,7 @@ module OneM2M_Testcases_CSE_Release_4 {
 													
 			function f_CSE_PP_008() runs on AeSimu system CseSystem {
 				// Local variables
-				var RequestPrimitive v_createPrimitveProfile;
+				var template RequestPrimitive v_createPrimitveProfile;
 				var RequestPrimitive v_updateContainer;
 				var ResponsePrimitive v_responsePrimitive;
 				var integer v_aeIndex := -1;
@@ -6010,119 +6008,1328 @@ module OneM2M_Testcases_CSE_Release_4 {
 					f_cf01Down();
 				} // f_CSE_PP_016_UPD
 			} // TC_CSE_PP_016
-		} //end group Primitive_Profile
+            
+	   	group TC_CSE_PP_017 {
+				/**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by adding the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_017_CRE() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_017_CRE()); 	
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_017_CRE() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var RequestPrimitive v_requestContainerCreate;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var MsgIn v_response;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+                    f_checkAeSimuStatus();
+					
+					// Primitive Profile with add atribute "maxByte" = "100" for content resource.
+					v_createPrimitiveProfile := m_createPrimitveProfileAddMaxByte100ToResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+                    
+					//Create container resource without "maxByte" primitive
+					v_requestContainerCreate := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
+					// Link Primitive Profile created to this Request. _to and _from handled in v_requestContainerCreate
+					v_requestContainerCreate.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);             
 
-		group Service_Charging_and_Accounting {
-			group Event_Based_Charging  {
+                    // Test Body
+					f_send(e_mcaPort, m_request(v_requestContainerCreate));
+					tc_ac.start;
+					alt { // Check that IUT sends a valid Response to the AE containing valid RESPONSE_STATUS_CODE
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+							tc_ac.stop;
+							if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.container.maxByteSize)){
+								if(v_response.primitive.responsePrimitive.primitiveContent.container.maxByteSize == 100) {
+									setverdict(pass, __SCOPE__ & ": Primitive Profile applied to response primitive");
+								} else {
+									setverdict(fail, __SCOPE__ & ": Primitive Profile not applied to response primitive");
+								}
+							} else {
+								setverdict(fail, __SCOPE__ & ": Primitive Profile not applied to response primitive!");
+							}
+						}
+						[] 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)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+						}
+					}
+							
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_017_CRE
 				
 				/**
-				 * @desc Check that the IUT successfully generates the statistics collection record and send to target AE once the IUT receives an event collection trigger from AE when the eventType event is TIMERBASED in the stat collection configuration.
-				 * 
-				 */
-				testcase TC_CSE_SCA_EBC_001() runs on Tester system CseSystem {
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by adding the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_017_RET() runs on Tester system CseSystem {
 					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
 							
-					v_ae1.start(f_CSE_SCA_EBC_001()); 	
+					v_ae1.start(f_CSE_PP_017_RET()); 	
 					v_ae1.done;					
 				}
-				
-				function f_CSE_SCA_EBC_001() runs on AeSimu system CseSystem {
-					
-					var integer v_statsConfigResourceIndex := -1;
-					var integer v_eventConfigResourceIndex := -1;
-					var integer v_statsCollectResourceIndex := -1;
-					var integer v_aeIndex1 := -1;
-					var integer v_aeIndex2 := -1;
-					var Timestamp v_eventStart := "20301231T012345"; //getcurrentTime()
-					var Timestamp v_timerDuration := "20301231T012345"; // 10 sec
-					var Timestamp v_eventEnd := "20301231T012345"; //v_eventStart + v_timerDuration; allow 10sec difference between Start and End
-					var template RequestPrimitive v_createStatsConfigResource := m_createStatsConfigBase;
-					var template RequestPrimitive v_createEventConfigResource;
-					var template RequestPrimitive v_createStatsCollectResource := m_createStatsCollectBase;
-					var PrimitiveContent v_primitiveContentRetrievedEventConfig;
+													
+				function f_CSE_PP_017_RET() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var RequestPrimitive v_retrieveRequest;
+					var template PrimitiveContent v_retrieveContentResponse;
+                    var integer v_containerIndex := -1;
 					
-					// Test component configuration
-					f_cf01Up(true);
-		
-					// Preamble
-					f_cse_createAccessControlPolicyAux(-, -, int63);//c_CUDNDi)
-    
-                    // AE1 - Billing application and client
-					v_aeIndex1 := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);//c_CRDNDi);
+                    // Test component configuration
+                    f_cf01Up();	
 	
-	                // AE2 - For performing billing operations
-					vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, {f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, -), -1)); // AE2 is registred
-					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
-					v_aeIndex2 := f_getLatestResourceIndex(vc_ae2);
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
 					
+					// Primitive Profile with attribute of Container resource 'MaxByte' to be added to response.
+					v_createPrimitiveProfile := m_createPrimitveProfileAddMaxByte100ToResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
 					
-					// AE1- Create StatsConfig resource from Billing application
-					v_statsConfigResourceIndex := f_cse_createResource(int22, v_createStatsConfigResource, v_aeIndex2);
-					 
-					//AE1 - Create EventConfig resource from Billing application as a child resource of StatsConfig
-					v_createEventConfigResource := m_createEventConfigTimerBased(v_eventStart, v_eventEnd);
-					v_eventConfigResourceIndex := f_cse_createResource(int7, v_createEventConfigResource, v_statsConfigResourceIndex);
+					// Set expected container in response
+					v_retrieveContentResponse.container := mw_contentContainerBase;
+					
+					//Create container resource without "maxByte" primitive
+					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+                
+					v_retrieveRequest := valueof(m_retrieve(f_getResourceAddress(v_containerIndex), f_getOriginator(v_containerIndex)));
+					v_retrieveRequest.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+					f_send(e_mcaPort, m_request(v_retrieveRequest));
 
-					//AE1 - Use generated eventID from eventConfig resouce in the statsCollect
-					v_createStatsCollectResource.primitiveContent.statsCollect.eventID := vc_response.primitive.responsePrimitive.primitiveContent.statsCollect.eventID;
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_retrieveContentResponse))) {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": ResultContent from Primitive Profile added to Retrieve Request");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_retrieveContentResponse))) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": ResultContent from Primitive Profile not added to Retrieve Request");
+						}
+						[] 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();
 
-					//AE1 Trigger stats collection.
-					v_statsCollectResourceIndex := f_cse_createResource(int21, v_createStatsCollectResource, v_statsConfigResourceIndex);
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_017_RET
+				
+			    /**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by adding the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_017_DEL() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_017_DEL()); 	
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_017_DEL() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var integer v_containerIndex := -1;
+					var RequestPrimitive v_deleteRequest;
+					var template PrimitiveContent v_deleteContentResponse;
 					
-					// Operations to generate charging info - AE2 stores total 200 bytes of data at 100 bytes at time
-					vc_ae2.start(f_cse_createContentAndInstances(200, 100, v_aeIndex2));
-					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
 					
-					// wait for timeout f_sleep(v_timerDuration);
-					f_sleep(10.0);
-					tc_ac.start;
+					// Primitive Profile with add atribute resultContent=1 (attribute) for content resource.
+                    v_createPrimitiveProfile := m_createPrimitiveProfileAddResultContentTo1FromResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+					
+					v_deleteContentResponse.container := mw_contentContainer_rc1;
+					
+					//Create Container resource
+					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+					
+					//Delete container resource with default resultContent
+					v_deleteRequest := valueof(m_delete(f_getResourceAddress(v_containerIndex), f_getOriginator(v_containerIndex)));
+					v_deleteRequest.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
 					
+					f_send(e_mcaPort, m_request(v_deleteRequest));
+					tc_ac.start;
+
 					alt {
-						[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002, v_deleteContentResponse))) {
 							tc_ac.stop;
-							setverdict(pass, __SCOPE__ & ":INFO: Notification of statistic collection received");
+							setverdict(pass, __SCOPE__ & ": All attributes provided as per the resultContent in primitive profile");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_deleteContentResponse))) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong content provided when resultContent set to 1 in Primitive Profile");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while deleting resource");
 						}
 						[] tc_ac.timeout {
-							setverdict(fail, __SCOPE__ & ": No notification received");
+							setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
 						}
 					}
-					
-					f_checkAeSimuStatus();
-					
-					// Postamble
+							
+					//Postamble
 					f_cse_postamble_deleteResources();
-                		
-					// Tear down
+
+					//Tear down
 					f_cf01Down();
-				}
+				} // f_CSE_PP_017_DEL
 				
-				/**
-				 * @desc Check that the IUT successfully generates the statistics collection record and send to target AE once the IUT receives an event collection trigger from AE when the eventType attribute is TIMERBASED in the stat collection configuration.
-				 * 
-				 */
-				testcase TC_CSE_SCA_EBC_002() runs on Tester system CseSystem {
+			    /**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by adding the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_017_UPD() runs on Tester system CseSystem {
 					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
 							
-					v_ae1.start(f_CSE_SCA_EBC_002()); 	
+					v_ae1.start(f_CSE_PP_017_UPD()); 	
 					v_ae1.done;					
 				}
+													
+				function f_CSE_PP_017_UPD() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var RequestPrimitive v_updateContainer;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var integer v_createdContainerResource := -1;
+					var MsgIn v_response;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+					
+					// Primitive Profile with add atribute "maxByte" = "100" for content resource.
+					v_createPrimitiveProfile := m_createPrimitveProfileAddMaxByte100ToResponse({f_getOriginator(v_aeIndex)});
+                    v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
 				
-				function f_CSE_SCA_EBC_002() runs on AeSimu system CseSystem {
+					//Create container resource without Primtive Profile ID and no maxByte attribte
+					v_createdContainerResource := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
 					
-					var integer v_statsConfigResourceIndex := -1;
-					var integer v_eventConfigResourceIndex := -1;
-					var integer v_statsCollectResourceIndex := -1;
-					var integer v_aeIndex1 := -1;
-					var integer v_aeIndex2 := -1;
-					var integer v_containerIndex := -1;
-					var Timestamp v_eventStart := "20301231T012345"; //getcurrentTime()
-					var Timestamp v_timerDuration := "20301231T012345"; // 10 sec
-					var Timestamp v_eventEnd := "20301231T012345"; //v_eventStart + v_timerDuration; allow 10sec difference between Start and End
-					var template RequestPrimitive v_createStatsConfigResource := m_createStatsConfigBase;
-					var template RequestPrimitive v_createEventConfigResource;
-					var template RequestPrimitive v_createStatsCollectResource := m_createStatsCollectBase;
-					var PrimitiveContent v_primitiveContentRetrievedEventConfig;
-					var RequestPrimitive v_updateRequest := m_updateContainerBase;
+					//Update container request with Primitive Profile ID, and not including update for maxByte
+					v_updateContainer:= f_getUpdateRequestPrimitive(int3, v_aeIndex, m_updateContainerBase);
+
+					// Link Primitve Prifle created to this Request
+					v_updateContainer.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+				
+					f_send(e_mcaPort, m_request(v_updateContainer));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
+							tc_ac.stop;
+							// Check that IUT applied the Primitve Profile
+						  	if(v_response.primitive.responsePrimitive.primitiveContent.container.maxByteSize == 100){
+						  		setverdict(pass, __SCOPE__ & ": maxByteSize primitive value in PrimitveProfile added correctly to Update Container Request!");
+						    } else {
+								setverdict(fail, __SCOPE__ & ": maxByteSize primitive value in PrimitveProfile not added to Update Container Request!");
+							}
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Unexpected response status code from IUT!");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while updating resource");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+						}
+					}
+							
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_017_UPD
+
+	    	} // TC_CSE_PP_017
+
+	   	group TC_CSE_PP_018 {
+				/**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by deleting the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_018_CRE() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_018_CRE()); 	
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_018_CRE() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var RequestPrimitive v_requestContainerCreate;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var MsgIn v_response;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+                    f_checkAeSimuStatus();
+					
+					// Primitive Profile with deletion atribute maxByteSize for content resource.
+                    v_createPrimitiveProfile := m_createPrimitveProfileDeleteFromResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+                    
+					//Create container resource without "maxByte" primitive
+					v_requestContainerCreate := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
+					// Link Primitive Profile created to this Request. _to and _from handled in v_requestContainerCreate
+					v_requestContainerCreate.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);             
+
+                    // Test Body
+                    f_send(e_mcaPort, m_request(v_requestContainerCreate));
+                    tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+							tc_ac.stop;
+							// Check that IUT applied the Primitve Profile
+							if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.container.maxByteSize)){
+								setverdict(fail, __SCOPE__ & ": Primitive Profile not applied to response primtive!");
+							} else {
+								setverdict(pass, __SCOPE__ & ": Primitive Profile successfully applied to response primtive by deleting maxByteSize!");
+							}
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Mismatch in 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 from IUT for the last Request!");
+						}
+					}    
+							
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_018_CRE
+				
+				/**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by deleting the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_018_RET() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_018_RET());
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_018_RET() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var RequestPrimitive v_retrieveRequest;
+					var template PrimitiveContent v_retrieveContentResponse;
+                    var integer v_containerIndex := -1;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+					
+					// Primitive Profile deleting "MaxByteSize" attribute of content resource
+					v_createPrimitiveProfile := m_createPrimitveProfileDeleteFromResponse({f_getOriginator(v_aeIndex)});
+                    v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+					
+					// Set expected container in response
+					v_retrieveContentResponse.container := mw_contentContainerBase;
+					
+					//Create container resource without "maxByte" primitive
+					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+                    
+                    // Associate the retrieve Request with the Primitive Profile
+					v_retrieveRequest := valueof(m_retrieve(f_getResourceAddress(v_containerIndex), f_getOriginator(v_containerIndex)));
+					v_retrieveRequest.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+					
+                    f_send(e_mcaPort, m_request(v_retrieveRequest));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_retrieveContentResponse))) {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": ResultContent from Primitive Profile added to Retrieve Request");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_retrieveContentResponse))) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": ResultContent from Primitive Profile not added to Retrieve Request");
+						}
+						[] 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();
+				} // f_CSE_PP_018_RET
+				
+			    /**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by deleting the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_018_DEL() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_018_DEL()); 	
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_018_DEL() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var integer v_containerIndex := -1;
+					var RequestPrimitive v_deleteRequest;
+					var template PrimitiveContent v_deleteContentResponse;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+					
+					// Primitive Profile deleting resultContent=1 (attribute) for content resource.
+                    v_createPrimitiveProfile := m_createPrimitiveProfileDeleteResultContentTo1FromResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+					
+					v_deleteContentResponse.container := mw_contentContainer_rc1;
+					
+					//Create Container resource
+					v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+					
+					//Delete container resource with default resultContent
+					v_deleteRequest := valueof(m_delete(f_getResourceAddress(v_containerIndex), f_getOriginator(v_containerIndex)));
+					v_deleteRequest.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+					
+					f_send(e_mcaPort, m_request(v_deleteRequest));
+					tc_ac.start;
+
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002, v_deleteContentResponse))) {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": All attributes provided as per the resultContent set in primitive profile");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_deleteContentResponse))) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong content provided when resultContent set to 1 in Primitive Profile");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while deleting resource");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
+						}
+					}
+							
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_018_DEL
+				
+			    /**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by deleting the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_018_UPD() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_018_UPD()); 	
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_018_UPD() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var RequestPrimitive v_updateContainer;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var integer v_createdContainerResource := -1;
+					var MsgIn v_response;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+					
+					// Primitive Profile with deletion of attribute "maxByteSize" for content resource.
+					v_createPrimitiveProfile := m_createPrimitveProfileDeleteFromResponse({f_getOriginator(v_aeIndex)});                    
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+				
+					//Create container resource without Primitive Profile ID
+					v_createdContainerResource := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);					
+                    
+					//Update container request to be linked to Primitive Profile ID
+					v_updateContainer:= f_getUpdateRequestPrimitive(int3, v_aeIndex, m_updateContainerBase);
+					// Link Primitive Profile created to this Request
+					v_updateContainer.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+				
+					f_send(e_mcaPort, m_request(v_updateContainer));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+							tc_ac.stop;
+							// Check that IUT applied the Primitive Profile
+							if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.container.maxByteSize)){
+								setverdict(fail, __SCOPE__ & ": Primitive Profile not applied to response primitive!");
+							} else {
+								setverdict(pass, __SCOPE__ & ": Primitive Profile successfully applied to response primitive by deleting maxByteSize!");
+							}
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Mismatch in 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 from IUT for the last Request!");
+						}
+					}
+							
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_018_UPD
+
+	    	} // TC_CSE_PP_018
+
+	   	group TC_CSE_PP_019 {
+				/**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by replacing the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_019_CRE() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_019_CRE()); 	
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_019_CRE() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var RequestPrimitive v_requestContainerCreate;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var MsgIn v_response;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+                    f_checkAeSimuStatus();
+					
+					// Primitive Profile with adition atribute maxByteSize for content resource.
+                    v_createPrimitiveProfile := m_createPrimitveProfileAddMaxByte100ToResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+                    
+					//Create container resource without "maxByte" primitive
+					v_requestContainerCreate := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex);
+					// Link Primitive Profile created to this Request. _to and _from handled in v_requestContainerCreate
+					v_requestContainerCreate.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);             
+
+                    // Test Body
+                    f_send(e_mcaPort, m_request(v_requestContainerCreate));
+                    tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+							tc_ac.stop;
+						  	if(v_response.primitive.responsePrimitive.primitiveContent.container.maxByteSize == 100){
+								setverdict(pass, __SCOPE__ & ": maxByteSize primitive value in Create Container Request modified to the value in Primitive Profile!");
+						    } else {
+						    	setverdict(fail, __SCOPE__ & ": maxByteSize primitive value in Create Container Request not modified to the value in Primitive Profile!");
+							}
+						}
+						[] 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 deleting resource");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+						}
+					}
+							
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_019_CRE
+				
+				/**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by replacing the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_019_RET() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_019_RET());
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_019_RET() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+                    var RequestPrimitive v_requestContainerCreate;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var integer v_containerParentIndex := -1;
+					var MsgIn v_response;
+					//var RequestPrimitive v_retrieveRequest;
+					var template PrimitiveContent v_retrieveContentResponse;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+					
+                    // Primitive Profile with Add atribute resultContent for container resource.
+					v_createPrimitiveProfile := m_createPrimitiveProfileAddResultContentTo4ToResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+					
+					// Set expected container of retrieve request as per Result Content=4, the default value when RC is not present
+					v_retrieveContentResponse.container := mw_contentContainer_rc4;
+					
+					//Create Container resource
+					v_containerParentIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+					
+					//Create child Container resource
+					f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+					
+					//Retrieve container with link to Primitive Profile
+					v_requestContainerCreate := valueof(m_retrieve(f_getResourceAddress(v_containerParentIndex), f_getOriginator(v_containerParentIndex)));
+					v_requestContainerCreate.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+					v_requestContainerCreate.resultContent := int1; // only attributes
+                    
+					f_send(e_mcaPort, m_request(v_requestContainerCreate));
+					tc_ac.start;
+					alt {
+						// Expect response as per resultContent=4, specified in Primitive Profile
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_retrieveContentResponse))) -> value v_response {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": ResultContent(4) from Primtive Profile added to Retrieve Request");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_retrieveContentResponse))) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": ResultContent from Primtive Profile not added to Retrieve Request");
+						}
+						[] 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();
+				} // f_CSE_PP_019_RET
+				
+			    /**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by replacing the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_019_DEL() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_019_DEL()); 	
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_019_DEL() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var integer v_containerIndex := -1;
+					var RequestPrimitive v_deleteRequest;
+					var template PrimitiveContent v_deleteContentResponse;
+                    var integer v_containerParentIndex := -1;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+					
+					// Primitive Profile with Add atribute resultContent=1 for container resource.
+					v_createPrimitiveProfile := m_createPrimitveProfileAddResultContentTo1ToResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+					
+					// Set expected container as per Result Content=1
+					v_deleteContentResponse.container := mw_contentContainer_rc1;
+					
+					//Create Container resource
+					v_containerParentIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+					
+					//Create child Container resource
+					f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+					
+					//Delete container resource with resultContent (4-attributes and child resource)
+					v_deleteRequest := valueof(m_delete(f_getResourceAddress(v_containerParentIndex), f_getOriginator(v_containerParentIndex)));
+					v_deleteRequest.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+					v_deleteRequest.resultContent := int4;
+					
+					f_send(e_mcaPort, m_request(v_deleteRequest));
+					tc_ac.start;
+
+					alt {
+						// If primitive profile applied, value of resultContent(1=attribute) will be applied
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002, v_deleteContentResponse))) {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": Only attributes of parent provided as per the resultContent in primitive profile");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_deleteContentResponse)))  {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong content provided when resultContent set to 1 in Primtive Profile");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while deleting resource");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
+						}
+					}
+							
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_019_DEL
+				
+			    /**
+				* @desc Check that IUT applies the referenced <primitiveProfile> over the response messages by replacing the applicable parameters/attributes when the originating AE specified a valid PrimitiveProfileIdentifier parameter in the corresponding request
+				*  
+				*/
+				testcase TC_CSE_PP_019_UPD() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_019_UPD()); 	
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_019_UPD() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+					var RequestPrimitive v_updateContainer;
+					var integer v_aeIndex := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var integer v_createdContainerResource := -1;
+					var MsgIn v_response;
+					
+                    // Test component configuration
+                    f_cf01Up();	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+					
+					// Primitive Profile with deletion of attribute "maxByteSize" for content resource.
+					v_createPrimitiveProfile := m_createPrimitveProfileAddContainerMaxByte100ToResponse({f_getOriginator(v_aeIndex)});
+                    v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+				
+					//Create container resource with maxByte=1000 attribte
+					v_createdContainerResource := f_cse_createResource(int3, m_createContainerMaxByte(1000), v_aeIndex);
+                    
+					//Update container request with maxByte=2000 and link to Primitive Profile
+					v_updateContainer:= f_getUpdateRequestPrimitive(int3, v_aeIndex, m_updateContainerMaxByte(2000));
+					// Link Primitive Profile created to this Request
+					v_updateContainer.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+				
+					f_send(e_mcaPort, m_request(v_updateContainer));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response {
+							tc_ac.stop;
+							// Check that IUT applied the Primitive Profile
+						  	if(v_response.primitive.responsePrimitive.primitiveContent.container.maxByteSize == 100){
+						  		setverdict(pass, __SCOPE__ & ": maxByteSize primitive value in PrimitiveProfile is updated correctly to Update Container Request!");
+						    } else {
+								setverdict(fail, __SCOPE__ & ": maxByteSize primitive value in PrimitveProfile is not updated to Update Container Request!");
+							}
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong status response code from IUT!");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while updating resource");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+						}
+					}
+							
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_019_UPD
+
+	    	} // TC_CSE_PP_019
+            
+	   	group TC_CSE_PP_020 {
+				/**
+				* @desc Check that IUT successfully applies the <primitiveProfile> to the representation of the requested resource returned in the Content parameter of the response and If the Content parameter of the response includes nested representations of child resource(s) and their descendant(s), the Hosting CSE shall not apply the profile to these child resource(s) or descendant(s)
+				*  
+				*/
+				testcase TC_CSE_PP_020_RET() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_020_RET());
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_020_RET() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+                    var template RequestPrimitive p_requestPrimitive := m_createContainerBase;
+                    var RequestPrimitive v_requestContainerCreate;
+					var integer v_aeIndex := -1;
+                    var integer v_ae2Index := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var integer v_containerParentIndex := -1;
+                    var integer v_childResourceIndex := -1;
+					var MsgIn v_response;
+					var template PrimitiveContent v_retrieveContentResponse;
+					
+                    // Test component configuration
+                    f_cf01Up(true);
+
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+
+                    // Primitive Profile with modifications attribute resultContent
+					v_createPrimitiveProfile := m_createPrimitiveProfileModifResultContentTo4ToResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+
+                    f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, int3); //register AE2
+                    v_containerParentIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+                    v_childResourceIndex := f_cse_createResource(int3, m_createContainerBase, v_containerParentIndex);                    
+
+					// Set expected container of retrieve request as per Result Content=1
+					v_retrieveContentResponse.container := mw_contentContainer_rc1;
+
+					//Retrieve container with link to Primitive Profile
+					v_requestContainerCreate := valueof(m_retrieve(f_getResourceAddress(v_containerParentIndex), f_getOriginator(v_containerParentIndex)));
+					v_requestContainerCreate.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+					v_requestContainerCreate.resultContent := int4; // (4-attributes and child resource)
+                    
+					f_send(e_mcaPort, m_request(v_requestContainerCreate));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_retrieveContentResponse))) -> value v_response {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": ResultContent from Primtive Profile modified on parent container");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_retrieveContentResponse))) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": ResultContent from Primtive Profile not added to Retrieve Request");
+						}
+						[] 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();
+				} // f_CSE_PP_020_RET
+				
+				/**
+				* @desc Check that IUT successfully applies the <primitiveProfile> to the representation of the requested resource returned in the Content parameter of the response and If the Content parameter of the response includes nested representations of child resource(s) and their descendant(s), the Hosting CSE shall not apply the profile to these child resource(s) or descendant(s)
+				*  
+				*/
+				testcase TC_CSE_PP_020_DEL() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_020_DEL()); 	
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_020_DEL() runs on AeSimu system CseSystem {
+					// Local variables
+					var template RequestPrimitive v_createPrimitiveProfile;
+                    var template RequestPrimitive p_requestPrimitive := m_createContainerBase;                    
+					var integer v_aeIndex := -1;
+                    var integer v_ae2Index := -1;
+					var integer v_primitiveProfileIndex := -1;
+					var integer v_containerParentIndex := -1;
+                    var integer v_childResourceIndex := -1;
+					var RequestPrimitive v_deleteRequest;
+					var MsgIn v_response;                    
+					var template PrimitiveContent v_deleteContentResponse;                    
+                    
+                    // Test component configuration
+                    f_cf01Up(true);	
+	
+	                // Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);
+					v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+					
+                    // Primitive Profile with modifications attribute resultContent
+					v_createPrimitiveProfile := m_createPrimitiveProfileModifResultContentTo4ToResponse({f_getOriginator(v_aeIndex)});
+					v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+					// Set expected container as per Result Content=1
+					v_deleteContentResponse.container := mw_contentContainer_rc1;
+                    
+                    f_cse_preamble_subscriptionVerification(v_ae2Index, p_requestPrimitive, int3); //register AE2
+                    v_containerParentIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
+                    v_childResourceIndex := f_cse_createResource(int3, m_createContainerBase, v_containerParentIndex);
+
+                    //Delete container resource with resultContent (4-attributes and child resource)
+					v_deleteRequest := valueof(m_delete(f_getResourceAddress(v_containerParentIndex), f_getOriginator(v_containerParentIndex)));
+					v_deleteRequest.primitiveProfileIdentifier := f_getResourceId(vc_resourcesList[v_primitiveProfileIndex].resource);
+					v_deleteRequest.resultContent := int4;                    
+					
+					f_send(e_mcaPort, m_request(v_deleteRequest));
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2002, v_deleteContentResponse))) -> value v_response {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": Only attributes of parent provided with RCN set to " & int2str(enum2int(v_deleteRequest.resultContent)));
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_deleteContentResponse))) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong content provided with RCN set to " & int2str(enum2int(v_deleteRequest.resultContent)));
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while deleting resource");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while deleting resource");
+						}
+					}
+							
+					//Postamble
+					f_cse_postamble_deleteResources();
+
+					//Tear down
+					f_cf01Down();
+				} // f_CSE_PP_020_DEL
+
+	    	} // TC_CSE_PP_020
+            
+				/**
+				* @desc Check that the IUT rejects the creation of <primitiveProfile> resource when the request parameters or resource attributes defined in the additions attribute have complex data type definition
+				*  
+				*/
+				testcase TC_CSE_PP_021() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_021());
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_021() runs on AeSimu system CseSystem {
+                    // Local variables
+                    var template(value) RequestPrimitive v_createPrimitiveProfile;
+                    var integer v_aeIndex := -1;
+                    var MsgIn v_response;
+
+                    // Test component configuration
+                    f_cf01Up();
+                    
+                    // Preamble
+                    f_cse_createAccessControlPolicyAux(-, -, int63);
+                    v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+                        
+                    // Primitive Profile with additions atribute having a complex data type definition
+                    v_createPrimitiveProfile := m_createPrimitiveProfileAddgmty({f_getOriginator(v_aeIndex)});                
+                
+                    f_send(e_mcaPort, m_request(v_createPrimitiveProfile));
+                    tc_ac.start;
+                    alt {
+                        [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response { // TS-004 Table 6.6.3.5-1: PRIMITIVE_PROFILE_BAD REQUEST. 
+                        //ToDo update type enumerated ResponseStatusCode - PRIMITIVE_PROFILE_BAD_REQUEST = 4137
+                            tc_ac.stop;
+                            setverdict(pass, __SCOPE__ & ": IUT rejected Primitive Profile because the additions attribute has a complex data type definition");
+                        }
+                        [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+                            tc_ac.stop;
+                            setverdict(fail, __SCOPE__ & ": Mismatch in status response code from IUT!");
+                        }
+                        [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+                            tc_ac.stop;
+                            setverdict(fail, __SCOPE__ & ": IUT accepted Primitve Profile with attributes including complex data type definition");
+                        }
+                        [] tc_ac.timeout {
+                            setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+                        }
+                    }
+
+                    //Postamble
+                    f_cse_postamble_deleteResources();
+
+                    //Tear down
+                    f_cf01Down();
+				} // f_CSE_PP_021
+
+				/**
+				* @desc Check that the IUT rejects the creation of a <primitiveProfile> resource when any parameters specified in the additions attribute not matching with the defined data types for the parameters
+				*  
+				*/
+				testcase TC_CSE_PP_022() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_022());
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_022() runs on AeSimu system CseSystem {
+                    // Local variables
+                    var template(value) RequestPrimitive v_createPrimitiveProfile;
+                    var integer v_aeIndex := -1;
+                    var MsgIn v_response;
+
+                    // Test component configuration
+                    f_cf01Up();
+                    
+                    // Preamble
+                    f_cse_createAccessControlPolicyAux(-, -, int63);
+                    v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+                        
+                    // Primitive Profile with add atribute "maxByte" assigned to a negative value
+                    v_createPrimitiveProfile := m_createPrimitiveProfileAddContainerMaxByteNegative({f_getOriginator(v_aeIndex)});
+                    
+                    f_send(e_mcaPort, m_request(v_createPrimitiveProfile));
+                    tc_ac.start;
+                    alt {
+                        [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response { // TS-004 Table 6.6.3.5-1: PRIMITIVE_PROFILE_BAD REQUEST. 
+                        //ToDo update type enumerated ResponseStatusCode - PRIMITIVE_PROFILE_BAD_REQUEST = 4137
+                            tc_ac.stop;
+                            setverdict(pass, __SCOPE__ & ": IUT rejected Primitive Profile with attributes not matching with the defined data types");
+                        }
+                        [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+                            tc_ac.stop;
+                            setverdict(fail, __SCOPE__ & ": Mismatch in status response code from IUT!");
+                        }
+                        [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+                            tc_ac.stop;
+                            setverdict(fail, __SCOPE__ & ": IUT accepted Primitive Profile with attributes not matching with the defined data types");
+                        }
+                        [] tc_ac.timeout {
+                            setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+                        }
+                    }
+
+                    //Postamble
+                    f_cse_postamble_deleteResources();
+
+                    //Tear down
+                    f_cf01Down();
+				} // f_CSE_PP_022
+
+				/**
+				* @desc Check that the IUT rejects the update request of a <primitiveProfile> resource when any parameters specified in the additions attribute not matching with the defined data types for the parameters
+				*  
+				*/
+				testcase TC_CSE_PP_023() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_PP_023());
+					v_ae1.done;					
+				}
+													
+				function f_CSE_PP_023() runs on AeSimu system CseSystem {
+                    // Local variables
+                    var template RequestPrimitive v_updatePrimitiveProfile;
+                    var template(value) RequestPrimitive v_createPrimitiveProfile;                    
+                    var integer v_aeIndex := -1;
+                    var integer v_primitiveProfileIndex := -1;
+                    var MsgIn v_response;
+                    var RequestPrimitive v_updatePrimitiveProfileRequest;
+
+                    // Test component configuration
+                    f_cf01Up();
+                    
+                    // Preamble
+                    f_cse_createAccessControlPolicyAux(-, -, int63);
+                    v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+                        
+                    // Primitive Profile with add atribute "maxByte" = "100" for content resource.
+                    v_createPrimitiveProfile := m_createPrimitveProfileAddContainerMaxByte100({f_getOriginator(v_aeIndex)});
+                    v_primitiveProfileIndex := f_cse_createResource(int59, v_createPrimitiveProfile, v_aeIndex); // TS-004 Table 6.3.4.2.1-1 -> primitiveProfile = 62
+                    
+                    // Update Primitive Profile with additions atribute of complex data type
+                    v_updatePrimitiveProfile := m_updatePrimitiveProfileAddContainerMaxByteNegative;
+                    v_updatePrimitiveProfileRequest := f_getUpdateRequestPrimitive(int59, v_primitiveProfileIndex, v_updatePrimitiveProfile);                    
+                    
+                    f_send(e_mcaPort, m_request(v_updatePrimitiveProfileRequest));
+                    tc_ac.start;
+                    alt {
+                        [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response { // TS-004 Table 6.6.3.5-1: PRIMITIVE_PROFILE_BAD REQUEST. 
+                        //ToDo update type enumerated ResponseStatusCode - PRIMITIVE_PROFILE_BAD_REQUEST = 4137
+                            tc_ac.stop;
+                            setverdict(pass, __SCOPE__ & ": IUT rejected Primitive Profile due to additions attribute not matching with the defined data types for the parameters");
+                        }
+                        [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+                            tc_ac.stop;
+                            setverdict(fail, __SCOPE__ & ": Mismatch in status response code from IUT!");
+                        }
+                        [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+                            tc_ac.stop;
+                            setverdict(fail, __SCOPE__ & ": IUT accepted Primitive Profile due to additions attribute not matching with the defined data types for the parameters");
+                        }
+                        [] tc_ac.timeout {
+                            setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+                        }
+                    }
+
+                    //Postamble
+                    f_cse_postamble_deleteResources();
+
+                    //Tear down
+                    f_cf01Down();
+				} // f_CSE_PP_023
+
+		} //end group Primitive_Profile
+
+		group Service_Charging_and_Accounting {
+			group Event_Based_Charging  {
+				
+				/**
+				 * @desc Check that the IUT successfully generates the statistics collection record and send to target AE once the IUT receives an event collection trigger from AE when the eventType event is TIMERBASED in the stat collection configuration.
+				 * 
+				 */
+				testcase TC_CSE_SCA_EBC_001() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_SCA_EBC_001()); 	
+					v_ae1.done;					
+				}
+				
+				function f_CSE_SCA_EBC_001() runs on AeSimu system CseSystem {
+					
+					var integer v_statsConfigResourceIndex := -1;
+					var integer v_eventConfigResourceIndex := -1;
+					var integer v_statsCollectResourceIndex := -1;
+					var integer v_aeIndex1 := -1;
+					var integer v_aeIndex2 := -1;
+					var Timestamp v_eventStart := "20301231T012345"; //getcurrentTime()
+					var Timestamp v_timerDuration := "20301231T012345"; // 10 sec
+					var Timestamp v_eventEnd := "20301231T012345"; //v_eventStart + v_timerDuration; allow 10sec difference between Start and End
+					var template RequestPrimitive v_createStatsConfigResource := m_createStatsConfigBase;
+					var template RequestPrimitive v_createEventConfigResource;
+					var template RequestPrimitive v_createStatsCollectResource := m_createStatsCollectBase;
+					var PrimitiveContent v_primitiveContentRetrievedEventConfig;
+					
+					// Test component configuration
+					f_cf01Up(true);
+		
+					// Preamble
+					f_cse_createAccessControlPolicyAux(-, -, int63);//c_CUDNDi)
+    
+                    // AE1 - Billing application and client
+					v_aeIndex1 := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);//c_CRDNDi);
+	
+	                // AE2 - For performing billing operations
+					vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, {f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, -), -1)); // AE2 is registred
+					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
+					v_aeIndex2 := f_getLatestResourceIndex(vc_ae2);
+					
+					
+					// AE1- Create StatsConfig resource from Billing application
+					v_statsConfigResourceIndex := f_cse_createResource(int22, v_createStatsConfigResource, v_aeIndex2);
+					 
+					//AE1 - Create EventConfig resource from Billing application as a child resource of StatsConfig
+					v_createEventConfigResource := m_createEventConfigTimerBased(v_eventStart, v_eventEnd);
+					v_eventConfigResourceIndex := f_cse_createResource(int7, v_createEventConfigResource, v_statsConfigResourceIndex);
+
+					//AE1 - Use generated eventID from eventConfig resouce in the statsCollect
+					v_createStatsCollectResource.primitiveContent.statsCollect.eventID := vc_response.primitive.responsePrimitive.primitiveContent.statsCollect.eventID;
+
+					//AE1 Trigger stats collection.
+					v_statsCollectResourceIndex := f_cse_createResource(int21, v_createStatsCollectResource, v_statsConfigResourceIndex);
+					
+					// Operations to generate charging info - AE2 stores total 200 bytes of data at 100 bytes at time
+					vc_ae2.start(f_cse_createContentAndInstances(200, 100, v_aeIndex2));
+					f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
+					
+					// wait for timeout f_sleep(v_timerDuration);
+					f_sleep(10.0);
+					tc_ac.start;
+					
+					alt {
+						[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ":INFO: Notification of statistic collection received");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No notification received");
+						}
+					}
+					
+					f_checkAeSimuStatus();
+					
+					// Postamble
+					f_cse_postamble_deleteResources();
+                		
+					// Tear down
+					f_cf01Down();
+				}
+				
+				/**
+				 * @desc Check that the IUT successfully generates the statistics collection record and send to target AE once the IUT receives an event collection trigger from AE when the eventType attribute is TIMERBASED in the stat collection configuration.
+				 * 
+				 */
+				testcase TC_CSE_SCA_EBC_002() runs on Tester system CseSystem {
+					var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+							
+					v_ae1.start(f_CSE_SCA_EBC_002()); 	
+					v_ae1.done;					
+				}
+				
+				function f_CSE_SCA_EBC_002() runs on AeSimu system CseSystem {
+					
+					var integer v_statsConfigResourceIndex := -1;
+					var integer v_eventConfigResourceIndex := -1;
+					var integer v_statsCollectResourceIndex := -1;
+					var integer v_aeIndex1 := -1;
+					var integer v_aeIndex2 := -1;
+					var integer v_containerIndex := -1;
+					var Timestamp v_eventStart := "20301231T012345"; //getcurrentTime()
+					var Timestamp v_timerDuration := "20301231T012345"; // 10 sec
+					var Timestamp v_eventEnd := "20301231T012345"; //v_eventStart + v_timerDuration; allow 10sec difference between Start and End
+					var template RequestPrimitive v_createStatsConfigResource := m_createStatsConfigBase;
+					var template RequestPrimitive v_createEventConfigResource;
+					var template RequestPrimitive v_createStatsCollectResource := m_createStatsCollectBase;
+					var PrimitiveContent v_primitiveContentRetrievedEventConfig;
+					var template RequestPrimitive v_updateRequest := m_updateContainerBase;
 					var template RequestPrimitive v_createRequestContainer := m_createContainerBase;
 					
 					// Test component configuration
@@ -6498,7 +7705,7 @@ module OneM2M_Testcases_CSE_Release_4 {
 					// Verifiy that the ServiceSubscribedUserProfile resource has been updated
 					vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscribedProfileIndex);
 					
-					if(not(match(v_updateRequestPrimitive.primitiveContent.serviceSubscribedUserProfile.maxNumAEs, vc_primitiveContentRetrievedResource.serviceSubscribedUserProfile.maxNumAEs))) {
+					if(not(match(valueof(v_updateRequestPrimitive.primitiveContent.serviceSubscribedUserProfile.maxNumAEs), vc_primitiveContentRetrievedResource.serviceSubscribedUserProfile.maxNumAEs))) {
 						setverdict(fail, __SCOPE__&":INFO: Retrived serviceSubscribedUserProfile does not match with updated content.");
 					} else {
 						setverdict(pass, __SCOPE__ & ": Retrived serviceSubscribedUserProfile matched with updated content.");
@@ -7695,6 +8902,367 @@ module OneM2M_Testcases_CSE_Release_4 {
 			} // Basic_Operation
 		} // Service_Subscription_User_Profile
 		
+    //group Software Management {
+            /**
+            * @desc Check that the IUT rejects the creation request of <softwareCampaign> resource if target node on which software management operation has to be performed does not exist.
+            *  
+            */
+            testcase TC_CSE_SM_001() runs on Tester system CseSystem {
+                var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+                        
+                v_ae1.start(f_CSE_SM_001());
+                v_ae1.done;					
+            }
+                                                
+            function f_CSE_SM_001() runs on AeSimu system CseSystem {
+                // Local variables
+                var template RequestPrimitive v_createSoftwareCampaignRequest;
+                var integer v_aeIndex := -1;
+                var MsgIn v_response;
+                var RequestPrimitive v_request;
+                var template Action p_actionGeneric;
+                
+                // Test component configuration
+                f_cf01Up();
+
+                // Preamble
+                v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi
+                
+                p_actionGeneric.subjectResourceID := f_getOriginator(v_aeIndex);// subject set as the parent resource
+                p_actionGeneric.evalCriteria.subject := "tempContainer.content";//string example
+                p_actionGeneric.evalCriteria.operator := int1;
+                p_actionGeneric.evalCriteria.threshold := 3;
+                v_createSoftwareCampaignRequest := m_createSoftwareCampaignNoSoftwareTargets(p_actionGeneric);					
+                
+                // Software Campaign resource created with no values on attribute SoftwareTargets
+                f_cse_activateDefaults_ae();
+                v_request := f_getCreateRequestPrimitive(int51, v_createSoftwareCampaignRequest, v_aeIndex);
+                // ToDo Resource Type set to 61? (softwareCampaign) to be defined and ID to be verified on TS
+                f_send(e_mcaPort, m_request(v_request));
+                tc_ac.start;
+                alt {
+                    [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response { // BAD_REQUEST should be applied instead?
+                        tc_ac.stop;
+                        setverdict(pass, __SCOPE__ & ": IUT rejected the creation request of softwareCampaign resource as the target node on which software management operation has to be performed does not exist");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": Mismatch in status response code from IUT!");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": IUT accepted creation of softwareCampaign over non existing target node");
+                    }
+                    [] tc_ac.timeout {
+                        setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+                    }
+                }
+                        
+                //Postamble
+                f_cse_postamble_deleteResources();
+
+                //Tear down
+                f_cf01Down();
+            } // f_CSE_SM_001
+
+
+            /**
+            * @desc Check that the IUT rejects creation of <softwareCampaign> resource if the resource referenced in softwareTriggerCriteria attribute does not exist.
+            *  
+            */
+            testcase TC_CSE_SM_002() runs on Tester system CseSystem {
+                var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+                        
+                v_ae1.start(f_CSE_SM_002());
+                v_ae1.done;					
+            }
+                                                
+            function f_CSE_SM_002() runs on AeSimu system CseSystem {
+                // Local variables
+                var template RequestPrimitive v_createSoftwareCampaignRequest;
+                var integer v_aeIndex := -1;
+                var integer v_aeIndex2 := -1;
+                var MsgIn v_response;
+                var RequestPrimitive v_request;
+                
+                // Test component configuration
+                f_cf01Up();
+
+                // Preamble
+                v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi
+                vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, -), -1)); // AE2 is registred
+                f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
+                v_aeIndex2 := f_getLatestResourceIndex(vc_ae2);
+                
+                v_createSoftwareCampaignRequest := m_createSoftwareCampaignNoSoftwareTriggerCriteria({f_getOriginator(v_aeIndex2)});					
+                
+                // Software Campaign resource created with no values on attribute softwareTriggerCriteria
+                f_cse_activateDefaults_ae();
+                v_request := f_getCreateRequestPrimitive(int51, v_createSoftwareCampaignRequest, v_aeIndex);
+                // ToDo Resource Type set to 61? (softwareCampaign) to be defined and ID to be verified on TS
+                f_send(e_mcaPort, m_request(v_request));
+                tc_ac.start;
+                alt {
+                    [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response {
+                        tc_ac.stop;
+                        setverdict(pass, __SCOPE__ & ": IUT rejected the creation request of softwareCampaign resource as the resource referenced in softwareTriggerCriteria attribute does not exist");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": Mismatch in status response code from IUT!");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": IUT accepted creation of softwareCampaign with resource referenced in softwareTriggerCriteria that does not exist");
+                    }
+                    [] tc_ac.timeout {
+                        setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+                    }
+                }
+                        
+                //Postamble
+                f_cse_postamble_deleteResources();
+
+                //Tear down
+                f_cf01Down();
+            } // f_CSE_SM_002
+            
+            /**
+            * @desc Check that the IUT rejects creation of <softwareCampaign> resource if the resource referenced in softwareTriggerCriteria attribute is not accessible by the AE
+            *  
+            */
+            testcase TC_CSE_SM_003() runs on Tester system CseSystem {
+                var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+                        
+                v_ae1.start(f_CSE_SM_003());
+                v_ae1.done;					
+            }
+                                                
+            function f_CSE_SM_003() runs on AeSimu system CseSystem {
+                // Local variables
+                var template RequestPrimitive v_createSoftwareCampaignRequest;
+                var integer v_aeIndex := -1;
+                var integer v_resourceIndex := -1;
+                var MsgIn v_response;
+                var RequestPrimitive v_request;
+                var template RequestPrimitive v_createRequest := m_createContainerBase;
+                var template Action p_actionGeneric;
+                
+                // Test component configuration
+                f_cf01Up();
+
+                // Preamble
+                v_aeIndex := f_cse_preamble_registerAe();            
+                f_cse_updateAcpAuxResource(int1); //Not including permissions
+
+                p_actionGeneric.subjectResourceID := f_getOriginator(v_aeIndex);// subject set as the parent resource
+                p_actionGeneric.evalCriteria.subject := "tempContainer.content";//string example
+                p_actionGeneric.evalCriteria.operator := int1;
+                p_actionGeneric.evalCriteria.threshold := 3;
+                
+                v_createRequest.primitiveContent.container.accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[vc_acpIndex].resource)};
+                v_resourceIndex := f_cse_createResource(int3, v_createRequest, v_aeIndex);
+                
+                v_createSoftwareCampaignRequest := m_createSoftwareCampaign;			
+                v_createSoftwareCampaignRequest.primitiveContent.softwareCampaign.softwareTargets := {f_getOriginator(v_resourceIndex)};
+                v_createSoftwareCampaignRequest.primitiveContent.softwareCampaign.softwareTriggerCriteria := p_actionGeneric;
+                
+                // Software Campaign resource created with no accessible softwareTriggerCriteria            
+                v_request := f_getCreateRequestPrimitive(int51, v_createSoftwareCampaignRequest, v_aeIndex);
+                // ToDo Resource Type set to 61? (softwareCampaign) to be defined and ID to be verified on TS
+                f_send(e_mcaPort, m_request(v_request));
+                tc_ac.start;
+                alt {
+                    [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response { // ORIGINATOR_HAS_NO_PRIVILEGE(4103) should be applied instead?
+                        tc_ac.stop;
+                        setverdict(pass, __SCOPE__ & ": IUT rejected the creation request of softwareCampaign resource as the resource referenced in softwareTriggerCriteria attribute does not exist");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": Mismatch in status response code from IUT!");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": IUT accepted creation of softwareCampaign with resource referenced in softwareTriggerCriteria that does not exist");
+                    }
+                    [] tc_ac.timeout {
+                        setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+                    }
+                }
+                        
+                //Postamble
+                f_cse_postamble_deleteResources();
+
+                //Tear down
+                f_cf01Down();
+            } // f_CSE_SM_003
+            
+            /**
+            * @desc Check that the IUT rejects creation of <softwareCampaign> resource if it conflicts with any existing <softwareCampaign> resource in the hosting CSE
+            *  
+            */
+            testcase TC_CSE_SM_004() runs on Tester system CseSystem {
+                var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+                        
+                v_ae1.start(f_CSE_SM_004());
+                v_ae1.done;					
+            }
+                                                
+            function f_CSE_SM_004() runs on AeSimu system CseSystem {
+                // Local variables
+                var template RequestPrimitive v_createSoftwareCampaignRequest;
+                var integer v_aeIndex := -1;
+                var integer v_softwareCampaignResourceIndex := -1;
+                var integer v_resourceIndexContainer := -1;
+                var MsgIn v_response;
+                var RequestPrimitive v_createRequestPrimitive;
+                var template RequestPrimitive v_createRequest := m_createContainerBase;
+                var ResourceType p_resourceType := int51;	
+                // TODO int61: To change to correct type value once Software Campaign resource is added in TS-004
+                var template Action p_actionGeneric;
+                //conflict occurs when <softwareCampaign> resources are targeting the same node and have the same trigger conditions but have different software versions
+
+                // Test component configuration
+                f_cf01Up();
+
+                // Preamble
+                f_cse_createAccessControlPolicyAux(-, -, int63);
+                v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+                v_resourceIndexContainer := f_cse_createResource(int3, v_createRequest, v_aeIndex);
+
+                p_actionGeneric.subjectResourceID := f_getOriginator(v_resourceIndexContainer);
+                p_actionGeneric.evalCriteria.subject := "tempContainer.content";//string example
+                p_actionGeneric.evalCriteria.operator := int1;
+                p_actionGeneric.evalCriteria.threshold := 3;
+                
+                v_createSoftwareCampaignRequest := m_createSoftwareCampaign;			
+                v_createSoftwareCampaignRequest.primitiveContent.softwareCampaign.softwareTargets := {f_getOriginator(v_aeIndex)};
+                v_createSoftwareCampaignRequest.primitiveContent.softwareCampaign.softwareTriggerCriteria := p_actionGeneric;
+                
+                //IUT having valid <softwareCampaign> resource with SOFTWARE_TARGETS
+                v_softwareCampaignResourceIndex := f_cse_createResource(p_resourceType, v_createSoftwareCampaignRequest, v_aeIndex);
+                
+                // Software Campaign resource created with no values on attribute softwareTriggerCriteria            
+                v_createRequestPrimitive := f_getCreateRequestPrimitive(p_resourceType, v_createSoftwareCampaignRequest, v_aeIndex);
+
+
+                f_send(e_mcaPort, m_request(v_createRequestPrimitive));
+                tc_ac.start;         
+                alt {
+                    [] mcaPort.receive(mw_response(mw_responsePrimitive(int4105))) -> value v_response { //Response Status Code set to 4105 (CONFLICT) but it should be SOFTWARE_CAMPAIGN_CONFLICT?
+                        tc_ac.stop;
+                        setverdict(pass, __SCOPE__ & ": IUT rejected the creation request of softwareCampaign due to conflict with an existing one");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": Mismatch in status response code from IUT!");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": IUT accepted creation of softwareCampaign although there is conflict with an existing one");
+                    }
+                    [] tc_ac.timeout {
+                        setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+                    }
+                }
+                        
+                //Postamble
+                f_cse_postamble_deleteResources();
+
+                //Tear down
+                f_cf01Down();
+            } // f_CSE_SM_004
+            
+       group f_CSE_SM_005 {
+       
+            function f_CSE_SM_005(in AggregatedSoftwareStatus p_aggregatedSoftwareStatus) runs on AeSimu system CseSystem {
+                // Local variables
+                var template RequestPrimitive v_createSoftwareCampaignRequest;
+                var RequestPrimitive v_updateRequest := valueof(m_updateSoftwareCampaign);
+                var integer v_aeIndex := -1;
+                var integer v_softwareCampaignResourceIndex := -1;
+                var MsgIn v_response;
+                var ResourceType p_resourceTypeSoftwareCampaign := int51;	
+                // TODO int61: To change to correct type value once Software Campaign resource is added in TS-004
+                var template Action p_actionGeneric;
+
+                // Test component configuration
+                f_cf01Up();
+
+                // Preamble
+                f_cse_createAccessControlPolicyAux(-, -, int63);
+                v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, -);
+
+                p_actionGeneric.subjectResourceID := f_getOriginator(v_aeIndex);
+                p_actionGeneric.evalCriteria.subject := "tempContainer.content";//string example
+                p_actionGeneric.evalCriteria.operator := int1;
+                p_actionGeneric.evalCriteria.threshold := 3;
+                
+                v_createSoftwareCampaignRequest := m_createSoftwareCampaign;			
+                v_createSoftwareCampaignRequest.primitiveContent.softwareCampaign.softwareTargets := {f_getOriginator(v_aeIndex)};
+                v_createSoftwareCampaignRequest.primitiveContent.softwareCampaign.softwareTriggerCriteria := p_actionGeneric;
+                v_createSoftwareCampaignRequest.primitiveContent.softwareCampaign.aggregatedSoftwareStatus := p_aggregatedSoftwareStatus; // PENDING/IN PROGRESS
+                
+                //IUT having valid <softwareCampaign> resource
+                v_softwareCampaignResourceIndex := f_cse_createResource(p_resourceTypeSoftwareCampaign, v_createSoftwareCampaignRequest, v_aeIndex);
+
+                v_updateRequest.primitiveContent.container.labels := {"MyLabel"};                    
+                v_updateRequest := f_getUpdateRequestPrimitive(int51, v_softwareCampaignResourceIndex, v_updateRequest);
+                v_updateRequest.to_ := f_getResourceAddress(v_softwareCampaignResourceIndex);
+                    
+                f_send(e_mcaPort, m_request(v_updateRequest));
+                tc_ac.start;         
+                alt {
+                    [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) -> value v_response { //Response Status Code set to 4000 - BAD_REQUEST
+                        tc_ac.stop;
+                        setverdict(pass, __SCOPE__ & ": IUT rejected the update of softwareCampaign resource when the aggregatedSoftwareStatus attribute is set to PENDING");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": Mismatch in status response code from IUT!");
+                    }
+                    [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
+                        tc_ac.stop;
+                        setverdict(fail, __SCOPE__ & ": IUT accepted update of softwareCampaign resource with aggregatedSoftwareStatus attribute set to PENDING");
+                    }
+                    [] tc_ac.timeout {
+                        setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!");
+                    }
+                }
+                        
+                //Postamble
+                f_cse_postamble_deleteResources();
+
+                //Tear down
+                f_cf01Down();
+            } // f_CSE_SM_005
+            
+            /**
+            * @desc Check that the IUT rejects UPDATE of <softwareCampaign> resource when the aggregatedSoftwareStatus attribute is set to PENDING.
+            *  
+            */
+            testcase TC_CSE_SM_005_PEN() runs on Tester system CseSystem {
+                var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+                        
+                v_ae1.start(f_CSE_SM_005(int1)); // aggregatedSoftwareStatus = PENDING
+                v_ae1.done;					
+            }
+            
+            /**
+            * @desc Check that the IUT rejects UPDATE of <softwareCampaign> resource when the aggregatedSoftwareStatus attribute is set to SOFTWARE_STATUS.
+            *  
+            */
+            testcase TC_CSE_SM_005_INPROG() runs on Tester system CseSystem {
+                var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+                        
+                v_ae1.start(f_CSE_SM_005(int2)); // aggregatedSoftwareStatus = IN PROGRESS
+                v_ae1.done;					
+            }
+            
+       } // End of group f_CSE_SM_005
+
+  // }  End group Software Management        
+        
 	}//end group CSE
 
-}		
+}
\ No newline at end of file