Commit 3ff2751942ed7232ee3e6e5239c18e5a88f0e35a

Authored by Enrique Sabatel
1 parent 51ff6403

TC_CSE_DAU_NTF_007 added

... ... @@ -2091,7 +2091,7 @@ module OneM2M_Functions {
2091 2091 * @param p_responseStatusCode Response Status Code to be used for the response to the verification request
2092 2092 * @verdict
2093 2093 */
2094   - function f_cse_notifyProcedure_dynamicAuthorizationHandler(in integer p_secInfoType, in AccessControlOperations p_grantedPrivileges := int61, in Timestamp p_privilegesLifetime := "21001231T012345") runs on AeSimu {
  2094 + function f_cse_notifyProcedure_dynamicAuthorizationHandler(in integer p_secInfoType, in DynAuthJWT p_token := null, in AccessControlOperations p_grantedPrivileges := int61, in Timestamp p_privilegesLifetime := "21001231T012345") runs on AeSimu {
2095 2095 // Local variables
2096 2096 var boolean v_response :=false;
2097 2097 var ResponsePrimitive v_responsePrimitive;
... ... @@ -2102,7 +2102,7 @@ module OneM2M_Functions {
2102 2102  
2103 2103 //Preparation of Notification response to be sent
2104 2104 v_responsePrimitive := valueof(m_responseNotification(int2000, omit));
2105   -
  2105 +
2106 2106 tc_ac.start;
2107 2107 alt {
2108 2108 [] mcaPortIn.receive(mw_request(mw_notifyNotification(v_notificationRequest))) -> value vc_request {
... ... @@ -2124,6 +2124,10 @@ module OneM2M_Functions {
2124 2124 v_responsePrimitive.primitiveContent.securityInfo.securityInfoType:=int2; //DynamicAuthorizationResponse
2125 2125 v_responsePrimitive.primitiveContent.securityInfo.dasResponse.dynamicACPInfo.grantedPrivileges.accessControlRule_list[0].accessControlOperations := p_grantedPrivileges;
2126 2126 v_responsePrimitive.primitiveContent.securityInfo.dasResponse.dynamicACPInfo.privilegesLifetime.alt_ := p_privilegesLifetime;
  2127 + if (p_token!=null)
  2128 + {
  2129 + v_responsePrimitive.primitiveContent.securityInfo.dasResponse.tokens[0] := p_token;
  2130 + }
2127 2131 }
2128 2132 else if (p_secInfoType==1)
2129 2133 {
... ... @@ -5551,6 +5555,11 @@ module OneM2M_Functions {
5551 5555 * Format shall be YYYYMMDDTHHMMSS
5552 5556 */
5553 5557 external function fx_generateTimestamp() return charstring;
  5558 +
  5559 + /**
  5560 + * @desc Generates a oneM2M JSON Web Token.
  5561 + */
  5562 + external function fx_generateJWT() return DynAuthJWT;
5554 5563  
5555 5564 } // end externalFunctions
5556 5565  
... ...
... ... @@ -10469,7 +10469,7 @@ module OneM2M_Testcases_CSE_Release_3 {
10469 10469 alt {
10470 10470 [] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))){
10471 10471 tc_ac.stop;
10472   - setverdict(pass, __SCOPE__ & ": Originator has no privilege");
  10472 + setverdict(pass, __SCOPE__ & ": 'Originator has no privilege' status code received");
10473 10473 }
10474 10474 [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
10475 10475 tc_ac.stop;
... ... @@ -10597,6 +10597,7 @@ module OneM2M_Testcases_CSE_Release_3 {
10597 10597 var integer v_ae2Index := -1;
10598 10598 var integer v_containerIndex, v_acpIndex := -1;
10599 10599 var integer v_dynamicAuthorizationConsultationIndex := -1;
  10600 + var template PrimitiveContent v_contentResponse;
10600 10601  
10601 10602 // Test control
10602 10603 if(not(PICS_ACP_SUPPORT)) {
... ... @@ -10624,12 +10625,17 @@ module OneM2M_Testcases_CSE_Release_3 {
10624 10625  
10625 10626 // Test Body
10626 10627 f_cse_retrieveResource(v_containerIndex);
  10628 + v_contentResponse.container := mw_contentContainer_any;
10627 10629  
10628 10630 tc_ac.start;
10629 10631 alt {
10630   - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
  10632 + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))) -> value vc_response {
  10633 + tc_ac.stop;
  10634 + setverdict(pass, __SCOPE__&": Resource retrieved successfully");
  10635 + }
  10636 + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK())) -> value vc_response {
10631 10637 tc_ac.stop;
10632   - setverdict(pass, __SCOPE__&": Resource retrieved successfuly");
  10638 + setverdict(fail, __SCOPE__&": Unexpected response received");
10633 10639 }
10634 10640 [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
10635 10641 tc_ac.stop;
... ... @@ -10670,14 +10676,14 @@ module OneM2M_Testcases_CSE_Release_3 {
10670 10676  
10671 10677 //Local variables
10672 10678 var RequestPrimitive v_notificationRequest, v_request;
10673   - var template PrimitiveContent v_contentResponse;
  10679 + var template PrimitiveContent v_contentResponse1, v_contentResponse2;
10674 10680 var AccessControlOperations v_grantedPrivileges := int61;
10675 10681 var Timestamp v_privilegesLifetime := "21001231T012345";
10676 10682 var integer v_dasIndex := -1;
10677 10683 var integer v_ae2Index := -1;
10678 10684 var integer v_containerIndex, v_acpIndex := -1;
10679 10685 var integer v_dynamicAuthorizationConsultationIndex := -1;
10680   -
  10686 +
10681 10687 // Test control
10682 10688 if(not(PICS_ACP_SUPPORT)) {
10683 10689 setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
... ... @@ -10700,16 +10706,21 @@ module OneM2M_Testcases_CSE_Release_3 {
10700 10706 var template RequestPrimitive v_createRequest1 := m_createDynamicAuthorizationConsultationBase(null, true); //dynamicAuthorizationEnable set to TRUE
10701 10707 var template RequestPrimitive v_createRequest2 := m_createContainerBase;
10702 10708 f_cse_preamble_dau(v_dasIndex, v_dynamicAuthorizationConsultationIndex, v_containerIndex, v_acpIndex, v_createRequest1, v_createRequest2);
10703   - vc_das.start(f_cse_notifyProcedure_dynamicAuthorizationHandler(2, v_grantedPrivileges, v_privilegesLifetime)); //Dynamic Authorization Response
  10709 + vc_das.start(f_cse_notifyProcedure_dynamicAuthorizationHandler(2, null, v_grantedPrivileges, v_privilegesLifetime)); //Dynamic Authorization Response
10704 10710  
10705 10711 // Test Body
10706 10712 f_cse_retrieveResource(v_containerIndex);
  10713 + v_contentResponse1.container := mw_contentContainer_any;
10707 10714  
10708 10715 tc_ac.start;
10709 10716 alt {
10710   - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
  10717 + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse1))) -> value vc_response {
  10718 + tc_ac.stop;
  10719 + setverdict(pass, __SCOPE__&": Resource retrieved successfully");
  10720 + }
  10721 + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK())) -> value vc_response {
10711 10722 tc_ac.stop;
10712   - setverdict(pass, __SCOPE__&": Resource retrieved successfuly");
  10723 + setverdict(fail, __SCOPE__&": Unexpected response received");
10713 10724 }
10714 10725 [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
10715 10726 tc_ac.stop;
... ... @@ -10725,35 +10736,39 @@ module OneM2M_Testcases_CSE_Release_3 {
10725 10736 v_request := valueof(m_retrieve(f_getResourceAddress(v_containerIndex), f_getOriginator(v_ae2Index)));
10726 10737 v_request.resultContent := int8;//Child resources
10727 10738 mcaPort.send(f_getMsgOutPrimitive(m_request(v_request)));
10728   -
10729   - v_contentResponse.accessControlPolicy := mw_contentAcp_any;
  10739 + v_contentResponse2.accessControlPolicy := mw_contentAcp_any;
10730 10740  
10731 10741 tc_ac.start;
10732 10742 alt {
10733   - [] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value vc_response {
  10743 + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse2))) -> value vc_response {
10734 10744 tc_ac.stop;
10735 10745 setverdict(pass, __SCOPE__ & ": accessControlPolicy child resource created");
10736 10746 if(vc_response.primitive.responsePrimitive.primitiveContent.accessControlPolicy.privileges.accessControlRule_list[0].accessControlOperations == v_grantedPrivileges)
10737 10747 {
10738 10748 setverdict(pass, __SCOPE__ & ": privileges attribute of the accessControlPolicy child resource is set to the right value");
10739   - } else {
  10749 + }
  10750 + else
  10751 + {
10740 10752 setverdict(fail, __SCOPE__ & ": privileges attribute of the accessControlPolicy child resource is not set to the right value");
10741 10753 }
10742 10754 if(vc_response.primitive.responsePrimitive.primitiveContent.accessControlPolicy.expirationTime == v_privilegesLifetime)
10743 10755 {
10744 10756 setverdict(pass, __SCOPE__ & ": expirationTime attribute of the accessControlPolicy child resource is set to the right value");
10745   - } else {
10746   - setverdict(fail, __SCOPE__ & ": expirationTime attribute of the accessControlPolicy child resource is not set to the right value");
10747 10757 }
  10758 + else
  10759 + {
  10760 + setverdict(fail, __SCOPE__ & ": expirationTime attribute of the accessControlPolicy child resource is not set to the right value");
  10761 + }
10748 10762 if(vc_response.primitive.responsePrimitive.primitiveContent.accessControlPolicy.selfPrivileges.accessControlRule_list[0].accessControlOperations == int61)
10749 10763 {
10750 10764 setverdict(pass, __SCOPE__ & ": selfPrivileges attribute of the accessControlPolicy child resource is set to the right value");
10751   - } else {
10752   - setverdict(fail, __SCOPE__ & ": selfPrivileges attribute of the accessControlPolicy child resource is not set to the right value");
10753 10765 }
10754   -
10755   - }
10756   - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))) -> value vc_response {
  10766 + else
  10767 + {
  10768 + setverdict(fail, __SCOPE__ & ": selfPrivileges attribute of the accessControlPolicy child resource is not set to the right value");
  10769 + }
  10770 + }
  10771 + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse2))) -> value vc_response {
10757 10772 tc_ac.stop;
10758 10773 setverdict(fail, __SCOPE__ & ": Error while retrieving accessControlPolicy resource");
10759 10774 }
... ... @@ -10768,8 +10783,7 @@ module OneM2M_Testcases_CSE_Release_3 {
10768 10783 [] tc_ac.timeout {
10769 10784 setverdict(fail, __SCOPE__ & ": No answer while retrieving accessControlPolicy resource");
10770 10785 }
10771   - }
10772   -
  10786 + }
