Commit 103f4249 authored by Sana Zulfiqar's avatar Sana Zulfiqar Committed by Giacomo Bernini
Browse files

new test added for Individual NSD Archive Artifact

parent 5cab4234
Loading
Loading
Loading
Loading
+172 −0
Original line number Diff line number Diff line
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Resource          environment/variables.txt    # Generic Parameters
Resource          NSDManagementKeywords.robot
Library           JSONLibrary
Library           REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}    ssl_verify=false
Library           OperatingSystem

*** Test Cases ***
GET Individual NSD Archive Artifact
    [Documentation]    Test ID: 5.3.1.16.1
    ...    Test title: GET Individual NSD Archive Artifact
    ...    Test objective: The objective is to test the retrieval of an individual NSD Archive artifact
    ...    Pre-conditions: One or more NSD archives are on-boarded to the NFVO.
    ...    Reference: Clause 5.4.4c.3.2 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Individual NSD Archive Artifact
    Check HTTP Response Status Code Is    200
    
GET Individual NSD Archive Artifact with include_signatures parameter
    [Documentation]    Test ID: 5.3.1.16.2
    ...    Test title: GET Individual NSD Archive Artifact with include_signatures parameter
    ...    Test objective: The objective is to test that the GET request read the whole content of the archive containing the artifact files successfully and also contain security certificates when requested with "include_signature" parameter, and perform a validation that returned content is in Zip format
    ...    Pre-conditions: One or more NSD archives are on-boarded to the NFVO.
    ...    Reference: Clause 5.4.4c.3.2 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    GET Individual NSD Archive Artifact with include_signatures parameter
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Content-Type Is    application/zip
    
GET Individual NSD Archive Artifact in octet stream format
    [Documentation]    Test ID: 5.3.1.16.3
    ...    Test title: GET Individual NSD Archive Artifact in octet stream format
    ...    Test objective: The objective is to test the retrieval of an individual NSD Archive artifact when the NFVO cannot determine the artifact content type. The test performs a validation that the returned artifcat in is octet-stream format. 
    ...    Pre-conditions: One or more NSD archives are on-boarded to the NFVO.
    ...    Reference: Clause 5.4.4c.3.2 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: The NFVO cannot determine the content type of the artifact
    ...    Post-Conditions: none
    GET Individual NSD Archive Artifact in octet stream format
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Content-Type Is    application/octet-stream

GET Individual NSD Archive Artifact with Range Request and NFVO supporting Range Requests
    [Documentation]    Test ID: 5.3.1.16.4
    ...    Test title: GET Individual NSD Archive Artifact with Range Request and NFVO supporting Range Requests
    ...    Test objective: The objective is to test the retrieval of an individual NSD Archive artifact when using a range request to return single range of bytes from the file, with the NFVO supporting it. The test also perform a validation that returned content matches the issued range
    ...    Pre-conditions: One or more NSD archives are on-boarded to the NFVO.
    ...    Reference: Clause 5.4.4c.3.2 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: The NFVO supports range requests to return single range of bytes from the NSD Archive artifact
    ...    Post-Conditions: none
    GET Individual NSD Archive Artifact with Range Request
    Check HTTP Response Status Code Is    206
    Check HTTP Response Header Content-Range Is Present and Matches the requested range
    Check HTTP Response Header Content-Length Is Present and Matches the requested range length
    
GET Individual NSD Archive Artifact with Range Request and NFVO not supporting Range Requests
    [Documentation]    Test ID: 5.3.1.16.5
    ...    Test title: GET Individual NSD Archive Artifact with Range Request and NFVO not supporting Range Requests
    ...    Test objective: The objective is to test that the retrieval of an individual NSD archive artifact, when using a range request to return single range of bytes from the file and the NFVO not supporting it, returns the full NSD Archive artifact.
    ...    Pre-conditions: One or more NSD archives are on-boarded to the NFVO.
    ...    Reference: Clause 5.4.4c.3.2 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: The NFVO does not support range requests to return single range of bytes from the NSD Archive artifact
    ...    Post-Conditions: none    
    GET Individual NSD Archive Artifact with Range Request
    Check HTTP Response Status Code Is    200
    
GET Individual NSD Archive Artifact with invalid resource identifier
    [Documentation]    Test ID: 5.3.1.16.6
    ...    Test title: GET Individual NSD Archive Artifact with invalid resource identifier
    ...    Test objective: The objective is to test that the retrieval of an individual NSD Archive Artifact fails when using an invalid resource identifier
    ...    Pre-conditions: One or more NSD archives are on-boarded to the NFVO.
    ...    Reference: Clause 5.4.4c.3.2 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none    
    GET Individual NSD Archive Artifact with invalid resource identifier
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails
    
