diff --git a/SOL002/VNFIndicatorNotification-API/VnfIndicatorNotification.robot b/SOL002/VNFIndicatorNotification-API/VnfIndicatorNotification.robot index 4545ea7d521a46bd5a4377a5589ae50c4ae2e767..3f077f50d66467ceac28fe8b57bf44e23ad82ebf 100644 --- a/SOL002/VNFIndicatorNotification-API/VnfIndicatorNotification.robot +++ b/SOL002/VNFIndicatorNotification-API/VnfIndicatorNotification.robot @@ -1,5 +1,5 @@ *** Setting *** -Resource environment/variables.txt +Resource environment/variables.txt Suite Setup Create Sessions Suite Teardown Terminate All Processes kill=true Library MockServerLibrary @@ -11,81 +11,56 @@ 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 VNF Indicator Notification - ${json}= Get File schemas/VnfIndicatorValueChangeNotification.schema.json - ${BODY}= evaluate json.loads('''${json}''') json - Log Creating mock request and response to handle VNF Indicator 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} +VNF Indicator Value Change Notification + [Documentation] Test ID: 6.3.2.6.1 + ... Test title: VNF Indicator Value Change Notification + ... Test objective: The objective is to test the dispatch of VNF Indicator Value Change Notification when new indicator values are available in the VNF, and perform a JSON schema and content validation of the delivered notification + ... Pre-conditions: A VNF is instantiated, and a subscription for indicator value change notifications is available in the VNF. + ... Reference: section 8.4.7.3.1 - SOL002 v2.4.1 + ... Config ID: Config_prod_VNF + ... Applicability: none + ... Post-Conditions: none + Trigger the availability of new indicator value in the VNF (external action) + Check Indicator Value Change Notification Http POST Request Body Json Schema Is VnfIndicatorValueChangeNotification + Check Indicator Value Change Notification Http POST Request Body notificationType attribute Is VnfIndicatorValueChangeNotification -Post VNF Indicator Notification Negative 404 - ${json}= Get File schemas/ProblemDetails.schema.json - ${BODY}= evaluate json.loads('''${json}''') json - Log Creating mock request and response to handle VNF Indicator 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 VNF Indicator 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 VNF Indicator 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 VNF Indicator 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} - *** Keywords *** +Trigger the availability of new indicator value in the VNF (external action) + #do nothing + Log do nothing + + +Check Indicator Value Change Notification Http POST Request Body Json Schema Is + [Arguments] ${element} + ${schema}= Get File schemas/${element}.schema.json + Configure Notification Forward ${schema} ${callback_endpoint} ${callback_endpoint_fwd} + +Check Indicator Value Change Notification Http POST Request Body notificationType attribute Is + [Arguments] ${type} + Configure Notification Indicator Value Change Handler ${callback_endpoint_fwd} ${type} + Wait Until Keyword Succeeds 2 min 10 sec Verify Mock Expectation ${notification_request} + Clear Requests ${callback_endpoint} + Clear Requests ${callback_endpoint_fwd} + +Configure Notification Indicator Value Change Handler + [Arguments] ${endpoint} ${type} + ${json}= evaluate {} + set to dictionary ${json} notificationType ${type} + ${BODY}= evaluate json.dumps(${json}) json + Log Creating mock request and response to handle status notification + &{notification_request}= Create Mock Request Matcher POST ${endpoint} body_type="JSON" body=${BODY} + &{notification_response}= Create Mock Response headers="Content-Type: application/json" status_code=204 + Create Mock Expectation ${notification_request} ${notification_response} + +Configure Notification Forward + [Arguments] ${schema} ${endpoint} ${endpoint_fwd} + Log Creating mock Http POST forward to handle ${schema} + &{notification_tmp}= Create Mock Request Matcher POST ${endpoint} body_type="JSON_SCHEMA" body=${schema} + &{notification_fwd}= Create Mock Http Forward ${endpoint_fwd} + Create Mock Expectation With Http Forward ${notification_tmp} ${notification_fwd} + Create Sessions - Start Process java -jar ${MOCK_SERVER_JAR} -serverPort ${callback_port} alias=mockInstance + 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} - \ No newline at end of file + Create Mock Session ${callback_uri}:${callback_port} \ No newline at end of file diff --git a/SOL002/VNFIndicatorNotification-API/environment/variables.txt b/SOL002/VNFIndicatorNotification-API/environment/variables.txt index 5820ea0b376bfaec4cc9d318d91a9c588cac559d..ad6eeadd74ce12230b7ec31dff825c9d9a40f711 100644 --- a/SOL002/VNFIndicatorNotification-API/environment/variables.txt +++ b/SOL002/VNFIndicatorNotification-API/environment/variables.txt @@ -2,6 +2,13 @@ ${callback_uri} http://localhost ${callback_port} 9091 ${callback_endpoint} /endpoint +${callback_endpoint_fwd} /endpoint/check ${callback_endpoint_error} /endpoint_404 ${sleep_interval} 20s -${MOCK_SERVER_JAR} ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar \ No newline at end of file +${total_polling_time} 2 min +${polling_interval} 10 sec + +${notification_request} [] +${notification_response} [] + +${MOCK_SERVER_JAR} ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar diff --git a/SOL003/VNFIndicator-API/VnfIndicatorNotification.robot b/SOL003/VNFIndicator-API/VnfIndicatorNotification.robot index 48b1c901133f54bda7c6a1839ed6c05bad081834..c9b359d537b7fd55c109eff1e3cd36ff9378f578 100644 --- a/SOL003/VNFIndicator-API/VnfIndicatorNotification.robot +++ b/SOL003/VNFIndicator-API/VnfIndicatorNotification.robot @@ -11,73 +11,56 @@ Library String *** Test Cases *** -Post VNF Indicator Notification - ${json}= Get File schemas/VnfIndicatorValueChangeNotification.schema.json - ${BODY}= evaluate json.loads('''${json}''') json - Log Creating mock request and response to handle VNF Indicator 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} - Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} +VNF Indicator Value Change Notification + [Documentation] Test ID: 7.3.6.6.1 + ... Test title: VNF Indicator Value Change Notification + ... Test objective: The objective is to test the dispatch of VNF Indicator Value Change Notification when new indicator values are available in the VNFM, and perform a JSON schema and content validation of the delivered notification + ... Pre-conditions: A VNF is instantiated, and a subscription for indicator value change notifications is available in the VNFM. + ... Reference: section 8.4.7.3.1 - SOL003 v2.4.1 + ... Config ID: Config_prod_VNFM + ... Applicability: none + ... Post-Conditions: none + Trigger the availability of new indicator value in the VNFM (external action) + Check Indicator Value Change Notification Http POST Request Body Json Schema Is VnfIndicatorValueChangeNotification + Check Indicator Value Change Notification Http POST Request Body notificationType attribute Is VnfIndicatorValueChangeNotification -Post VNF Indicator Notification Negative 404 - ${json}= Get File schemas/ProblemDetails.schema.json - ${BODY}= evaluate json.loads('''${json}''') json - Log Creating mock request and response to handle VNF Indicator 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} - Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - - - -Put VNF Indicator 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} - Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - - -Patch VNF Indicator 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} - Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - - -Delete VNF Indicator Notification - Log DELETE Method not implemented - &{req}= Create Mock Request Matcher DELETE ${callback_endpoint} - &{rsp}= Create Mock Response status_code=405 - Create Mock Expectation ${req} ${rsp} - Wait Until Keyword Succeeds ${total_polling_time} ${polling_interval} Verify Mock Expectation ${req} - Log Verifying results - Verify Mock Expectation ${req} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} - *** Keywords *** +Trigger the availability of new indicator value in the VNFM (external action) + #do nothing + Log do nothing + + +Check Indicator Value Change Notification Http POST Request Body Json Schema Is + [Arguments] ${element} + ${schema}= Get File schemas/${element}.schema.json + Configure Notification Forward ${schema} ${callback_endpoint} ${callback_endpoint_fwd} + +Check Indicator Value Change Notification Http POST Request Body notificationType attribute Is + [Arguments] ${type} + Configure Notification Indicator Value Change Handler ${callback_endpoint_fwd} ${type} + Wait Until Keyword Succeeds 2 min 10 sec Verify Mock Expectation ${notification_request} + Clear Requests ${callback_endpoint} + Clear Requests ${callback_endpoint_fwd} + +Configure Notification Indicator Value Change Handler + [Arguments] ${endpoint} ${type} + ${json}= evaluate {} + set to dictionary ${json} notificationType ${type} + ${BODY}= evaluate json.dumps(${json}) json + Log Creating mock request and response to handle status notification + &{notification_request}= Create Mock Request Matcher POST ${endpoint} body_type="JSON" body=${BODY} + &{notification_response}= Create Mock Response headers="Content-Type: application/json" status_code=204 + Create Mock Expectation ${notification_request} ${notification_response} + +Configure Notification Forward + [Arguments] ${schema} ${endpoint} ${endpoint_fwd} + Log Creating mock Http POST forward to handle ${schema} + &{notification_tmp}= Create Mock Request Matcher POST ${endpoint} body_type="JSON_SCHEMA" body=${schema} + &{notification_fwd}= Create Mock Http Forward ${endpoint_fwd} + Create Mock Expectation With Http Forward ${notification_tmp} ${notification_fwd} + Create Sessions - Start Process java -jar ${MOCK_SERVER_JAR} -serverPort ${callback_port} alias=mockInstance + 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 + Create Mock Session ${callback_uri}:${callback_port} \ No newline at end of file diff --git a/SOL003/VNFIndicator-API/environment/variables.txt b/SOL003/VNFIndicator-API/environment/variables.txt index 6fe8d3117d49640b672d112f2ac0d3ede582589a..5949e3c1705175a263265b4d48ded922513de472 100644 --- a/SOL003/VNFIndicator-API/environment/variables.txt +++ b/SOL003/VNFIndicator-API/environment/variables.txt @@ -20,10 +20,16 @@ ${VNFM_ALLOWS_DUPLICATE_SUBS} 1 ${response} +${callback_uri} http://localhost ${callback_port} 9091 -${callback_uri} http://172.22.1.7:${callback_port} -${callback_endpoint} /vnfind/subscriptions -${callback_endpoint_error} /subs_404 +${callback_endpoint} /endpoint +${callback_endpoint_fwd} /endpoint/check +${callback_endpoint_error} /endpoint_404 +${sleep_interval} 20s ${total_polling_time} 2 min ${polling_interval} 10 sec + +${notification_request} [] +${notification_response} [] + ${MOCK_SERVER_JAR} ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar \ No newline at end of file