From ea091c23606bd2b6aff076d19099f86b5ec4ea56 Mon Sep 17 00:00:00 2001
From: acverdugo <acverdugo@at4wireless.com>
Date: Wed, 7 Feb 2018 17:05:49 +0100
Subject: [PATCH] Some REG Test Cases updated

Signed-off-by: acverdugo <acverdugo@at4wireless.com>
---
 LibOneM2M/OneM2M_Functions.ttcn     | 23 ++++++++++++---
 OneM2M_Testcases_CSE_Release_1.ttcn | 45 +++++++++++------------------
 2 files changed, 36 insertions(+), 32 deletions(-)

diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn
index ac8c147..ea652b0 100644
--- a/LibOneM2M/OneM2M_Functions.ttcn
+++ b/LibOneM2M/OneM2M_Functions.ttcn
@@ -1361,6 +1361,25 @@ module OneM2M_Functions {
     
 			} //end f_compareURIs	
 			
+			/**
+			 * @desc Sending a request primitive on mcaPort on AeSimu
+			 * @param p_resourceType Resource type of the resource to be created
+			 * @param p_requestPrimitive CREATE request primitive for the resource to be created
+			 * @param p_parentIndex Internal resource index which indicates the parent of the resource to be created
+			 * @return Internal resource index of the created resource
+			 * @verdict 
+			 */
+			function f_cse_sendCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create, integer p_parentIndex := -1) runs on AeSimu{
+
+				var RequestPrimitive v_request;
+				var integer v_resourceIndex := -1;
+	
+				v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, p_parentIndex);
+
+				mcaPort.send(m_request(v_request));
+
+			}
+			
 		}//end group AeSimu
 			
 		group CseSimuFunctions {
@@ -1803,10 +1822,6 @@ module OneM2M_Functions {
 						
 						v_resourceIndex := f_setResource(valueof(m_primitiveContentRemoteCSE(m_contentMyRemoteCSEResource)), int16, -1);
 					}
-					[] mccPortIn.receive {
-						tc_ac.stop;
-						setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
-					}
 					[] tc_ac.timeout {
 						setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type remoteCSE");
 					}
diff --git a/OneM2M_Testcases_CSE_Release_1.ttcn b/OneM2M_Testcases_CSE_Release_1.ttcn
index 550dcba..9da2e05 100644
--- a/OneM2M_Testcases_CSE_Release_1.ttcn
+++ b/OneM2M_Testcases_CSE_Release_1.ttcn
@@ -450,7 +450,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 					// Test component configuration
 					f_cf01Up();
 		  	  	
-					//Preambule
+					//Preamble
 					
 					//Test Body
 					v_request := valueof(m_createAe(PX_APP_ID, omit, "C-AE-ID-STEM"));				
@@ -520,7 +520,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 					// Test component configuration
 					f_cf01Up();
 		  	  	
-					//Preambule
+					//Preamble
 					//vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
 					//TODO: create serviceSubscribedProfile, Node, and serviceSubscribedAppRule
 					//v_cseBaseIndex := f_cse_preamble_createServiceSubscribedProfile({"C*"}); //c_CRUDNDi);
@@ -571,26 +571,23 @@ module OneM2M_Testcases_CSE_Release_1 {
 					// Test component configuration
 					f_cf02UpCseSimuMaster();
 		  	  	
-					//Preambule
+					//Preamble
 					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
 		
 					//Test Body
-					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, "S", omit)));				
+					vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, -, "S", omit)));
+					vc_ae1.done;
 	    									
 					tc_ac.start;
 					alt{
-						[] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", "CSE_ID", -))){
+						[] mccPortIn.receive(mw_request(mw_createAEAnnc(PX_CSE_ID, f_getResourceAddress(-1,e_hierarchical, e_spRelative) & "/S", -))){
 							tc_ac.stop;
 							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
 						}
-						[] mccPortIn.receive(mw_request(mw_createAEAnnc(f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", "CSE_ID", -))){
+						[] mccPortIn.receive(mw_request(mw_createAEAnnc(PX_CSE_ID, f_getResourceAddress(-1,e_hierarchical, e_absolute) & "/S", -))){
 							tc_ac.stop;
 							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
 						}
-						[] mccPortIn.receive {
-							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ": Error while creating AE");
-						}
 						[] tc_ac.timeout {
 							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
 						}
@@ -626,11 +623,11 @@ module OneM2M_Testcases_CSE_Release_1 {
 					// Test component configuration
 					f_cf02UpCseSimuMaster();
 
-					//Preambule
+					//Preamble
 					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
 					
 					//Test Body
-					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
+					vc_ae1.start(f_cse_sendCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S")));
 					vc_ae1.done;
 							
 					tc_ac.start;
@@ -640,10 +637,6 @@ module OneM2M_Testcases_CSE_Release_1 {
 							tc_ac.stop;
 							setverdict(pass, __SCOPE__ & ": AE creation redirected.");
 						}
-						[] mccPortIn.receive {
-							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ": Error while creating AE");
-						}
 						[] tc_ac.timeout {
 							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
 						}
@@ -676,11 +669,11 @@ module OneM2M_Testcases_CSE_Release_1 {
 					// Test component configuration
 					f_cf02Up();
 					
-					//Preambule
+					//Preamble
 					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
 					vc_cse1.done;
-					
-					v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S"));
+			
+					mcaPort.send(m_request(f_getCreateRequestPrimitive(int2, m_createAe(PX_APP_ID, omit, "S"),-1)));
 					
 					vc_cse1.start(f_cse_resourceAnnouncementHandler());
 					vc_cse1.done;
@@ -689,7 +682,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 					tc_ac.start;
 					
 					alt {
-						[] mcaPortIn.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
 							tc_ac.stop;
 							//continue to test the content
 							if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){
@@ -702,10 +695,6 @@ module OneM2M_Testcases_CSE_Release_1 {
 								setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist");
 							}
 						}
-						[] mcaPortIn.receive {
-							tc_ac.stop;
-							setverdict(fail, __SCOPE__ & ": Error while creating AE");
-						}
 						[] tc_ac.timeout {
 							setverdict(fail, __SCOPE__ & ": No answer while creating AE");
 						}
@@ -738,7 +727,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 					// Test component configuration
 					f_cf02UpCseSimuMaster();
 		  	  	
-					//Preambule
+					//Preamble
 					vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
 					vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
 					
@@ -799,7 +788,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 					// Test component configuration
 					f_cf04Up();
 		  	  	
-					//Preambule
+					//Preamble
 					
 					vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
 							
@@ -866,7 +855,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 					// Test component configuration
 					f_cf02Up();
 		  	  	
-					//Preambule
+					//Preamble
 					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
 					vc_cse1.done;
 					
@@ -1278,7 +1267,7 @@ module OneM2M_Testcases_CSE_Release_1 {
 					// Test component configuration
 					f_cf02Up();
 
-					//Preambule
+					//Preamble
 					vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE));
 					vc_cse1.done;
 	
-- 
GitLab