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

Merge branch '3.5.1-dev-SOL009-NFVMANO-PM' into '3.5.1-dev'

SOL009 NFV MANO Performance Management - Implementation of deltas between v3.5.1 and v3.3.1

See merge request !209
parents 8d315e49 fad9463d
Loading
Loading
Loading
Loading
+0 −25442

File deleted.

File size exceeds preview limit.

+1 −87
Original line number Original line Diff line number Diff line
*** Settings ***
*** Settings ***
Resource    environment/variables.txt
Resource    NFVMANOPMKeywords.robot
Library    REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false
Library    DependencyLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/


*** Test Cases ***
*** Test Cases ***
POST API Version - Method not implemented
POST API Version - Method not implemented
@@ -127,85 +123,3 @@ DELETE API Version with apiMajorVerion - Method not implemented
    ...    Post-Conditions: none 
    ...    Post-Conditions: none 
    DELETE API Version
    DELETE API Version
	Check HTTP Response Status Code Is    405
	Check HTTP Response Status Code Is    405

*** Keywords ***
POST API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
GET API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
PUT API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
PATCH API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Patch    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
DELETE API Version
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
POST API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
GET API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
PUT API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
PATCH API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
DELETE API Version with apiMajorVersion
    Set Headers    {"Accept":"${ACCEPT_JSON}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/${apiMajorVersion} /api_versions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse} 
	
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
    Should Be Equal As Strings   ${response['status']}    ${expected_status}
    Log    Status code validated 

Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response['body']}
    Log    Json Schema Validation OK
+39 −105
Original line number Original line Diff line number Diff line
*** Settings ***
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Resource          NFVMANOPMKeywords.robot
Resource          environment/variables.txt    # Generic Parameters
Library           JSONLibrary
Resource          environment/IndividualPmJob.txt
Library           REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false


*** Test Cases ***
*** Test Cases ***
POST Individual NFV-MANO Performance Job - Method not implemented
POST Individual NFV-MANO Performance Job - Method not implemented
@@ -11,7 +7,7 @@ POST Individual NFV-MANO Performance Job - Method not implemented
    ...    Test title: POST Individual NFV-MANO Performance Job - method not implemented
    ...    Test title: POST Individual NFV-MANO Performance Job - method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create a new NFV-MANO Performance Monitoring Job
    ...    Test objective: The objective is to test that POST method is not allowed to create a new NFV-MANO Performance Monitoring Job
    ...    Pre-conditions: none
    ...    Pre-conditions: none
    ...    Reference: clause 6.5.4.3.1 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.4.3.1 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
@@ -23,7 +19,7 @@ GET individual NFV-MANO Performance Job
    ...    Test title: Get individual NFV-MANO Performance Job
    ...    Test title: Get individual NFV-MANO Performance Job
    ...    Test objective: The objective is to test the retrieval of an individual performance monitoring job and perform a JSON schema validation of the collected job data structure
    ...    Test objective: The objective is to test the retrieval of an individual performance monitoring job and perform a JSON schema validation of the collected job data structure
    ...    Pre-conditions: A NFV-MANO instance is instantiated.
    ...    Pre-conditions: A NFV-MANO instance is instantiated.
    ...    Reference: clause 6.5.4.3.2 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.4.3.2 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
@@ -37,7 +33,7 @@ GET individual NFV-MANO Performance Job with invalid resource identifier
    ...    Test title: Get individual NFV-MANO Performance Job with invalid resource identifier
    ...    Test title: Get individual NFV-MANO Performance Job with invalid resource identifier
    ...    Test objective: The objective is to test that the retrieval of an individual performance monitoring job fails when using an invalid resource identifier, and perform the JSON schema validation of the failed operation HTTP response
    ...    Test objective: The objective is to test that the retrieval of an individual 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 NFV-MANO instance is instantiated. One or more NFV-MANO performance jobs are set in the NFV-MANO.
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance jobs are set in the NFV-MANO.
    ...    Reference: clause 6.5.4.3.2 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.4.3.2 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
