Commit d9c8fea3 authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

Merge branch 'master' into 'master'

New TDs for SOL002

See merge request !10
parents 808bc598 eeeb1e25
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ Set new VNF Configuration
    Send VNF configuration
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Contains    ETag
    Check HTTP Response Body Json Schema Is   vnfConfigModifications.schema.json
    Check HTTP Response Body Json Schema Is   vnfConfigModifications
    Check Postcondition VNF Is Configured

Get information about a VNF configuration
@@ -34,7 +34,7 @@ Get information about a VNF configuration
    ...    Post-Conditions: none
    Get VNF configuration
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfConfiguration.schema.json
    Check HTTP Response Body Json Schema Is   vnfConfiguration

Get information about a VNF configuration with HTTP Etag
    [Tags]    etag
@@ -49,7 +49,7 @@ Get information about a VNF configuration with HTTP Etag
    Get VNF configuration
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Contains    ETag
    Check HTTP Response Body Json Schema Is   vnfConfiguration.schema.json
    Check HTTP Response Body Json Schema Is   vnfConfiguration

Set new VNF Configuration - HTTP Etag precondition unsuccessful
    [Tags]    etag
@@ -138,8 +138,9 @@ Check HTTP Response Header Contains
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    [Arguments]    ${input}
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK
      
+2 −1
Original line number Diff line number Diff line
@@ -171,8 +171,9 @@ Check HTTP Response Header Contains
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    [Arguments]    ${input}
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK

+2 −1
Original line number Diff line number Diff line
@@ -144,8 +144,9 @@ Check HTTP Response Header Contains
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    [Arguments]    ${input}
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK

+2 −1
Original line number Diff line number Diff line
@@ -191,8 +191,9 @@ Check HTTP Response Header Contains
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    [Arguments]    ${input}
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK

+96 −83
Original line number Diff line number Diff line
@@ -8,141 +8,132 @@ Library REST ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT}

*** Test Cases ***
Get all VNF Indicators
    [Documentation]    Test ID 6.4.1
    [Documentation]    Test ID: 6.3.2.1.1
    ...    Test title: Get all VNF Indicators
    ...    Test objective: The objective is to test the retrieval of all the available VNF indicators
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Test objective: The objective is to test the retrieval of all the available VNF indicators and perform a JSON schema validation of the collected indicators data structure
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Get all VNF indicators
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfIndicators
    Check Postcondition VNF Indicators Untouched (Implicit)
    
Get VNF Indicators with attribute-based filter
    [Documentation]    Test ID 6.4.2
    [Documentation]    Test ID: 6.3.2.1.2
    ...    Test title: Get VNF Indicators with attribute-based filter
    ...    Test objective: The objective is to test the retrieval of VNF indicators using attribute-based filter
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Test objective: The objective is to test the retrieval of VNF indicators using attribute-based filter, perform a JSON schema validation of the collected indicators data structure, and verify that the retrieved information matches the issued attribute-based filters 
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Get VNF indicators with filter
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfIndicators
    Check HTTP Response Body Matches Attribute-Based Filter
    Check Postcondition VNF Indicators Untouched (Implicit)

Get all VNF Indicators with invalid attribute-based filter
    [Documentation]    Test ID 6.4.3
    [Documentation]    Test ID: 6.3.2.1.3
    ...    Test title: Get VNF Indicators with invalid attribute-based filter
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails using invalid attribute-based filters
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails using invalid attribute-based filters, and perform the JSON schema validation of the failed operation HTTP response. 
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Get VNF indicators with invalid filter
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails
    Check Postcondition VNF Indicators Untouched (Implicit)

Get all VNF Indicators with invalid authorization token
    [Documentation]    Test ID 6.4.4
    [Documentation]    Test ID: 6.3.2.1.4
    ...    Test title: GET all VNF Indicators One or more measures of VNF performance indicators are available in the VNF.
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails using invalid authorization token
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails using invalid authorization token, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 4.5.3.3, 8.4.2.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Get all VNF indicators with invalid authorization token
    Check HTTP Response Status Code Is    401
    Check HTTP Response Status Code Is 40x
    Check HTTP Response Body Json Schema Is   ProblemDetails
    Check Postcondition VNF Indicators Untouched (Implicit)

Get all VNF Indicators without authorization token
    [Documentation]    Test ID 6.4.5
    [Documentation]    Test ID: 6.3.2.1.5
    ...    Test title: GET all VNF Indicators without authorization bearers
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails by omitting the authorization token
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails by omitting the authorization token, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 4.5.3.3, 8.4.2.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Get all VNF indicators without authorization token
    Check HTTP Response Status Code Is    401
    Check HTTP Response Status Code Is 40x
    Check HTTP Response Body Json Schema Is   ProblemDetails
    Check Postcondition VNF Indicators Untouched (Implicit)

Get all VNF Indicators with invalid resource endpoint
    [Documentation]    Test ID 6.4.6
    [Documentation]    Test ID: 6.3.2.1.6
    ...    Test title: GET all VNF Indicators with invalid resource endpoint
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails when using invalid resource endpoint
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Test objective: The objective is to test that the retrieval of VNF indicators fails when using invalid resource endpoint, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Get all VNF indicators with invalid resource endpoint
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails
    Check Postcondition VNF Indicators Untouched (Implicit)

