From 51e8205315e77242fb7657b11b90d19e308e25c8 Mon Sep 17 00:00:00 2001
From: pkulkarni <pkulkarni75@gmail.com>
Date: Wed, 18 Oct 2017 17:44:40 +0200
Subject: [PATCH] Implementing further REG/RET/ TCs

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

diff --git a/OneM2M_Testcases_CSE.ttcn b/OneM2M_Testcases_CSE.ttcn
index f346dcc..a08d56f 100644
--- a/OneM2M_Testcases_CSE.ttcn
+++ b/OneM2M_Testcases_CSE.ttcn
@@ -1785,9 +1785,9 @@ module OneM2M_Testcases_CSE {
 								tc_ac.stop;
 								if ((ispresent(v_response.primitive.responsePrimitive.primitiveContent.cSEBase.cseType)) or 
 								     (ispresent(v_response.primitive.responsePrimitive.primitiveContent.cSEBase.nodeLink))){
-								  setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute cseType or nodeLink");
+								  setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute");
 								} else {
-								  setverdict(fail, __SCOPE__ & ": Error: Unable to retrieve attribute cseType"); 	
+								  setverdict(fail, __SCOPE__ & ": Error: Unable to retrieve attribute"); 	
 								}
 							}
 							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> value v_response {
@@ -1816,6 +1816,175 @@ module OneM2M_Testcases_CSE {
 					
 				} //end g_CSE_REG_RET_002
 				
+				testcase TC_CSE_REG_RET_003() runs on AeSimu system CseSystem {
+					// Local variables
+					var MsgIn v_response;
+					var integer v_aeIndex := -1;
+					var template PrimitiveContent v_contentResponse;
+								   
+					// Test control
+
+					// Test component configuration
+					f_cf01Up();
+
+					// Test adapter configuration
+
+					// Preamble
+					v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
+	
+					// Test Body
+					v_contentResponse.aE := mw_contentAeBase;
+	
+					mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(v_aeIndex))));//TODO Maybe PX_SUPER_AE_ID
+
+					tc_ac.start;
+					alt {
+						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {
+							tc_ac.stop;
+							setverdict(pass, __SCOPE__ & ": Response OK for retrieving");
+						}
+						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))) -> 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__ & ": Error, resource elements provided not matching expected resource elements");
+						}
+						[] mcaPort.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_deleteResources();
+
+					// Tear down
+					f_cf01Down();
+	
+				}//end TC_CSE_REG_RET_003
+				
+				group g_CSE_REG_RET_004 {
+					
+					testcase TC_CSE_REG_RET_004_LBL() runs on Tester system CseSystem {
+						// Local variables
+						var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+						var template PrimitiveContent v_contentResponse;
+	
+						v_contentResponse.aE := mw_contentAeBase;
+		    
+						v_ae1.start(f_CSE_REG_RET_004(v_contentResponse));
+						v_ae1.done;
+					}
+	
+					testcase TC_CSE_REG_RET_004_APN() runs on Tester system CseSystem {
+						//Local variables
+						 var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+						 var template PrimitiveContent v_contentResponse;
+
+						 v_contentResponse.aE := mw_contentAeBase;
+
+						 v_ae1.start(f_CSE_REG_RET_004(v_contentResponse));
+						 v_ae1.done;
+					}
+					
+					testcase TC_CSE_REG_RET_004_POA() runs on Tester system CseSystem {
+						//Local variables
+						 var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+						 var template PrimitiveContent v_contentResponse;
+
+						 v_contentResponse.aE := mw_contentAeBase;
+
+						 v_ae1.start(f_CSE_REG_RET_004(v_contentResponse));
+						 v_ae1.done;
+					}
+					
+					testcase TC_CSE_REG_RET_004_NL() runs on Tester system CseSystem {
+						//Local variables
+						 var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+						 var template PrimitiveContent v_contentResponse;
+
+						 v_contentResponse.aE := mw_contentAeBase;
+
+						 v_ae1.start(f_CSE_REG_RET_004(v_contentResponse));
+						 v_ae1.done;
+					}
+					
+					testcase TC_CSE_REG_RET_004_CSZ() runs on Tester system CseSystem {
+						//Local variables
+						 var AeSimu v_ae1 := AeSimu.create("AE1") alive;
+						 var template PrimitiveContent v_contentResponse;
+
+						 v_contentResponse.aE := mw_contentAeBase;
+
+						 v_ae1.start(f_CSE_REG_RET_004(v_contentResponse));
+						 v_ae1.done;
+					}
+	
+					function f_CSE_REG_RET_004(template PrimitiveContent p_contentResponse) runs on AeSimu {
+						//Local variables
+						 var MsgIn v_response;
+						 var integer v_aeIndex := -1;
+				   
+						 // Test control
+
+						 // Test component configuration
+						 f_cf01Up();
+
+						 // Test adapter configuration
+
+						 // Preamble
+						 v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
+		 
+						 mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(v_aeIndex))));//TODO Maybe PX_SUPER_AE_ID
+						 tc_ac.start;
+						 alt {
+							[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
+								tc_ac.stop;
+								if (ispresent(v_response.primitive.responsePrimitive.primitiveContent)){
+									if ((ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.appName)) or 
+										 (ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.nodeLink)) or
+									     (ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.labels)) or 
+									     (ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.pointOfAccess)) or
+									     (ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.contentSerialization)) ){
+									  setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute");
+									} else {
+									  setverdict(fail, __SCOPE__ & ": Error: Unable to retrieve attribute"); 	
+									}
+							  } else {
+								setverdict(fail, __SCOPE__ & ": Error: Primitive content not available");
+							  }
+							}
+							[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> 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__ & ": Error, resource elements provided not matching expected resource elements");
+							}
+							[] mcaPort.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_deleteResources();
+
+						// Tear down
+						f_cf01Down();
+					} //end f_CSE_REG_RET_004
+	
+				} //end g_CSE_REG_RET_004
+				
 				/**
 				 * @desc Check that if the IUT is IN-CSE, it accepts an retrieval request of <CSEBase> resource and returns the cseType attribute. cseType Attribute is mandatory for IN-CSE
 				 * 
@@ -1850,16 +2019,19 @@ module OneM2M_Testcases_CSE {
 					alt {
 						[] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response {
 							tc_ac.stop;
-							if (ispresent(v_response.primitive.responsePrimitive.primitiveContent.cSEBase.cseType)){
-								if (v_response.primitive.responsePrimitive.primitiveContent.cSEBase.cseType==int1){
-									setverdict(pass, __SCOPE__ & ": cseType attribute is set to 1 (IN_CSE)");
+							if (ispresent(v_response.primitive.responsePrimitive.primitiveContent)) {
+								if (ispresent(v_response.primitive.responsePrimitive.primitiveContent.cSEBase.cseType)){
+									if (v_response.primitive.responsePrimitive.primitiveContent.cSEBase.cseType==int1){
+										setverdict(pass, __SCOPE__ & ": cseType attribute is set to 1 (IN_CSE)");
+									}else{
+										setverdict(fail, __SCOPE__ & ": Error, cseType attribute is set to " & int2str(enum2int(v_response.primitive.responsePrimitive.primitiveContent.cSEBase.cseType)));
+									}
 								}else{
-									setverdict(fail, __SCOPE__ & ": Error, cseType attribute is set to " & int2str(enum2int(v_response.primitive.responsePrimitive.primitiveContent.cSEBase.cseType)));
+									setverdict(fail, __SCOPE__ & ": Error, cseType attribute is not present");
 								}
-							}else{
-								setverdict(fail, __SCOPE__ & ": Error, cseType attribute is not present");
-							}
-							
+						  } else {
+							setverdict(fail, __SCOPE__ & ": Error, Primitive content not available");  
+						  }
 						}
 						[] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))) -> value v_response {
 							tc_ac.stop;
@@ -1886,6 +2058,163 @@ module OneM2M_Testcases_CSE {
 
 				}//end TC_CSE_REG_RET_BV_005
 				
+				testcase TC_CSE_REG_RET_006() runs on CseSimu system CseSystem {
+				//Local variables
+				 //Local variables
+				 var MsgIn v_response;
+				 var RequestPrimitive v_request;
+				 var ResourceType v_resourceType := int16;	//remoteCSE
+				 var template PrimitiveContent v_contentResponse;
+				 		
+				 // Test control
+
+				 // Test component configuration
+				 f_cf04Up();
+
+				 // Test adapter configuration
+
+				 // Preamble
+				 vc_remoteCseIndex := f_cse_registerRemoteCse(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_006
+				
+				group g_CSE_REG_RET_007 {
+					
+					testcase TC_CSE_REG_RET_007_LBL() runs on Tester system CseSystem {
+						// Local variables
+						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
+						var template PrimitiveContent v_contentResponse;
+
+						v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
+
+						v_cse1.start(f_CSE_REG_RET_007(v_contentResponse));
+						v_cse1.done;
+					}
+					
+					testcase TC_CSE_REG_RET_007_CST() runs on Tester system CseSystem {
+						// Local variables
+						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
+						var template PrimitiveContent v_contentResponse;
+
+						v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
+
+						v_cse1.start(f_CSE_REG_RET_007(v_contentResponse));
+						v_cse1.done;
+					}
+					
+					testcase TC_CSE_REG_RET_007_POA() runs on Tester system CseSystem {
+						// Local variables
+						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
+						var template PrimitiveContent v_contentResponse;
+
+						v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
+
+						v_cse1.start(f_CSE_REG_RET_007(v_contentResponse));
+						v_cse1.done;
+					}
+					
+					testcase TC_CSE_REG_RET_007_NL() runs on Tester system CseSystem {
+						// Local variables
+						var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
+						var template PrimitiveContent v_contentResponse;
+
+						v_contentResponse.remoteCSE := mw_contentRemoteCSEBase;
+
+						v_cse1.start(f_CSE_REG_RET_007(v_contentResponse));
+						v_cse1.done;
+					}
+					
+					function f_CSE_REG_RET_007(template PrimitiveContent p_contentResponse) runs on CseSimu {
+						var MsgIn v_response;
+						var RequestPrimitive v_request;
+						var ResourceType v_resourceType := int16;	//remoteCSE
+						var template PrimitiveContent v_contentResponse;
+ 		
+						// Test control
+
+						// Test component configuration
+						f_cf04Up();
+
+						// Test adapter configuration
+
+						// Preamble
+						vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
+						mccPort.send(m_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex))));
+					    tc_ac.start;
+						alt {
+							[] mccPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response {
+								tc_ac.stop;
+								if (ispresent(v_response.primitive.responsePrimitive.primitiveContent)){
+									if ((ispresent(v_response.primitive.responsePrimitive.primitiveContent.remoteCSE.labels)) or 
+										 (ispresent(v_response.primitive.responsePrimitive.primitiveContent.remoteCSE.nodeLink)) or
+										 (ispresent(v_response.primitive.responsePrimitive.primitiveContent.remoteCSE.cseType)) or 
+										 (ispresent(v_response.primitive.responsePrimitive.primitiveContent.remoteCSE.pointOfAccess))){
+									  setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute");
+									} else {
+									  setverdict(fail, __SCOPE__ & ": Error: Unable to retrieve attribute"); 	
+									}
+							  } else {
+								setverdict(fail, __SCOPE__ & ": Error: Primitive content not available");
+							  }
+							}
+							[] mccPort.receive(mw_response(mw_responsePrimitiveOK(p_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();
+					} // f_CSE_REG_RET_007
+				
+				} //end g_CSE_REG_RET_007
+				
 				/**
 				 * @desc Check that the IUT accepts a retrieval request of <CSEBase> resource and responds with supportedResourceTypes attribute containing a list of the supported resources and pointOfAccess containing the list of physical addresses to be used by Registree to connect to this CSE (e.g. IP address, FQDN).
 				 * 
-- 
GitLab