@@ -50,31 +46,32 @@ PUT Individual NFV-MANO Performance Job - Method not implemented
    ...    Test title: PUT Individual NFV-MANO Performance Job - method not implemented
    ...    Test title: PUT Individual NFV-MANO Performance Job - method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to update an existing NFV-MANO Performance Monitoring Job
    ...    Test objective: The objective is to test that PUT method is not allowed to update an existing NFV-MANO Performance Monitoring Job
    ...    Pre-conditions: none
    ...    Pre-conditions: none
    ...    Reference: clause 6.5.4.3.4 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.4.3.4 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
    Send Put request for individual NFV-MANO Performance Job
    Send Put request for individual NFV-MANO Performance Job
    Check HTTP Response Status Code Is    405
    Check HTTP Response Status Code Is    405


PATCH Individual NFV-MANO Performance Job - Method not implemented
PATCH Individual NFV-MANO Performance Job
    [Documentation]    Test ID: 8.3.2.2.5
    [Documentation]    Test ID: 8.3.2.2.5
    ...    Test title: PATCH Individual NFV-MANO Performance Job - method not implemented
    ...    Test title: PATCH Individual NFV-MANO Performance Job
    ...    Test objective: The objective is to test that PATCH method is not allowed to modify an existing new NFV-MANO Performance Monitoring Job
    ...    Test objective: The objective is to test that PATCH method modify an existing individual NFV-MANO Performance Monitoring Job
    ...    Pre-conditions: none
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance jobs are set in the NFV-MANO.
    ...    Reference: clause 6.5.4.3.4 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.4.3.4 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: PM Job resource is modified.
    Send Patch request for individual NFV-MANO Performance Job
    Send Patch request for individual NFV-MANO Performance Job
    Check HTTP Response Status Code Is    405
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is     PmJobModifications


DELETE Individual NFV-MANO Performance Job
DELETE Individual NFV-MANO Performance Job
    [Documentation]    Test ID: 8.3.2.2.6
    [Documentation]    Test ID: 8.3.2.2.6
    ...    Test title: Delete Individual NFV-MANO Performance Job
    ...    Test title: Delete Individual NFV-MANO Performance Job
    ...    Test objective: The objective is to test the deletion of an individual performance monitoring job
    ...    Test objective: The objective is to test the deletion of an individual performance monitoring job
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance jobs are set in the NFV-MANO.
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance jobs are set in the NFV-MANO.
    ...    Reference: clause 6.5.4.3.5 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.4.3.5 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: The NFV-MANO Performance Job is no more available.   
    ...    Post-Conditions: The NFV-MANO Performance Job is no more available.   
@@ -87,98 +84,35 @@ DELETE Individual NFV-MANO Performance Job with invalid resource identifier
    ...    Test title: Delete individual NFV-MANO Performance Job with invalid resource identifier
    ...    Test title: Delete individual NFV-MANO Performance Job with invalid resource identifier
    ...    Test objective: The objective is to test that the deletion of an individual NFV-MANO performance monitoring job fails when using an invalid resource identifier
    ...    Test objective: The objective is to test that the deletion of an individual NFV-MANO performance monitoring job fails when using an invalid resource identifier
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance jobs are set in the NFV-MANO.
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance jobs are set in the NFV-MANO.
    ...    Reference: clause 6.5.4.3.5 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.4.3.5 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
    Send Delete request for individual NFV-MANO Performance Job with invalid resource identifier
    Send Delete request for individual NFV-MANO Performance Job with invalid resource identifier
    Check HTTP Response Status Code Is    404
    Check HTTP Response Status Code Is    404


*** Keywords ***
PATCH Individual NFV-MANO Performance Job - Precondition failed
GET individual NFV-MANO Performance Job
    [Documentation]    Test ID: 8.3.2.2.8
    Log    Trying to get a Pm Job 
    ...    Test title: PATCH Individual NFV-MANO Performance Job - Precondition failed
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ...    Test objective: The objective is to test that the PATCH method cannot modify an individual NFV-MANO Performance job where the precondition was not met.
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance jobs are set in the NFV-MANO.
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}
    ...    Reference: clause 6.5.4.3.4 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ${output}=    Output    response
    ...    Config ID: Config_prod_NFV-MANO
    Set Suite Variable    ${response}    ${output}
    ...    Applicability: none

    ...    Post-Conditions: PM Job resource is not modified.
