Commit 2749be02 authored by Elian Kraja's avatar Elian Kraja
Browse files

Adding tests for exclude_fields and exclude_default where requested

parent 132daa1a
Loading
Loading
Loading
Loading
+59 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,18 @@ GET all Packages
    ${json}=    evaluate    json.loads('''${result}''')    json
    ${json}=    evaluate    json.loads('''${result}''')    json
    Validate Json    vnfPkgInfo.schema.json    ${json}
    Validate Json    vnfPkgInfo.schema.json    ${json}
    Log    Validation OK
    Log    Validation OK
    Log    Checking missing information for softwareImages element
    ${softwareImages}=    Get Value From Json    ${json}    $..softwareImages
    Should Be Empty    ${softwareImages}
    Log    softwareImages element is missing as excepted
    Log    Checking missing information for additionalArtifact element
    ${additional_artifacts}=    Get Value From Json    ${json}    $..additionalArtifacts
    Should Be Empty    ${additional_artifacts}
    Log    additionalArtifact element is missing as excepted
    Log    Checking missing information for _links element
    ${links}=    Get Value From Json    ${json}    $.._links
    Should Be Empty    ${links}
    Log    _links element is missing as excepted


GET all Packages - Filter
GET all Packages - Filter
    Log    Trying to get all VNF Packages present in the NFVO Catalogue, using filter params
    Log    Trying to get all VNF Packages present in the NFVO Catalogue, using filter params
@@ -105,8 +117,35 @@ GET all Packages - all_fields
    Validate Json    links.schema.json    ${links[0]}
    Validate Json    links.schema.json    ${links[0]}
    Log    Validation for _links schema OK
    Log    Validation for _links schema OK


GET all Packages - exclude_default
    Log    Trying to get all VNF Packages present in the NFVO Catalogue, using exclude_default filter.
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages?exclude_default
    Integer    response status    200
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE_JSON}
    ${vnfPkgInfos}=    Output    response body
    ${json}=    evaluate    json.loads('''${vnfPkgInfos}''')    json
    Log    Trying to validate response
    Validate Json    vnfPkgInfo.schema.json    ${json}
    Log    Validation OK
    Log    Checking missing information for softwareImages element
    ${softwareImages}=    Get Value From Json    ${json}    $..softwareImages
    Should Be Empty    ${softwareImages}
    Log    softwareImages element is missing as excepted
    Log    Checking missing information for additionalArtifact element
    ${additional_artifacts}=    Get Value From Json    ${json}    $..additionalArtifacts
    Should Be Empty    ${additional_artifacts}
    Log    additionalArtifact element is missing as excepted
    Log    Checking missing information for _links element
    ${links}=    Get Value From Json    ${json}    $.._links
    Should Be Empty    ${links}
    Log    _links element is missing as excepted

GET all Packages - fields
GET all Packages - fields
    Log    Trying to get all VNF Packages present in the NFVO Catalogue, using filter params
    Log    Trying to get all VNF Packages present in the NFVO Catalogue, using filter params
    Pass Execution If    ${NFVO_FIELDS} == 0    The NFVO is not able to use fields parameter
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages?fields=${fields}
    GET    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages?fields=${fields}
@@ -127,6 +166,26 @@ GET all Packages - fields
    Validate Json    additionalArtifacts.schema.json    ${additional_artifacts[0]}
    Validate Json    additionalArtifacts.schema.json    ${additional_artifacts[0]}
    Log    Validation for additionalArtifacts schema OK
    Log    Validation for additionalArtifacts schema OK


GET all Packages - exclude_fields
    Log    Trying to get all VNF Packages present in the NFVO Catalogue, using filter params
    Pass Execution If    ${NFVO_FIELDS} == 0    The NFVO is not able to use exclude_fields option
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/vnf_packages?exlude_fields=${fields}
    Integer    response status    200
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE_JSON}
    ${vnfPkgInfos}=    Output    response body
    ${json}=    evaluate    json.loads('''${vnfPkgInfos}''')    json
    Log    Checking missing information for softwareImages element
    ${softwareImages}=    Get Value From Json    ${json}    $..softwareImages
    Should Be Empty    ${softwareImages}
    Log    softwareImages element is missing as excepted
    Log    Checking missing information for additionalArtifact element
    ${additional_artifacts}=    Get Value From Json    ${json}    $..additionalArtifacts
    Should Be Empty    ${additional_artifacts}
    Log    additionalArtifact element is missing as excepted

