Commit 430db536 authored by Giacomo Bernini's avatar Giacomo Bernini
Browse files

fixed issue #154 on SOL003 subscriptions - v2.7.1

parent 565276cf
Loading
Loading
Loading
Loading
+33 −9
Original line number Original line Diff line number Diff line
@@ -5,6 +5,7 @@ Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} ssl_verify=fal
Library    JSONLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    JSONSchemaLibrary    schemas/
Library    OperatingSystem
Library    OperatingSystem
Library    MockServerLibrary
#Suite Teardown    Terminate All Processes    kill=true
#Suite Teardown    Terminate All Processes    kill=true


Library    Process
Library    Process
@@ -13,6 +14,11 @@ Library Process
${original_etag}    1234
${original_etag}    1234


*** Keywords ***
*** 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
Check created Subscription existence
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
@@ -257,9 +263,15 @@ POST Subscription
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template}=    Get File    jsons/fmSubscriptionRequest.json
    ${template}=    Get File    jsons/fmSubscriptionRequest.json
    ${body}=        Format String   ${template}    vnfdIds=${vnfdIds}      callback_uri=${callback_uri}:${callback_port}    callback_endpoint=${callback_endpoint}
    ${body}=        Format String   ${template}    vnfdIds=${vnfdIds}      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}    
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}    
	${outputResponse}=    Output    response
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	Set Global Variable    ${response}    ${outputResponse}
	Clear Requests    ${callback_endpoint}
    
    
Send POST Request for duplicated subscription
Send POST Request for duplicated subscription
    Log    Create subscription instance by POST to ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
    Log    Create subscription instance by POST to ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
@@ -269,9 +281,15 @@ Send POST Request for duplicated subscription
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template}=    Get File    jsons/fmSubscriptionRequest.json
    ${template}=    Get File    jsons/fmSubscriptionRequest.json
    ${body}=        Format String   ${template}    vnfdIds=${vnfdIds}     callback_uri=${callback_uri}:${callback_port}    callback_endpoint=${callback_endpoint}
    ${body}=        Format String   ${template}    vnfdIds=${vnfdIds}     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}    
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}    
	${outputResponse}=    Output    response
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	Set Global Variable    ${response}    ${outputResponse}
	Clear Requests    ${callback_endpoint}


Send POST Request for duplicated subscription not permitted
Send POST Request for duplicated subscription not permitted
    Log    Create subscription instance by POST to ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
    Log    Create subscription instance by POST to ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
@@ -281,9 +299,15 @@ Send POST Request for duplicated subscription not permitted
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    ${template}=    Get File    jsons/fmSubscriptionRequest.json
    ${template}=    Get File    jsons/fmSubscriptionRequest.json
    ${body}=        Format String   ${template}    vnfdIds=${vnfdIds}     callback_uri=${callback_uri}:${callback_port}    callback_endpoint=${callback_endpoint}
    ${body}=        Format String   ${template}    vnfdIds=${vnfdIds}     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}    
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}    
	${outputResponse}=    Output    response
	${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}
	Set Global Variable    ${response}    ${outputResponse}
	Clear Requests    ${callback_endpoint}


GET Subscriptions
GET Subscriptions
    Log    Get the list of active subscriptions
    Log    Get the list of active subscriptions
+3 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,9 @@ Library REST ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} ssl_verify=fal
Library    OperatingSystem
Library    OperatingSystem
Library    JSONLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    JSONSchemaLibrary    schemas/
Library           Process
Suite Setup       Create Sessions
Suite Teardown    Terminate All Processes    kill=true


*** Test Cases ***
*** Test Cases ***
Create a new Fault Management alarm subscription
Create a new Fault Management alarm subscription
+3 −1
Original line number Original line Diff line number Diff line
@@ -59,3 +59,5 @@ ${callback_endpoint} /subscribe
${vnfdIds}    6fc3539c-e602-4afa-8e13-962fb5a7d81f
${vnfdIds}    6fc3539c-e602-4afa-8e13-962fb5a7d81f


${callbackResp}    localhost
${callbackResp}    localhost

${MOCK_SERVER_JAR}    ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar
 No newline at end of file
+25 −28
Original line number Original line Diff line number Diff line
@@ -99,21 +99,19 @@ Send Post Request for VNF Indicator Subscription
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    ${template}=    Get File    jsons/subscriptions.json
    ${template}=    Get File    jsons/subscriptions.json
    ${body}=        Format String   ${template}     callback=${callback}    {callback_subscribe}=${callback_subscribe}
    ${body}=        Format String   ${template}     callback_uri=${callback_uri}    callback_port=${callback_port}    callback_endpoint=${callback_endpoint}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}
    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
	${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
	Set Global Variable    ${response}    ${output}
    Run Keyword If    ${VNFM_CHECKS_NOTIF_ENDPOINT} == 1
	Clear Requests    ${callback_endpoint}
    ...       Check Notification Endpoint
    #Run Keyword If    ${NFVO_CHECKS_NOTIF_ENDPOINT} == 1    #removed as the check of notif endpoint is done by NFVO while processing subscription reques
    # Integer    response status    201
    #...    Check Notification Endpoint 
    # 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






@@ -122,19 +120,19 @@ Send Post Request for Duplicated VNF indicator Subscription
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
     ${template}=    Get File    jsons/subscriptions.json
     ${template}=    Get File    jsons/subscriptions.json
    ${body}=        Format String   ${template}     callback=${callback}    {callback_subscribe}=${callback_subscribe}
    ${body}=        Format String   ${template}     callback_uri=${callback_uri}    callback_port=${callback_port}    callback_endpoint=${callback_endpoint}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions    ${body}
    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
	${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
	Set Global Variable    ${response}    ${output}
    # Integer    response status    201
	Clear Requests    ${callback_endpoint}
    # Log    Received 201 Created as expected
    #Run Keyword If    ${NFVO_CHECKS_NOTIF_ENDPOINT} == 1    #removed as the check of notif endpoint is done by NFVO while processing subscription reques
    # ${headers}=    Output    response headers
    #...    Check Notification Endpoint 
    # Should Contain    ${headers}    Location
    # Log    Response has header Location
    # ${result}=    Output    response body
    # Validate Json    VnfIndicatorSubscription.schema.json    ${result}
    # Log    Validation of VnfIndicatorSubscription OK
    
    
    
    
Send Put Request for VNF Indicator Subscriptions
Send Put Request for VNF Indicator Subscriptions
@@ -528,7 +526,6 @@ Check Postcondition Individual VNF Indicator Subscription is Deleted
    Check HTTP Response Status Code Is    404
    Check HTTP Response Status Code Is    404


Create Sessions   
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
    Start Process  java  -jar  ${MOCK_SERVER_JAR}    -serverPort  ${callback_port}  alias=mockInstance
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
    Wait For Process  handle=mockInstance  timeout=5s  on_timeout=continue
    Create Mock Session  ${callback_uri}:${callback_port}
    Create Mock Session  ${callback_uri}:${callback_port}
+0 −3
Original line number Original line Diff line number Diff line
@@ -35,9 +35,6 @@ ${notification_response} []


${MOCK_SERVER_JAR}    ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar
${MOCK_SERVER_JAR}    ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar


${callback}    http://172.22.1.7:${callback_port}
${callback_subscribe}    /vnfind/subscribes



${subscriptionId}    17563e75-0e14-4bd7-94b4-6bbb869c79aa
${subscriptionId}    17563e75-0e14-4bd7-94b4-6bbb869c79aa
${erroneousSubscriptionId}    erroneousSubscriptionId
${erroneousSubscriptionId}    erroneousSubscriptionId
Loading