Commit c447c675 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for individual NSLCM Op Occs

parent 99abe8d9
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -107,3 +107,27 @@ DELETE status information about Individual NS LCM occurrences - Method not imple
    ...    Post-Conditions: none
    DELETE Individual NS LCM OP Occurrence
    Check HTTP Response Status Code Is    405

PATCH status information about Individual NS LCM occurrences with permitted authorization scope
     [Documentation]    Test ID: 5.3.2.9.6
    ...    Test title: PATCH status information about Individual NS LCM occurrences with permitted authorization scope
    ...    Test objective: The objective is to test that PATCH method modify an existing Individual NS LCM occurrence with permitted authorization scope
    ...    Pre-conditions: An Individual NS LCM occurrence represents a scheduled operation not yet started 
    ...    Reference: Clause 6.4.10.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    PATCH Individual NS LCM OP Occurrence with permitted authorization scope
    Check HTTP Response Status Code Is    204

PATCH status information about Individual NS LCM occurrences with not permitted authorization scope
     [Documentation]    Test ID: 5.3.2.9.4
    ...    Test title: PATCH status information about Individual NS LCM occurrences with not permitted authorization scope
    ...    Test objective: The objective is to test that PATCH method modify an existing Individual NS LCM occurrence fails when using not permitted authorization scope
    ...    Pre-conditions: An Individual NS LCM occurrence represents a scheduled operation not yet started 
    ...    Reference: Clause 6.4.10.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    PATCH Individual NS LCM OP Occurrence with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+27 −0
Original line number Diff line number Diff line
@@ -1144,6 +1144,33 @@ PATCH Individual NS LCM OP Occurrence
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

PATCH Individual NS LCM OP Occurrence with permitted authorization scope
    log    Trying to perform a PATCH.
    Set Headers  {"Accept":"${ACCEPT}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    ${scopeValue}=    Create Dictionary    scope=${OPOCCS_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}    ${body}=    Get File    jsons/NsLcmInfoModificationRequest.json
    ${body}=        Format String   ${body}     scheduledTime=${schedule_for_new_operation_start}
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_lcm_op_occs/${nsLcmOpOccId_scheduledOp_notStarted}    ${body}	 	
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

PATCH Individual NS LCM OP Occurrence with not permitted authorization scope
    log    Trying to perform a PATCH.
    Set Headers  {"Accept":"${ACCEPT}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    ${scopeValue}=    Create Dictionary    scope=${OPOCCS_NOT_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}    ${body}=    Get File    jsons/NsLcmInfoModificationRequest.json
    ${body}=        Format String   ${body}     scheduledTime=${schedule_for_new_operation_start}
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_lcm_op_occs/${nsLcmOpOccId_scheduledOp_notStarted}    ${body}	 	
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}


PATCH Individual NS LCM OP Occurrence of Already Started Scheduled Operation 
    log    Trying to perform a PATCH.
    Set Headers  {"Accept":"${ACCEPT}"}
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ ${UPDATE_PERMITTED_SCOPE} nslcm:v2:update
${HEAL_PERMITTED_SCOPE}    nslcm:v2:heal
${TERMINATE_PERMITTED_SCOPE}    nslcm:v2:tearminate
${OPOCCS_PERMITTED_SCOPE}    nslcm:v2:op_occs
${OPOCCS_NOT_PERMITTED_SCOPE}    nslcm:v2:op_occs:readonly

${NOT_PERMITTED_SCOPE}    nslcm:v2:invalid