Commit 77e40353 authored by AHMADABB's avatar AHMADABB
Browse files
parents de4c02e8 eeeb1e25
Loading
Loading
Loading
Loading
+11 −9
Original line number Original line Diff line number Diff line
@@ -18,8 +18,8 @@ Set new VNF Configuration
    ...    Post-Conditions: The configuration is successfully set in the VNF and it matches the issued configuration
    ...    Post-Conditions: The configuration is successfully set in the VNF and it matches the issued configuration
    Send VNF configuration
    Send VNF configuration
    Check HTTP Response Status Code Is    200
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Contains    Etag
    Check HTTP Response Header Contains    ETag
    Check HTTP Response Body Json Schema Is   vnfConfigModifications.schema.json
    Check HTTP Response Body Json Schema Is   vnfConfigModifications
    Check Postcondition VNF Is Configured
    Check Postcondition VNF Is Configured


Get information about a VNF configuration
Get information about a VNF configuration
@@ -34,7 +34,7 @@ Get information about a VNF configuration
    ...    Post-Conditions: none
    ...    Post-Conditions: none
    Get VNF configuration
    Get VNF configuration
    Check HTTP Response Status Code Is    200
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfConfiguration.schema.json
    Check HTTP Response Body Json Schema Is   vnfConfiguration


Get information about a VNF configuration with HTTP Etag
Get information about a VNF configuration with HTTP Etag
    [Tags]    etag
    [Tags]    etag
@@ -48,8 +48,8 @@ Get information about a VNF configuration with HTTP Etag
    ...    Post-Conditions: none
    ...    Post-Conditions: none
    Get VNF configuration
    Get VNF configuration
    Check HTTP Response Status Code Is    200
    Check HTTP Response Status Code Is    200
    Check HTTP Response Header Contains    Etag
    Check HTTP Response Header Contains    ETag
    Check HTTP Response Body Json Schema Is   vnfConfiguration.schema.json
    Check HTTP Response Body Json Schema Is   vnfConfiguration


Set new VNF Configuration - HTTP Etag precondition unsuccessful
Set new VNF Configuration - HTTP Etag precondition unsuccessful
    [Tags]    etag
    [Tags]    etag
@@ -121,6 +121,7 @@ Send VNF configuration
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/vnfConfigModifications.json
    ${body}=    Get File    jsons/vnfConfigModifications.json
    Patch    ${apiRoot}/${apiName}/${apiVersion}/configuration    ${body}
    Patch    ${apiRoot}/${apiName}/${apiVersion}/configuration    ${body}
    Set Suite Variable    &{etag}    ${response[0]['headers']['ETag']}
    ${output}=    Output    response
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}
    Set Suite Variable    @{response}    ${output}


@@ -137,8 +138,9 @@ Check HTTP Response Header Contains
    Log    Header is present
    Log    Header is present
    
    
Check HTTP Response Body Json Schema Is
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    [Arguments]    ${input}
    Should Contain    ${response[0]['headers']['Content-Type']}    ${CONTENT_TYPE}
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK
    Log    Json Schema Validation OK
      
      
@@ -158,11 +160,11 @@ Check Postcondition VNF Is Configured
    Should Be Equal  ${response[0]['body']}    ${input} 
    Should Be Equal  ${response[0]['body']}    ${input} 