10773 10787  
10774 10788 // Postamble
10775 10789 f_cse_postamble_deleteResources();
... ... @@ -10777,7 +10791,7 @@ module OneM2M_Testcases_CSE_Release_3 {
10777 10791 // Tear down
10778 10792 f_cf06Down();
10779 10793  
10780   - } // end f_CSE_DAU_NTF_005
  10794 + } // end f_CSE_DAU_NTF_006
10781 10795  
10782 10796  
10783 10797 /**
... ... @@ -10791,9 +10805,80 @@ module OneM2M_Testcases_CSE_Release_3 {
10791 10805 v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
10792 10806 v_ae1.done;
10793 10807  
10794   - //v_ae1.start(f_CSE_DAU_NTF_001());
10795   - //v_ae1.done;
  10808 + v_ae1.start(f_CSE_DAU_NTF_007());
  10809 + v_ae1.done;
10796 10810 }
  10811 +
  10812 + function f_CSE_DAU_NTF_007() runs on AeSimu {
  10813 +
  10814 + //Local variables
  10815 + var RequestPrimitive v_notificationRequest, v_request;
  10816 + var template PrimitiveContent v_contentResponse;
  10817 + var DynAuthJWT v_token;
  10818 + var integer v_dasIndex := -1;
  10819 + var integer v_ae2Index := -1;
  10820 + var integer v_containerIndex, v_acpIndex := -1;
  10821 + var integer v_dynamicAuthorizationConsultationIndex := -1;
  10822 +
  10823 + // Test control
  10824 + if(not(PICS_ACP_SUPPORT)) {
  10825 + setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case");
  10826 + stop;
  10827 + }
  10828 + if(not(PICS_DYN_AUTH_SUPPORT)) {
  10829 + setverdict(inconc, __SCOPE__ & ": DynamicAuthorizationConsultation support is required to run this test case");
  10830 + stop;
  10831 + }
  10832 +
  10833 + // Test component configuration
  10834 + f_cf06Up();
  10835 +
  10836 + // Test adapter configuration
  10837 +
  10838 + // Preamble
  10839 + v_ae2Index := f_cse_preamble_registerAe();
  10840 + v_acpIndex := f_cse_preamble_createAcpAux(-, int61); //c_CUDNDi), no resource retrieval privilege
  10841 +
  10842 + var template RequestPrimitive v_createRequest1 := m_createDynamicAuthorizationConsultationBase(null, true); //dynamicAuthorizationEnable set to TRUE
  10843 + var template RequestPrimitive v_createRequest2 := m_createContainerBase;
  10844 + f_cse_preamble_dau(v_dasIndex, v_dynamicAuthorizationConsultationIndex, v_containerIndex, v_acpIndex, v_createRequest1, v_createRequest2);
  10845 + v_token := fx_generateJWT();
  10846 + vc_das.start(f_cse_notifyProcedure_dynamicAuthorizationHandler(2, v_token)); //Dynamic Authorization Response
  10847 +
  10848 + // Test Body
  10849 + f_cse_retrieveResource(v_containerIndex);
  10850 +
  10851 + tc_ac.start;
  10852 + alt {
  10853 + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK())) -> value vc_response {
  10854 + tc_ac.stop;
  10855 + if (vc_response.primitive.responsePrimitive.primitiveContent.securityInfo.dasResponse.tokens[0] == v_token)
  10856 + {
  10857 + setverdict(pass, __SCOPE__&": Token received successfully");
  10858 + }
  10859 + else
  10860 + {
  10861 + setverdict(fail, __SCOPE__&": Error while receiving token");
  10862 + }
  10863 + }
  10864 + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
  10865 + tc_ac.stop;
  10866 + setverdict(fail, __SCOPE__&": Error while retrieving resource");
  10867 + }
  10868 + [] tc_ac.timeout {
  10869 + setverdict(fail, __SCOPE__&": No answer while retrieving resource");
  10870 + }
  10871 + }
  10872 +
  10873 + f_aeSimu_checkComponentDoneAndGetVerdict(vc_das);
  10874 +
  10875 + // Postamble
  10876 + f_cse_postamble_deleteResources();
  10877 +
  10878 + // Tear down
  10879 + f_cf06Down();
  10880 +
  10881 + } // end f_CSE_DAU_NTF_007
10797 10882  
10798 10883 /**
10799 10884 * @desc Check that the IUT correctly processes a Notify response received in response to a Notify request that started Dynamic Authorization.
... ... @@ -10850,7 +10935,7 @@ module OneM2M_Testcases_CSE_Release_3 {
10850 10935 alt {
10851 10936 [] mcaPort.receive(mw_response(mw_responsePrimitive(int4103))){
10852 10937 tc_ac.stop;
10853   - setverdict(pass, __SCOPE__ & ": Originator has no privilege");
  10938 + setverdict(pass, __SCOPE__ & ": 'Originator has no privilege' status code received");
10854 10939 }
10855 10940 [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
10856 10941 tc_ac.stop;
... ...