Commit 45096e43 authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

Merge branch 'master' into 'master'

Master

See merge request !4
parents 5a5aba54 cb446db5
Loading
Loading
Loading
Loading
+127 −81
Original line number Diff line number Diff line
@@ -6,77 +6,106 @@ Library JSONSchemaLibrary schemas/
Library    OperatingSystem
Library    DependencyLibrary

*** Variables ***
${response}=    httpresponse

*** Test Cases ***
POST Configuration - Method not implemented
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/${apiVersion}/configuration
    Log    Validate Status code
    Integer    response status    405

Get information about a configuration
    [Documentation]    Test ID: 9.4.2.2
    ...    Test title: Get information about a configuration
    ...    Test objective: The objective is to test the retrieval of an existing VNF instance configuration
    ...    Pre-conditions: A VNF instance is up and running. The VNF instance is already configured (Test ID: 9.4.2.1)
    ...    Reference: section 9.4.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: The VNF supports the generation of HTTP Etag opaque identifiers
    ...    Post-Conditions: The VNF configuration is not modified by the operation
    Get VNF configuration
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Contains    Etag
    Check HTTP Response Body Json Schema Is   vnfConfiguration
    Check Postcondition VNF Configuration Untouched

PUT Config - Method not implemented
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/${apiVersion}/configuration
    Log    Validate Status code
    Integer    response status    405

Set new VNF Configuration
    [Documentation]    Test ID: 9.4.2.1
    [Documentation]    Test ID: 6.3.1
    ...    Test title: Set a new VNF Configuration
    ...    Test objective: The objective is to test the creation of a new VNF configuration
    ...    Pre-conditions: A VNF instance is up and running
    ...    Reference: section 9.4.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation of HTTP Etag opaque identifiers
    ...    Post-Conditions: The VNF configuration is set
    Send VNF configuration
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Contains    Etag
    Check HTTP Response Body Json Schema Is   vnfConfiModifications
    Check HTTP Response Body Json Schema Is   vnfConfigModifications.schema.json
    Check Postcondition VNF Is Configured

Get information about a VNF configuration
    [Tags]    no-etag
    [Documentation]    Test ID: 6.3.2
    ...    Test title: Get information about a VNF configuration
    ...    Test objective: The objective is to test the retrieval of an existing VNF instance configuration
    ...    Pre-conditions: A VNF instance is up and running. The VNF instance is already configured (Test ID 6.3.1)
    ...    Reference: section 9.4.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: none
    ...    Post-Conditions: The VNF configuration is not modified by the operation
    Get VNF configuration
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfConfiguration.schema.json
    Check Postcondition VNF Configuration Untouched (Implicit)

Get information about a VNF configuration - with HTTP Etag
    [Tags]    etag
    [Documentation]    Test ID: 6.3.3
    ...    Test title: Get information about a VNF configuration with HTTP Etag
    ...    Test objective: The objective is to test the retrieval of an existing VNF instance configuration with usage of HTTP Etag
    ...    Pre-conditions: A VNF instance is up and running. The VNF instance is already configured (Test ID 6.3.1)
    ...    Reference: section 9.4.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation of HTTP Etag opaque identifiers
    ...    Post-Conditions: The VNF configuration is not modified by the operation
    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 Postcondition VNF Configuration Untouched (Implicit)

Set new VNF Configuration - HTTP Etag precondition failed
    [Documentation]    Test ID: 9.4.2.3
    [Tags]    etag
    [Documentation]    Test ID: 6.3.4
    ...    Test title: Set a new VNF Configuration - HTTP Etag precondition failed
    ...    Test objective: The objective is to test the failure in setting a duplication of VNF configuration identified by an already used HTTP Etag identifier.
    ...    Pre-conditions: A VNF instance is up and running. The VNF instance is already configured (Test ID: 9.4.2.1) with a given HTTP Etag identifier.
    ...    Pre-conditions: A VNF instance is up and running. The VNF instance is already configured (Test ID 6.3.1) with a given HTTP Etag identifier.
    ...    Reference: section 9.4.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation of HTTP Etag opaque identifiers
    ...    Post-Conditions:  The VNF configuration is not modified by the operation
    Send Duplicated VNF configuration
    Check HTTP Response Status Code Is    412
    Check HTTP Response Body Json Schema Is   ProblemDetails
    Check Postcondition VNF Configuration Untouched
    Check Postcondition VNF Configuration Untouched (Implicit)

DELETE Config - Method not implemented
    log    Trying to perform a DELETE. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/configuration
    Log    Validate Status code
    Integer    response status    405
POST VNF Configuration - Method not implemented
    [Documentation]    Test ID: 6.3.5
    ...    Test title: POST VNF Configuration - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create a new VNF configuration
    ...    Pre-conditions: A VNF instance is up and running. The VNF instance is already configured (Test ID 6.3.1)
    ...    Reference: section 9.4.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: none
    ...    Post-Conditions: The VNF configuration is not modified by the operation
    Send POST Request for VNF Configuration
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Configuration Untouched (Implicit)    

PUT VNF Configuration - Method not implemented
    [Documentation]    Test ID: 6.3.6
    ...    Test title: PUT VNF Configuration - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to modify an existing VNF configuration
    ...    Pre-conditions: A VNF instance is up and running. The VNF instance is already configured (Test ID 6.3.1)
    ...    Reference: section 9.4.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: none
    ...    Post-Conditions: The VNF configuration is not modified by the operation
    Send PUT Request for VNF Configuration
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Configuration Untouched (Implicit)   

