Commit 634e51c2 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for change interface state task

parent 93e3627b
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -82,3 +82,29 @@ DELETE Change interface state task - Conflict - Method not implemented
    ...    Post-Conditions: none
    Send Delete request for Change interface state task
    Check HTTP Response Status Code Is    405

POST Change interface state task with permitted authorization scope
    [Documentation]    Test ID: 8.3.1.7.7
    ...    Test title: POST Change interface state task with permitted authorization scope
    ...    Test objective: The objective is send put request to change the state of the NFV-MANO service interface with permitted authorization scope
    ...    Pre-conditions: none
    ...    Reference: clause 5.5.12.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: interface status changed
    Send Post request for Change interface state task with permitted authorization scope
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains Location
    Check PostCondition NFV-MANO service interface state matches the requested state

POST Change interface state task with not permitted authorization scope
    [Documentation]    Test ID: 8.3.1.7.8
    ...    Test title: POST Change interface state task with permitted authorization scope
    ...    Test objective: The objective is to verify that put request to change the state of the NFV-MANO service interface fails with not permitted authorization scope
    ...    Pre-conditions: none
    ...    Reference: clause 5.5.12.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: interface status changed
    Send Post request for Change interface state task with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
@@ -580,6 +580,32 @@ Send Post request for Change interface state task
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post request for Change interface state task with permitted authorization scope
    Log    Trying to perform a POST for Change interface state task
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${CHANGE_STATE_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Log    Authorization Token: ${authorizationToken}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    ${template}=    Get File    jsons/ChangeStateRequest.json
    ${body}=        Format String   ${template}    state=${state}     stateAction=${stateAction}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/mano_entity/mano_interfaces/${manoServiceInterfaceId}/change_state    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post request for Change interface state task with not permitted authorization scope
    Log    Trying to perform a POST for Change interface state task
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${NOT_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Log    Authorization Token: ${authorizationToken}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"} 
    ${template}=    Get File    jsons/ChangeStateRequest.json
    ${body}=        Format String   ${template}    state=${state}     stateAction=${stateAction}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/mano_entity/mano_interfaces/${manoServiceInterfaceId}/change_state    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Check PostCondition NFV-MANO service interface state matches the requested state
    Wait Until Keyword Succeeds    ${retry}   ${polling}    Check interface state