From 40575462e3dd577a1c1222fc87fc5df116f04cd7 Mon Sep 17 00:00:00 2001
From: Naum Spaseski <naum.spaseski@eglobalmark.com>
Date: Sat, 9 Jul 2016 19:42:47 +0200
Subject: [PATCH] Corrected function f_prepareCSE and added new configuration
 function f_cf02Up

---
 OneM2M_Functions.ttcn | 56 +++++++++++++++++++------------------------
 OneM2M_Templates.ttcn | 12 +++++-----
 OneM2M_Testcases.ttcn |  4 ++--
 OneM2M_Types.ttcn     |  2 +-
 4 files changed, 34 insertions(+), 40 deletions(-)

diff --git a/OneM2M_Functions.ttcn b/OneM2M_Functions.ttcn
index c4c1524..2048df8 100644
--- a/OneM2M_Functions.ttcn
+++ b/OneM2M_Functions.ttcn
@@ -33,7 +33,6 @@ module OneM2M_Functions {
     			
 			// Map
 			map(self:mcaPort, system:mcaPort);
-			map(self:mccPort, system:mccPort);
 			map(self:acPort, system:acPort);
 			activate(a_default());
     			
@@ -42,6 +41,22 @@ module OneM2M_Functions {
 			//Initialze the IUT
     						
 		} // end f_cf01Up
+		
+		function f_cf02Up() runs on M2M {
+    			
+			// Variables
+    			
+			// Map
+			map(self:mcaPort, system:mcaPort);
+			map(self:mccPort, system:mccPort);
+			map(self:acPort, system:acPort);
+			activate(a_default());
+    			
+			// Connect
+    						
+			//Initialze the IUT
+    						
+		} // end f_cf02Up
     	
 	}//end group configFunctions
 	
@@ -113,37 +128,9 @@ module OneM2M_Functions {
 		
 			var M2MResponsePrimitive v_response;
 			var integer v_cseBaseAuxIndex := -1;
-			var integer v_acpAuxIndex := -1;
-			var ServiceSubscribedAppRule_optional v_serviceSubscribedAppRule;
+			var RequestPrimitive v_request;
 
-			v_serviceSubscribedAppRule.applicableCredIDs := {"None"};
-			v_serviceSubscribedAppRule.allowedApp_IDs := {PX_APP_ID};
-			v_serviceSubscribedAppRule.allowedAEs := valueof(p_allowedAEs);
-			
-			mcaPort.send(m_request(m_createServiceSubscribedAppRule(v_serviceSubscribedAppRule)));
-		
-			tc_ac.start;
-			alt {
-				[] mcaPort.receive(mw_response(int2001)) -> value v_response{
-					tc_ac.stop;
-					v_cseBaseAuxIndex := f_setResource(v_response.responsePrimitive_.primitiveContent);
-					vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_cseBaseAuxIndex};
-				}
-				[] mcaPort.receive(mw_responseKO) {
-					tc_ac.stop;
-					setverdict(inconc, "Preamble: Error while registering application");
-					stop;
-				}
-				[] mcaPort.receive {
-					tc_ac.stop;
-					setverdict(inconc, "Preamble: Unexpected message received");
-					stop;
-				}
-				[] tc_ac.timeout {
-					setverdict(inconc, "Preamble: No answer while registering resource");
-					stop;
-				}
-			}	
+			v_cseBaseAuxIndex := f_createResource(int19, m_createServiceSubscribedAppRule({"None"}, {PX_APP_ID}, valueof(p_allowedAEs)));
 			
 			return v_cseBaseAuxIndex;
 		
