diff --git a/SOL005/NSPerformanceManagement-API/NSPerformanceManagementKeywords.robot b/SOL005/NSPerformanceManagement-API/NSPerformanceManagementKeywords.robot index 29e0c56239bb4707d444a65c05610d7c83e71729..15bd31168def8ee935e6ffe258e9f40b4f234413 100644 --- a/SOL005/NSPerformanceManagement-API/NSPerformanceManagementKeywords.robot +++ b/SOL005/NSPerformanceManagement-API/NSPerformanceManagementKeywords.robot @@ -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 @@ -530,10 +546,19 @@ Send Patch request for individual NS performance Threshold Set Headers {"Accept": "${ACCEPT_JSON}"} 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}= 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}"} diff --git a/SOL005/NSPerformanceManagement-API/environment/variables.txt b/SOL005/NSPerformanceManagement-API/environment/variables.txt index 647fed2500065f6c25b2d67045f53fbf2e900741..e8b303c04649934ac151d3c5c50329061d3cf964 100644 --- a/SOL005/NSPerformanceManagement-API/environment/variables.txt +++ b/SOL005/NSPerformanceManagement-API/environment/variables.txt @@ -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 diff --git a/SOL005/NSPerformanceManagement-API/jsons/CreatePmJobRequest.json b/SOL005/NSPerformanceManagement-API/jsons/CreatePmJobRequest.json index 2f55c065cc74b267b603d644df2eff20ea725cce..c0fb7de33dcf3d1a59c9985ef4e9af304c4483b4 100644 --- a/SOL005/NSPerformanceManagement-API/jsons/CreatePmJobRequest.json +++ b/SOL005/NSPerformanceManagement-API/jsons/CreatePmJobRequest.json @@ -1,5 +1,5 @@ {{ - "objectInstanceIds": ["{pmJobId}"], + "objectInstanceIds": ["{pmJobObjectInstanceId} "], "criteria": {{ "performanceMetric": "{performanceMetric}", "performanceMetricGroup": [], diff --git a/SOL005/NSPerformanceManagement-API/jsons/CreateThresholdRequest.json b/SOL005/NSPerformanceManagement-API/jsons/CreateThresholdRequest.json index 145f2d681bd8c4bf536e2e479687d4a45677543d..5572d846924a0dc4bcd3adcf8665f125520ef321 100644 --- a/SOL005/NSPerformanceManagement-API/jsons/CreateThresholdRequest.json +++ b/SOL005/NSPerformanceManagement-API/jsons/CreateThresholdRequest.json @@ -1,11 +1,12 @@ {{ - "objectInstanceIds" : "{pmJobId}", + "objectType": "{objectType}", + "objectInstanceId" : "{thresholdObjectInstanceId}", "criteria" : {{ "performanceMetric": "{performanceMetric}", "thresholdType": "{thresholdType}", "simpleThresholdDetails": {{ - "thresholdValue": {thresholdValue}, - "hysteresis": {hysteresis} + "thresholdValue": "{thresholdValue}", + "hysteresis": "{hysteresis}" }} }}, "callbackUri": "{callbackUri}:{callbackPort}{callbackEndpoint}"