Commit 6fd8948c authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

Merge branch 'master' into 'master'

Master

See merge request !11
parents d9c8fea3 fc175e82
Loading
Loading
Loading
Loading
+173 −41
Original line number Diff line number Diff line
@@ -6,69 +6,201 @@ Resource environment/IndividualPmJob.txt
Library           REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}

*** Test Cases ***
GET Individual PM Job
GET individual VNF Performance Job
    [Documentation]    Test ID: 6.3.3.2.1
    ...    Test title: Get individual VNF Performance Job
    ...    Test objective: The objective is to test the retrieval of an individual VNF performance monitoring job and perform a JSON schema and content validation of the collected job data structure
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
    ...    Reference: section 6.4.3.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET individual VNF Performance Job
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PmJob
    Check HTTP Response Body Pm Job Identifier

GET individual VNF Performance Job with invalid resource identifier
    [Documentation]    Test ID: 6.3.3.2.2
    ...    Test title: Get individual VNF Performance Job with invalid resource identifier
    ...    Test objective: The objective is to test that the retrieval of an individual VNF performance monitoring job fails when using an invalid resource identifier, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
    ...    Reference: section 6.4.3.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET individual VNF Performance Job with invalid resource identifier
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails

DELETE Individual VNF Performance Job
    [Documentation]    Test ID: 6.3.3.2.3
    ...    Test title: Delete Individual VNF Performance Job
    ...    Test objective: The objective is to test the deletion of an individual VNF performance monitoring job
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
    ...    Reference: section 6.4.3.3.5 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Job is no more available in the VNFM    
    Send Delete request for individual VNF Performance Job
    Check HTTP Response Status Code Is    204
    Check Postcondition VNF Pm Job is Deleted

DELETE Individual VNF Performance Job with invalid resource identifier
    [Documentation]    Test ID: 6.3.3.2.4
    ...    Test title: Delete individual VNF Performance Job with invalid resource identifier
    ...    Test objective: The objective is to test that the deletion of an individual VNF performance monitoring job fails when using an invalid resource identifier, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
    ...    Reference: section 6.4.3.3.5 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    Send Delete request for individual VNF Performance Job with invalid resource identifier
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails

POST Individual VNF Performance Job - Method not implemented
    [Documentation]    Test ID: 6.3.3.2.5
    ...    Test title: POST Individual VNF Performance Job - method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create a new VNF Performance Monitoring Job
    ...    Pre-conditions: A VNF instance is instantiated
    ...    Reference: section 6.4.3.3.1 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Job is not created on the VNFM
    Send Post request for individual VNF Performance Job
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Performance Job is not Created

PUT Individual VNF Performance Job - Method not implemented
    [Documentation]    Test ID: 6.3.3.2.6
    ...    Test title: PUT Individual VNF Performance Job - method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to update an existing VNF Performance Monitoring Job
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
    ...    Reference: section 6.4.3.3.4 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Job is not modified by the operation
    Send Put request for individual VNF Performance Job
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Performance Job is Unmodified (Implicit)

PATCH Individual VNF Performance Job - Method not implemented
    [Documentation]    Test ID: 6.3.3.2.7
    ...    Test title: PATCH Individual VNF Performance Job - method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to modify an existing new VNF Performance Monitoring Job
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNFM.
    ...    Reference: section 6.4.3.3.5 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Job is not modified by the operation
    Send Patch request for individual VNF Performance Job
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Performance Job is Unmodified (Implicit)
    
*** Keywords ***
GET individual VNF Performance Job
    Log    Trying to get a Pm Job present in the NFVO Catalogue
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    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
    Validate Json    PmJob.schema.json    ${result}
    Log    Validation OK

GET Individual PM Job - Negative (Not Found)
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

GET individual VNF Performance Job with invalid resource identifier  
    Log    Trying to perform a negative get, using erroneous PM Job identifier
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${erroneousPmJobId}
    Integer    response status    404
    Log    Received 404 Not Found as expected
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    ${problemDetails}=    Output    response body
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK

DELETE Individual PM Job
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Send Delete request for individual VNF Performance Job
    Log    Trying to delete an existing PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    Integer    response status    204
    Log    Received 204 No Content as expected
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
DELETE Individual PM Job - Negative (Not Found)
    Log    Trying to delete an existing PM Job
Send Delete request for individual VNF Performance Job with invalid resource identifier
    Log    Trying to perform a negative delete, using erroneous PM Job identifier
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${erroneousPmJobId}
    Integer    response status    404
    Log    Received 204 No Content as expected
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

