Commit f8f4621e authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

updated SOL005 NS PM job creeation and update with mandatory test notification endpoint

parent 0c5662ae
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,11 @@ Resource environment/variables.txt # Generic Parameters
Library           JSONLibrary
Resource          NSPerformanceManagementKeywords.robot
Library           REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}    ssl_verify=false
Library           MockServerLibrary
Library           Process

Suite Setup       Create Sessions
Suite Teardown    Terminate All Processes    kill=true

*** Test Cases ***
GET individual NS Performance Job
+5 −0
Original line number Diff line number Diff line
@@ -6,6 +6,11 @@ Resource NSPerformanceManagementKeywords.robot
Library           JSONLibrary
Library           REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}    ssl_verify=false
Library           OperatingSystem
Library           MockServerLibrary
Library           Process

Suite Setup       Create Sessions
Suite Teardown    Terminate All Processes    kill=true

*** Test Cases ***
GET Individual Threshold
+28 −2
Original line number Diff line number Diff line
@@ -92,10 +92,19 @@ Send Post Request Create new NS Performance Monitoring Job
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template}=    Get File    jsons/CreatePmJobRequest.json
    ${body}=        Format String   ${template}     pmJobId=${pmJobId}
    ${body}=        Format String   ${template}     pmJobId=${pmJobId}    callbackUri=${callback_uri}   callbackEndpoint=${callback_endpoint}   callbackPort=${callback_port}    performanceMetric=${performanceMetric}    collectionPeriod=${collectionPeriod}    reportingPeriod=${reportingPeriod} 
    Log  Creating mock request and response to handle GET operation on notification endpoint
    &{notification_request}=  Create Mock Request Matcher	GET  ${callback_endpoint}
    &{notification_response}=  Create Mock Response	status_code=204
    Log    Issue the request
    Create Mock Expectation  ${notification_request}  ${notification_response}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Log    Verify producer tested the notification endpoint
	Verify Mock Expectation    ${notification_request}
	Clear Requests    ${callback_endpoint}

    
Send POST request for NS Performance Monitoring Job with unprocessable entity
    Log    trying to create a new NS PM Job
@@ -103,10 +112,18 @@ Send POST request for NS Performance Monitoring Job with unprocessable entity
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template}=    Get File    jsons/CreatePmJobRequest.json
    ${body}=        Format String   ${template}     objectInstanceIds=${objectInstanceIds}    callback_uri=${unreachable_callback_uri}:${callback_port}
    ${body}=        Format String   ${template}     pmJobId=${pmJobId}    callbackUri=${callback_uri}   callbackEndpoint=${unreachable_callback_uri}   callbackPort=${callback_port}    performanceMetric=${performanceMetric}    collectionPeriod=${collectionPeriod}    reportingPeriod=${reportingPeriod} 
    Log  Creating mock request and response to handle GET operation on notification endpoint
    &{notification_request}=  Create Mock Request Matcher	GET  ${callback_endpoint}
    &{notification_response}=  Create Mock Response	status_code=204
    Log    Issue the request
    Create Mock Expectation  ${notification_request}  ${notification_response}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Log    Verify producer tested the notification endpoint
	Verify Mock Expectation    ${notification_request}
	Clear Requests    ${callback_endpoint}

Send PUT Request for all NS Performance Monitoring Jobs 
    Log    Trying to perform a PUT. This method should not be implemented
@@ -251,9 +268,18 @@ Send Patch request for individual NS Performance Job
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${body}=    Get File    jsons/PmJobModifications.json
    ${body}=        Format String   ${body}     callbackUri=${callback_uri}   callbackEndpoint=${callback_endpoint}   callbackPort=${callback_port}
    Log  Creating mock request and response to handle GET operation on notification endpoint
    &{notification_request}=  Create Mock Request Matcher	GET  ${callback_endpoint}
    &{notification_response}=  Create Mock Response	status_code=204
    Log    Issue the request
    Create Mock Expectation  ${notification_request}  ${notification_response}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Log    Verify producer tested the notification endpoint
	Verify Mock Expectation    ${notification_request}
	Clear Requests    ${callback_endpoint}

Send Patch request for individual NS Performance Job - Etag mismatch 
    Log    Trying to perform a PATCH 
+4 −0
Original line number Diff line number Diff line
@@ -6,6 +6,10 @@ Library JSONLibrary
Library           OperatingSystem
Library           REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}    ssl_verify=false
Library           MockServerLibrary
Library           Process

Suite Setup       Create Sessions
Suite Teardown    Terminate All Processes    kill=true

*** Test Cases ***
GET all NS Performance Monitoring Jobs
+5 −0
Original line number Diff line number Diff line
@@ -6,6 +6,11 @@ Resource NSPerformanceManagementKeywords.robot
Library           JSONLibrary
Library           REST    ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}    ssl_verify=false
Library           OperatingSystem
Library           MockServerLibrary
Library           Process

Suite Setup       Create Sessions
Suite Teardown    Terminate All Processes    kill=true

*** Test Cases ***
GET All Performance Thresholds
Loading