Commit 3d028d2c authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

fixed issue #149 on all SOL002 subscriptions - v2.6.1

parent 563b2bad
......@@ -4,6 +4,12 @@ Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} ssl_verify=fal
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
......@@ -304,9 +310,19 @@ Post Create subscription
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/fmSubscriptionRequest.json
Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
${body}= Replace String ${body} \${callback_uri} ${callback_uri}
${body}= Replace String ${body} \${callback_port} ${callback_port}
${body}= Replace String ${body} \${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}/${apiVersion}/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_ALLOWS_DUPLICATE_SUBS} == 0 VNFM is not permitting duplication. Skipping the test
......@@ -314,9 +330,18 @@ Post Create subscription - DUPLICATION
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/fmSubscriptionRequest.json
Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body}
${outputResponse}= Output response
${body}= Replace String ${body} \${callback_uri} ${callback_uri}
${body}= Replace String ${body} \${callback_port} ${callback_port}
${body}= Replace String ${body} \${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}/${apiVersion}/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
......@@ -325,9 +350,18 @@ Post Create subscription - NO-DUPLICATION
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/fmSubscriptionRequest.json
Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body}
${outputResponse}= Output response
${body}= Replace String ${body} \${callback_uri} ${callback_uri}
${body}= Replace String ${body} \${callback_port} ${callback_port}
${body}= Replace String ${body} \${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}/${apiVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
Clear Requests ${callback_endpoint}
Get subscriptions
Log Get the list of active subscriptions
......@@ -504,3 +538,8 @@ Check Response for duplicated subscription
Run Keyword If ${VNFM_ALLOWS_DUPLICATE_SUBS} == 1 Check HTTP Response Status Code Is 201
Run Keyword If ${VNFM_ALLOWS_DUPLICATE_SUBS} == 1 Check HTTP Response Body Json Schema Is FmSubscription
Run Keyword If ${VNFM_ALLOWS_DUPLICATE_SUBS} == 0 Check HTTP Response Status Code Is 303
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}
......@@ -6,5 +6,5 @@
]
}
},
"callbackUri": "http://127.0.0.1/subscribe"
"callbackUri": "${callback_uri}:${callback_port}${callback_endpoint}"
}
\ No newline at end of file
......@@ -180,11 +180,18 @@ Send Post Request for VNF Indicator Subscription
Set Headers {"Content-Type": "${CONTENT_TYPE_JSON}"}
${body}= Get File jsons/subscriptions.json
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
POST ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body}
${output}= Output response
Set Suite Variable ${response} ${output}
Run Keyword If ${VNFM_CHECKS_NOTIF_ENDPOINT} == 1
... Check Notification Endpoint
${body}= Replace String ${body} \${callback_uri} ${callback_uri}
${body}= Replace String ${body} \${callback_port} ${callback_port}
${body}= Replace String ${body} \${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}/${apiVersion}/subscriptions ${body}
${output}= Output response
Set Global Variable ${response} ${output}
Clear Requests ${callback_endpoint}
Send Put Request for VNF Indicator Subscriptions
Log Trying to create a new subscription
......@@ -251,7 +258,6 @@ Check HTTP Response Body Subscriptions Match the requested Attribute-Based Filte
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
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}
......
{
"callbackUri": "http://127.0.0.1/subscribe"
"callbackUri": "${callback_uri}:${callback_port}${callback_endpoint}"
}
\ No newline at end of file
......@@ -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,6 +9,8 @@ Library BuiltIn
Library JSONLibrary
Library Collections
Library JSONSchemaLibrary schemas/
Library String
Library Process
*** Keywords ***
......@@ -734,9 +736,19 @@ Post Create subscription
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/lccnSubscriptionRequest.json
Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
${body}= Replace String ${body} \${callback_uri} ${callback_uri}
${body}= Replace String ${body} \${callback_port} ${callback_port}
${body}= Replace String ${body} \${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}/${apiVersion}/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
......@@ -744,9 +756,19 @@ Post Create subscription - DUPLICATION
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/lccnSubscriptionRequest.json
Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
${body}= Replace String ${body} \${callback_uri} ${callback_uri}
${body}= Replace String ${body} \${callback_port} ${callback_port}
${body}= Replace String ${body} \${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}/${apiVersion}/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
......@@ -754,9 +776,19 @@ Post Create subscription - NO-DUPLICATION
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/lccnSubscriptionRequest.json
Post ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
${body}= Replace String ${body} \${callback_uri} ${callback_uri}
${body}= Replace String ${body} \${callback_port} ${callback_port}
${body}= Replace String ${body} \${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}/${apiVersion}/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}"}
......@@ -973,4 +1005,9 @@ Get VNF LCM Operation occurrences with exclude_fields attribute selector
GET ${apiRoot}/${apiName}/${apiVersion}/vnf_lcm_op_occs?exclude_fields=${fields}
${output}= Output response
Set Suite Variable ${response} ${output}
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}
\ No newline at end of file
......@@ -6,5 +6,5 @@
]
}
},
"callbackUri": "http://127.0.0.1/subscribe"
"callbackUri": "${callback_uri}:${callback_port}${callback_endpoint}"
}
\ No newline at end of file
......@@ -9,7 +9,8 @@ Library BuiltIn
Library JSONLibrary
Library Collections
Library JSONSchemaLibrary schemas/
Library Process
Library Process
Library String
*** Keywords ***
Get all VNF Performance Subscriptions
......@@ -104,22 +105,19 @@ Send Post Request for VNF Performance Subscription
Set headers {"Content-Type": "${CONTENT_TYPE_JSON}"}
Set headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body_request}= Get File jsons/subscriptions.json
POST ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body_request}
${output}= Output response
Set Suite Variable ${response} ${output}
Run Keyword If ${VNFM_CHECKS_NOTIF_ENDPOINT} == 1
... Check Notification Endpoint
# Integer response status 201
# Log Received a 201 Created as expected
# ${contentType}= Output response headers Content-Type
# Should Contain ${contentType} application/json
# ${result}= Output response body
# Validate Json PmSubscription.schema.json ${result}
# Log Validated PmSubscription schema
# Log Trying to validate the Location header
# ${headers}= Output response headers
# Should Contain ${headers} Location
${body}= Get File jsons/subscriptions.json
${body}= Replace String ${body} \${callback_uri} ${callback_uri}
${body}= Replace String ${body} \${callback_port} ${callback_port}
${body}= Replace String ${body} \${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}/${apiVersion}/subscriptions ${body}
${output}= Output response
Set Global Variable ${response} ${output}
Clear Requests ${callback_endpoint}
Send Post Request for Duplicated VNF Performance Subscription
......@@ -135,20 +133,19 @@ Send Post Request for Duplicated VNF Performance Subscription
Set headers {"Content-Type": "${CONTENT_TYPE_JSON}"}
Set headers {"Accept": "${ACCEPT_JSON}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body_request}= Get File jsons/subscriptions.json
POST ${apiRoot}/${apiName}/${apiVersion}/subscriptions ${body_request}
${output}= Output response
Set Suite Variable ${response} ${output}
# Integer response status 303
# Log Received a 303 See other as expected
# ${contentType}= Output response headers Content-Type
# Should Contain ${contentType} application/json
# ${result}= Output response body
# Should Be Empty ${result}
# Log Body is empty
# Log Trying to validate the Location header
# ${headers}= Output response headers
# Should Contain ${headers} Location
${body}= Get File jsons/subscriptions.json
${body}= Replace String ${body} \${callback_uri} ${callback_uri}
${body}= Replace String ${body} \${callback_port} ${callback_port}
${body}= Replace String ${body} \${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}/${apiVersion}/subscriptions ${body}
${output}= Output response
Set Global Variable ${response} ${output}
Clear Requests ${callback_endpoint}
......@@ -335,7 +332,6 @@ Check HTTP Response Location Header Resource URI
Log Validated PmSubscription schema
Create Sessions
Pass Execution If ${VNFM_CHECKS_NOTIF_ENDPOINT} == 0 MockServer not necessary to run
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}
......
{
"callbackUri": "http://127.0.0.1/subscribe",
"callbackUri": "${callback_uri}:${callback_port}${callback_endpoint}",
"filter": {
"notificationTypes": ["ThresholdCrossedNotification"]
}
......
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