Commit 7afb3303 authored by Najam UI Hassan's avatar Najam UI Hassan Committed by Giacomo Bernini
Browse files

Added Test Cases for IndiviualAlarm.robot

parent 6eed89f9
Loading
Loading
Loading
Loading
+76 −2
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ Library OperatingSystem
Library    Process

*** Variables ***

${original_etag}    1234

*** Keywords ***

@@ -93,3 +93,77 @@ Check Postcondition NFV-MANO fault management alarms Exists
    GET Fault Management Alarms
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    Alarms
    
Send POST request for fault management Individual Alarm
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Post    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarmId}
    ${outputResponse}=    Output    response 
    Set Global Variable    @{response}    ${outputResponse}
    
GET Fault Management Individual Alarm
    Log    Query VNF The GET method queries information about an alarm.
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarmId}
    ${etag}    Output    response headers ETag
    Set Suite Variable    &{original_etag}    ${etag}
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
    
PUT Fault Management Individual Alarm
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Put    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarmId}
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
    
Check Postcondition fault management individual alarm Exists
    Log    Checking that individual alarm exists
    GET Fault Management Individual Alarm
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    alarm  
    
PATCH Fault Management Individual Alarm
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/alarmModifications.json
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarmId}    ${body}
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
    
PATCH Fault Management Individual Alarm - precondition failed
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    Set Headers    {"If-Match": "${original_etag[0]}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/alarmModifications.json
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarmId}    ${body}
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
   
PATCH Fault Management Individual Alarm Conflict
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    Set Headers    {"If-Match": "${Etag}"} 
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/alarmModifications.json
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarmId}    ${body}
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
    
DELETE Fault Management Individual Alarm
    log    Trying to perform a DELETE. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Delete    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarmId}
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
 No newline at end of file
+104 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    environment/variables.txt 
Resource    FaultManagement-APIKeyword.robot
Library    REST    ${NFVMANO_SCHEMA}://${NFVMANO_HOST}:${NFVMANO_PORT} 
Library    OperatingSystem
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/
Library    DependencyLibrary



*** Test Cases ***
POST Alarm - Method not implemented
     [Documentation]    Test ID: 8.3.3.2.1
    ...    Test title: POST Alarm - Method not implemented
    ...    Test objective: The objective is to test that Post method is not allowed to create Fault management individual alarm on NFV-MANO 
    ...    Pre-conditions: none
    ...    Reference: clause 7.5.4.3.1 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none  
    Send POST request for fault management Individual Alarm
    Check HTTP Response Status Code Is    405   

Get information about an fault management individual alarm
    [Documentation]    Test ID: 8.3.3.2.2
    ...    Test title: Get information about an fault management individual alarm
    ...    Test objective: The objective is to retrieve information about an individual alarm and perform a JSON schema and content validation of the returned alarm data structure
    ...    Pre-conditions: The related alarm exists
    ...    Reference: clause 7.5.4.3.2 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions:  none 
    GET Fault Management Individual Alarm
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    alarm

PUT Alarm - Method not implemented
    [Documentation]    Test ID: 8.3.3.2.3
    ...    Test title: PUT Alarm - Method not implemented
    ...    Test objective: he objective is to test that PUT method is not allowed to for Fault management individual alarm on NFV-MANO 
    ...    Pre-conditions: The related alarm exists
    ...    Reference: clause 7.5.4.3.3 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions:  none 
    PUT Fault Management Individual Alarm
    Check HTTP Response Status Code Is    405

PATCH Fault Management Individual Alarm
    [Documentation]    Test ID: 8.3.3.2.4
    ...    Test title: PATCH Fault Management Individual Alarm
    ...    Test objective: The objective is to Modify an individual alarm resource and perform a JSON schema and content validation of the returned alarm data structure
    ...    Pre-conditions: The related alarm exists
    ...    Reference: clause 7.5.4.3.4 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    Check Postcondition fault management individual alarm Exists
    PATCH Fault Management Individual Alarm
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is  alarmModification

Modify an individual alarm resource - Precondition failed
    [Documentation]    Test ID: 8.3.3.2.5
    ...    Test title: Modify an individual alarm resource - Precondition failed
    ...    Test objective: The objective is to test that an individual alarm resource cannot be modified if the alarm is already in the state that is requested to be set
    ...    Pre-conditions: The related alarm exists
    ...    Reference: clause 7.5.4.3.4 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    Check Postcondition fault management individual alarm Exists  
    PATCH Fault Management Individual Alarm - precondition failed
    Check HTTP Response Status Code Is    409
    Check HTTP Response Body Json Schema Is  ProblemDetails

Modify an individual alarm resource - Conflict
    [Documentation]    Test ID: 8.3.3.2.6
    ...    Test title: Modify an individual alarm resource - Conflict
    ...    Test objective: The objective is to test that an individual alarm resource cannot be modified if the resource was modified by another entity
    ...    Pre-conditions: The related alarm exists
    ...    Reference: clause 7.5.4.3.4 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none
    Depends On Test    PATCH Fault Management Individual Alarm
    Check Postcondition fault management individual alarm Exists
    PATCH Fault Management Individual Alarm Conflict
    Check HTTP Response Status Code Is    412
    Check HTTP Response Body Json Schema Is     ProblemDetails

DELETE Alarm - Method not implemented
     [Documentation]    Test ID: 8.3.3.2.7
    ...    Test title: DELETE Alarm - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to for Fault management individual alarm on NFV-MANO
    ...    Pre-conditions: nona
    ...    Reference: clause 7.5.4.3.5 - ETSI GS NFV-SOL 009 [5] V3.3.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions:  The individual alarm still exists 
    DELETE Fault Management Individual Alarm
    Check HTTP Response Status Code Is    405
    Check Postcondition fault management individual alarm Exists
 No newline at end of file
+8 −0
Original line number Diff line number Diff line
@@ -14,10 +14,18 @@ ${apiName} nfvmanofm
${apiMajorVersion}     v1

${response}    {}
${CONTENT_TYPE_PATCH}    application/merge-patch+json

${alarm_filter}       managedObjectId
${managedObjectId}    007c111c-38a1-42c0-a666-7475ecb1567c
${invalid_alarm_filter}    badFilter

${alarmId}    6fc3539c-e602-4afa-8e13-962fb5a7d81d

${Etag}=    an etag
${Etag_modified}=    a modified etag