Commit 1dac9845 authored by M. Rehan Abbasi's avatar M. Rehan Abbasi
Browse files

implement PATCH method for individual PM job for PM API

parent de0dca1d
Loading
Loading
Loading
Loading
+34 −6
Original line number Original line Diff line number Diff line
@@ -4,6 +4,7 @@ Resource environment/variables.txt # Generic Parameters
Library           JSONLibrary
Library           JSONLibrary
Resource          environment/IndividualPmJob.txt
Resource          environment/IndividualPmJob.txt
Resource          NFVMANOPMKeywords.robot
Resource          NFVMANOPMKeywords.robot
Resource    ../NFVManoConfigurationAndInformationManagement-API/NFVMANOCimKeywords.robot
Library           REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false
Library           REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false


*** Test Cases ***
*** Test Cases ***
@@ -58,17 +59,18 @@ PUT Individual NFV-MANO Performance Job - Method not implemented
    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.5.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
@@ -94,3 +96,29 @@ DELETE Individual NFV-MANO Performance Job with invalid resource identifier
    ...    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

PATCH Individual NFV-MANO Performance Job - Precondition failed
    [Documentation]    Test ID: 8.3.2.2.8
    ...    Test title: PATCH Individual NFV-MANO Performance Job - Precondition failed
    ...    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.
    ...    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.5.1
    ...    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 - Etag mismatch
    Check HTTP Response Status Code Is    412
    Check HTTP Response Body Json Schema Is     ProblemDetails

PATCH Individual NFV-MANO Performance Job - Unprocessable entity
    [Documentation]    Test ID: 8.3.2.2.9
    ...    Test title: PATCH Individual NFV-MANO Performance Job - Unprocessable entity
    ...    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.
    ...    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.5.1
    ...    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
+30 −2
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@ Library String
Library     JSONSchemaLibrary    schemas/
Library     JSONSchemaLibrary    schemas/
Resource    environment/variables.txt   
Resource    environment/variables.txt   
Resource    environment/pmJobs.txt
Resource    environment/pmJobs.txt
Resource    environment/IndividualPmJob.txt
Library     JSONLibrary
Library     JSONLibrary
Library     OperatingSystem
Library     OperatingSystem
Library     REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false
Library     REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT}    ssl_verify=false
@@ -265,10 +266,37 @@ Send Put request for individual NFV-MANO Performance Job
    Set Suite Variable    ${response}    ${output}
    Set Suite Variable    ${response}    ${output}
    
    
Send Patch request for individual NFV-MANO Performance Job    
Send Patch request for individual NFV-MANO Performance Job    
    Log    Trying to perform a PATCH (method should not be implemented)
    Log    Trying to perform a PATCH on PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}
    Check GET response from Notification Endpoint
    ${template}=    Get File    jsons/PmJobModifications.json
    ${body}=    Format String    ${template}    callbackUri=${callback_uri}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Patch request for individual NFV-MANO Performance Job - Etag mismatch
    Log    Trying to perform a PATCH on PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Set Headers  {"If-Match": "${invalid_etag}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Check GET response from Notification Endpoint
    ${template}=    Get File    jsons/PmJobModifications.json
    ${body}=    Format String    ${template}    callbackUri=${callback_uri}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Patch request for individual NFV_MANO Performance Job with unprocessable entity
    Set Headers  {"Accept":"${ACCEPT_JSON}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template}=    Get File    jsons/PmJobModifications.json
    ${body}=        Format String   ${template}    callbackUri=${unreachable_callback_uri}:${callback_port}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}     ${body}
    ${output}=    Output    response
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Set Suite Variable    ${response}    ${output}


+2 −1
Original line number Original line Diff line number Diff line
@@ -4,3 +4,4 @@ ${erroneousPmJobId} erroneousPmJobId
${newPmJobId}    newPmJobId
${newPmJobId}    newPmJobId
${response}=    httpresponse
${response}=    httpresponse
${OrigResponse}=    httpresponse
${OrigResponse}=    httpresponse
${invalid_etag}    invalid etag
 No newline at end of file
+3 −0
Original line number Original line Diff line number Diff line
{
	"callbackUri": "{callbackUri}"
}
 No newline at end of file