From 1c47a04e15de8f95df6b7c98f3e43e9c32e0bd0e Mon Sep 17 00:00:00 2001 From: Abbas Ahmad Date: Thu, 7 Mar 2019 17:30:22 +0100 Subject: [PATCH] SOL005 NSFM Notification Endpoint added. Closes NSFaultManagement-API --- .../IndividualSubscription.robot | 2 +- .../NSFMOperationKeywords.robot | 95 ++++++++++++++++-- .../NotificationEndpoint.robot | 97 +++++++++++++++++++ .../environment/variables.txt | 5 + 4 files changed, 190 insertions(+), 9 deletions(-) create mode 100644 SOL005/NSFaultManagement-API/NotificationEndpoint.robot diff --git a/SOL005/NSFaultManagement-API/IndividualSubscription.robot b/SOL005/NSFaultManagement-API/IndividualSubscription.robot index 9878321d..1f49c0ca 100644 --- a/SOL005/NSFaultManagement-API/IndividualSubscription.robot +++ b/SOL005/NSFaultManagement-API/IndividualSubscription.robot @@ -64,7 +64,7 @@ DELETE an individual subscription [Documentation] Test ID: 8.4.5.5 ... Test title:DELETE an individual subscription ... Test objective: The objective is to DELETE an individual subscription - ... Pre-conditions: Subsbcription already exists + ... Pre-conditions: The Subsbcription already exists ... Reference: section 8.4.5 - SOL005 v2.4.1 ... Config ID: ... Applicability: diff --git a/SOL005/NSFaultManagement-API/NSFMOperationKeywords.robot b/SOL005/NSFaultManagement-API/NSFMOperationKeywords.robot index 220da8a6..58a27927 100644 --- a/SOL005/NSFaultManagement-API/NSFMOperationKeywords.robot +++ b/SOL005/NSFaultManagement-API/NSFMOperationKeywords.robot @@ -4,9 +4,16 @@ Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} Library JSONLibrary Library JSONSchemaLibrary schemas/ Library OperatingSystem - +Suite Teardown Terminate All Processes kill=true +Library MockServerLibrary +Library Process *** Keywords *** +Create Sessions + Start Process java -jar ../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar -serverPort ${callback_port} alias=mockInstance + Wait For Process handle=mockInstance timeout=5s on_timeout=continue + Create Mock Session ${callback_uri}:${callback_port} #The API producer is set to NFVO according to SOL002-7.3.4 + Check Individual Subscription existance Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} @@ -35,6 +42,14 @@ Check HTTP Response Header ContentType is Should Be Equal ${response[0]['headers']['Content-Type']} ${expected_contentType} Log Content Type validated +Check Alarm notification Endpoint has been delivered + Log Verifying results + Wait Until Keyword Succeeds ${sleep_interval} Verify Mock Expectation ${req_mock} + +Clean Endpoint + Log Cleaning the endpoint + Clear Requests ${callback_endpoint} + Do POST Alarms log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} @@ -58,7 +73,6 @@ Do PUT Alarms Put ${apiRoot}/${apiName}/${apiVersion}/alarms ${outputResponse}= Output response Set Global Variable @{response} ${outputResponse} - Do DELETE Alarms log Trying to perform a DELETE. This method should not be implemented @@ -149,7 +163,6 @@ Do PATCH Individual Alarm ${outputResponse}= Output response Set Global Variable @{response} ${outputResponse} - Do PATCH Individual Alarm Conflict log Trying to perform a PATCH. This method modifies an individual alarm resource Set Headers {"Accept":"${ACCEPT}"} @@ -185,8 +198,7 @@ Do GET Subscriptions with filter Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization": "${AUTHORIZATION}"} GET ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter} ${outputResponse}= Output response - Set Global Variable @{response} ${outputResponse} - + Set Global Variable @{response} ${outputResponse} Do GET Subscriptions with Invalid filter Log Get the list of active subscriptions using an invalid filter @@ -228,15 +240,13 @@ Do POST Individual Subscription ${outputResponse}= Output response Set Global Variable @{response} ${outputResponse} - Do GET Individual Subscription log Trying to get information about an individual subscription Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} Get ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} ${outputResponse}= Output response - Set Global Variable @{response} ${outputResponse} - + Set Global Variable @{response} ${outputResponse} Do PUT Individual Subscription log Trying to perform a PUT. This method should not be implemented @@ -261,3 +271,72 @@ Do DELETE Individual Subscription Delete ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} ${outputResponse}= Output response Set Global Variable @{response} ${outputResponse} + + +Do POST Alarm Notification Endpoint + log The POST method delivers a notification - Information of a NFVO alarm. + ${json}= Get File schemas/alarmNotification.schema.json + ${BODY}= evaluate json.loads('''${json}''') json + Log Creating mock request and response to handle alarmNotification + &{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} + Set Global Variable @{req_mock} ${req} + Set Global Variable @{resp_mock} ${rsp} + +Do POST Alarm Clearance Notification Endpoint + log The POST method delivers a notification - Information of a NFVO alarm. + ${json}= Get File schemas/alarmClearedNotification.schema.json + ${BODY}= evaluate json.loads('''${json}''') json + Log Creating mock request and response to handle alarmNotification + &{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} + Set Global Variable @{req_mock} ${req} + Set Global Variable @{resp_mock} ${rsp} + +Do POST Alarm List Rebuilt Notification Endpoint + log The POST method delivers a notification - Information of a NFVO alarm. + ${json}= Get File schemas/alarmListRebuiltNotification.schema.json + ${BODY}= evaluate json.loads('''${json}''') json + Log Creating mock request and response to handle alarmNotification + &{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} + Set Global Variable @{req_mock} ${req} + Set Global Variable @{resp_mock} ${rsp} + +Do GET Notification Endpoint + log The GET method allows the server to test the 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} + Set Global Variable @{req_mock} ${req} + Set Global Variable @{resp_mock} ${rsp} + +Do PUT 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} + +Do PATCH 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} + +Do DELETE 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} + Sleep ${sleep_interval} + Log Verifying results + Verify Mock Expectation ${req} \ No newline at end of file diff --git a/SOL005/NSFaultManagement-API/NotificationEndpoint.robot b/SOL005/NSFaultManagement-API/NotificationEndpoint.robot new file mode 100644 index 00000000..c9b769fc --- /dev/null +++ b/SOL005/NSFaultManagement-API/NotificationEndpoint.robot @@ -0,0 +1,97 @@ +*** Settings *** +Resource environment/variables.txt +Resource NSFMOperationKeywords.robot +Suite Teardown Terminate All Processes kill=true +Library MockServerLibrary +Library Process +Library OperatingSystem +Suite Setup Create Sessions + +*** Test Cases *** +Deliver a notification - Alarm + [Documentation] Test ID: 8.4.6.2-1 + ... Test title: Deliver a notification - Alarm + ... Test objective: The objective is to notify a NFVO alarm or that the alarm list has been rebuilt. + ... Pre-conditions: The NFVO has subscribed to the NSFM alarm + ... Reference: section 8.4.6 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do POST Alarm Notification Endpoint + Check Alarm notification Endpoint has been delivered + Clean Endpoint + +Deliver a notification - Alarm Clearance + [Documentation] Test ID: 8.4.6.2-2 + ... Test title: Deliver a notification - Alarm Clearance + ... Test objective: The objective is to notify a NFVO alarm or that the alarm list has been rebuilt. + ... Pre-conditions: The NFVO has subscribed to the NSFM alarm + ... Reference: section 8.4.6 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do POST Alarm Clearance Notification Endpoint + Check Alarm notification Endpoint has been delivered + Clean Endpoint + +Deliver a notification - Alarm List Rebuilt + [Documentation] Test ID: 8.4.6.2-3 + ... Test title: Deliver a notification - Alarm List Rebuilt + ... Test objective: The objective is to notify a NFVO alarm or that the alarm list has been rebuilt. + ... Pre-conditions: The NFVO has subscribed to the NSFM alarm + ... Reference: section 8.4.6 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do POST Alarm List Rebuilt Notification Endpoint + Check Alarm notification Endpoint has been delivered + Clean Endpoint + +Test a notification end point + [Documentation] Test ID: 8.4.6.3 + ... Test title: Test a notification end point + ... Test objective: The objective is to allow the server to test the notification endpoint that is provided by the client, e.g. during subscription + ... Pre-conditions: + ... Reference: section 8.4.6 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do GET Notification Endpoint + Check Alarm notification Endpoint has been delivered + Clean Endpoint + +PUT notification - Method not implemented + [Documentation] Test ID: 8.4.6.4 + ... Test title: PUT notification - Method not implemented + ... Test objective: The objective is to PUT a notification endpoint. The method should not be implemented + ... Pre-conditions: + ... Reference: section 8.4.6 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do PUT Notification + Clean Endpoint + +PATCH notification - Method not implemented + [Documentation] Test ID: 8.4.6.5 + ... Test title: PATCH notification - Method not implemented + ... Test objective: The objective is to PATCH a notification endpoint. The method should not be implemented + ... Pre-conditions: + ... Reference: section 8.4.6 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do PATCH Notification + Clean Endpoint + +DELETE notification - Method not implemented + [Documentation] Test ID: 8.4.6.6 + ... Test title: DELETE notification - Method not implemented + ... Test objective: The objective is to DELETE a notification endpoint. The method should not be implemented + ... Pre-conditions: + ... Reference: section 8.4.6 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do DELETE Notification + Clean Endpoint \ No newline at end of file diff --git a/SOL005/NSFaultManagement-API/environment/variables.txt b/SOL005/NSFaultManagement-API/environment/variables.txt index 69b955eb..f13d6bfe 100644 --- a/SOL005/NSFaultManagement-API/environment/variables.txt +++ b/SOL005/NSFaultManagement-API/environment/variables.txt @@ -39,3 +39,8 @@ ${AlarmClearedNotification} {} ${AlarmListRebuiltNotification} {} ${response} {} + +&{req_mock} {} +&{resp_mock} {} + + -- GitLab