IndividualVNFindicator.robot 9.77 KB
Newer Older
Elian Kraja's avatar
Elian Kraja committed
1
2
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Elian Kraja's avatar
Elian Kraja committed
3
Resource          environment/variables.txt    # Generic Parameters
Elian Kraja's avatar
Elian Kraja committed
4
Resource          environment/individualVnfIndicator.txt
Elian Kraja's avatar
Elian Kraja committed
5
Library           REST    ${EM-VNF_SCHEMA}://${EM-VNF_HOST}:${EM-VNF_PORT}
Elian Kraja's avatar
Elian Kraja committed
6
7

*** Test Cases ***
8
9
10
11
12
13
14
15
16
17
18
19
Get Individual Indicator for VNF Instance
    [Documentation]    Test ID: 6.3.2.3.1
    ...    Test title: Get individual performance indicator for a VNF instance
    ...    Test objective: The objective is to test the retrieval of a performance indicator for a given VNF instance and perform a JSON schema validation of the returned indicator data structure
    ...    Pre-conditions: A VNF instance is instantiated. At least one measure of performance indicator is available for the given VNF instance.
    ...    Reference:  section 8.4.4.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 Indicator for a VNF instance
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   vnfIndicator
20
21
    Check HTTP Response Body Includes Requested VNF Instance ID
    Check HTTP Response Body Includes Requested Indicator ID
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

Get Individual Indicator for VNF Instance with invalid indicator identifier
    [Documentation]    Test ID 6.3.2.3.2
    ...    Test title: Get individual performance indicator for a VNF instance with invalid indicator identifier
    ...    Test objective: The objective is to test that the retrieval of a performance indicator for a given VNF instance 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 measure of performance indicator is available for the given VNF instance.
    ...    Reference: section 8.4.4.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 Indicator for a VNF instance with invalid indicator identifier
    Check HTTP Response Status Code Is    404
    Check HTTP Response Body Json Schema Is   ProblemDetails

POST Individual VNF Indicator - Method not implemented
    [Documentation]    Test ID 6.3.2.3.3
    ...    Test title: POST individual performance indicator for VNF instance - Method not implemented
    ...    Test objective: The objective is to test that POST method is not allowed to create a new performance indicator for a VNF instance
    ...    Pre-conditions: A VNF instance is instantiated.
    ...    Reference: section 8.4.4.3.1 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: none
    Send POST Request for individual indicator in VNF instance
    Check HTTP Response Status Code Is    405

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

PATCH Individual VNF Indicator - Method not implemented
    [Documentation]    Test ID 6.3.2.3.5
    ...    Test title: PATCH individual performance indicator for VNF instance - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to update an existing performance indicator for a VNF instance
    ...    Pre-conditions: A VNF instance is instantiated. At least one measure of performance indicator is available for the given VNF instance.
    ...    Reference: section 8.4.4.3.4 - SOL002 v2.4.1
    ...    Config ID: Config_prod_VE
    ...    Applicability: The VNF supports the generation and maintenance of performance indicators.
    ...    Post-Conditions: none
69
    Send PATCH Request for individual indicator in VNF instance
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    Check HTTP Response Status Code Is    405

DELETE Individual VNF Indicator - Method not implemented
    [Documentation]    Test ID 6.3.2.3.6
    ...    Test title: DELETE individual performance indicator indicators for VNF instance - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to delete an existing performance indicator for a VNF instance
    ...    Pre-conditions: A VNF instance is instantiated. At least one measure of performance indicator is available for the given VNF instance.
    ...    Reference: section 8.4.3.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 individual performance indicator for the VNF instance is not deleted by the unsuccessful operation
    Send DELETE Request for individual indicator in VNF instance
    Check HTTP Response Status Code Is    405
    Check Postcondition Indicator for VNF instance Exist
    
85
*** Keywords ***
86
87
Get Individual Indicator for a VNF instance
    Log    This resource represents a VNF indicator related to a VNF instance.