GET all PACKAGE (Negative: Not found)
GET all PACKAGE (Negative: Not found)
    Log    Trying to perform a GET on a erroneous URI
    Log    Trying to perform a GET on a erroneous URI
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
+1 −0
Original line number Original line Diff line number Diff line
@@ -15,3 +15,4 @@ ${apiVersion} v1
${apiName}        vnfpkgm
${apiName}        vnfpkgm
${FIELD_USAGE}    1
${FIELD_USAGE}    1
${NFVO_PLAIN}     1
${NFVO_PLAIN}     1
${NFVO_FIELDS}    1
+46 −1
Original line number Original line Diff line number Diff line
@@ -20,6 +20,10 @@ GET all Pm Jobs
    ${json}=    evaluate    json.loads('''${result}''')    json
    ${json}=    evaluate    json.loads('''${result}''')    json
    Validate Json    PmJob.schema.json    ${json}
    Validate Json    PmJob.schema.json    ${json}
    Log    Validation OK
    Log    Validation OK
    Log    Checking that reports element is missing
    ${reports}=    Get Value From Json    ${json}    $..reports
    Should Be Empty    ${reports}
    Log    Reports element is empty as expected


GET all Pm Jobs - Filter
GET all Pm Jobs - Filter
    Log    Trying to get all PM Jobs present in the VNFM, using filter params
    Log    Trying to get all PM Jobs present in the VNFM, using filter params
@@ -61,9 +65,27 @@ GET all Pm Jobs - all_fields
    Validate Json    links.schema.json    ${links[0]}
    Validate Json    links.schema.json    ${links[0]}
    Log    Validation for _links schema OK
    Log    Validation for _links schema OK


GET all Pm Jobs - exclude_default
    Log    Trying to get all VNF Packages present in the VNFM, using filter params
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${VNFM_AUTH_USAGE} == 1    Set Headers    {"Authorization": "${VNFM_AUTHENTICATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?exclude_default
    Integer    response status    200
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE_JSON}
    Log    Trying to validate response
    ${result}=    Output    response body
    ${json}=    evaluate    json.loads('''${result}''')    json
    Validate Json    PmJob.schema.json    ${json}
    Log    Validation OK
    Log    Checking that reports element is missing
    ${reports}=    Get Value From Json    ${json}    $..reports
    Should Be Empty    ${reports}
    Log    Reports element is empty as expected

GET all Pm Jobs - fields
GET all Pm Jobs - fields
    Log    Trying to get all VNF Packages present in the VNFM, using filter params
    Log    Trying to get all VNF Packages present in the VNFM, using filter params
    Pass Execution If    ${VNFM_AUTH_USAGE} == 0    Skipping test as VNFM is not supporting 'fields'
    Pass Execution If    ${FIELDS_USAGE} == 0    Skipping test as VNFM is not supporting 'fields'
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${VNFM_AUTH_USAGE} == 1    Set Headers    {"Authorization": "${VNFM_AUTHENTICATION}"}
    Run Keyword If    ${VNFM_AUTH_USAGE} == 1    Set Headers    {"Authorization": "${VNFM_AUTHENTICATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?fields=${fields}
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?fields=${fields}
@@ -84,6 +106,29 @@ GET all Pm Jobs - fields
    Validate Json    reports.schema.json    ${reports[0]}
    Validate Json    reports.schema.json    ${reports[0]}
    Log    Validation for reports schema OK
    Log    Validation for reports schema OK


GET all Pm Jobs - exclude_fields
    Log    Trying to get all VNF Packages present in the VNFM, using filter params
    Pass Execution If    ${FIELDS_USAGE} == 0    Skipping test as VNFM is not supporting 'fields'
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${VNFM_AUTH_USAGE} == 1    Set Headers    {"Authorization": "${VNFM_AUTHENTICATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?fields=${fields}
    Integer    response status    200
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE_JSON}
    Log    Trying to validate response
    ${result}=    Output    response body
    ${json}=    evaluate    json.loads('''${result}''')    json
    Validate Json    PmJob.schema.json    ${json}
    Log    Validation OK
    Log    Checking that reports element is missing
    ${reports}=    Get Value From Json    ${json}    $..reports
    Should Be Empty    ${reports}
    Log    Reports element is empty as expected
    Log    Checking that criteria element is missing
    ${criteria}=    Get Value From Json    ${json}    $..criteria
    Should Be Empty    ${criteria}
    Log    Criteria element is empty as expected

GET all Pm Jobs - Negative (wronge filter name)
GET all Pm Jobs - Negative (wronge filter name)
    Log    Trying to get all PM Jobs present in the VNFM, using an erroneous filter param
    Log    Trying to get all PM Jobs present in the VNFM, using an erroneous filter param
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}