From 7fbe0ec21d12a06cca83c03ea8421824ba5412cd Mon Sep 17 00:00:00 2001 From: Abbas Ahmad Date: Fri, 1 Mar 2019 17:51:10 +0100 Subject: [PATCH] Added Modifications to alarm List + Added Individual Alarm Tests + update OperationKeywords File. --- SOL005/NSFaultManagement-API/Alarms.robot | 2 +- .../IndividualAlarm.robot | 116 ++++++++++++++++++ .../NSFMOperationKeywords.robot | 101 +++++++++++++-- .../environment/variables.txt | 1 + .../jsons/alarmModifications.json | 3 + .../schemas/ProblemDetails.schema.json | 34 +++++ 6 files changed, 246 insertions(+), 11 deletions(-) create mode 100644 SOL005/NSFaultManagement-API/IndividualAlarm.robot create mode 100644 SOL005/NSFaultManagement-API/jsons/alarmModifications.json create mode 100644 SOL005/NSFaultManagement-API/schemas/ProblemDetails.schema.json diff --git a/SOL005/NSFaultManagement-API/Alarms.robot b/SOL005/NSFaultManagement-API/Alarms.robot index 9ea4d502..18354e9a 100644 --- a/SOL005/NSFaultManagement-API/Alarms.robot +++ b/SOL005/NSFaultManagement-API/Alarms.robot @@ -20,7 +20,7 @@ POST Alarms - Method not implemented Check HTTP Response Status Code Is 405 Get information about multiple alarms - [Documentation] Test ID: 8.4.2.2 + [Documentation] Test ID: 8.4.2.2-1 ... Test title: Get information about multiple alarms ... Test objective: The objective is to retrieve information about the alarm list ... Pre-conditions: diff --git a/SOL005/NSFaultManagement-API/IndividualAlarm.robot b/SOL005/NSFaultManagement-API/IndividualAlarm.robot new file mode 100644 index 00000000..b7db7a34 --- /dev/null +++ b/SOL005/NSFaultManagement-API/IndividualAlarm.robot @@ -0,0 +1,116 @@ +*** Settings *** +# Suite setup Expect spec SOL003-VNFLifecycleManagement-API.yaml +Resource environment/variables.txt +Resource NSFMOperationKeywords.robot +Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT} +Library JSONLibrary +Library JSONSchemaLibrary schemas/ +Library OperatingSystem +Library DependencyLibrary + +*** Test Cases *** +POST Individual Alarm - Method not implemented + [Documentation] Test ID: 8.4.3.1 + ... Test title:POST Individual Alarm - Method not implemented + ... Test objective: The objective is to post alarms + ... Pre-conditions: + ... Reference: section 8.4.3 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do POST Individual Alarm + Check HTTP Response Status Code Is 405 + +GET information about Individual Alarm + [Documentation] Test ID: 8.4.3.2-1 + ... Test title: GET information about Individual Alarm + ... Test objective: The objective is to read an individual alarm. + ... Pre-conditions: The related alarm exists + ... Reference: section 8.4.3 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do GET Individual Alarm + Check HTTP Response Status Code Is 200 + Check HTTP Response Header ContentType is ${CONTENT_TYPE} + Check HTTP Response Body Json Schema Is alarm.schema.json + +GET information about Invalid Individual Alarm + [Documentation] Test ID: 8.4.3.2-2 + ... Test title: GET information about Invalid Individual Alarm + ... Test objective: The objective is to read an Invalid individual alarm. + ... Pre-conditions: The related alarm does not exists + ... Reference: section 8.4.3 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do GET Invalid Individual Alarm + Check HTTP Response Status Code Is 404 + + +PUT Individual Alarm - Method not implemented + [Documentation] Test ID: 8.4.3.3 + ... Test title:PUT Individual Alarm - Method not implemented + ... Test objective: The objective is to post alarms + ... Pre-conditions: + ... Reference: section 8.4.3 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do PUT Individual Alarm + Check HTTP Response Status Code Is 405 + +PATCH Alarm + [Documentation] Test ID: 8.4.3.4-1 + ... Test title: Modify an individual alarm resource + ... Test objective: The objective is to Modify an individual alarm resource + ... Pre-conditions: The related alarm exists + ... Reference: section 8.4.3 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do PATCH Individual Alarm + Check HTTP Response Status Code Is 200 + Check HTTP Response Header ContentType is ${CONTENT_TYPE} + Check HTTP Response Body Json Schema Is alarmModifications.schema.json + +PATCH Alarm - Conflict + [Documentation] Test ID: 8.4.3.4-2 + ... Test title: Modify an individual alarm resource - Conflict + ... Test objective: The objective is to Modify an individual alarm resource + ... Pre-conditions: The related alarm exists + ... Reference: section 8.4.3 - SOL002 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: The alarm resource is not modified + Depends On Test PATCH Alarm # If the previous test scceeded, it means that the alarm is in ackownledged state + Do PATCH Individual Alarm + Check HTTP Response Status Code Is 409 + Check HTTP Response Body Json Schema Is ProblemDetails.schema.json + + +PATCH Alarm - Precondition failed + [Documentation] Test ID: 8.4.3.4-3 + ... Test title: Modify an individual alarm resource - Precondition failed + ... Test objective: The objective is to Modify an individual alarm resource + ... Pre-conditions: The related alarm exists + ... Reference: section 8.4.3 - SOL005 v2.4.1 + ... Config ID: Config_prod_VNFM + ... Applicability: + ... Post-Conditions: The alarm resource is not modified + Depends On Test PATCH Alarm # If the previous test scceeded, it means that Etag has been modified + Do PATCH Individual Alarm Conflict + Check HTTP Response Status Code Is 412 + Check HTTP Response Body Json Schema Is ProblemDetails.schema.json + +DELETE Individual Alarm - Method not implemented + [Documentation] Test ID: 8.4.3.5 + ... Test title:DELETE Individual Alarm - Method not implemented + ... Test objective: The objective is to post alarms + ... Pre-conditions: + ... Reference: section 8.4.3 - SOL005 v2.4.1 + ... Config ID: + ... Applicability: + ... Post-Conditions: + Do DELETE Individual Alarm + Check HTTP Response Status Code Is 405 diff --git a/SOL005/NSFaultManagement-API/NSFMOperationKeywords.robot b/SOL005/NSFaultManagement-API/NSFMOperationKeywords.robot index 87af3aa7..9acf1536 100644 --- a/SOL005/NSFaultManagement-API/NSFMOperationKeywords.robot +++ b/SOL005/NSFaultManagement-API/NSFMOperationKeywords.robot @@ -15,7 +15,7 @@ Check HTTP Response Status Code Is Check HTTP Response Header Contains [Arguments] ${CONTENT_TYPE} - Should Contain ${response.headers} ${CONTENT_TYPE} + Should Contain ${response[0]['headers']} ${CONTENT_TYPE} Log Header is present Check HTTP Response Body Json Schema Is @@ -30,48 +30,129 @@ Check HTTP Response Header ContentType is Log Content Type validated Do POST Alarms - log Trying to perform a PUT. This method should not be implemented + log Trying to perform a POST. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} Post ${apiRoot}/${apiName}/${apiVersion}/alarms - ${outputResponse}= Output Response + ${outputResponse}= Output response Set Global Variable @{response} ${outputResponse} Do PATCH Alarms log Trying to perform a PATCH. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - ${response} = Patch ${apiRoot}/${apiName}/${apiVersion}/alarms + Patch ${apiRoot}/${apiName}/${apiVersion}/alarms + ${outputResponse} = Output response + Set Global Variable @{response} ${outputResponse} Do PUT Alarms log Trying to perform a PUT. This method should not be implemented Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - ${response} = Put ${apiRoot}/${apiName}/${apiVersion}/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 Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} - ${response} = Delete ${apiRoot}/${apiName}/${apiVersion}/alarms + Delete ${apiRoot}/${apiName}/${apiVersion}/alarms + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} Do GET Alarms Log Query NFVO The GET method queries information about multiple alarms. Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} Log Execute Query - ${response} = Get ${apiRoot}/${apiName}/${apiVersion}/alarms + Get ${apiRoot}/${apiName}/${apiVersion}/alarms + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} - Do GET Alarms With Filters +Do GET Alarms With Filters Log Query NFVO The GET method queries information about multiple alarms with filters. Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} Log Execute Query - ${response} = Get ${apiRoot}/${apiName}/${apiVersion}/alarms?${alarm_filter}=${nsInstanceId} + Get ${apiRoot}/${apiName}/${apiVersion}/alarms?${alarm_filter}=${nsInstanceId} + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} Do GET Alarms With Invalid Filters Log Query NFVO The GET method queries information about multiple alarms with filters. Set Headers {"Accept":"${ACCEPT}"} Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} Log Execute Query - ${response} = Get ${apiRoot}/${apiName}/${apiVersion}/alarms?${invalid_alarm_filter}=${Id} \ No newline at end of file + Get ${apiRoot}/${apiName}/${apiVersion}/alarms?${invalid_alarm_filter}=${nsInstanceId} + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} + +Do POST Individual Alarm + log Trying to perform a PUT. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Post ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId} + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} + +Do DELETE Individual Alarm + log Trying to perform a DELETE. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Delete ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId} + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} + +Do PUT Individual Alarm + log Trying to perform a PUT. This method should not be implemented + Set Headers {"Accept":"${ACCEPT}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Put ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId} + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} + +Do GET Individual Alarm + Log Query NFVO The GET method queries information about an alarm. + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Log Execute Query + Get ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId} + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} + +Do GET Invalid Individual Alarm + Log Query NFVO The GET method queries information about an invalid alarm. Should return does not exist + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + Log Execute Query + Get ${apiRoot}/${apiName}/${apiVersion}/alarms/${invalidAlarmId} + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} + +Do PATCH Individual Alarm + log Trying to perform a PATCH. This method modifies an individual alarm resource + Set Headers {"Accept":"${ACCEPT}"} + Set Headers {"Content-Type": "${CONTENT_TYPE_PATCH}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File jsons/alarmModifications.json + Patch ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId} ${body} + ${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}"} + Set Headers {"Content-Type": "${CONTENT_TYPE_PATCH}"} + Set Headers {"If-Match": "${Etag}"} + Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"} + ${body}= Get File jsons/alarmModifications.json + Patch ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId} ${body} + ${outputResponse}= Output response + Set Global Variable @{response} ${outputResponse} + + \ No newline at end of file diff --git a/SOL005/NSFaultManagement-API/environment/variables.txt b/SOL005/NSFaultManagement-API/environment/variables.txt index 9f6537e6..69b955eb 100644 --- a/SOL005/NSFaultManagement-API/environment/variables.txt +++ b/SOL005/NSFaultManagement-API/environment/variables.txt @@ -16,6 +16,7 @@ ${CONTENT_TYPE} application/json ${NFVO_DUPLICATION} 0 ${alarmId} 6fc3539c-e602-4afa-8e13-962fb5a7d81d +${invalidAlarmId} invalidAlramID ${Etag}= an etag ${Etag_modified}= a modified etag ${CONTENT_TYPE_PATCH} application/merge-patch+json diff --git a/SOL005/NSFaultManagement-API/jsons/alarmModifications.json b/SOL005/NSFaultManagement-API/jsons/alarmModifications.json new file mode 100644 index 00000000..89f6d32b --- /dev/null +++ b/SOL005/NSFaultManagement-API/jsons/alarmModifications.json @@ -0,0 +1,3 @@ +{ + "ackState": "ACKNOWLEDGED" +} \ No newline at end of file diff --git a/SOL005/NSFaultManagement-API/schemas/ProblemDetails.schema.json b/SOL005/NSFaultManagement-API/schemas/ProblemDetails.schema.json new file mode 100644 index 00000000..cb8cecc4 --- /dev/null +++ b/SOL005/NSFaultManagement-API/schemas/ProblemDetails.schema.json @@ -0,0 +1,34 @@ +{ + "definitions": {}, + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "description": "The definition of the general \"ProblemDetails\" data structure from IETF RFC 7807 [19] is reproduced inthis structure. Compared to the general framework defined in IETF RFC 7807 [19], the \"status\" and \"detail\" attributes are mandated to be included by the present document, to ensure that the response contains additional textual information about an error. IETF RFC 7807 [19] foresees extensibility of the \"ProblemDetails\" type. It is possible that particular APIs in the present document, or particular implementations, define extensions to define additional attributes that provide more information about the error. The description column only provides some explanation of the meaning to Facilitate understanding of the design. For a full description, see IETF RFC 7807 [19].\n", + "properties": { + "type": { + "type": "string", + "description": "A URI reference according to IETF RFC 3986 [5] that identifies the problem type. It is encouraged that the URI provides human-readable documentation for the problem (e.g. using HTML) when dereferenced. When this member is not present, its value is assumed to be \"about:blank\".\n", + "format": "URI" + }, + "title": { + "type": "string", + "description": "A short, human-readable summary of the problem type. It should not change from occurrence to occurrence of the problem, except for purposes of localization. If type is given and other than \"about:blank\", this attribute shall also be provided. A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization (e.g., using proactive content negotiation; see [RFC7231], Section 3.4).\n" + }, + "status": { + "type": "integer", + "description": "The HTTP status code for this occurrence of the problem. The HTTP status code ([RFC7231], Section 6) generated by the origin server for this occurrence of the problem.\n" + }, + "detail": { + "type": "string", + "description": "A human-readable explanation specific to this occurrence of the problem.\n" + }, + "instance": { + "type": "string", + "description": "A URI reference that identifies the specific occurrence of the problem. It may yield further information if dereferenced.\n", + "format": "URI" + } + }, + "required": [ + "status", + "detail" + ] +} \ No newline at end of file -- GitLab