From e5a9c9aaee097055e23fac0229550990b3d220b3 Mon Sep 17 00:00:00 2001
From: pkulkarni <pkulkarni75@gmail.com>
Date: Fri, 20 Oct 2017 11:31:23 +0200
Subject: [PATCH] Implemented REG/RET/010 TC

Signed-off-by: pkulkarni <pkulkarni75@gmail.com>
---
 OneM2M_Testcases_CSE.ttcn | 79 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 77 insertions(+), 2 deletions(-)

diff --git a/OneM2M_Testcases_CSE.ttcn b/OneM2M_Testcases_CSE.ttcn
index 1a9ccd1..0070491 100644
--- a/OneM2M_Testcases_CSE.ttcn
+++ b/OneM2M_Testcases_CSE.ttcn
@@ -2478,6 +2478,10 @@ module OneM2M_Testcases_CSE {
 
 				}//end TC_CSE_REG_RET_008
 				
+				/**
+				 * @desc Check that the IUT sends a <remoteCSE> retrieve request on TARGET_REMOTE_CSE_ADDRESS
+				 * 
+				 */
 				testcase TC_CSE_REG_RET_009() runs on CseSimu system CseSystem {
 					//Local variables
 					 //Local variables
@@ -2507,7 +2511,19 @@ module OneM2M_Testcases_CSE {
 					 f_sendUtPrimitive(v_utRequest);
 					 
 					 tc_ac.start;
-					 mccPort.send(m_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex))));
+					 alt {
+ 						[] mccPort.receive(mw_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex)))) -> value v_response {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": Retrieve Request received successfully");
+						}
+						[] mccPort.receive {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error Retrieve request was not received");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while waiting to receive Retrieve request");
+						}
+	  				 }
 					 // Postamble
 					 f_cse_postamble_deleteResourcesCSE();
 	
@@ -2515,8 +2531,67 @@ module OneM2M_Testcases_CSE {
 					 f_cf04Down();
  
 				}//end TC_CSE_REG_RET_009
+				
+				/**
+				 * @desc Check that IUT accepts a <remoteCSE> retrieve request
+				 * 
+				 */
+				testcase TC_CSE_REG_RET_010() runs on CseSimu system CseSystem {
+					 //Local variables
+					 var MsgIn v_response;
+					 var RequestPrimitive v_request;
+					 var ResourceType v_resourceType := int16;	//remoteCSE
+					 var template PrimitiveContent v_contentResponse;
+					 var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE;
+	
+					 // Test control
+					if(not(PICS_MN_CSE)) {
+						setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case");
+						stop;
+					 }
+	
+					 // Test component configuration
+					 f_cf04Up();
+	
+					 // Test adapter configuration
+	
+					 // Preamble
+					 vc_remoteCseIndex := f_cse_registrationRemoteCse(m_createRemoteCSEBase);
+					 
+					v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
+	 
+					 mccPort.send(m_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex))));
+					 tc_ac.start;
+					 alt {
+						[] mccPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
+						}
+						[] mccPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Wrong response status code");
+						}
+						[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements");
+						}
+						[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
+							tc_ac.stop;
+							setverdict(fail, __SCOPE__ & ": Error while retrieving resource");
+						}
+						[] tc_ac.timeout {
+							setverdict(fail, __SCOPE__ & ": No answer while retrieving resource");
+						}
+					 }
+					 // Postamble
+					 f_cse_postamble_deleteResourcesCSE();
+	
+					 // Tear down
+					 f_cf04Down();
+	 
+				}//end TC_CSE_REG_RET_010
 			
-			}	//end group Retrieve
+			}//end group Retrieve
 			
 			group Update{
 			
-- 
GitLab