Send Duplicated VNF configuration
Send Duplicated VNF configuration
    Depends On Test    PATCH Alarm    # If the previous test scceeded, it means that Etag has been modified
    Depends On Test    Send VNF configuration    # If the previous test scceeded, it means that Etag has been modified
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"}
    Set Headers  {"Accept":"${ACCEPT}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Set Headers    {"If-Match": "${Etag}"}
    Set Headers    {"If-Match": "${etag[0]}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/vnfConfigModifications.json
    ${body}=    Get File    jsons/vnfConfigModifications.json
    Patch    ${apiRoot}/${apiName}/${apiVersion}/configuration    ${body}
    Patch    ${apiRoot}/${apiName}/${apiVersion}/configuration    ${body}
+24 −13
Original line number Original line Diff line number Diff line
@@ -8,6 +8,10 @@ Library JSONSchemaLibrary schemas/
Library    DependencyLibrary
Library    DependencyLibrary




*** Variables **
${original_etag}    1234


*** Test Cases ***
*** Test Cases ***
POST Alarm - Method not implemented
POST Alarm - Method not implemented
    log    Trying to perform a POST. This method should not be implemented
    log    Trying to perform a POST. This method should not be implemented
@@ -17,6 +21,7 @@ POST Alarm - Method not implemented
    Log    Validate Status code
    Log    Validate Status code
    Integer    response status    405
    Integer    response status    405



Get information about a configuration
Get information about a configuration
    [Documentation]    Test ID: 7.4.3.1
    [Documentation]    Test ID: 7.4.3.1
    ...    Test title: Get information about an alarm
    ...    Test title: Get information about an alarm
@@ -32,15 +37,17 @@ Get information about a configuration
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Log    Execute Query and validate response
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId}
    Get    ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId}
    ${Etag}=    Output    response headers Etag
    Log    Validate Status code
    Log    Validate Status code
    Integer    response status    200
    Integer    response status    200
    ${etag}    Output    response header ETag
    Set Suite Variable    &{original_etag}    ${etag}
    ${contentType}=    Output    response headers Content-Type
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE}
    Should Contain    ${contentType}    ${CONTENT_TYPE}
    ${result}=    Output    response body
    ${result}=    Output    response body
    Validate Json    alarm.schema.json    ${result}
    Validate Json    alarm.schema.json    ${result}
    Log    Validation OK
    Log    Validation OK



PUT Alarm - Method not implemented
PUT Alarm - Method not implemented
    log    Trying to perform a PUT. This method should not be implemented
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Accept":"${ACCEPT}"}  
@@ -49,6 +56,7 @@ PUT Alarm - Method not implemented
    Log    Validate Status code
    Log    Validate Status code
    Integer    response status    405
    Integer    response status    405



PATCH Alarm
PATCH Alarm
    [Documentation]    Test ID: 7.4.3.2
    [Documentation]    Test ID: 7.4.3.2
    ...    Test title: Modify an individual alarm resource
    ...    Test title: Modify an individual alarm resource
@@ -61,11 +69,11 @@ PATCH Alarm
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    Set Headers  {"If-Match": "${original_etag[0]}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/alarmModifications.json
    ${body}=    Get File    jsons/alarmModifications.json
    Patch    ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId}    ${body}
    Patch    ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId}    ${body}
    Log    Validate Status code
    Log    Validate Status code
    ${Etag_modified}=    Output    response headers Etag
    Integer    response status    200
    Integer    response status    200
    ${contentType}=    Output    response headers Content-Type
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE}
    Should Contain    ${contentType}    ${CONTENT_TYPE}
@@ -73,47 +81,50 @@ PATCH Alarm
    Validate Json    alarmModifications.schema.json    ${result}
    Validate Json    alarmModifications.schema.json    ${result}
    Log    Validation OK
    Log    Validation OK
    
    
PATCH Alarm - Conflict



PATCH Alarm - Precondition failed
    [Documentation]    Test ID: 7.4.3.2-1
    [Documentation]    Test ID: 7.4.3.2-1
    ...    Test title: Modify an individual alarm resource - Conflict
    ...    Test title: Modify an individual alarm resource - Precondition failed
    ...    Test objective: The objective is to Modify an individual alarm resource
    ...    Test objective: The objective is to Modify an individual alarm resource
    ...    Pre-conditions: The related alarm exists
    ...    Pre-conditions: The related alarm exists
    ...    Reference: section 7.4.3 - SOL002 v2.4.1
    ...    Reference: section 7.4.3 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Applicability: 
    ...    Post-Conditions: The alarm resource is not modified
    ...    Post-Conditions: The alarm resource is not modified
    Depends On Test    PATCH Alarm    # If the previous test scceeded, it means that the alarm is in ackownledged state
    Depends On Test    PATCH Alarm    # If the previous test scceeded, it means that Etag has been modified
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    Set Headers    {"If-Match": "${original_etag[0]}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/alarmModifications.json
    ${body}=    Get File    jsons/alarmModifications.json
    Patch    ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId}    ${body}
    Patch    ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId}    ${body}
    Log    Validate Status code
    Log    Validate Status code
    Integer    response status    409
    Integer    response status    412
    ${problemDetails}=    Output    response body
    ${problemDetails}=    Output    response body
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    Log    Validation OK


