Commit be4de28e3d15c342ba391ccedf3db093b90e02da

Authored by Miguel Angel Reina Ortega
1 parent bec8fb18

First Hybrid addressing test case

Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org>
... ... @@ -4227,13 +4227,20 @@ module OneM2M_Functions {
4227 4227 } else {
4228 4228 return f_getResourceId(vc_resourcesList[p_targetResourceIndex].resource);
4229 4229 }
4230   - } else {
  4230 + } else if (p_addressingMethod == e_hierarchical){
4231 4231 if(p_targetResourceIndex == -1) {
4232 4232 return PX_CSE_NAME;
4233 4233 } else {
4234 4234 v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource);
4235 4235 return v_resourceAddress;
4236 4236 }
  4237 + } else if (p_addressingMethod == e_hybrid){
  4238 + if(p_targetResourceIndex == -1) {
  4239 + return PX_CSE_RESOURCE_ID;
  4240 + } else {
  4241 + v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, e_nonHierarchical, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource);
  4242 + return v_resourceAddress;
  4243 + }
4237 4244 }
4238 4245  
4239 4246 } else if (p_primitiveScope == e_spRelative) {
... ... @@ -4244,13 +4251,20 @@ module OneM2M_Functions {
4244 4251 v_resourceAddress := PX_CSE_ID & "/" & f_getResourceId(vc_resourcesList[p_targetResourceIndex].resource);
4245 4252 return v_resourceAddress;
4246 4253 }
4247   - } else {
  4254 + } else if (p_addressingMethod == e_hierarchical){
4248 4255 if(p_targetResourceIndex == -1) {
4249 4256 return PX_CSE_ID & "/" & PX_CSE_NAME;
4250 4257 } else {
4251 4258 v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource);
4252 4259 return v_resourceAddress;
4253 4260 }
  4261 + } else if (p_addressingMethod == e_hybrid){
  4262 + if(p_targetResourceIndex == -1) {
  4263 + return PX_CSE_ID & "/" & PX_CSE_RESOURCE_ID;
  4264 + } else {
  4265 + v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, e_nonHierarchical, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource);
  4266 + return v_resourceAddress;
  4267 + }
4254 4268 }
4255 4269 } else if (p_primitiveScope == e_absolute) {
4256 4270 if(p_addressingMethod == e_nonHierarchical) {
... ... @@ -4260,14 +4274,21 @@ module OneM2M_Functions {
4260 4274 v_resourceAddress := PX_SP_ID & PX_CSE_ID & "/" & f_getResourceId(vc_resourcesList[p_targetResourceIndex].resource);
4261 4275 return v_resourceAddress;
4262 4276 }
4263   - } else {
  4277 + } else if (p_addressingMethod == e_hierarchical){
4264 4278 if(p_targetResourceIndex == -1) {
4265 4279 return PX_SP_ID & PX_CSE_ID & "/" & PX_CSE_NAME;
4266 4280 } else {
4267 4281 v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource);
4268 4282 return v_resourceAddress;
4269 4283 }
4270   - }
  4284 + } else if (p_addressingMethod == e_hybrid){
  4285 + if(p_targetResourceIndex == -1) {
  4286 + return PX_SP_ID & PX_CSE_ID & "/" & PX_CSE_RESOURCE_ID;
  4287 + } else {
  4288 + v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, e_nonHierarchical, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource);
  4289 + return v_resourceAddress;
  4290 + }
  4291 + }