GET Individual NSD Archive Artifact - Not Acceptable
    [Documentation]    Test ID: 5.3.1.16.7
    ...    Test title: GET Individual NSD Archive Artifact - Not Acceptable
    ...    Test objective: The objective is to test that the retrieval of an individual NSD Archive artifact fails when related request contained an "Accept" header not compatible with the Content type "application/zip" but the "include_signatures" flag was provided
    ...    Pre-conditions: One or more NSD archives are on-boarded to the NFVO.
    ...    Reference: Clause 5.4.4c.3.2 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none      
    GET Individual NSD Archive Artifact with incompatable header
    Check HTTP Response Status Code Is    406
    Check HTTP Response Body Json Schema Is   ProblemDetails

GET Individual NSD Archive Artifact with conflict due to onboarding state
    [Documentation]    Test ID: 5.3.1.16.8
    ...    GET Individual NSD Archive Artifact with conflict due to onboarding state
    ...    Test objective: The objective is to test that the retrieval of an individual NSD Archive Artifact fails due to a conflict when the NSD is not in onboarding state ONBOARDED in the NFVO. The test also performs a validation of the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: The onboarding state of the NSD archive for which the content is requested is different from ONBOARDED.
    ...    Reference: Clause 5.4.4c.3.2 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none   
    GET Individual NSD Archive Artifact in onboarding state different from ONBOARDED
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is   ProblemDetails
    
GET Individual NSD Archive Artifact with invalid Range Request
    [Documentation]    Test ID: 5.3.1.16.9
    ...    Test title: GET Individual NSD Archive Artifact with invalid Range Request
    ...    Test objective: The objective is to test that the retrieval of an Individual NSD Archive fails when using a range request that does not match any available byte range in the file.
    ...    Pre-conditions: One or more NSD Archives are on-boarded to the NFVO.
    ...    Reference: Clause 5.4.4c.3.2 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: The NFVO supports range requests to return single range of bytes from the NSD Archive artifact
    ...    Post-Conditions: none      
    GET Individual NSD Archive Artifact with invalid Range Request
    Check HTTP Response Status Code Is    416

POST Individual NSD Archive Artifact - Method not implemented
    [Documentation]    Test ID: 5.3.1.16.10
    ...    Test title: POST Individual NSD Archive Artifact - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create an individual artifact contained in an NSD archive.
    ...    Pre-conditions: none
    ...    Reference: Clause 5.4.4c.3.1 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send POST Request for NSD archive Artifact
    Check HTTP Response Status Code Is    405
    
PUT Individual NSD Archive Artifact - Method not implemented
    [Documentation]    Test ID: 5.3.1.16.11
    ...    Test title: PUT Individual NSD Archive Artifact - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to modify an Individual NSD Archive artifact
    ...    Pre-conditions: none
    ...    Reference: Clause 5.4.4c.3.3 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send PUT Request for Individual NSD Archive Artifact
    Check HTTP Response Status Code Is    405

PATCH Individual NSD Archive Artifact - Method not implemented
    [Documentation]    Test ID: 5.3.1.16.12
    ...    Test title: PATCH Individual NSD Archive Artifact - Method not implemented
    ...    Test objective: The objective is to test that PATCH  method is not allowed to update an Individual NSD Archive artifact
    ...    Pre-conditions: none
    ...    Reference: Clause 5.4.4c.3.4 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send PATCH Request for Individual NSD Archive Artifact
    Check HTTP Response Status Code Is    405

DELETE Individual NSD Archive Artifact - Method not implemented
    [Documentation]    Test ID: 5.3.1.16.13
    ...    Test title: DELETE Individual NSD Archive Artifact - Method not implemented
    ...    Test objective: The objective is to test that DELETE  method is not allowed to delete an Individual NSD Archive artifact
    ...    Pre-conditions: none
    ...    Reference: Clause 5.4.4c.3.5 - ETSI GS NFV-SOL 005 [3] v3.3.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none
    Send DELETE Request for Individual NSD Archive Artifact
    Check HTTP Response Status Code Is    405
    
 No newline at end of file
+107 −0
Original line number Diff line number Diff line
@@ -1330,6 +1330,113 @@ Send DELETE Request for PNFD Archive Manifest
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send POST Request for NSD archive Artifact
    Pass Execution If    ${testOptionalMethods} == 0    optional methods are not implemented on the FUT. Skipping test.
    Log    Trying to perform a POST. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.POST    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