POST Individual PM Job - (Method not implemented)
Send Post request for individual VNF Performance Job    
    Log    Trying to perform a POST (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    POST    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    Integer    response status    405
    Log    Received 405 Method not implemented as expected
    POST    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${newPmJobId}
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
PUT Individual PM Job - (Method not implemented)
    Log    Trying to perform a PUT. This method should not be implemented
Send Put request for individual VNF Performance Job    
    Log    Trying to perform a POST (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    ${origOutput}=    Output    response
    Set Suite Variable    @{origResponse}    ${origOutput}
    PUT    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    Integer    response status    405
    Log    Received 405 Method not implemented as expected
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    
PATCH Individual PM Job - (Method not implemented)
    Log    Trying to perform a PATCH. This method should not be implemented
Send Patch request for individual VNF Performance Job    
    Log    Trying to perform a PATCH (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    Integer    response status    405
    Log    Received 405 Method not implemented as expected
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Check Postcondition VNF Performance Job is not Created
    Log    Trying to get a new Pm Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${newPmJobId}
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    Check HTTP Response Status Code Is    404

Check Postcondition VNF Performance Job is Unmodified (Implicit)
    Log    Check Postcondition VNF PM job is not modified
    GET individual VNF Performance Job
    Log    Check Response matches original VNF Pm Job
    ${pmJob}=    evaluate    json.loads('''${response[0]['body']}''')    json
    Should Be Equal    ${origResponse[0]['body']['id']}    ${pmJob.id}
    Should Be Equal    ${origResponse[0]['body']['criteria']}    ${pmJob.criteria}
    Should Be Equal    ${origResponse[0]['body']['_links']}    ${pmJob._links}

Check Postcondition VNF Pm Job is Deleted
    Log    Check Postcondition
    GET individual VNF Performance Job
    Check HTTP Response Status Code Is    404

Check HTTP Response Body Pm Job Identifier
    Log    Going to validate Pm Job info retrieved
    Should Be Equal    ${response[0]['body']['id']}    ${pmJobId} 
    Log    Pm Job identifier as expected
    
Check HTTP Response Status Code Is
    [Arguments]    ${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[0]['headers']}    ${CONTENT_TYPE}
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [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
+3 −0
Original line number Diff line number Diff line
*** Variables ***
${pmJobId}        29f4ff6a-be91-4ec8-856e-fcf1e2479e4e
${erroneousPmJobId}    erroneousPmJobId
${newPmJobId}    newPmJobId
@{response}=    httpresponse
@{OrigResponse}=    httpresponse
+47 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource   NSLCMOperationKeywords.robot   
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} 
Library    OperatingSystem
Library    DependencyLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/

*** Test Cases ***
Post Cancel operation task
    Depends on test    Check resource FAILED_TEMP
	Do POST Cancel operation task
	Check HTTP Response Status Code Is    202
	
Post Cancel operation task Not Found
    [Setup]    Check Cancel not supported
	Do POST Cancel operation task
	Check HTTP Response Status Code Is    404
	Check HTTP Response Body Json Schema Is    ProblemDetails.schema.json
		
Post Cancel operation task Conflict
    Depends on test failure      Check resource FAILED_TEMP
	Do POST Cancel operation task
	Check HTTP Response Status Code Is    409
	Check HTTP Response Body Json Schema Is    ProblemDetails.schema.json
	
PUT Cancel operation task - Method not implemented
    Do PUT Cancel operation task
    Check HTTP Response Status Code Is    405

PATCH Cancel operation task - Method not implemented
    Do PATCH Cancel operation task
    Check HTTP Response Status Code Is    405

DELETE Cancel operation task - Method not implemented
    Do DELETE Cancel operation task
    Check HTTP Response Status Code Is    405
    
GET Cancel operation task - Method not implemented 
	Do GET Cancel operation task
	Check HTTP Response Status Code Is    405




	
 No newline at end of file
+45 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource   NSLCMOperationKeywords.robot   
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} 
Library    OperatingSystem
Library    DependencyLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/

*** Test Cases ***
Post Continue operation task
    Depends on test    Check resource FAILED_TEMP
	Do POST Continue operation task
	Check HTTP Response Status Code Is    202
	
Post Continue operation task Not Found
    [Setup]    Check Continue not supported
	Do POST Continue operation task
	Check HTTP Response Status Code Is    404
	Check HTTP Response Body Json Schema Is    ProblemDetails.schema.json
		
Post Continue operation task Conflict
    Depends on test failure  Check resource FAILED_TEMP
	Do POST Continue operation task
	Check HTTP Response Status Code Is    409
	Check HTTP Response Body Json Schema Is    ProblemDetails.schema.json
	
PUT Continue operation task - Method not implemented
    Do PUT Continue operation task
    Check HTTP Response Status Code Is    405

PATCH Continue operation task - Method not implemented
    Do PATCH Continue operation task
    Check HTTP Response Status Code Is    405

DELETE Continue operation task - Method not implemented
    Do DELETE Continue operation task
    Check HTTP Response Status Code Is    405
    
GET Continue operation task - Method not implemented 
	Do GET Continue operation task
	Check HTTP Response Status Code Is    405


	
 No newline at end of file
+46 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource   NSLCMOperationKeywords.robot   
Library    REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} 
Library    OperatingSystem
Library    DependencyLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/

*** Test Cases ***
Post Fail operation task
    Depends on test    Check resource FAILED_TEMP
	Do POST Fail operation task
	Check HTTP Response Status Code Is    202
	
Post Fail operation task Not Found
    [Setup]    Check Fail not supported
	Do POST Fail operation task
	Check HTTP Response Status Code Is    404
	Check HTTP Response Body Json Schema Is    ProblemDetails.schema.json
		
Post Fail operation task Conflict
    Depends on test failure      Check resource FAILED_TEMP
	Do POST Fail operation task
	Check HTTP Response Status Code Is    409
	Check HTTP Response Body Json Schema Is    ProblemDetails.schema.json
	
PUT Fail operation task - Method not implemented
    Do PUT Fail operation task
    Check HTTP Response Status Code Is    405

PATCH Fail operation task - Method not implemented
    Do PATCH Fail operation task
    Check HTTP Response Status Code Is    405

DELETE Fail operation task - Method not implemented
    Do DELETE Fail operation task
    Check HTTP Response Status Code Is    405
    
GET Fail operation task - Method not implemented 
	Do GET Fail operation task
	Check HTTP Response Status Code Is    405



	
 No newline at end of file
Loading