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

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

parent f8f4621e
Loading
Loading
Loading
Loading
+48 −15
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ 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}    callbackUri=${callback_uri}   callbackEndpoint=${callback_endpoint}   callbackPort=${callback_port}    performanceMetric=${performanceMetric}    collectionPeriod=${collectionPeriod}    reportingPeriod=${reportingPeriod} 
    ${body}=        Format String   ${template}     pmJobObjectInstanceId=${pmJobObjectInstanceId}    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
@@ -112,18 +112,10 @@ 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}     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}
    ${body}=        Format String   ${template}     pmJobObjectInstanceId=${pmJobObjectInstanceId}    callbackUri=${callback_uri}   callbackEndpoint=${unreachable_callback_uri}   callbackPort=${callback_port}    performanceMetric=${performanceMetric}    collectionPeriod=${collectionPeriod}    reportingPeriod=${reportingPeriod} 
    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
@@ -289,9 +281,17 @@ Send Patch request for individual NS Performance Job - Etag mismatch
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template}=    Get File    jsons/PmJobModifications.json
    ${body}=        Format String   ${template}    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 with unprocessable entity
@@ -420,10 +420,18 @@ Send Post Request Create new Performance Threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${template}=    Get File    jsons/CreateThresholdRequest.json
    ${body}=        Format String   ${template}     pmJobId=${pmJobId}
    ${body}=        Format String   ${template}     thresholdObjectInstanceId=${thresholdObjectInstanceId}    callbackUri=${callback_uri}   callbackEndpoint=${callback_endpoint}
    ...   callbackPort=${callback_port}    performanceMetric=${performanceMetric}    thresholdType=${thresholdType}    thresholdValue=${thresholdValue}    hysteresis=${hysteresis} 
    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}/thresholds    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Set Suite Variable    ${response}    ${output}ndpoint
	Verify Mock Expectation    ${notification_request}
	Clear Requests    ${callback_endpoint}
    
Send POST request for Performance threshold with unprocessable entity
    Log    Creating a new Threshold
@@ -431,10 +439,18 @@ Send POST request for Performance threshold with unprocessable entity
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${template}=    Get File    jsons/CreateThresholdRequest.json
    ${body}=        Format String   ${template}    callback_uri=${unreachable_callback_uri}:${callback_port}
    ${body}=        Format String   ${template}     thresholdObjectInstanceId=${thresholdObjectInstanceId}    callbackUri=${callback_uri}   callbackEndpoint=${unreachable_callback_uri}
    ...   callbackPort=${callback_port}    performanceMetric=${performanceMetric}    thresholdType=${thresholdType}    thresholdValue=${thresholdValue}    hysteresis=${hysteresis}
    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}/thresholds    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Set Suite Variable    ${response}    ${output}ndpoint
	Verify Mock Expectation    ${notification_request}
	Clear Requests    ${callback_endpoint}

Send PUT Request for all Performance Thresholds
    Log    PUT THresholds
@@ -531,9 +547,18 @@ Send Patch request for individual NS performance Threshold
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${body}=    Get File    jsons/ThresholdModifications.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}/thresholds/${thresholdId}    ${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 Threshold - Etag mismatch
    Log    Trying to PUT threshold
@@ -543,9 +568,17 @@ Send Patch request for individual NS performance Threshold - Etag mismatch
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template}=    Get File    jsons/ThresholdModifications.json
    ${body}=        Format String   ${template}    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}/thresholds/${thresholdId}    ${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 Threshold with unprocessable entity
    Set Headers  {"Accept":"${ACCEPT_JSON}"} 
+3 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@ ${invalid_etag} invalid etag
${total_polling_time}   2 min
${polling_interval}     10 sec

${objectType}           my_type
${pmJobObjectInstanceId}     my_id
${thresholdObjectInstanceId}     my_id
${performanceMetric}    cpu_util
${thresholdType}        SIMPLE
${thresholdValue}       10
+1 −1
Original line number Diff line number Diff line
{{
	"objectInstanceIds": ["{pmJobId}"],
	"objectInstanceIds": ["{pmJobObjectInstanceId} "],
	"criteria": {{
		"performanceMetric": "{performanceMetric}",
		"performanceMetricGroup": [],
+4 −3
Original line number Diff line number Diff line
{{
	"objectInstanceIds" :  "{pmJobId}",
	"objectType": "{objectType}",
	"objectInstanceId" :  "{thresholdObjectInstanceId}",
	"criteria" : {{
		"performanceMetric": "{performanceMetric}",
		"thresholdType": "{thresholdType}",
		"simpleThresholdDetails": {{
			"thresholdValue": {thresholdValue},
			"hysteresis": {hysteresis}
			"thresholdValue": "{thresholdValue}",
			"hysteresis": "{hysteresis}"
		}}	
	}},
	"callbackUri": "{callbackUri}:{callbackPort}{callbackEndpoint}"