@@ -198,6 +185,13 @@ module OneM2M_Functions {
 			
 		function f_postamble_default() runs on M2M {
 	
+			unmap(self:mcaPort, system:mcaPort);
+			unmap(self:acPort, system:acPort);
+			//stop;
+		}	
+		
+		function f_postamble_CF02() runs on M2M {
+	
 			unmap(self:mcaPort, system:mcaPort);
 			unmap(self:mccPort, system:mccPort);
 			unmap(self:acPort, system:acPort);
diff --git a/OneM2M_Templates.ttcn b/OneM2M_Templates.ttcn
index 606c069..fd79907 100644
--- a/OneM2M_Templates.ttcn
+++ b/OneM2M_Templates.ttcn
@@ -787,14 +787,14 @@ module OneM2M_Templates {
 			};
 			
 			//Added by @Naum
-			template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ServiceSubscribedAppRule_optional p_serviceSubscribedAppRule) := {
+			template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) := {
 				operation := int1,
 				to_ := "NotInitialized",
 				from_ := PX_AE_ID_STEM,
 				requestIdentifier := "m_createCSE" & f_rnd(1, 1000000),
 				resourceType := int1,
 				primitiveContent := {
-					any_1 := {{ServiceSubscribedAppRule_optional := m_contentCreateServiceSubscribedAppRule (p_serviceSubscribedAppRule)}}
+					any_1 := {{ServiceSubscribedAppRule_optional := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedApp_IDs, p_allowedAEs)}}
 				},
 				role := omit,
 				originatingTimestamp := omit,
@@ -1071,7 +1071,7 @@ module OneM2M_Templates {
 			choice := omit//NP
 		};    	
 		
-		template (value) ServiceSubscribedAppRule_optional m_contentCreateServiceSubscribedAppRule (in template (value) ServiceSubscribedAppRule_optional serviceSubscribedAppRule := omit) := {
+		template (value) ServiceSubscribedAppRule_optional m_contentCreateServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) := {
 		  	resourceName := omit,
 			resourceType := omit,
 			resourceID := omit,
@@ -1081,9 +1081,9 @@ module OneM2M_Templates {
 			labels := omit,
 			accessControlPolicyIDs := omit,
 			expirationTime := omit,
-			applicableCredIDs := serviceSubscribedAppRule.applicableCredIDs,
-			allowedApp_IDs := serviceSubscribedAppRule.allowedApp_IDs,
-			allowedAEs := serviceSubscribedAppRule.allowedAEs,
+			applicableCredIDs := p_applicableCredIDs,
+			allowedApp_IDs := p_allowedApp_IDs,
+			allowedAEs := p_allowedAEs,
 			choice := omit
 		}
     	
diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn
index de79f3a..bdd01f0 100644
--- a/OneM2M_Testcases.ttcn
+++ b/OneM2M_Testcases.ttcn
@@ -118,7 +118,7 @@ module OneM2M_Testcases {
                 
                 // Test component configuration
 				f_cf01Up();
-				
+                
 				//Preambule
 				v_cseBaseIndex := f_preamble_prepareCSE({"C-AE-ID-STEM"});//c_CRUDNDi);
 	
@@ -274,7 +274,7 @@ module OneM2M_Testcases {
 				var ResourceType v_resourceType := int2;
                 
                 // Test component configuration
-				f_cf01Up();
+				f_cf02Up();
 	  	  	
 				//Preambule
 				v_cseBaseIndex := f_preamble_prepareCSE({"S"});//c_CRUDNDi);
diff --git a/OneM2M_Types.ttcn b/OneM2M_Types.ttcn
index 5520e3c..3216964 100644
--- a/OneM2M_Types.ttcn
+++ b/OneM2M_Types.ttcn
@@ -4558,5 +4558,5 @@ with {
   encode "XML";
   variant "namespace as 'http://www.onem2m.org/xml/protocols' prefix 'm2m'";
   variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
-  extension "anytype charstring, AnyURI, AttributeList, AE, AccessControlPolicy, AccessControlPolicy_optional, ACP_update_invalid, AE_optional, AE_update_invalid,AEAnnc_optional, Container_optional, CSEBase_optional, Container_update_invalid, ContentInstance_optional, ContentInstance_update_invalid, Group_optional, Group_update_invalid, Schedule_optional, Schedule_update_invalid, Subscription_optional, Subscription_update_invalid, PollingChannel_optional, PollingChannel_update_invalid"
+  extension "anytype ServiceSubscribedAppRule_optional, charstring, AnyURI, AttributeList, AE, AccessControlPolicy, AccessControlPolicy_optional, ACP_update_invalid, AE_optional, AE_update_invalid,AEAnnc_optional, Container_optional, CSEBase_optional, Container_update_invalid, ContentInstance_optional, ContentInstance_update_invalid, Group_optional, Group_update_invalid, Schedule_optional, Schedule_update_invalid, Subscription_optional, Subscription_update_invalid, PollingChannel_optional, PollingChannel_update_invalid"
 }
-- 
GitLab