DELETE VNF Configuration - Method not implemented
    [Documentation]    Test ID: 6.3.7
    ...    Test title: Delete VNF Configuration - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to delete an existing VNF configuration
    ...    Pre-conditions: A VNF instance is up and running. The VNF instance is already configured (Test ID 6.3.1)
    ...    Reference: section 9.4.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: none
    ...    Post-Conditions: The VNF configuration is not modified by the operation
    Send DELETE Request for VNF Configuration
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Configuration Untouched (Implicit)
    
*** Keywords ***    
Get VNF configuration
@@ -85,57 +114,48 @@ Get VNF configuration
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Log    Execute Query and validate response
    ${response}=    Get    ${apiRoot}/${apiName}/${apiVersion}/configuration
    Get    ${apiRoot}/${apiName}/${apiVersion}/configuration
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Send VNF configuration
    log    Trying to perform a PATCH. This method modifies the configuration    
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    json/vnfConfigModifications.json
    ${response}=    Patch    ${apiRoot}/${apiName}/${apiVersion}/configuration    ${body}

PATCH Config - Precondition failed
    [Documentation]    Precondition Failed
    ...    Precondition Failed A precondition given in an HTTP request header is not fulfilled. 
    ...    Typically, this is due to an ETag mismatch, indicating that the resource was modified by another entity. 
    ...    The response body should contain a ProblemDetails structure, in which the �detail� attribute should convey more information about the error.
    Depends On Test    PATCH Alarm    # If the previous test scceeded, it means that Etag has been modified
    log    Trying to perform a PATCH. This method modifies an individual alarm resource  
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"} 
    Set Headers    {"If-Match": "${Etag}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    json/vnfConfigModifications.json
    ${response}=    Patch    ${apiRoot}/${apiName}/${apiVersion}/configuration    ${body}
    ${body}=    Get File    jsons/vnfConfigModifications.json
    Patch    ${apiRoot}/${apiName}/${apiVersion}/configuration    ${body}
    ${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 Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response.headers}    ${CONTENT_TYPE}
    Log    ${response[0]['headers']}
    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}
    Validate Json    ${schema}    ${response.body}
    Should Contain    ${response[0]['headers']['Content-Type']}    ${CONTENT_TYPE}
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK
      
Check Postcondition VNF Configuration Untouched
    Log    Check Postcondition for GET
    #todo
Check Postcondition VNF Configuration Untouched (Implicit)
    Log    Check Implicit Postcondition
    Check Postcondition VNF Is Configured
    
Check Postcondition VNF Is Configured
    Log    Check Postcondition for PATCH
    Log    Check Postcondition for VNF Configuration
    Get VNF configuration
    ${output}=    evaluate    json.loads('''${response.body}''')    json
    ${input}=    Get File    json/vnfConfigModifications.json
    Should Be Equal  ${output}    ${input}   
    ${input_file}=    Get File    jsons/vnfConfigModifications.json
    ${input}=    evaluate    json.loads('''${input_file}''')    json
    Should Be Equal  ${response[0]['body']}    ${input} 

Send Duplicated VNF configuration
    Depends On Test    PATCH Alarm    # If the previous test scceeded, it means that Etag has been modified
@@ -144,5 +164,31 @@ Send Duplicated VNF configuration
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers    {"If-Match": "${Etag}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    json/vnfConfigModifications.json
    ${response}=    Patch    ${apiRoot}/${apiName}/${apiVersion}/configuration    ${body}
    ${body}=    Get File    jsons/vnfConfigModifications.json
    Patch    ${apiRoot}/${apiName}/${apiVersion}/configuration    ${body}
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Send POST Request for VNF Configuration
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/${apiVersion}/configuration
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
Send PUT Request for VNF Configuration
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/${apiVersion}/configuration
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
Send DELETE Request for VNF Configuration
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/configuration
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
 No newline at end of file
+2 −23
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

${Etag}=    an etag
${Etag_modified}=    12345
${response}=    httpresponse
@{response}=    httpresponse

${EM-VNF_HOST}      localhost    # Hostname of the NFVO
${EM-VNF_PORT}      8081    # Listening port of the NFVO
@@ -20,25 +20,4 @@ ${alarm_filter} managedObjectId
${managedObjectId}    007c111c-38a1-42c0-a666-7475ecb1567c
${invalid_alarm_filter}    badFilter
${alarmId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${vnfInstanceDescription}    description vnf
${vnfInstanceDescription_Update}    Updated description vnf
${SINGLE_FILE_VNFD}    1    # If VNFD is PLAIN TEXT
${ACCEPT_PLAIN}    text/plain
${ACCEPT_ZIP}     application/zip
${vnfPkgId_processing}    007c111c-38a1-42c0-a666-7475ecb1567c
${ARTIFACT_TYPE}    application/octet-stream
${ARTIFACT_ID}    artifactId
${WRONG_ACCEPT}    application/json
${vnfLcmOpOccId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${CancelMode}    GRACEFUL
${LccnSubscriptionRequest}    {}
${NVFM_DUPLICATION}    0
${sub_filter}    filter
${sub_filter_invalid}    filter_invalid
${subscriptionId}    6fc3539c-e602-4afa-8e13-962fb5a7d81f
${notification_ep}    /notification
${notification_port}    9091
${AlarmNotification}    {}
${AlarmClearedNotification}    {}
${AlarmListRebuiltNotification}    {}
${PerceivedSeverity}    CRITICAL
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ DELETE Subscription - Negative (Not Found)
    Log    The subscriptionId is not present in database
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    application/json
    ${problemDetails}=    Output
    ${problemDetails}=    Output    response body
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ POST Subscription
    Log    Trying to create a new subscription
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${body}=    Get File    json/subscriptions.json
    ${body}=    Get File    jsons/subscriptions.json
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    POST    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}
    Integer    response status    201
+216 −103

File changed.

Preview size limit exceeded, changes collapsed.

Loading