Commit 3bd3c2d7 authored by Elian Kraja's avatar Elian Kraja
Browse files
parents 871b2cd4 1c47a04e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@ DELETE an individual subscription
    [Documentation]    Test ID: 8.4.5.5
    [Documentation]    Test ID: 8.4.5.5
    ...    Test title:DELETE an individual subscription
    ...    Test title:DELETE an individual subscription
    ...    Test objective: The objective is to DELETE an individual subscription 
    ...    Test objective: The objective is to DELETE an individual subscription 
    ...    Pre-conditions: Subsbcription already exists
    ...    Pre-conditions: The Subsbcription already exists
    ...    Reference: section 8.4.5 - SOL005 v2.4.1
    ...    Reference: section 8.4.5 - SOL005 v2.4.1
    ...    Config ID:
    ...    Config ID:
    ...    Applicability: 
    ...    Applicability: 
+87 −8
Original line number Original line Diff line number Diff line
@@ -4,9 +4,16 @@ Library REST ${NFVO_SCHEMA}://${NFVO_HOST}:${NFVO_PORT}
Library    JSONLibrary
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    JSONSchemaLibrary    schemas/
Library    OperatingSystem
Library    OperatingSystem

Suite Teardown    Terminate All Processes    kill=true
Library    MockServerLibrary
Library    Process


*** Keywords ***
*** Keywords ***
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}     #The API producer is set to NFVO according to SOL002-7.3.4
    
Check Individual Subscription existance
Check Individual Subscription existance
    Set Headers    {"Accept":"${ACCEPT}"}
    Set Headers    {"Accept":"${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
@@ -35,6 +42,14 @@ Check HTTP Response Header ContentType is
    Should Be Equal    ${response[0]['headers']['Content-Type']}    ${expected_contentType}
    Should Be Equal    ${response[0]['headers']['Content-Type']}    ${expected_contentType}
    Log    Content Type validated 
    Log    Content Type validated 
    
    
Check Alarm notification Endpoint has been delivered
    Log  Verifying results
    Wait Until Keyword Succeeds    ${sleep_interval}    Verify Mock Expectation    ${req_mock}
        
Clean Endpoint   
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint}
    
Do POST Alarms
Do POST Alarms
    log    Trying to perform a POST. This method should not be implemented
    log    Trying to perform a POST. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Accept":"${ACCEPT}"}  
@@ -59,7 +74,6 @@ Do PUT Alarms
    ${outputResponse}=    Output    response 
    ${outputResponse}=    Output    response 
    Set Global Variable    @{response}    ${outputResponse}
    Set Global Variable    @{response}    ${outputResponse}
    
    
    
Do DELETE Alarms
Do DELETE Alarms
    log    Trying to perform a DELETE. This method should not be implemented
    log    Trying to perform a DELETE. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Accept":"${ACCEPT}"}  
@@ -149,7 +163,6 @@ Do PATCH Individual Alarm
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
    Set Global Variable    @{response}    ${outputResponse}
   
   
   
Do PATCH Individual Alarm Conflict
Do PATCH Individual Alarm Conflict
    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}"} 
@@ -187,7 +200,6 @@ Do GET Subscriptions with filter
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}    
    Set Global Variable    @{response}    ${outputResponse}    
    
    
    
Do GET Subscriptions with Invalid filter   
Do GET Subscriptions with Invalid filter   
    Log    Get the list of active subscriptions using an invalid filter
    Log    Get the list of active subscriptions using an invalid filter
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Accept": "${ACCEPT}"}
@@ -228,7 +240,6 @@ Do POST Individual Subscription
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
    Set Global Variable    @{response}    ${outputResponse}
    
    
    
Do GET Individual Subscription
Do GET Individual Subscription
    log    Trying to get information about an individual subscription
    log    Trying to get information about an individual subscription
    Set Headers    {"Accept":"${ACCEPT}"}  
    Set Headers    {"Accept":"${ACCEPT}"}  
@@ -237,7 +248,6 @@ Do GET Individual Subscription
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}   
    Set Global Variable    @{response}    ${outputResponse}   
    
    
    
Do PUT Individual Subscription
Do PUT Individual 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}"}
    Set Headers  {"Accept":"${ACCEPT}"}
@@ -261,3 +271,72 @@ Do DELETE Individual Subscription
    Delete    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}  
    Delete    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId}  
    ${outputResponse}=    Output    response
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
    Set Global Variable    @{response}    ${outputResponse}
    

Do POST Alarm Notification Endpoint    
    log    The POST method delivers a notification - Information of a NFVO alarm.
    ${json}=	Get File	schemas/alarmNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle alarmNotification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Set Global Variable    @{req_mock}    ${req}
    Set Global Variable    @{resp_mock}    ${rsp}
    
Do POST Alarm Clearance Notification Endpoint 
    log    The POST method delivers a notification - Information of a NFVO alarm.
    ${json}=	Get File	schemas/alarmClearedNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle alarmNotification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Set Global Variable    @{req_mock}    ${req}
    Set Global Variable    @{resp_mock}    ${rsp}
    
Do POST Alarm List Rebuilt Notification Endpoint 
     log    The POST method delivers a notification - Information of a NFVO alarm.
    ${json}=	Get File	schemas/alarmListRebuiltNotification.schema.json
    ${BODY}=	evaluate	json.loads('''${json}''')	json
    Log  Creating mock request and response to handle alarmNotification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${BODY}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Set Global Variable    @{req_mock}    ${req}
    Set Global Variable    @{resp_mock}    ${rsp}   

