diff --git a/SOL003/VNFPerformanceManagement-API/PerformanceManagementNotification.robot b/SOL003/VNFPerformanceManagement-API/PerformanceManagementNotification.robot deleted file mode 100644 index 099a2d292f2c98c92c2198d8320ec3edf396d784..0000000000000000000000000000000000000000 --- a/SOL003/VNFPerformanceManagement-API/PerformanceManagementNotification.robot +++ /dev/null @@ -1,115 +0,0 @@ -*** Setting *** -Resource environment/variables.txt -Library MockServerLibrary -Library Process -Library OperatingSystem -Library BuiltIn -Library Collections -Library String - - -*** Keywords *** -Check Notification Endpoint - &{req}= Create Mock Request Matcher GET ${callback_endpoint} - &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=204 - Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} - Verify Mock Expectation ${req} - Clear Requests ${callback_endpoint} - -Post Performance Information Available Notification - ${json}= Get File schemas/PerformanceInformationAvailableNotification.schema.json - ${BODY}= evaluate json.loads('''${json}''') json - Log Creating mock request and response to handle Performance Information Available Notification - &{req}= Create Mock Request Matcher POST ${callback_endpoint} body_type="JSON_SCHEMA" body=${BODY} - &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=204 - Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - - -Post Performance Information Available Notification Negative 404 - ${json}= Get File schemas/ProblemDetails.schema.json - ${BODY}= evaluate json.loads('''${json}''') json - Log Creating mock request and response to handle Performance Information Available Notification to handle 404 error - &{req}= Create Mock Request Matcher POST ${callback_endpoint_error} body_type="JSON_SCHEMA" body=${BODY} - &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=404 - Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - -Post Threshold Crossed Notification - ${json}= Get File schema/ThresholdCrossedNotification.schema.json - ${BODY}= evaluate json.loads('''${json}''') json - Log Creating mock request and response to handle Threshold Crossed Notification - &{req}= Create Mock Request Matcher POST ${callback_endpoint} body_type="JSON_SCHEMA" body=${BODY} - &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=204 - Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - - -Post Threshold Crossed Notification Negative 404 - ${json}= Get File schemas/ProblemDetails.schema.json - ${BODY}= evaluate json.loads('''${json}''') json - Log Creating mock request and response to handleThreshold Crossed Notification to handle 404 error - &{req}= Create Mock Request Matcher POST ${callback_endpoint_error} body_type="JSON_SCHEMA" body=${BODY} - &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=404 - Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - - -PUT Performance Notification - Log PUT Method not implemented - &{req}= Create Mock Request Matcher PUT ${callback_endpoint} - &{rsp}= Create Mock Response status_code=405 - Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - - -PATCH Performance Notification - Log PATCH Method not implemented - &{req}= Create Mock Request Matcher PATCH ${callback_endpoint} - &{rsp}= Create Mock Response status_code=405 - Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - - -DELETE Performance Notification - Log PATCH Method not implemented - &{req}= Create Mock Request Matcher DELETE ${callback_endpoint} - &{rsp}= Create Mock Response status_code=405 - Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - - -Create Sessions - Pass Execution If ${VNFM_CHECKS_NOTIF_ENDPOINT} == 0 VNFM is not checking notification endpoint. - Start Process java -jar ${MOCK_SERVER_JAR} -serverPort ${callback_port} alias=mockInstance - Wait For Process handle=mockInstance timeout=5s on_timeout=continue - Create Mock Session ${callback_uri} \ No newline at end of file diff --git a/SOL003/VNFPerformanceManagement-API/VNFPerformanceManagementKeywords.robot b/SOL003/VNFPerformanceManagement-API/VNFPerformanceManagementKeywords.robot index 1b9e0e7cb5848a50dce4ce21152e4d7aa9d94d76..27973a6d8b966d0b7e4a098bc1dc46a92b2a7d77 100644 --- a/SOL003/VNFPerformanceManagement-API/VNFPerformanceManagementKeywords.robot +++ b/SOL003/VNFPerformanceManagement-API/VNFPerformanceManagementKeywords.robot @@ -1,13 +1,14 @@ *** Settings *** Resource environment/variables.txt Resource environment/subscriptions.txt -Resource PerformanceManagementNotification.robot Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} ssl_verify=false +Library MockServerLibrary Library OperatingSystem Library BuiltIn Library JSONLibrary Library Collections Library JSONSchemaLibrary schemas/ +Library Process *** Keywords *** Get VNF Performance Management Subscriptions @@ -230,3 +231,17 @@ Check HTTP Response Header Contains [Arguments] ${CONTENT_TYPE} Should Contain ${response.headers} ${CONTENT_TYPE} Log Header is present + + +Create Sessions + Start Process java -jar ${MOCK_SERVER_JAR} -serverPort ${callback_port} alias=mockInstance + Wait For Process handle=mockInstance timeout=5s on_timeout=continue + Create Mock Session ${callback_uri}:${callback_port} + + +Check Notification Endpoint + &{notification_request}= Create Mock Request Matcher GET ${callback_endpoint} + &{notification_response}= Create Mock Response headers="Content-Type: application/json" status_code=204 + Create Mock Expectation ${notification_request} ${notification_response} + Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${notification_request} + Clear Requests ${callback_endpoint} diff --git a/SOL003/VNFPerformanceManagement-API/environment/subscriptions.txt b/SOL003/VNFPerformanceManagement-API/environment/subscriptions.txt index fe74d7bf40ecd1808c1ea3a18b0698d8aa62d397..78528ad3188d9ea4f12a0908699e0daa481c663b 100644 --- a/SOL003/VNFPerformanceManagement-API/environment/subscriptions.txt +++ b/SOL003/VNFPerformanceManagement-API/environment/subscriptions.txt @@ -2,3 +2,5 @@ ${callbackUri} http://172.22.1.7:9091/vnfpm/subscriptions ${filter_ok} callbackUri=${callbackUri} ${filter_ko} erroneousFilter=erroneous +${total_polling_time} 2 min +${polling_interval} 10 sec diff --git a/SOL003/VNFPerformanceManagementNotification-API/PerformanceManagementNotification.robot b/SOL003/VNFPerformanceManagementNotification-API/PerformanceManagementNotification.robot index 7f4b0a00e8b284a1c4402dc314bdd0a196edbd07..7fc29c18581a69922fdb349c7894c6b338d28563 100644 --- a/SOL003/VNFPerformanceManagementNotification-API/PerformanceManagementNotification.robot +++ b/SOL003/VNFPerformanceManagementNotification-API/PerformanceManagementNotification.robot @@ -1,7 +1,5 @@ *** Setting *** Resource environment/variables.txt -Suite Setup Create Sessions -Suite Teardown Terminate All Processes kill=true Library MockServerLibrary Library Process Library OperatingSystem @@ -11,14 +9,6 @@ Library String *** Test Cases *** -Check Notification Endpoint - &{req}= Create Mock Request Matcher GET ${callback_endpoint} - &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=204 - Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} - Verify Mock Expectation ${req} - Clear Requests ${callback_endpoint} - Post Performance Information Available Notification ${json}= Get File schemas/PerformanceInformationAvailableNotification.schema.json ${BODY}= evaluate json.loads('''${json}''') json @@ -26,7 +16,7 @@ Post Performance Information Available Notification &{req}= Create Mock Request Matcher POST ${callback_endpoint} body_type="JSON_SCHEMA" body=${BODY} &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=204 Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} + Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} Log Verifying results Verify Mock Expectation ${req} Log Cleaning the endpoint @@ -40,7 +30,7 @@ Post Performance Information Available Notification Negative 404 &{req}= Create Mock Request Matcher POST ${callback_endpoint_error} body_type="JSON_SCHEMA" body=${BODY} &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=404 Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} + Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} Log Verifying results Verify Mock Expectation ${req} Log Cleaning the endpoint @@ -53,7 +43,7 @@ Post Threshold Crossed Notification &{req}= Create Mock Request Matcher POST ${callback_endpoint} body_type="JSON_SCHEMA" body=${BODY} &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=204 Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} + Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} Log Verifying results Verify Mock Expectation ${req} Log Cleaning the endpoint @@ -67,7 +57,7 @@ Post Threshold Crossed Notification Negative 404 &{req}= Create Mock Request Matcher POST ${callback_endpoint_error} body_type="JSON_SCHEMA" body=${BODY} &{rsp}= Create Mock Response headers="Content-Type: application/json" status_code=404 Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} + Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} Log Verifying results Verify Mock Expectation ${req} Log Cleaning the endpoint @@ -79,7 +69,7 @@ PUT Performance Notification &{req}= Create Mock Request Matcher PUT ${callback_endpoint} &{rsp}= Create Mock Response status_code=405 Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} + Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} Log Verifying results Verify Mock Expectation ${req} Log Cleaning the endpoint @@ -91,7 +81,7 @@ PATCH Performance Notification &{req}= Create Mock Request Matcher PATCH ${callback_endpoint} &{rsp}= Create Mock Response status_code=405 Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} + Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} Log Verifying results Verify Mock Expectation ${req} Log Cleaning the endpoint @@ -103,7 +93,7 @@ DELETE Performance Notification &{req}= Create Mock Request Matcher DELETE ${callback_endpoint} &{rsp}= Create Mock Response status_code=405 Create Mock Expectation ${req} ${rsp} - Sleep ${sleep_interval} + Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} Log Verifying results Verify Mock Expectation ${req} Log Cleaning the endpoint diff --git a/SOL003/VNFPerformanceManagementNotification-API/environment/variables.txt b/SOL003/VNFPerformanceManagementNotification-API/environment/variables.txt index 3d24134ebd622d14cecb4d46622e625690a06f86..bd4361c1cbdaef24c048783c48b74bb924c3b51c 100644 --- a/SOL003/VNFPerformanceManagementNotification-API/environment/variables.txt +++ b/SOL003/VNFPerformanceManagementNotification-API/environment/variables.txt @@ -1,8 +1,8 @@ *** Variables *** -${callback_uri} http://localhost ${callback_port} 9091 -${callback_endpoint} /endpoint -${callback_endpoint_error} /endpoint_404 -${sleep_interval} 20s - +${callback_uri} http://localhost:${callback_port} +${callback_endpoint} /vnfpm/subscriptios +${callback_endpoint_error} /subs_404 +${total_polling_time} 2 min +${polling_interval} 10 sec ${MOCK_SERVER_JAR} ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar \ No newline at end of file