GET Individual NSD Archive Artifact
    Log    Trying to get a NSD Archive Artifact
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
GET Individual NSD Archive Artifact with include_signatures parameter
    Log    Trying to get NSD Archive Artifact with security certificates
    Set Headers    {"Accept": "${ACCEPT_ZIP}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}/include_signatures
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
GET Individual NSD Archive Artifact in octet stream format
    Log    Trying to get a NSD Archive Artifact
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
GET Individual NSD Archive Artifact with Range Request
    Log    Trying to get an Artifact using RANGE Header and using an NFVO that can handle it
    Pass Execution If    ${NFVO_RANGE_OK} == 0    Skipping this test as NFVO is not able to handle partial Requests.
    Set Headers    {"Range": "${range}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Check HTTP Response Header Content-Range Is Present and Matches the requested range
    Log    Check Content-Range HTTP Header
    Should Contain    ${response['headers']}    Content-Range
    Should Be Equal As Strings    ${response['headers']['Content-Range']}    ${range}/${full_lenght}
    Log    Header Content-Range is present
    
Check HTTP Response Header Content-Length Is Present and Matches the requested range length
    Log    Check Content-Length HTTP Header
    Should Contain    ${response['headers']}    Content-Length
    Should Be Equal As Integers    ${response['headers']['Content-Length']}    ${full_lenght}
    Log    Header Content-Length is present
    
GET Individual NSD Archive Artifact with invalid resource identifier
    Log    Trying to perform a negative get, using an erroneous NSD ID
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${erroneous_nsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
GET Individual NSD Archive Artifact with incompatable header
    Log    Trying to get a NSD Archive Artifact
    Set Headers    {"Accept": "${ACCEPT_PLAIN}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}/include_signatures
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

GET Individual NSD Archive Artifact in onboarding state different from ONBOARDED
    Log    Trying to get a NSD Archive artifact present in the NFVO Catalogue, but not in ONBOARDED nsdOnboardingState
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${onboardingStateNsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
GET Individual NSD Archive Artifact with invalid Range Request
    Log    Trying to get a range of bytes of the limit of the NSD Archive
    Pass Execution If    ${NFVO_RANGE_OK} == 0    Skipping this test as NFVO is not able to handle partial Requests.
    Set Headers    {"Accept": "${ACCEPT_ZIP}"}
    Set Headers    {"Range": "${erroneousRange}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send PUT Request for Individual NSD Archive Artifact
    Pass Execution If    ${testOptionalMethods} == 0    optional methods are not implemented on the FUT. Skipping test.
    Log    Trying to perform a PUT. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.PUT    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send PATCH Request for Individual NSD Archive Artifact
    Pass Execution If    ${testOptionalMethods} == 0    optional methods are not implemented on the FUT. Skipping test.
    Log    Trying to perform a Patch. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send DELETE Request for Individual NSD Archive Artifact
    Pass Execution If    ${testOptionalMethods} == 0    optional methods are not implemented on the FUT. Skipping test.
    Log    Trying to perform a DELETE. This method should not be implemented
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    REST.DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/ns_descriptors/${nsdInfoId}/artifacts/${artifactPath}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Check HTTP Response Body NsInstance content against NS Descriptor
    #${check_descriptors} flag, 1 to check descriptors
    Run Keyword If    ${check_descriptors} == 1    Check Individual NsdInfo Content for NSD
+6 −3
Original line number Diff line number Diff line
@@ -61,9 +61,6 @@ ${ACCEPT_ZIP} application/zip
${ACCEPT_PLAIN}    text/plain
${CONTENT_TYPE_ZIP}    application/zip
${CONTENT_TYPE_PLAIN}    text/plain
${NFVO_RANGE_OK}    1
${range}          bytes=0-1023
${erroneousRange}    bytes=100000-1000000    # Requesting a out of range number of bytes
${onboardingStateNsdInfoId}    b992a851-08b1-45a8-9282-a5f7a7df04a6
${contentZipNsd}    files/nsd.zip
${contentFileNsd}    files/nsd.yml
@@ -77,6 +74,12 @@ ${createdNsdInfoId} f27200b1-1d8b-48c2-9d98-a993b8ab117f
${NSD_NAME}     nsdName=onBoardedNSD
${PNFD_NAME}     pnfdName=onBoardedPNFD
${SEPERATOR}      =
${artifactPath}    artifactPath
${CONTENT_TYPE_OCTET}    application/octet-stream
${NFVO_RANGE_OK}    1    # If 1 means that Range is supported by the NFVO
${range}          bytes=0-1023
${erroneousRange}    bytes=100000-1000000    # Requesting a out of range number of bytes
${full_lenght}        2000 


${pnfdInfoId}    40853bda-8a8f-4f63-9130-cef439f65348