PATCH Alarm - Precondition failed
PATCH Alarm - Conflict
    [Documentation]    Test ID: 7.4.3.2-1
    [Documentation]    Test ID: 7.4.3.2-1
    ...    Test title: Modify an individual alarm resource - Precondition failed
    ...    Test title: Modify an individual alarm resource - Conflict
    ...    Test objective: The objective is to Modify an individual alarm resource
    ...    Test objective: The objective is to Modify an individual alarm resource
    ...    Pre-conditions: The related alarm exists
    ...    Pre-conditions: The related alarm exists
    ...    Reference: section 7.4.3 - SOL002 v2.4.1
    ...    Reference: section 7.4.3 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VNFM
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
    ...    Applicability: 
    ...    Post-Conditions: The alarm resource is not modified
    ...    Post-Conditions: The alarm resource is not modified
    Depends On Test    PATCH Alarm    # If the previous test scceeded, it means that Etag has been modified
    Depends On Test    PATCH Alarm    # If the previous test scceeded, it means that the alarm is in ackownledged state
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"}
    Set Headers  {"Accept":"${ACCEPT}"}
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    Set Headers    {"If-Match": "${Etag}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/alarmModifications.json
    ${body}=    Get File    jsons/alarmModifications.json
    Patch    ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId}    ${body}
    Patch    ${apiRoot}/${apiName}/${apiVersion}/alarms/${alarmId}    ${body}
    Log    Validate Status code
    Log    Validate Status code
    Integer    response status    412
    Integer    response status    409
    ${problemDetails}=    Output    response body
    ${problemDetails}=    Output    response body
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK
    Log    Validation OK
+2 −2
Original line number Original line Diff line number Diff line
@@ -16,8 +16,8 @@ ${CONTENT_TYPE} application/json
${VNFM_DUPLICATION}    0
${VNFM_DUPLICATION}    0


${alarmId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${alarmId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d
${Etag}=    an etag
${etags}    a modified etag
${Etag_modified}=    a modified etag
${wrong_etag}    wrong-tag    
${CONTENT_TYPE_PATCH}    application/merge-patch+json
${CONTENT_TYPE_PATCH}    application/merge-patch+json


${PerceivedSeverity}    CRITICAL
${PerceivedSeverity}    CRITICAL
+162 −48
Original line number Original line Diff line number Diff line
@@ -6,76 +6,190 @@ Library OperatingSystem
Library           REST    ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT}
Library           REST    ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT}


*** Test Cases ***
*** Test Cases ***
GET Individual Subscription
GET Individual VNF Indicator Subscription
    [Documentation]    Test ID: 6.3.2.5.1
    ...    Test title: Get individual subscription to VNF performance indicators
    ...    Test objective: The objective is to test the retrieval of individual VNF performance indicator subscription and perform a JSON schema validation of the returned subscription data structure
    ...    Pre-conditions: A VNF instance is instantiated. At least one VNF indicator subscription is available in the VNF.
    ...    Reference:  section 8.4.6.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators
    ...    Post-Conditions: none
    Get Individual VNF Indicator Subscription
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   VnfIndicatorSubscription

GET Individual VNF Indicator Subscription with invalid resource identifier
    [Documentation]    Test ID: 6.3.2.5.2
    ...    Test title: Get individual subscription to VNF performance indicators
    ...    Test objective: The objective is to test that the retrieval of individual VNF performance indicator subscription fails when using an invalid resource identifier. The test also checks the JSON schema of the unsuccessful operation HTTP response.
    ...    Pre-conditions: A VNF instance is instantiated. At least one VNF indicator subscription is available in the VNF.
    ...    Reference:  section 8.4.6.3.2 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators
    ...    Post-Conditions: none
    GET Individual VNF Indicator Subscription with invalid resource identifier
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails
    
