Commit b92c322e authored by Mudassar Khan's avatar Mudassar Khan Committed by Giacomo Bernini
Browse files

implement OAuth scope test for VNFConfiguration API of SOL002

parent 519e60a7
Loading
Loading
Loading
Loading
+54 −3
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ Library JSONSchemaLibrary schemas/
Library    OperatingSystem
Library    String
Library    DependencyLibrary
Library    jwt

*** Test Cases ***
Set new VNF Configuration
@@ -132,8 +133,32 @@ Set new VNF Configuration With Attribute vnfcConfigurationData
    Check HTTP Response Header Contains ETag and Last-Modified
    Check HTTP Response Body Json Schema Is   vnfConfigModifications
    Check Postcondition VNF Is Configured


Get information about a VNF configuration with permitted authorization scope
    [Tags]    no-etag
    [Documentation]    Test ID: 6.3.1.1.10
    ...    Test title: Get information about a VNF configuration with permitted authorization scope
    ...    Test objective: The objective is to test the retrieval of an existing VNF instance configuration and perform a JSON schema validation of the collected configuration data structure
    ...    Pre-conditions: A VNF instance is instantiated. The VNF instance is already configured.
    ...    Reference: Clause 9.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v4.5.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: none
    ...    Post-Conditions: none
    Get VNF configuration with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfConfiguration
Get information about a VNF configuration with NOT permitted authorization scope
    [Tags]    no-etag
    [Documentation]    Test ID: 6.3.1.1.11
    ...    Test title: Get information about a VNF configuration with not permitted authorization scope
    ...    Test objective: The objective is to test the retrieval of an existing VNF instance configuration and perform a JSON schema validation of the collected configuration data structure
    ...    Pre-conditions: A VNF instance is instantiated. The VNF instance is already configured.
    ...    Reference: Clause 9.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v4.5.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: none
    ...    Post-Conditions: none
    Get VNF configuration with not permitted authorization scope
    Check HTTP Response Status Code Is    403
    Check HTTP Response Body Json Schema Is   ProblemDetails
*** Keywords ***    
Get VNF configuration
    Log    Query VNF The GET method queries information about a configuration.
@@ -248,3 +273,29 @@ Check HTTP Response Header Contains
    Log    ${response['headers']}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
    Log    Header is present
JWT Encode
    [Arguments]    ${payload}    ${key}    ${algorithm}
    ${encoded}=    Evaluate    jwt.encode(${payload}, ${key}, ${algorithm})
    [Return]    ${encoded}
Get VNF configuration with permitted authorization scope
    Log    Query VNF The GET method queries information about a configuration.
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${scope_value}=    Create Dictionary    scopeValue=${CONFIGURATION_SCOPE}
    ${Authorization_Key}=    JWT Encode    payload=${scope_value}    key=''    algorithm=${OAUTH_Encryption_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${Authorization_Key}"}
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/configuration
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
Get VNF configuration with not permitted authorization scope
    Log    Query VNF The GET method queries information about a configuration.
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${scope_value}=    Create Dictionary    scopeValue=${NEG_SCOPE}
    ${Authorization_Key}=    JWT Encode    payload=${scope_value}    key=''    algorithm=${OAUTH_Encryption_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${Authorization_Key}"}
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/configuration
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@ ${ACCEPT} application/json
${AUTH_USAGE}     1
${AUTHORIZATION_HEADER}    Authorization
${AUTHORIZATION_TOKEN}    Bearer 0b79bab50daca910b000d4f1a2b675d604257e42
${NEG_SCOPE}    configuration:v1:invalid
${CONFIGURATION_SCOPE}    configuration:v1:invalid
${OAUTH_Encryption_ALGORITHM}   HS256

${CONTENT_TYPE}    application/json