4271 4292 } else {
4272 4293 return "";
4273 4294 }
... ...
... ... @@ -8690,7 +8690,8 @@ group OtherTypes {
8690 8690  
8691 8691 type enumerated AddressingMethod {
8692 8692 e_nonHierarchical,
8693   - e_hierarchical
  8693 + e_hierarchical,
  8694 + e_hybrid
8694 8695 }
8695 8696  
8696 8697 type union Resource_2 {
... ...
... ... @@ -858,7 +858,68 @@ module OneM2M_PermutationFunctions {
858 858 // Tear down
859 859 f_cf01Down();
860 860  
861   - }//end f_CSE_GEN_CRE_002
  861 + }//end f_CSE_GEN_CRE_002
  862 +
  863 + function f_CSE_GEN_CRE_003(in PrimitiveScope p_primitiveScope) runs on AeSimu {
  864 +
  865 + // Local variables
  866 + var RequestPrimitive v_request;
  867 + var integer v_aeIndex := -1;
  868 + var integer v_resourceIndex := -1;
  869 + var AddressingMethod v_addressingMethod;
  870 + var PrimitiveScope v_primitiveScope;
  871 +
  872 + // Test control
  873 + if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) {
  874 + setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case");
  875 + stop;
  876 + }
  877 +
  878 + // Test component configuration
  879 + f_cf01Up();
  880 +
  881 + // Test adapter configuration
  882 +
  883 + // Preamble
  884 + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
  885 +
  886 + v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
  887 +
  888 + // Test Body
  889 + //Force usage of Hybrid Hierarchical addressing method
  890 + v_addressingMethod := e_hybrid;
  891 + v_primitiveScope := p_primitiveScope;
  892 + v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex);
  893 + v_request.to_ := f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope);
  894 +
  895 + mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
  896 + tc_ac.start;
  897 + alt {
  898 + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
  899 + tc_ac.stop;
  900 + setverdict(pass, __SCOPE__ & ": Container resource created using hierarchical addressing method");
  901 + }
  902 + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
  903 + tc_ac.stop;
  904 + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
  905 + }
  906 + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
  907 + tc_ac.stop;
  908 + setverdict(fail, __SCOPE__ & ": Error while creating container resource using hierarchical addressing method");
  909 + }
  910 + [] tc_ac.timeout {
  911 + setverdict(fail, __SCOPE__ & ": No answer while creating resource");
  912 + }
  913 + }
  914 +
  915 + // Postamble
  916 + f_cse_postamble_deleteResources();
  917 +
  918 + // Tear down
  919 + f_cf01Down();
  920 +
  921 + }//end f_CSE_GEN_CRE_003
  922 +
862 923  
863 924 } // end of group Create
864 925  
... ...
... ... @@ -82,6 +82,47 @@ module OneM2M_Testcases_CSE_Release_2 {
82 82 group Generic {
83 83  
84 84 group Create {
  85 +
  86 + group g_CSE_GEN_CRE_003 {
  87 +
  88 + /**
  89 + * @desc Check that the IUT accepts the creation of a <container> resource using structured resource identifier with hybrid addressing.
  90 + *
  91 + */
  92 + testcase TC_CSE_GEN_CRE_003_CSR() runs on Tester system CseSystem {
  93 + // Local variables
  94 +
  95 + var AeSimu v_ae1 := AeSimu.create("AE1") alive;
  96 + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
  97 + v_ae1.done;
  98 +
  99 + v_ae1.start(f_CSE_GEN_CRE_003(e_cseRelative));
  100 + v_ae1.done;
  101 + }
  102 +
  103 + testcase TC_CSE_GEN_CRE_003_SPR() runs on Tester system CseSystem {
  104 + // Local variables
  105 +
  106 + var AeSimu v_ae1 := AeSimu.create("AE1") alive;
  107 + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
  108 + v_ae1.done;
  109 +
  110 + v_ae1.start(f_CSE_GEN_CRE_003(e_spRelative));
  111 + v_ae1.done;
  112 + }
  113 +
  114 + testcase TC_CSE_GEN_CRE_003_ABS() runs on Tester system CseSystem {
  115 + // Local variables
  116 +
  117 + var AeSimu v_ae1 := AeSimu.create("AE1") alive;
  118 + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
  119 + v_ae1.done;
  120 +
  121 + v_ae1.start(f_CSE_GEN_CRE_003(e_absolute));
  122 + v_ae1.done;
  123 + }
  124 +
  125 + } // end of group g_CSE_GEN_CRE_003
85 126  
86 127 } // end of group Create
87 128  
... ...