DELETE Individual VNF Indicator Subscription
    [Documentation]    Test ID: 6.3.2.5.3
    ...    Test title: Delete individual subscription to VNF performance indicators
    ...    Test objective: The objective is to test the deletion of an individual VNF performance indicator subscription.
    ...    Pre-conditions: A VNF instance is instantiated. At least one VNF indicator subscription is available in the VNF.
    ...    Reference:  section 8.4.6.3.5 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators
    ...    Post-Conditions: The subscription to VNF performance indicators is deleted
    Send Delete Request for Individual VNF Indicator Subscription
    Check HTTP Response Status Code Is    204
    Check Postcondition Individual VNF Indicator Subscription is Deleted

DELETE Individual VNF Indicator Subscription with invalid resource identifier
    [Documentation]    Test ID: 6.3.2.5.4
    ...    Test title: Delete individual subscription to VNF performance indicators
    ...    Test objective: The objective is to test that the deletion of an individual VNF performance indicator subscription fails when using an invalid resource identifier. The test also checks the JSON schema of the unsuccessful operation HTTP response.
    ...    Pre-conditions: A VNF instance is instantiated. At least one VNF indicator subscription is available in the VNF.
    ...    Reference:  section 8.4.6.3.5 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators
    ...    Post-Conditions: none   
    Send Delete Request for Individual VNF Indicator Subscription with invalid resource identifier
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails

PUT Individual VNF Indicator Subscription - Method not implemented
    [Documentation]    Test ID 6.3.2.5.5
    ...    Test title: PUT individual VNF indicator subscription - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to modify an individual VNF performance indicator subscription
    ...    Pre-conditions: A VNF instance is instantiated. At least one VNF indicator subscription is available in the VNF.
    ...    Reference: section 8.4.5.3.3 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The individual VNF indicator subscription is not modified by the operation
    Send Put Request for Individual VNF Indicator Subscription
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF individual subscription Unmodified (Implicit)

PATCH Individual VNF Indicator Subscription - Method not implemented
    [Documentation]    Test ID 6.3.2.5.6
    ...    Test title: PUT individual VNF indicator subscription - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to update an individual VNF performance indicator subscription
    ...    Pre-conditions: A VNF instance is instantiated. At least one VNF indicator subscription is available in the VNF.
    ...    Reference: section 8.4.5.3.4 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The individual VNF indicator subscription is not modified by the operation
    Send Patch Request for Individual VNF Indicator Subscription
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF individual subscription Unmodified (Implicit) 

POST Individual VNF Indicator Subscription - Method not implemented
    [Documentation]    Test ID 6.3.2.5.7
    ...    Test title: PUT individual VNF indicator subscription - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to modify an individual VNF performance indicator subscription
    ...    Pre-conditions: A VNF instance is instantiated. At least one VNF indicator subscription is available in the VNF.
    ...    Reference: section 8.4.5.3.1 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: The individual VNF indicator subscription is not created by the operation
    Send Post Request for Individual VNF Indicator Subscription
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF individual subscription is not created  

 *** Keywords ***
Get Individual VNF Indicator Subscription
    Log    Trying to get a given subscription identified by subscriptionId
    Log    Trying to get a given subscription identified by subscriptionId
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    Integer    response status    200
    ${output}=    Output    response
    Log    Received a 200 OK as expected
    Set Suite Variable    @{response}    ${output}
    ${contentType}=    Output    response headers Content-Type

    Should Contain    ${contentType}    application/json
GET Individual VNF Indicator Subscription with invalid resource identifier
    ${result}=    Output    response body
    Log    Trying to validate result with VnfIndicatorSubscription schema
    Validate Json    VnfIndicatorSubscription.schema.json    ${result}
    Log    Validated VnfIndicatorSubscription schema

GET Subscription - Negative (Not Found)
    Log    Trying to perform a request on a subscriptionID which doesn't exist
    Log    Trying to perform a request on a subscriptionID which doesn't exist
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${erroneousSubscriptionId}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${erroneousSubscriptionId}
    Integer    response status    404
    ${output}=    Output    response
    Log    Received 404 Not Found as expected
    Set Suite Variable    @{response}    ${output}
    ${contentType}=    Output    response headers Content-Type

    Should Contain    ${contentType}    application/json
Send Delete Request for Individual VNF Indicator Subscription
    ${problemDetails}=    Output    response body
    Log    Trying to validate ProblemDetails
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    Log    Validation OK

