PlatAppServices.robot 9.88 KB
Newer Older
1
2
3
*** Settings ***

Documentation
4
...    A test suite for validating Application Service Availability Query (APPSAQ) operations.
5

6
Resource    ../../GenericKeywords.robot
Elian Kraja's avatar
Elian Kraja committed
7
8
Resource    environment/variables.txt
Library     REST    ${SCHEMA}://${HOST}:${PORT}    ssl_verify=false
9

Elian Kraja's avatar
Elian Kraja committed
10
Default Tags    TC_MEC_SRV_APPSAQ
11
12
13
14
15



*** Test Cases ***

Elian Kraja's avatar
Elian Kraja committed
16
TC_MEC_SRV_APPSAQ_001_OK
17
    [Documentation]
18
19
    ...    Check that the IUT responds with a list of available MEC services
    ...    for a given application instance when queried by a MEC Application
20
    ...
21
22
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.1
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
23

24
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
25

Elian Kraja's avatar
Elian Kraja committed
26
    Get a list of mecService of an application instance    ${APP_INSTANCE_ID} 
27
28
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    ServiceInfoList
29

30

Elian Kraja's avatar
Elian Kraja committed
31
TC_MEC_SRV_APPSAQ_001_BR
32
33
    [Documentation]
    ...   Check that the IUT responds with an error when
34
    ...    a request with incorrect parameters is sent by a MEC Application
35
    ...
36
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.1
37

38
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
39

40
    # Wrong query parameter name should trigger an error response.
Elian Kraja's avatar
Elian Kraja committed
41
    Get a list of mecService of an application instance with parameters    ${APP_INSTANCE_ID}    ${INSTANCE_ID}    ${FAKE_INSTANCE_ID_VALUE}
42
    Check HTTP Response Status Code Is    400
43
44


Elian Kraja's avatar
Elian Kraja committed
45
TC_MEC_SRV_APPSAQ_002_OK
46
    [Documentation]
47
48
    ...    Check that the IUT notifies the authorised relevant (subscribed) application
    ...    instances when a new service for a given application instance is registered
49
    ...
50
51
52
53
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.4
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
54
    Create new service    ServiceInfo    ${APP_INSTANCE_ID}
55
56
57
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    ServiceInfo
    Check HTTP Response Header Contains    Location
Elian Kraja's avatar
Elian Kraja committed
58
#    Check Result Contains    ${response['body']['ServiceInfo']}    serName    ${SERVICE_NAME}
59
60


Elian Kraja's avatar
Elian Kraja committed
61
TC_MEC_SRV_APPSAQ_002_BR
62
63
64
65
66
67
68
69
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.4
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
70
    Create new service    ServiceInfoError    ${APP_INSTANCE_ID}
71
72
73
    Check HTTP Response Status Code Is    400


Elian Kraja's avatar
Elian Kraja committed
74
TC_MEC_SRV_APPSAQ_002_NF
75
76
77
78
79
80
81
82
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.4
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
83
    Create new service    ServiceInfo    ${NON_EXISTENT_APP_INSTANCE_ID}
84
85
86
    Check HTTP Response Status Code Is    404


Elian Kraja's avatar
Elian Kraja committed
87
TC_MEC_SRV_APPSAQ_003_OK
88
89
90
91
92
93
94
95
    [Documentation]
    ...    Check that the IUT responds with the information on a specific service
    ...    for a given application instance when queried by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.1
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
96
    Get individual service    ${APP_INSTANCE_ID}    ${SERVICE_ID}
97
98
99
100
101
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    ServiceInfo
    Check Result Contains    ${response['body']['ServiceInfo']}    serInstanceId    ${SERVICE_ID}


Elian Kraja's avatar
Elian Kraja committed
102
TC_MEC_SRV_APPSAQ_003_NF
103
104
105
106
107
108
109
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.1

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
110
    Get individual service    ${APP_INSTANCE_ID}    ${NON_EXISTENT_SERVICE_ID}
111
112
113
    Check HTTP Response Status Code Is    404


Elian Kraja's avatar
Elian Kraja committed
114
TC_MEC_SRV_APPSAQ_004_OK
115
116
117
118
119
120
121
122
    [Documentation]
    ...    Check that the IUT updates a service information for a given
    ...    application instance when commanded by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
123
    Update service    ${APP_INSTANCE_ID}    ${SERVICE_ID}    ServiceInfoUpdated
124
125
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    ServiceInfo
Elian Kraja's avatar
Elian Kraja committed
126
    #Check Result Contains    ${response['body']['ServiceInfo']}    version    ${SVC_NEW_VERSION}
127
128


Elian Kraja's avatar
Elian Kraja committed
129
TC_MEC_SRV_APPSAQ_004_BR
130
131
132
133
134
135
136
137
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
138
    Update service    ${APP_INSTANCE_ID}    ${SERVICE_ID}    ServiceInfoUpdatedError
139
140
141
    Check HTTP Response Status Code Is    400


Elian Kraja's avatar
Elian Kraja committed
142
TC_MEC_SRV_APPSAQ_004_NF
143
144
145
146
147
148
149
150
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
151
    Update service    ${APP_INSTANCE_ID}    ${NON_EXISTENT_SERVICE_ID}    ServiceInfoUpdated
152
153
154
    Check HTTP Response Status Code Is    404


Elian Kraja's avatar
Elian Kraja committed
155
TC_MEC_SRV_APPSAQ_004_PF
156
157
158
159
160
161
162
163
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request sent by a MEC Application doesn't comply with a required condition
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
Elian Kraja's avatar
Elian Kraja committed
164
    Update service with invalid etag     ${APP_INSTANCE_ID}    ${SERVICE_ID}    ServiceInfoUpdated
165
166
167
168
169
    Check HTTP Response Status Code Is    412



*** Keywords ***
Elian Kraja's avatar
Elian Kraja committed
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
Get a list of mecService of an application instance with parameters
    [Arguments]    ${appInstanceId}    ${key}=None    ${value}=None
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services?${key}=${value}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get a list of mecService of an application instance
    [Arguments]    ${appInstanceId}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
186

Elian Kraja's avatar
Elian Kraja committed
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
Create new service
    [Arguments]    ${content}    ${appInstanceId}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
    ${body}=    Get File    ${file}
    Post    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}


Get individual service
    [Arguments]    ${appInstanceId}    ${serviceName} 
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services/${serviceName}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}  
    
Update service    
    [Arguments]    ${appInstanceId}    ${serviceId}    ${content}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
    ${body}=    Get File    ${file}
    Post    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services/${serviceId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    


Update service with invalid etag
    [Arguments]    ${appInstanceId}    ${serviceId}    ${content}
    Set Headers    {"If-Match": ${INVALID_ETAG}}
    Update service    ${appInstanceId}    ${serviceId}    ${content}
    

# Check Plaform IUT notifies the MEC Application instances
    # [Documentation]
    # ...    
229

Elian Kraja's avatar
Elian Kraja committed
230
    # [Arguments]    ${instance_id}    ${content}
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246

    # TODO check how to send the message (isn't defined). Does it need to be tested as it's not defined?
    
    # // MEC 011, clause 6.4.2
    # the IUT entity sends a notification_message containing
    # body containing
    # notificationType set to "SerAvailabilityNotification",
    # services containing
    # serName set to SERVICE_NAME
    # _links containing
    # subscription set to MP1_SUBSCRIPTION_A
    # ;
    # ;
    # ;
    # ;
    # to the MEC_APP_Subscriber entity