Elian Kraja's avatar
Elian Kraja committed
88
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
89
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Elian Kraja's avatar
Elian Kraja committed
90
    GET    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}/${indicatorId}
91
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
92
    Set Suite Variable    ${response}    ${output}
Elian Kraja's avatar
Elian Kraja committed
93

94
95
Get Individual Indicator for a VNF instance with invalid indicator identifier
    Log    Trying to perform a negative get, using wrong identifier
Elian Kraja's avatar
Elian Kraja committed
96
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
97
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Elian Kraja's avatar
Elian Kraja committed
98
    GET    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}/${erroneousIndicatorId}
99
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
100
    Set Suite Variable    ${response}    ${output}
Elian Kraja's avatar
Elian Kraja committed
101

102
Send POST Request for individual indicator in VNF instance
Elian Kraja's avatar
Elian Kraja committed
103
104
    Log    Trying to perform a POST (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
105
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
106
107
    POST    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}/${notAllowedIndicatorId}
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
108
    Set Suite Variable    ${response}    ${output}
Elian Kraja's avatar
Elian Kraja committed
109

110
Send PUT Request for individual indicator in VNF instance
Elian Kraja's avatar
Elian Kraja committed
111
112
    Log    Trying to perform a PUT. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
113
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Elian Kraja's avatar
Elian Kraja committed
114
    PUT    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}/${indicatorId}
115
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
116
    Set Suite Variable    ${response}    ${output}
117
118
    
Send PATCH Request for individual indicator in VNF instance
Elian Kraja's avatar
Elian Kraja committed
119
120
    Log    Trying to perform a PATCH. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
121
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Elian Kraja's avatar
Elian Kraja committed
122
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}/${indicatorId}
123
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
124
    Set Suite Variable    ${response}    ${output} 
125
126
     
Send DELETE Request for individual indicator in VNF instance
Elian Kraja's avatar
Elian Kraja committed
127
128
    Log    Trying to perform a DELETE. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
129
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Elian Kraja's avatar
Elian Kraja committed
130
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/indicators/${vnfInstanceId}/${indicatorId}
131
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
132
    Set Suite Variable    ${response}    ${output} 
133
134
135
136

Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
    ${status}=    Convert To Integer    ${expected_status}    
Giacomo Bernini's avatar
Giacomo Bernini committed
137
    Should Be Equal    ${response['status']}    ${status}
138
139
140
141
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
Giacomo Bernini's avatar
Giacomo Bernini committed
142
143
    Log    ${response['headers']}
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
144
145
146
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
147
    [Arguments]    ${input}
Giacomo Bernini's avatar
Giacomo Bernini committed
148
    Should Contain    ${response['headers']['Content-Type']}    application/json
149
    ${schema} =    Catenate    ${input}    .schema.json
Giacomo Bernini's avatar
Giacomo Bernini committed
150
    Validate Json    ${schema}    ${response['body']}
151
152
    Log    Json Schema Validation OK

153
Check HTTP Response Body Includes Requested Indicator ID
154
    Log    Check Response includes propoer VNF instance and Indicator identifiers
Giacomo Bernini's avatar
Giacomo Bernini committed
155
    Should Be Equal    ${response['body']['id']}    ${indicatorId}
156

157
Check HTTP Response Body Includes Requested VNF Instance ID
158
    Log    Check Response includes propoer VNF instance and Indicator identifiers
Giacomo Bernini's avatar
Giacomo Bernini committed
159
    Should Be Equal    ${response['body']['vnfInstanceId']}    ${vnfInstanceId}
160
161
162
163

Check Postcondition Indicator for VNF instance Exist
    Log    Check Response includes VNF Indicator
    Get Individual Indicator for a VNF instance
Giacomo Bernini's avatar
Giacomo Bernini committed
164
165
    Should Be Equal    ${response['body']['vnfInstanceId']}    ${vnfInstanceId}
    Should Be Equal    ${response['body']['id']}    ${indicatorId}