DELETE Subscription
    Log    Trying to perform a DELETE on a subscriptionId
    Log    Trying to perform a DELETE on a subscriptionId
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    Integer    response status    204
    ${output}=    Output    response
    Log    Received 204 No Content as expected
    Set Suite Variable    @{response}    ${output}


DELETE Subscription - Negative (Not Found)
Send Delete Request for Individual VNF Indicator Subscription with invalid resource identifier
    Log    Trying to perform a DELETE on a subscriptionId which doesn't exist
    Log    Trying to perform a DELETE on a subscriptionId which doesn't exist
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${erroneousSubscriptionId}
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${erroneousSubscriptionId}
    Integer    response status    404
    ${output}=    Output    response
    Log    The subscriptionId is not present in database
    Set Suite Variable    @{response}    ${output}
    ${contentType}=    Output    response headers Content-Type
    
    Should Contain    ${contentType}    application/json
Send Post Request for Individual VNF Indicator Subscription
    ${problemDetails}=    Output    response body
    Log    Trying to create a new subscription
    Log    Trying to validate ProblemDetails
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
    POST    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${erroneousSubscriptionId}
    Log    Validation OK
    ${output}=    Output    response

    Set Suite Variable    @{response}    ${output}   
PUT Subscription - (Method not implemented)

Send Put Request for Individual VNF Indicator Subscription
    Log    Trying to perform a PUT. This method should not be implemented
    Log    Trying to perform a PUT. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    ${origOutput}=    Output    response
    Set Suite Variable    @{origResponse}    ${origOutput}
    PUT    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    PUT    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    Integer    response status    405
    ${output}=    Output    response
    Log    Received 405 Method not implemented as expected
    Set Suite Variable    @{response}    ${output}   


PATCH Subscription - (Method not implemented)
Send Patch Request for Individual VNF Indicator Subscription
    Log    Trying to perform a PATCH. This method should not be implemented
    Log    Trying to create a new subscription
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    ${origOutput}=    Output    response
    Set Suite Variable    @{origResponse}    ${origOutput}
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    Integer    response status    405
    ${output}=    Output    response
    Log    Received 405 Method not implemented as expected
    Set Suite Variable    @{response}    ${output}


POST Subscription - (Method not implemented)
Check HTTP Response Status Code Is
    Log    Trying to perform a POST. This method should not be implemented
    [Arguments]    ${expected_status}    
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${status}=    Convert To Integer    ${expected_status}    
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    Should Be Equal    ${response[0]['status']}    ${status}
    POST    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}
    Log    Status code validated
    Integer    response status    405

    Log    Received 405 Method not implemented as expected
Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
    Log    ${response[0]['headers']}
    Should Contain    ${response[0]['headers']}    ${CONTENT_TYPE}
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK

Check Postcondition Individual VNF Indicator Subscription is Deleted
    Log    Check Postcondition subscription is deleted
    GET Individual VNF Indicator Subscription
    Check HTTP Response Status Code Is    404

Check Postcondition VNF individual subscription Unmodified (Implicit)
    Log    Check Postcondition subscription is not modified
    GET Individual VNF Indicator Subscription
    Log    Check Response matches original subscription
    ${subscription}=    evaluate    json.loads('''${response[0]['body']}''')    json
    Should Be Equal    ${origResponse[0]['body']['callbackUri']}    ${subscription.callbackUri}
    
Check Postcondition VNF individual subscription is not created
    Log    Check Postcondition subscription is not created
    GET Individual VNF Indicator Subscription with invalid resource identifier
    Check HTTP Response Status Code Is    404
+3 −2
Original line number Original line Diff line number Diff line
@@ -144,8 +144,9 @@ Check HTTP Response Header Contains
    Log    Header is present
    Log    Header is present
    
    
Check HTTP Response Body Json Schema Is
Check HTTP Response Body Json Schema Is
    [Arguments]    ${schema}
    [Arguments]    ${input}
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    Should Contain    ${response[0]['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    ${input}    .schema.json
    Validate Json    ${schema}    ${response[0]['body']}
    Validate Json    ${schema}    ${response[0]['body']}
    Log    Json Schema Validation OK
    Log    Json Schema Validation OK


Loading