Do GET Notification Endpoint
    log    The GET method allows the server to test the notification endpoint
    &{req}=  Create Mock Request Matcher	GET  ${callback_endpoint}    
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}    
    Set Global Variable    @{req_mock}    ${req}
    Set Global Variable    @{resp_mock}    ${rsp}
    
Do PUT Notification     
    Log  PUT Method not implemented
    &{req}=  Create Mock Request Matcher	PUT  ${callback_endpoint}
    &{rsp}=  Create Mock Response  status_code=405
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    
Do PATCH Notification     
    Log  PATCH Method not implemented
    &{req}=  Create Mock Request Matcher	PATCH  ${callback_endpoint}
    &{rsp}=  Create Mock Response  status_code=405
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    
Do DELETE Notification     
    Log  DELETE Method not implemented
    &{req}=  Create Mock Request Matcher	DELETE  ${callback_endpoint}
    &{rsp}=  Create Mock Response  status_code=405
    Create Mock Expectation  ${req}  ${rsp}
    Sleep  ${sleep_interval}
    Log  Verifying results
    Verify Mock Expectation  ${req}
 No newline at end of file
+97 −0
Original line number Original line Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource    NSFMOperationKeywords.robot   
Suite Teardown    Terminate All Processes    kill=true
Library    MockServerLibrary
Library    Process
Library    OperatingSystem
Suite Setup    Create Sessions

*** Test Cases ***
Deliver a notification - Alarm
    [Documentation]    Test ID: 8.4.6.2-1
    ...    Test title: Deliver a notification - Alarm
    ...    Test objective: The objective is to notify a NFVO alarm or that the alarm list has been rebuilt.
    ...    Pre-conditions: The NFVO has subscribed to the NSFM alarm
    ...    Reference: section 8.4.6 - SOL005 v2.4.1
    ...    Config ID:
    ...    Applicability: 
    ...    Post-Conditions:   
    Do POST Alarm Notification Endpoint 
    Check Alarm notification Endpoint has been delivered
    Clean Endpoint 

Deliver a notification - Alarm Clearance
    [Documentation]    Test ID: 8.4.6.2-2
    ...    Test title: Deliver a notification - Alarm Clearance
    ...    Test objective: The objective is to notify a NFVO alarm or that the alarm list has been rebuilt.
    ...    Pre-conditions: The NFVO has subscribed to the NSFM alarm
    ...    Reference: section 8.4.6 - SOL005 v2.4.1
    ...    Config ID:
    ...    Applicability: 
    ...    Post-Conditions:   
    Do POST Alarm Clearance Notification Endpoint 
    Check Alarm notification Endpoint has been delivered
    Clean Endpoint 

Deliver a notification - Alarm List Rebuilt
    [Documentation]    Test ID: 8.4.6.2-3
    ...    Test title: Deliver a notification - Alarm List Rebuilt
    ...    Test objective: The objective is to notify a NFVO alarm or that the alarm list has been rebuilt.
    ...    Pre-conditions: The NFVO has subscribed to the NSFM alarm
    ...    Reference: section 8.4.6 - SOL005 v2.4.1
    ...    Config ID:
    ...    Applicability: 
    ...    Post-Conditions:  
    Do POST Alarm List Rebuilt Notification Endpoint 
    Check Alarm notification Endpoint has been delivered
    Clean Endpoint 

Test a notification end point
    [Documentation]    Test ID: 8.4.6.3
    ...    Test title: Test a notification end point
    ...    Test objective: The objective is to allow the server to test the notification endpoint that is provided by the client, e.g. during subscription
    ...    Pre-conditions: 
    ...    Reference: section 8.4.6 - SOL005 v2.4.1
    ...    Config ID:
    ...    Applicability: 
    ...    Post-Conditions:  
    Do GET Notification Endpoint
    Check Alarm notification Endpoint has been delivered
    Clean Endpoint 
    
PUT notification - Method not implemented
    [Documentation]    Test ID: 8.4.6.4
    ...    Test title: PUT notification - Method not implemented
    ...    Test objective: The objective is to PUT a notification endpoint. The method should not be implemented
    ...    Pre-conditions: 
    ...    Reference: section 8.4.6 - SOL005 v2.4.1
    ...    Config ID:
    ...    Applicability: 
    ...    Post-Conditions:  
    Do PUT Notification 
    Clean Endpoint

PATCH notification - Method not implemented
  [Documentation]    Test ID: 8.4.6.5
    ...    Test title: PATCH notification - Method not implemented
    ...    Test objective: The objective is to PATCH a notification endpoint. The method should not be implemented
    ...    Pre-conditions: 
    ...    Reference: section 8.4.6 - SOL005 v2.4.1
    ...    Config ID:
    ...    Applicability: 
    ...    Post-Conditions:  
    Do PATCH Notification 
    Clean Endpoint
    
DELETE notification - Method not implemented
  [Documentation]    Test ID: 8.4.6.6
    ...    Test title: DELETE notification - Method not implemented
    ...    Test objective: The objective is to DELETE a notification endpoint. The method should not be implemented
    ...    Pre-conditions: 
    ...    Reference: section 8.4.6 - SOL005 v2.4.1
    ...    Config ID:
    ...    Applicability: 
    ...    Post-Conditions:  
    Do DELETE Notification 
    Clean Endpoint
 No newline at end of file
+5 −0
Original line number Original line Diff line number Diff line
@@ -39,3 +39,8 @@ ${AlarmClearedNotification} {}
${AlarmListRebuiltNotification}    {}
${AlarmListRebuiltNotification}    {}


${response}    {}
${response}    {}

&{req_mock}    {}
&{resp_mock}    {}