POST all VNF Indicators - Method not implemented
    [Documentation]    Test ID 6.4.7
    [Documentation]    Test ID: 6.3.2.1.7
    ...    Test title: POST all VNF Indicators - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create new VNF indicators
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF
    ...    Reference: section 8.4.2.3.1 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Send POST Request for all VNF indicators
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Indicators Untouched (Implicit) 

PUT all VNF Indicators - Method not implemented
    [Documentation]    Test ID 6.4.7
    [Documentation]    Test ID: 6.3.2.1.8
    ...    Test title: PUT all VNF Indicators - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to modify VNF indicators
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF
    ...    Reference: section 8.4.2.3.3 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Send PUT Request for all VNF indicators
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Indicators Untouched (Implicit) 

PATCH all VNF Indicators - Method not implemented
     [Documentation]    Test ID 6.4.8
     [Documentation]    Test ID: 6.3.2.1.9
    ...    Test title: POST all VNF Indicators - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to update VNF indicators
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF
    ...    Reference: section 8.4.2.3.4 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Send PATCH Request for all VNF indicators
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Indicators Untouched (Implicit) 

DELETE all VNF Indicators (Method not implemented)
    [Documentation]    Test ID 6.4.9
DELETE all VNF Indicators - Method not implemented
    [Documentation]    Test ID: 6.3.2.1.10
    ...    Test title: POST all VNF Indicators - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to delete VNF indicators
    ...    Pre-conditions: A VNF instance is up and running. One or more measures of VNF performance indicators are available in the VNF.
    ...    Reference: section 8.4.2 - SOL002 v2.4.1
    ...    Pre-conditions: A VNF instance is instantiated. One or more measures of VNF performance indicators are available in the VNF
    ...    Reference: section 8.4.2.3.5 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The VNF indicators are not modified by the operation
    ...    Post-Conditions: none
    Send DELETE Request for all VNF indicators
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Indicators Untouched (Implicit) 
    Check Postcondition VNF Indicators Exist
    
*** Keywords ***
Get all VNF indicators
@@ -150,22 +141,29 @@ Get all VNF indicators
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Log    Execute Query and validate response
    ${response}=    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${vnfIndicators}=    evaluate    json.loads('''${response.body}''')    json
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    ${body}=    evaluate    json.loads('''${response.body}''')    json
    Set Suite Variable    @{vnfIndicators}    ${body}
    
Get VNF indicators with filter
    Log    The GET method queries multiple VNF indicators using Attribute-based filtering parameters
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Log    Execute Query and validate response
    ${response}=    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators?${POS_FIELDS}
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators?${POS_FIELDS}
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Get VNF indicators with invalid filter
    Log    The GET method queries multiple VNF indicators using invalid Attribute-based filtering parameters
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Log    Execute Query and validate response
    ${response}=    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators?${NEG_FIELDS}
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators?${NEG_FIELDS}
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Get all VNF indicators with invalid authorization token
    Pass Execution If    ${AUTH_USAGE} == 0    Skipping test as EM/VNF is not supporting authentication
@@ -173,70 +171,85 @@ Get all VNF indicators with invalid authorization token
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Authorization": "${NEG_AUTHORIZATION}"}
    Log    Execute Query and validate response
    ${response}=    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Get all VNF indicators without authorization token
    Pass Execution If    ${AUTH_USAGE} == 0    Skipping test as EM/VNF is not supporting authentication
    Log    The GET method queries multiple VNF indicators omitting token
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Log    Execute Query and validate response
    ${response}=    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
Get all VNF indicators with invalid resource endpoint
    Log    The GET method queries multiple VNF indicators omitting token
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Log    Execute Query and validate response
    ${response}=    Get    ${apiRoot}/${apiName}/${apiVersion}/indicator
    Get    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Send POST Request for all VNF indicators
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/configuration
    Post    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
Send PUT Request for all VNF indicators
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/configuration
    Post    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
Send PATCH Request for all VNF indicators
    log    Trying to perform a PATCH. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/configuration
    Post    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
Send DELETE Request for all VNF indicators
    log    Trying to perform a DELETE. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${response}=    Post    ${apiRoot}/${apiName}/${apiVersion}/configuration
    Post    ${apiRoot}/${apiName}/${apiVersion}/indicators
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
    Should Be Equal    ${response.status_code}    ${expected_status}
    ${status}=    Convert To Integer    ${expected_status}    
    Should Be Equal    ${response[0]['status']}    ${status} 
    Log    Status code validated
    
Check HTTP Response Status Code Is 40x  
    Should Contain Any    ${response[0]['status']}    401    403
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response.headers}    ${CONTENT_TYPE}
    Should Contain    ${response[0]['headers']}    ${CONTENT_TYPE}
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    ${contentType}=    Get Value From Json    ${response.headers}    $..Content-Type
    Should Be Equal    ${contentType}    ${CONTENT_TYPE_JSON}
    ${json}=    evaluate    json.loads('''${response.body}''')    json
    Validate Json    ${schema}    ${json}
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK

Check Postcondition VNF Indicators Untouched (Implicit)
    Log    Check Implicit Postcondition
    ${input}=    evaluate    json.loads('''${vnfIndicators}''')    json
Check Postcondition VNF Indicators Exist
    Log    Check  Postcondition indicators exist
    Get all VNF indicators
    ${output}=    evaluate    json.loads('''${response.body}''')    json
    Should Be Equal  ${output}    ${input}
    Check HTTP Response Status Code Is    200
    
Check HTTP Response Body Matches Attribute-Based Filter
    Log    Check Response includes VNF Indicators according to filter
Loading