GET individual NFV-MANO Performance Job with invalid resource identifier  
    Send Patch request for individual NFV-MANO Performance Job - Etag mismatch
    Log    Trying to perform a negative get, using erroneous PM Job identifier
    Check HTTP Response Status Code Is    412
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Check HTTP Response Body Json Schema Is     ProblemDetails
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${erroneousPmJobId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Delete request for individual NFV-MANO 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}/${apiMajorVersion}/pm_jobs/${pmJobId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send Delete request for individual NFV-MANO 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}/${apiMajorVersion}/pm_jobs/${erroneousPmJobId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post request for individual NFV-MANO 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}/${apiMajorVersion}/pm_jobs/${newPmJobId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send Put request for individual NFV-MANO 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}/${apiMajorVersion}/pm_jobs/${pmJobId}
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    PUT    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send Patch request for individual NFV-MANO 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}/${apiMajorVersion}/pm_jobs/${pmJobId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

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

Check HTTP Response Body Pm Job Identifier matches the requested Pm Job
    Log    Going to validate Pm Job info retrieved
    Should Be Equal    ${response['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['status']}    ${status} 
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
    Log    Header is present


Check HTTP Response Body Json Schema Is
PATCH Individual NFV-MANO Performance Job - Unprocessable entity
    [Arguments]    ${input}
    [Documentation]    Test ID: 8.3.2.2.9
    Run Keyword If    '${input}' == 'ProblemDetails'    Should Contain    ${response['headers']['Content-Type']}    application/problem+json
    ...    Test title: PATCH Individual NFV-MANO Performance Job - Unprocessable entity
    ...    ELSE    Should Contain    ${response['headers']['Content-Type']}    application/json
    ...    Test objective: The objective is to test that PATCH method cannot modify an exsisting individual PM job resource when a request contains syntactically correct data but the data cannot be processed.
    ${schema} =    Catenate    SEPARATOR=    ${input}	.schema.json
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance jobs are set in the NFV-MANO.
    Validate Json    ${schema}    ${response['body']}
    ...    Reference: clause 6.5.4.3.4 - ETSI GS NFV-SOL 009 [7] v3.5.1
    Log    Json Schema Validation OK
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: PM Job resource is not modified.
    Send Patch request for individual NFV_MANO Performance Job with unprocessable entity
    Check HTTP Response Status Code Is    422
    Check HTTP Response Body Json Schema Is     ProblemDetails
+7 −81
Original line number Original line Diff line number Diff line
*** Settings ***
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Resource          NFVMANOPMKeywords.robot
Resource          environment/variables.txt    # Generic Parameters
Resource          environment/reports.txt
Library           JSONLibrary
Library           REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false


*** Test Cases ***
*** Test Cases ***
POST Individual Performance Report - Method not implemented
POST Individual Performance Report - Method not implemented
@@ -11,7 +7,7 @@ POST Individual Performance Report - Method not implemented
    ...    Test title: POST Individual Performance Report - Method not implemented
    ...    Test title: POST Individual Performance Report - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create a new NFV-MANO performance report within a monitoring job.
    ...    Test objective: The objective is to test that POST method is not allowed to create a new NFV-MANO performance report within a monitoring job.
    ...    Pre-conditions: none
    ...    Pre-conditions: none
    ...    Reference: clause 6.5.5.3.1 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.5.3.1 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
@@ -23,7 +19,7 @@ Get Individual Performance Report
    ...    Test title: Get Individual Performance Report
    ...    Test title: Get Individual Performance Report
    ...    Test objective: The objective is to test the retrieval of an individual performance report associated to a monitoring job and perform a JSON schema validation of the collected report data structure
    ...    Test objective: The objective is to test the retrieval of an individual performance report associated to a monitoring job and perform a JSON schema validation of the collected report data structure
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance reports are set for a monitoring job.
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance reports are set for a monitoring job.
    ...    Reference: clause 6.5.5.3.2 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.5.3.2 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
@@ -36,7 +32,7 @@ Get Individual Performance Report with invalid resource endpoint
    ...    Test title: Get Individual Performance Report with invalid resource endpoint
    ...    Test title: Get Individual Performance Report with invalid resource endpoint
    ...    Test objective:  The objective is to test that the retrieval of an individual NFV-MANO performance report associated to a monitoring job fails when using an invalid resource endpoint. 
    ...    Test objective:  The objective is to test that the retrieval of an individual NFV-MANO performance report associated to a monitoring job fails when using an invalid resource endpoint. 
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance reports are set for a monitoring job.
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more NFV-MANO performance reports are set for a monitoring job.
    ...    Reference: clause 6.5.5.3.2 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.5.3.2 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
@@ -48,7 +44,7 @@ PUT Individual Performance Report - Method not implemented
    ...    Test title: PUT Individual Performance Report - Method not implemented
    ...    Test title: PUT Individual Performance Report - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to update an existing NFV-MANO performance report within a monitoring job.
    ...    Test objective: The objective is to test that PUT method is not allowed to update an existing NFV-MANO performance report within a monitoring job.
    ...    Pre-conditions: none
    ...    Pre-conditions: none
    ...    Reference: clause 6.5.5.3.3 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.5.3.3 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
@@ -60,7 +56,7 @@ PATCH Individual Performance Report - Method not implemented
    ...    Test title: PATCH Individual Performance Report - Method not implemented
    ...    Test title: PATCH Individual Performance Report - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to modify an existing NFV-MANO performance report within a monitoring job.
    ...    Test objective: The objective is to test that PATCH method is not allowed to modify an existing NFV-MANO performance report within a monitoring job.
    ...    Pre-conditions: none
    ...    Pre-conditions: none
    ...    Reference: clause 6.5.5.3.4 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.5.3.4 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
@@ -72,80 +68,10 @@ DELETE Individual Performance Report - Method not implemented
    ...    Test title: DELETE Individual Performance Report - Method not implemented
    ...    Test title: DELETE Individual Performance Report - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to delete an existing NFV-MANO performance report within a monitoring job
    ...    Test objective: The objective is to test that DELETE method is not allowed to delete an existing NFV-MANO performance report within a monitoring job
    ...    Pre-conditions: none
    ...    Pre-conditions: none
    ...    Reference: clause 6.5.5.3.5 - ETSI GS NFV-SOL 009 [7] v3.3.1
    ...    Reference: clause 6.5.5.3.5 - ETSI GS NFV-SOL 009 [7] v3.5.1
    ...    Config ID: Config_prod_NFV-MANOM
    ...    Config ID: Config_prod_NFV-MANOM
    ...    Applicability: none
    ...    Applicability: none
    ...    Post-Conditions: none
    ...    Post-Conditions: none
    Send Delete request for Individual Performance Report
    Send Delete request for Individual Performance Report
    Check HTTP Response Status Code Is    405
    Check HTTP Response Status Code Is    405
*** Keywords ***
Get Individual Performance Report
    Log    Trying to get a performance report present in the NFV-MANOM
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}/reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get Individual Performance Report with invalid resource endpoint
    Log    Trying to get a performance report with invalid resource endpoint
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}/reports/${erroneousReportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post request for Individual Performance Report
    Log    Trying to create new performance report
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}/reports/${newReportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Put request for Individual Performance Report
    Log    Trying to update performance report
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    PUT    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}/reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Send Patch request for Individual Performance Report
    Log    Trying to update performance report
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}/reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Delete request for Individual Performance Report
    Log    Trying to delete performance report   
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": ${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}/reports/${reportId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
    ${status}=    Convert To Integer    ${expected_status}    
    Should Be Equal    ${response['status']}    ${status} 
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    Run Keyword If    '${input}' == 'ProblemDetails'    Should Contain    ${response['headers']['Content-Type']}    application/problem+json
    ...    ELSE    Should Contain    ${response['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    SEPARATOR=    ${input}    .schema.json
    Validate Json    ${schema}    ${response['body']}
    Log    Json Schema Validation OK
Loading