From 2dfe635c265ec39c68702e359dc8001b599848d4 Mon Sep 17 00:00:00 2001 From: hammad zafar Date: Wed, 24 Mar 2021 13:00:29 +0500 Subject: [PATCH 1/2] NotificationEndpoint.robot resource updated --- .../NotificationEndpoint.robot | 115 +++++------- .../environment/variables.txt | 3 + .../jsons/VrQuotaAvailNotification.json | 1 - .../VrQuotaAvailNotification.schema.json | 8 + .../VrQuotaAvailSubscription.schema.json | 84 ++++++++- .../VrQuotaAvailSubscriptions.schema.json | 168 +++++++++--------- .../vrQuotaAvailNotification.schema.json | 0 7 files changed, 225 insertions(+), 154 deletions(-) create mode 100644 SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailNotification.schema.json delete mode 100644 SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/vrQuotaAvailNotification.schema.json diff --git a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/NotificationEndpoint.robot b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/NotificationEndpoint.robot index 9d81b4580..60af974de 100644 --- a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/NotificationEndpoint.robot +++ b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/NotificationEndpoint.robot @@ -1,83 +1,62 @@ *** Settings *** Resource environment/variables.txt -Resource VRQANOperationKeywords.robot Suite Setup Create Sessions Suite Teardown Terminate All Processes kill=true Library MockServerLibrary Library Process Library OperatingSystem - -*** Variables *** - +Library Collections *** Test Cases *** -Deliver a notification - Vr Quota Availibility - [Documentation] Test ID: 11.4.4.1 - ... Test title: Deliver a notification - Vr Quota Availibility - ... Test objective: The objective is to notify related to the availability of the virtualised resources quota. - ... Pre-conditions: The VNF has subscribed to the Vr Quota Availibility resource - ... Reference: Clause 11.4.4 - ETSI GS NFV-SOL 003 [1] v2.7.1 +Virtual Quota Available Notification + [Documentation] Test ID: 7.3.7.5.1 + ... Test title: Virtual Quota Available Notification + ... Test objective: The objective is to test the dispatch of Virtual Quota Available Notification, and perform a JSON schema and content validation of the delivered notification. The action that triggers the notification under test is an explicit test step, but it is not performed by the test system. + ... Pre-conditions: A subscription for Virtual Quota Available Notification is available in the VNFM. + ... Reference: Clause 11.4.4.3.1 - ETSI GS NFV-SOL 003 [1] v2.7.1 ... Config ID: Config_prod_VNFM - ... Applicability: - ... Post-Conditions: - log The POST method delivers a notification from the server to the client. - ${json}= Get File schemas/VrQuotaAvailNotification.schema.json - ${BODY}= evaluate json.loads('''${json}''') json - Log Creating mock request and response to handle Vr Quota AvailibilityNotification - &{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} - -Test a notification end point - 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} - Sleep ${sleep_interval} - Verify Mock Expectation ${req} - Clear Requests ${callback_endpoint} - -PUT notification - Method not implemented - 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 subscriptions - Method not implemented - 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} + ... Applicability: none + ... Post-Conditions: none + Trigger a dispatch of virtual quota available notification (external action) + Check Virtual Quota Available Notification Http POST Request Body Json Schema Is VrQuotaAvailNotification + Check Virtual Quota Available Notification Http POST Request Body notificationType attribute Is VrQuotaAvailNotification + +*** Keywords *** -DELETE subscriptions - Method not implemented - 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} - Log Cleaning the endpoint - Clear Requests ${callback_endpoint} +Trigger a dispatch of virtual quota available notification (external action) + #do nothing + Log do nothing + +Check Virtual Quota Available 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 Virtual Quota Available Notification Http POST Request Body notificationType attribute Is + [Arguments] ${type} + Configure Virtual Quota Available Notification 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 Virtual Quota Available Notification 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} -*** Keywords *** 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} - + Create Mock Session ${callback_uri}:${callback_port} diff --git a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/environment/variables.txt b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/environment/variables.txt index a705ad751..3a90362a0 100644 --- a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/environment/variables.txt +++ b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/environment/variables.txt @@ -15,11 +15,14 @@ ${sub_filter} filter ${sub_filter_invalid} filter_invalid ${callback_endpoint} /notification +${callback_endpoint_fwd} /endpoint/check ${callback_subscribe} /subscribe ${callback_port} 9091 ${callback_uri} http://localhost ${sleep_interval} 20s +${notification_request} [] +${notification_response} [] ${apiRoot} / ${apiName} vrqan diff --git a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/jsons/VrQuotaAvailNotification.json b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/jsons/VrQuotaAvailNotification.json index e24fb8108..7cab6f283 100644 --- a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/jsons/VrQuotaAvailNotification.json +++ b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/jsons/VrQuotaAvailNotification.json @@ -1,4 +1,3 @@ - {{ "id":"", "notificationType":"VrQuotaAvailNotification", diff --git a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailNotification.schema.json b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailNotification.schema.json new file mode 100644 index 000000000..31a1800bb --- /dev/null +++ b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailNotification.schema.json @@ -0,0 +1,8 @@ +{ + "id":"", + "notificationType":"VrQuotaAvailNotification", + "subscriptionId": "", + "timeStamp":"", + "resourceGroupId":"", + "_links": "" +} \ No newline at end of file diff --git a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailSubscription.schema.json b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailSubscription.schema.json index aaa9c5405..8f37c51c1 100644 --- a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailSubscription.schema.json +++ b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailSubscription.schema.json @@ -1 +1,83 @@ -{ "description": "This type represents a subscription related to notifications related to the availability of the virtualised resources quotas.\n", "type": "object", "required": [ "id", "callbackUri", "_links" ], "properties": { "id": { "description": "An identifier with the intention of being globally unique.\n", "type": "string" }, "filter": { "description": "This type represents a subscription filter related to notifications about the availability of the virtualised resources quotas. At a particular nesting level in the filter structure, the following applies: All attributes shall match in order for the filter to match (logical \"and\" between different filter attributes). If an attribute is an array, the attribute shall match if at least one of the values in the array matches (logical \"or\" between the values of one filter attribute).\n", "type": "object", "properties": { "vimIds": { "description": "Match VIMs that were created the quota for a consumer of the virtualised resources. This attribute shall only be supported when VNF-related Resource Management in direct mode is applicable.\n", "type": "array", "items": { "description": "An identifier with the intention of being globally unique.\n", "type": "string" } }, "resourceProviderIds": { "description": "Match the entities responsible for the management of the virtualised resources that were allocated by the NFVO. This attribute shall only be supported when VNF-related Resource Management in indirect mode is applicable. The identification scheme is outside the scope of the present document.\n", "type": "array", "items": { "description": "An identifier with the intention of being globally unique.\n", "type": "string" } }, "resourceTypes": { "description": "Match particular resource types.\n", "type": "array", "items": { "type": "string", "enum": [ "COMPUTE", "STORAGE", "NETWORK" ] } }, "resourceGroupIds": { "description": "Match the \"infrastructure resource groups\" that are logical groupings of the virtualised resources assigned to a tenant within an infrastructure Domain.\n", "type": "array", "items": { "description": "An identifier maintained by the VIM or other resource provider. It is expected to be unique within the VIM instance.\n", "type": "string" } } } }, "callbackUri": { "description": "String formatted according to IETF RFC 3986.\n", "type": "string" }, "_links": { "description": "Links for this resource\n", "type": "object", "required": [ "self" ], "properties": { "self": { "description": "This type represents a link to a resource.\n", "type": "object", "required": [ "href" ], "properties": { "href": { "description": "URI of the referenced resource.\n", "type": "string", "format": "url" } } } } } }} \ No newline at end of file +{ + "description": "This type represents a subscription related to notifications related to the availability of the virtualised resources quotas.\n", + "type": "object", + "required": [ + "id", + "callbackUri", + "_links" + ], + "properties": { + "id": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "filter": { + "description": "This type represents a subscription filter related to notifications about the availability of the virtualised resources quotas. At a particular nesting level in the filter structure, the following applies: All attributes shall match in order for the filter to match (logical \"and\" between different filter attributes). If an attribute is an array, the attribute shall match if at least one of the values in the array matches (logical \"or\" between the values of one filter attribute).\n", + "type": "object", + "properties": { + "vimIds": { + "description": "Match VIMs that were created the quota for a consumer of the virtualised resources. This attribute shall only be supported when VNF-related Resource Management in direct mode is applicable.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "resourceProviderIds": { + "description": "Match the entities responsible for the management of the virtualised resources that were allocated by the NFVO. This attribute shall only be supported when VNF-related Resource Management in indirect mode is applicable. The identification scheme is outside the scope of the present document.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "resourceTypes": { + "description": "Match particular resource types.\n", + "type": "array", + "items": { + "type": "string", + "enum": [ + "COMPUTE", + "STORAGE", + "NETWORK" + ] + } + }, + "resourceGroupIds": { + "description": "Match the \"infrastructure resource groups\" that are logical groupings of the virtualised resources assigned to a tenant within an infrastructure Domain.\n", + "type": "array", + "items": { + "description": "An identifier maintained by the VIM or other resource provider. It is expected to be unique within the VIM instance.\n", + "type": "string" + } + } + } + }, + "callbackUri": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + }, + "_links": { + "description": "Links for this resource\n", + "type": "object", + "required": [ + "self" + ], + "properties": { + "self": { + "description": "This type represents a link to a resource using an absolute URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailSubscriptions.schema.json b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailSubscriptions.schema.json index 8bab3d157..9ad57bc21 100644 --- a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailSubscriptions.schema.json +++ b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/VrQuotaAvailSubscriptions.schema.json @@ -1,87 +1,87 @@ { "type": "array", - "items": { - "description": "This type represents a subscription related to notifications related to the availability of the virtualised resources quotas.\n", - "type": "object", - "required": [ - "id", - "callbackUri", - "_links" - ], - "properties": { - "id": { - "description": "An identifier with the intention of being globally unique.\n", - "type": "string" - }, - "filter": { - "description": "This type represents a subscription filter related to notifications about the availability of the virtualised resources quotas. At a particular nesting level in the filter structure, the following applies: All attributes shall match in order for the filter to match (logical \"and\" between different filter attributes). If an attribute is an array, the attribute shall match if at least one of the values in the array matches (logical \"or\" between the values of one filter attribute).\n", - "type": "object", - "properties": { - "vimIds": { - "description": "Match VIMs that were created the quota for a consumer of the virtualised resources. This attribute shall only be supported when VNF-related Resource Management in direct mode is applicable.\n", - "type": "array", - "items": { - "description": "An identifier with the intention of being globally unique.\n", - "type": "string" - } - }, - "resourceProviderIds": { - "description": "Match the entities responsible for the management of the virtualised resources that were allocated by the NFVO. This attribute shall only be supported when VNF-related Resource Management in indirect mode is applicable. The identification scheme is outside the scope of the present document.\n", - "type": "array", - "items": { - "description": "An identifier with the intention of being globally unique.\n", - "type": "string" - } - }, - "resourceTypes": { - "description": "Match particular resource types.\n", - "type": "array", - "items": { - "type": "string", - "enum": [ - "COMPUTE", - "STORAGE", - "NETWORK" - ] - } - }, - "resourceGroupIds": { - "description": "Match the \"infrastructure resource groups\" that are logical groupings of the virtualised resources assigned to a tenant within an infrastructure Domain.\n", - "type": "array", - "items": { - "description": "An identifier maintained by the VIM or other resource provider. It is expected to be unique within the VIM instance.\n", - "type": "string" - } - } - } - }, - "callbackUri": { - "description": "String formatted according to IETF RFC 3986.\n", - "type": "string" - }, - "_links": { - "description": "Links for this resource\n", - "type": "object", - "required": [ - "self" - ], - "properties": { - "self": { - "description": "This type represents a link to a resource.\n", - "type": "object", - "required": [ - "href" - ], - "properties": { - "href": { - "description": "URI of the referenced resource.\n", - "type": "string", - "format": "url" - } - } - } - } - } - } + "items": + { + "description": "This type represents a subscription related to notifications related to the availability of the virtualised resources quotas.\n", + "type": "object", + "required": [ + "id", + "callbackUri", + "_links" + ], + "properties": { + "id": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + }, + "filter": { + "description": "This type represents a subscription filter related to notifications about the availability of the virtualised resources quotas. At a particular nesting level in the filter structure, the following applies: All attributes shall match in order for the filter to match (logical \"and\" between different filter attributes). If an attribute is an array, the attribute shall match if at least one of the values in the array matches (logical \"or\" between the values of one filter attribute).\n", + "type": "object", + "properties": { + "vimIds": { + "description": "Match VIMs that were created the quota for a consumer of the virtualised resources. This attribute shall only be supported when VNF-related Resource Management in direct mode is applicable.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "resourceProviderIds": { + "description": "Match the entities responsible for the management of the virtualised resources that were allocated by the NFVO. This attribute shall only be supported when VNF-related Resource Management in indirect mode is applicable. The identification scheme is outside the scope of the present document.\n", + "type": "array", + "items": { + "description": "An identifier with the intention of being globally unique.\n", + "type": "string" + } + }, + "resourceTypes": { + "description": "Match particular resource types.\n", + "type": "array", + "items": { + "type": "string", + "enum": [ + "COMPUTE", + "STORAGE", + "NETWORK" + ] + } + }, + "resourceGroupIds": { + "description": "Match the \"infrastructure resource groups\" that are logical groupings of the virtualised resources assigned to a tenant within an infrastructure Domain.\n", + "type": "array", + "items": { + "description": "An identifier maintained by the VIM or other resource provider. It is expected to be unique within the VIM instance.\n", + "type": "string" + } + } + } + }, + "callbackUri": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + }, + "_links": { + "description": "Links for this resource\n", + "type": "object", + "required": [ + "self" + ], + "properties": { + "self": { + "description": "This type represents a link to a resource using an absolute URI.\n", + "type": "object", + "required": [ + "href" + ], + "properties": { + "href": { + "description": "String formatted according to IETF RFC 3986.\n", + "type": "string" + } + } + } + } + } + } } -} +} \ No newline at end of file diff --git a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/vrQuotaAvailNotification.schema.json b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/schemas/vrQuotaAvailNotification.schema.json deleted file mode 100644 index e69de29bb..000000000 -- GitLab From 3c9a10ec2243ff7831318d499849764d3a76e7b8 Mon Sep 17 00:00:00 2001 From: Giacomo Bernini Date: Wed, 24 Mar 2021 10:10:57 +0100 Subject: [PATCH 2/2] upd to notification --- .../NotificationEndpoint.robot | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/NotificationEndpoint.robot b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/NotificationEndpoint.robot index 60af974de..d1a1a3272 100644 --- a/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/NotificationEndpoint.robot +++ b/SOL003/VirtualisedResourcesQuotaAvailableNotification-API/NotificationEndpoint.robot @@ -8,31 +8,31 @@ Library OperatingSystem Library Collections *** Test Cases *** -Virtual Quota Available Notification +Virtualised Resource Quota Available Notification [Documentation] Test ID: 7.3.7.5.1 - ... Test title: Virtual Quota Available Notification - ... Test objective: The objective is to test the dispatch of Virtual Quota Available Notification, and perform a JSON schema and content validation of the delivered notification. The action that triggers the notification under test is an explicit test step, but it is not performed by the test system. - ... Pre-conditions: A subscription for Virtual Quota Available Notification is available in the VNFM. + ... Test title: Virtualised Resource Quota Available Notification + ... Test objective: The objective is to test the dispatch of Virtualised Resource Quota Available Notification, and perform a JSON schema and content validation of the delivered notification. The action that triggers the notification under test is an explicit test step, but it is not performed by the test system. + ... Pre-conditions: A subscription for Virtualised Resource Quota Available Notification is available in the VNFM. ... Reference: Clause 11.4.4.3.1 - ETSI GS NFV-SOL 003 [1] v2.7.1 ... Config ID: Config_prod_VNFM ... Applicability: none ... Post-Conditions: none - Trigger a dispatch of virtual quota available notification (external action) - Check Virtual Quota Available Notification Http POST Request Body Json Schema Is VrQuotaAvailNotification - Check Virtual Quota Available Notification Http POST Request Body notificationType attribute Is VrQuotaAvailNotification + Trigger a dispatch of virtualised resource quota available notification (external action) + Check Virtualised Resource Quota Available Notification Http POST Request Body Json Schema Is VrQuotaAvailNotification + Check Virtualised Resource Quota Available Notification Http POST Request Body notificationType attribute Is VrQuotaAvailNotification *** Keywords *** -Trigger a dispatch of virtual quota available notification (external action) +Trigger a dispatch of virtualised resource quota available notification (external action) #do nothing Log do nothing -Check Virtual Quota Available Notification Http POST Request Body Json Schema Is +Check Virtualised Resource Quota Available 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 Virtual Quota Available Notification Http POST Request Body notificationType attribute Is +Check Virtualised Resource Quota Available Notification Http POST Request Body notificationType attribute Is [Arguments] ${type} Configure Virtual Quota Available Notification Handler ${callback_endpoint_fwd} ${type} Wait Until Keyword Succeeds 2 min 10 sec Verify Mock Expectation ${notification_request} @@ -45,8 +45,9 @@ Configure Virtual Quota Available Notification Handler 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 + &{req}= Create Mock Request Matcher POST ${endpoint} body_type="JSON" body=${BODY} + Set Global Variable ${req} ${notification_request} + &{notification_response}= Create Mock Response status_code=204 Create Mock Expectation ${notification_request} ${notification_response} Configure Notification Forward -- GitLab