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

added oauth scope tests for change nfv mano entity state task

parent 8d8a7493
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -81,3 +81,31 @@ DELETE NFV-MANO functional entity application state change - Method not implemen
    ...    Post-Conditions: none
    Send Delete request for NFV-MANO functional entity application state change
    Check HTTP Response Status Code Is    405

POST NFV-MANO functional entity application state change with permitted authorization scope
    [Documentation]    Test ID: 8.3.1.2.7
    ...    Test title: POST NFV-MANO functional entity application state change with permitted authorization scope
    ...    Test objective: The objective is to test a state change of the NFV-MANO functional entity application with permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: clause 5.5.7.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: entity status changed
    Send Post request for NFV-MANO functional entity application state change with permitted authorization scope
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains Location
    Wait for entity state change success notification and validate status

POST NFV-MANO functional entity application state change with not permitted authorization scope
    [Documentation]    Test ID: 8.3.1.2.8
    ...    Test title: POST NFV-MANO functional entity application state change with not permitted authorization scope
    ...    Test objective: The objective is to test that state change of the NFV-MANO functional entity application fails with not permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: clause 5.5.7.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: entity status changed
    Send Post request for NFV-MANO functional entity application state change with not permitted authorization scope
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains Location
    Wait for entity state change success notification and validate status
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
@@ -108,6 +108,32 @@ Send Post request for NFV-MANO functional entity application state change
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post request for NFV-MANO functional entity application state change with permitted authorization scope
    Log    Trying to perform a POST for NFV-MANO functional entity application state change
    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/change_state
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post request for NFV-MANO functional entity application state change with not permitted authorization scope
    Log    Trying to perform a POST for NFV-MANO functional entity application state change
    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/change_state
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Wait for entity state change success notification and validate status
    Wait Until Keyword Succeeds    ${retry}   ${polling}    Check entity state    
    
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ ${ENTITY_NOT_PERMITTED_SCOPE} nfvpolicy:v2:mano_entity_info:readonly
${PEER_PERMITTED_SCOPE}    nfvpolicy:v2:peer_entity_info
${PEER_NOT_PERMITTED_SCOPE}    nfvpolicy:v2:peer_entity_info:readonly
${SUBSCRIPTIONS_PERMITTED_SCOPE}    nfvpolicy:v2:subscriptions
${CHANGE_STATE_PERMITTED_SCOPE}    nfvpolicy:v2:change_state
${NOT_PERMITTED_SCOPE}    nfvpolicy:v2:policies:invalid

${CONTENT_TYPE_JSON}    application/json