Commit c9b85ade authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

fixed issue #154 on SOL002 subscriptions - v2.7.1

parent 9eb1681a
......@@ -5,6 +5,10 @@ Library OperatingSystem
Library JSONLibrary
Library JSONSchemaLibrary schemas/
Library String
Library Process
Library MockServerLibrary
Suite Setup Create Sessions
Suite Teardown Terminate All Processes kill=true
*** Test Cases ***
Create a new subscription
......@@ -314,6 +318,11 @@ POST Create a new Subscription - Unprocessable Entity
Check HTTP Response Body Json Schema Is ProblemDetails
*** 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}
Post Create subscription
Log Create subscription instance by POST to ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
Set Headers {"Accept":"${ACCEPT}"}
......@@ -321,9 +330,16 @@ Post Create subscription
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${template}= Get File jsons/fmSubscriptionRequest.json
${body}= Format String ${template} callback_uri=${callback_uri}:${callback_port} callback_endpoint=${callback_endpoint}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Log Creating mock request and response to handle GET operation on notification endpoint
&{notification_request}= Create Mock Request Matcher GET ${callback_endpoint}
&{notification_response}= Create Mock Response status_code=204
Log Issue the subscription request
Create Mock Expectation ${notification_request} ${notification_response}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${output}= Output response
Set Global Variable ${response} ${output}
Clear Requests ${callback_endpoint}
# Post Create subscription - DUPLICATION
# Log Trying to create a subscription with an already created content
# Pass Execution If ${VNFM_ALLOWS_DUPLICATE_SUBS} == 0 NVFO is not permitting duplication. Skipping the test
......
......@@ -145,12 +145,12 @@ POST Create a new Subscription - Unprocessable Entity
[Documentation] Test ID: 6.3.2.4.11
... Test title: POST Create a new Subscription - Unprocessable Entity
... Test objective: The objective is to test that content type of the payload body is supported and the payload body of a request contains syntactically correct data but the data cannot be processed.
... re-conditions: none
... Pre-conditions: none
... Reference: Clause 8.4.5.3.1 - ETSI GS NFV-SOL 002 [2] v2.7.1
... Config ID: Config_prod_VE
... Applicability: none
... Post-Conditions: none
Send Post Request for VNF Indicator Subscription
Send Post Request for VNF Indicator Subscription wih unprocessable entity
Check HTTP Response Status Code Is 422
Check HTTP Response Body Json Schema Is ProblemDetails
......@@ -221,11 +221,28 @@ Send Post Request for VNF Indicator Subscription
${template}= Get File jsons/subscriptions.json
${body}= Format String ${template} callback_uri=${callback_uri}:${callback_port} callback_endpoint=${callback_endpoint}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
POST ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${output}= Output response
Set Suite Variable ${response} ${output}
Run Keyword If ${VNFM_CHECKS_NOTIF_ENDPOINT} == 1
... Check Notification Endpoint
Log Creating mock request and response to handle GET operation on notification endpoint
&{notification_request}= Create Mock Request Matcher GET ${callback_endpoint}
&{notification_response}= Create Mock Response status_code=204
Log Issue the subscription request
Create Mock Expectation ${notification_request} ${notification_response}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${output}= Output response
Set Global Variable ${response} ${output}
Clear Requests ${callback_endpoint}
#Run Keyword If ${NFVO_CHECKS_NOTIF_ENDPOINT} == 1 #removed as the check of notif endpoint is done by NFVO while processing subscription reques
#... Check Notification Endpoint
Send Post Request for VNF Indicator Subscription with unprocessable entity
Log Trying to create a new subscription
Set Headers {"Accept": "${ACCEPT_JSON}"}
Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"}
${template}= Get File jsons/subscriptions.json
${body}= Format String ${template} callback_uri=localhost #not reachable endpoint
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${output}= Output response
Set Global Variable ${response} ${output}
Send Put Request for VNF Indicator Subscriptions
Log Trying to create a new subscription
......@@ -291,8 +308,7 @@ Check HTTP Response Body Subscriptions Match the requested Attribute-Based Filte
@{words} = Split String ${POS_FILTER} ,${SEPERATOR}
Should Be Equal As Strings ${response['body'][0]['callbackUri']} @{words}[1]
Create Sessions
Pass Execution If ${VNFM_CHECKS_NOTIF_ENDPOINT} == 0 MockServer not necessary to run
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}
......@@ -315,9 +331,18 @@ Post Create subscription - DUPLICATION
Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/subscriptions.json
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
${body}= Format String ${template} callback_uri=${callback_uri}:${callback_port} callback_endpoint=${callback_endpoint}
Log Creating mock request and response to handle GET operation on notification endpoint
&{notification_request}= Create Mock Request Matcher GET ${callback_endpoint}
&{notification_response}= Create Mock Response status_code=204
Log Issue the subscription request
Create Mock Expectation ${notification_request} ${notification_response}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Clear Requests ${callback_endpoint}
#Run Keyword If ${NFVO_CHECKS_NOTIF_ENDPOINT} == 1 #removed as the check of notif endpoint is done by NFVO while processing subscription reques
#... Check Notification Endpoint
Post Create subscription - NO-DUPLICATION
Log Trying to create a subscription with an already created content
......@@ -326,9 +351,18 @@ Post Create subscription - NO-DUPLICATION
Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/subscriptions.json
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
${body}= Format String ${template} callback_uri=${callback_uri}:${callback_port} callback_endpoint=${callback_endpoint}
Log Creating mock request and response to handle GET operation on notification endpoint
&{notification_request}= Create Mock Request Matcher GET ${callback_endpoint}
&{notification_response}= Create Mock Response status_code=204
Log Issue the subscription request
Create Mock Expectation ${notification_request} ${notification_response}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Clear Requests ${callback_endpoint}
#Run Keyword If ${NFVO_CHECKS_NOTIF_ENDPOINT} == 1 #removed as the check of notif endpoint is done by NFVO while processing subscription reques
#... Check Notification Endpoint
Check Operation Occurrence Id
${vnfLcmOpOccId}= Get Value From Json ${response['headers']} $..Location
......
......@@ -5,6 +5,9 @@ Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} ssl_verify=fal
Library OperatingSystem
Library JSONLibrary
Library JSONSchemaLibrary schemas/
Library Process
Suite Setup Create Sessions
Suite Teardown Terminate All Processes kill=true
*** Test Cases ***
POST Create a new subscription
......
......@@ -9,12 +9,17 @@ Library BuiltIn
Library JSONLibrary
Library Collections
Library JSONSchemaLibrary schemas/
Library String
Library String
Library Process
Variables descriptors/SOL001/VNFD/vnfd_SOL001.yaml
Variables descriptors/SOL006/VNFD/vnfd_SOL006.yaml
*** 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}
Get Vnf Instance
[Arguments] ${vnfInstanceId}
Set Headers {"Accept":"${ACCEPT}"}
......@@ -795,9 +800,17 @@ Post Create subscription
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${template}= Get File jsons/lccnSubscriptionRequest.json
${body}= Format String ${template} vnfdIds=${vnfdIds} callback_uri=${callback_uri}:${callback_port} callback_endpoint=${callback_endpoint}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Log Creating mock request and response to handle GET operation on notification endpoint
&{notification_request}= Create Mock Request Matcher GET ${callback_endpoint}
&{notification_response}= Create Mock Response status_code=204
Log Issue the subscription request
Create Mock Expectation ${notification_request} ${notification_response}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Clear Requests ${callback_endpoint}
Post Create subscription - DUPLICATION
Log Trying to create a subscription with an already created content
Pass Execution If ${VNFM_DUPLICATION} == 0 VNFM is not permitting duplication. Skipping the test
......@@ -806,9 +819,16 @@ Post Create subscription - DUPLICATION
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${template}= Get File jsons/lccnSubscriptionRequest.json
${body}= Format String ${template} vnfdIds=${vnfdIds} callback_uri=${callback_uri}:${callback_port} callback_endpoint=${callback_endpoint}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Log Creating mock request and response to handle GET operation on notification endpoint
&{notification_request}= Create Mock Request Matcher GET ${callback_endpoint}
&{notification_response}= Create Mock Response status_code=204
Log Issue the subscription request
Create Mock Expectation ${notification_request} ${notification_response}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Clear Requests ${callback_endpoint}
Post Create subscription - NO-DUPLICATION
Log Trying to create a subscription with an already created content
Pass Execution If ${VNFM_DUPLICATION} == 1 VNFM permits duplication. Skipping the test
......@@ -817,9 +837,16 @@ Post Create subscription - NO-DUPLICATION
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${template}= Get File jsons/lccnSubscriptionRequest.json
${body}= Format String ${template} vnfdIds=${vnfdIds} callback_uri=${callback_uri}:${callback_port} callback_endpoint=${callback_endpoint}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Log Creating mock request and response to handle GET operation on notification endpoint
&{notification_request}= Create Mock Request Matcher GET ${callback_endpoint}
&{notification_response}= Create Mock Response status_code=204
Log Issue the subscription request
Create Mock Expectation ${notification_request} ${notification_response}
Post ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Clear Requests ${callback_endpoint}
Get subscriptions
Log Get the list of active subscriptions
Set Headers {"Accept":"${ACCEPT}"}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment