Commit 546fb82e authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

fixed issue #149 on all SOL003ù subscriptions - v2.6.1

parent 3d028d2c
......@@ -5,13 +5,19 @@ Library JSONLibrary
Library JSONSchemaLibrary schemas/
Library OperatingSystem
#Suite Teardown Terminate All Processes kill=true
Library Process
Library MockServerLibrary
Library String
*** Variables ***
${original_etag} 1234
*** 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}
Check created Subscription existence
Set Headers {"Accept":"${ACCEPT}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
......@@ -261,9 +267,19 @@ POST 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}
Send POST Request for duplicated subscription
Log Create subscription instance by POST to ${apiRoot}/${apiName}/${apiVersion}/subscriptions
......@@ -272,9 +288,18 @@ Send POST Request for duplicated 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}
Send POST Request for duplicated subscription not permitted
Log Create subscription instance by POST to ${apiRoot}/${apiName}/${apiVersion}/subscriptions
......@@ -283,9 +308,18 @@ Send POST Request for duplicated subscription not permitted
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}
GET Subscriptions
Log Get the list of active subscriptions
......
......@@ -6,6 +6,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 ***
Create a new Fault Management alarm subscription
......
......@@ -53,3 +53,9 @@ ${invalid_alarm_filter} badFilter
${invalidAlarmId} invalidIdAlarm
${fields} criteria,objectInstanceIds
${callback_endpoint} /notification
${callback_port} 9091
${callback_uri} http://localhost
${MOCK_SERVER_JAR} ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar
......@@ -6,5 +6,5 @@
]
}
},
"callbackUri": "http://127.0.0.1/subscribe"
"callbackUri": "${callback_uri}:${callback_port}${callback_endpoint}"
}
\ No newline at end of file
......@@ -105,19 +105,20 @@ 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
# Integer response status 201
# Log Received 201 Created as expected
# ${headers}= Output response headers
# Should Contain ${headers} Location
# Log Response has header Location
# ${result}= Output response body
# Validate Json VnfIndicatorSubscription.schema.json ${result}
# Log Validation of VnfIndicatorSubscription OK
${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}
#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
......@@ -127,17 +128,20 @@ Send Post Request for Duplicated 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}
# Integer response status 201
# Log Received 201 Created as expected
# ${headers}= Output response headers
# Should Contain ${headers} Location
# Log Response has header Location
# ${result}= Output response body
# Validate Json VnfIndicatorSubscription.schema.json ${result}
# Log Validation of VnfIndicatorSubscription OK
${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}
#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 Put Request for VNF Indicator Subscriptions
......@@ -554,8 +558,7 @@ Check Postcondition VNF indicator subscription is not created
GET Individual VNF Indicator Subscription with invalid resource identifier
Check HTTP Response Status Code Is 404
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}
......
{
"callbackUri": "http://172.22.1.7:9091/vnfind/subscribes"
"callbackUri": "${callback_uri}:${callback_port}${callback_endpoint}"
}
\ No newline at end of file
......@@ -6,7 +6,9 @@ Library OperatingSystem
Library JSONLibrary
Library JSONSchemaLibrary schemas/
Resource VnfLcmMntOperationKeywords.robot
Library Process
Suite Setup Create Sessions
Suite Teardown Terminate All Processes kill=true
*** Test Cases ***
POST Create a new subscription
......
......@@ -9,8 +9,14 @@ Library BuiltIn
Library JSONLibrary
Library Collections
Library JSONSchemaLibrary schemas/
Library Process
Library String
*** 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}
......@@ -1144,9 +1150,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
......@@ -1154,9 +1170,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
......@@ -1164,9 +1190,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}"}
......
......@@ -6,5 +6,5 @@
]
}
},
"callbackUri": "http://localhost:9091/notification"
"callbackUri": "${callback_uri}:${callback_port}${callback_endpoint}"
}
......@@ -389,11 +389,20 @@ Send Post Request for VNF Package 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 ${NFVO_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}
#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 Duplicated VNF Package Subscription
Log Trying to create a subscription with an already created content
......@@ -401,9 +410,20 @@ Send Post Request for Duplicated VNF Package 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}
${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}
#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 Put Request for VNF Package Subscriptions
Log Trying to perform a PUT. This method should not be implemented
......@@ -773,7 +793,6 @@ Check HTTP Response Body Subscription Identifier matches the requested Subscript
Log Subscription identifier as expected
Create Sessions
Pass Execution If ${NFVO_CHECKS_NOTIF_ENDPOINT} == 0 MockServer not started as NFVO is not checking the notification endpoint
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://172.22.1.7:9091/vnfpkgm/subscriptions"
"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,21 @@ 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}
#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 Duplicated VNF Performance Subscription
......@@ -135,20 +135,21 @@ 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}
#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
......
{
"callbackUri": "http://172.22.1.7:9091/vnfpm/subscriptions",
"callbackUri": "${callback_uri}:${callback_port}${callback_endpoint}",
"filter": {
"notificationTypes": ["ThresholdCrossedNotification"]
}
......
......@@ -75,9 +75,3 @@ DELETE subscriptions - Method not implemented
Log Cleaning the endpoint
Clear Requests ${callback_endpoint}
*** 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}
......@@ -5,8 +5,9 @@ Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_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 ***
Create new Virtualised Resources Quota Available Notification subscription
......
......@@ -7,6 +7,7 @@ Library OperatingSystem
#Suite Teardown Terminate All Processes kill=true
Library MockServerLibrary
Library Process
Library String
*** Keywords ***
Create Sessions
......@@ -98,10 +99,19 @@ Send Post request for new Virtualised Resources Quota Available Notification sub
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/vrQuotaAvailSubscriptionRequest.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}
${outputResponse}= Output response
Set Global Variable ${response} ${outputResponse}
${output}= Output response
Set Global Variable ${response} ${output}
Clear Requests ${callback_endpoint}
Send Post request for new Virtualised Resources Quota Available Notification subscription - DUPLICATION
Log Trying to create a subscription with an already created content
Pass Execution If ${NFVO_DUPLICATION} == 0 NVFO is not permitting duplication. Skipping the test
......@@ -109,9 +119,18 @@ Send Post request for new Virtualised Resources Quota Available Notification sub
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/vrQuotaAvailSubscriptionRequest.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}
${output}= Output response
Set Global Variable ${response} ${output}
Clear Requests ${callback_endpoint}
Send Post request for new Virtualised Resources Quota Available Notification subscription - NO-DUPLICATION
Log Trying to create a subscription with an already created content
......@@ -120,9 +139,18 @@ Send Post request for new Virtualised Resources Quota Available Notification sub
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
${body}= Get File jsons/vrQuotaAvailSubscriptionRequest.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}
${output}= Output response
Set Global Variable ${response} ${output}
Clear Requests ${callback_endpoint}
GET Virtualised Resources Quota Available Notification Subscriptions
Log Get the list of active subscriptions
......@@ -180,4 +208,5 @@ Send Delete request for Virtualised Resources Quota Available Notification subsc
Check LINK in Header
${linkURL}= Get Value From Json ${response['headers']} $..Link
Should Not Be Empty ${linkURL}
\ No newline at end of file