Newer
Older
*** Settings ***
Resource /opt/robot-tests/tests/resources/common.resource
Library /opt/robot-tests/tests/libraries/bodyRequests.py
Library XML
Library String
Resource /opt/robot-tests/tests/resources/common/basicRequests.robot
Resource ../../resources/common.resource
Suite Teardown Reset Testing Environment
Test Setup Reset Testing Environment
Test Teardown Reset Testing Environment
*** Variables ***
${API_INVOKER_NOT_REGISTERED} not-valid
${SUBSCRIBER_ID_NOT_VALID} not-valid
${SUBSCRIPTION_ID_NOT_VALID} not-valid
*** Test Cases ***
21
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
Publish without apiStatus feature receive eventDetails with serviceAPIDescription
[Tags] api_status-1 mockserver smoke
# Initialize Mock server
Init Mock Server
# Default Invoker Registration and Onboarding
${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding
# Register APF
${register_user_info_provider}= Provider Default Registration total_aef_roles=2
${aef_id_1}= Set Variable ${register_user_info_provider['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']}
${aef_id_2}= Set Variable ${register_user_info_provider['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']}
${aef_ids}= Create List ${aef_id_1} ${aef_id_2}
# Subscribe to events
${events_list}= Create List SERVICE_API_AVAILABLE SERVICE_API_UNAVAILABLE
${request_body}= Create Events Subscription
... events=@{events_list}
... notification_destination=${NOTIFICATION_DESTINATION_URL}/testing
... supported_features=C
${resp}= Post Request Capif
... /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
... json=${request_body}
... server=${CAPIF_HTTPS_URL}
... verify=ca.crt
... username=${INVOKER_USERNAME}
# Check Results
Check Response Variable Type And Values ${resp} 201 EventSubscription
${subscriber_id} ${subscription_id}= Check Event Location Header ${resp}
# Publish api with 2 aefIds
${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api
... ${register_user_info_provider}
... service_1
... aef_id=${aef_ids}
# Discover APIs by invoker
${resp}= Get Request Capif
... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${aef_id_1}
... server=${CAPIF_HTTPS_URL}
... verify=ca.crt
... username=${INVOKER_USERNAME}
Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs
# Check Results
Dictionary Should Contain Key ${resp.json()} serviceAPIDescriptions
Should Not Be Empty ${resp.json()['serviceAPIDescriptions']}
Length Should Be ${resp.json()['serviceAPIDescriptions']} 1
List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published}
# Provider Remove service_1 published API
${resp}= Delete Request Capif
... ${resource_url.path}
... server=${CAPIF_HTTPS_URL}
... verify=ca.crt
... username=${APF_PROVIDER_USERNAME}
Status Should Be 204 ${resp}
# Check Event Notifications
## Create check Events to ensure all notifications were received
${service_api_available_resources}= Create List ${resource_url}
${service_api_unavailable_resources}= Create List ${resource_url}
${events_expected}= Create Expected Events For Service API Notifications
... subscription_id=${subscription_id}
... service_api_available_resources=${service_api_available_resources}
... service_api_unavailable_resources=${service_api_unavailable_resources}
... event_detail_expected=${TRUE}
... service_api_description_expected=${TRUE}
... service_api_description=${service_api_description_published}
## Check Events Expected towards received notifications at mock server
Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected}
Publish without apiStatus feature receive eventDetails without serviceAPIDescription
[Tags] api_status-2 mockserver
# Initialize Mock server
Init Mock Server
# Default Invoker Registration and Onboarding
${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding
# Register APF
${register_user_info_provider}= Provider Default Registration total_aef_roles=2
${aef_id_1}= Set Variable ${register_user_info_provider['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']}
${aef_id_2}= Set Variable ${register_user_info_provider['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']}
${aef_ids}= Create List ${aef_id_1} ${aef_id_2}
# Subscribe to events
${events_list}= Create List SERVICE_API_AVAILABLE SERVICE_API_UNAVAILABLE
${request_body}= Create Events Subscription
... events=@{events_list}
... notification_destination=${NOTIFICATION_DESTINATION_URL}/testing
... supported_features=4
${resp}= Post Request Capif
... /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
... json=${request_body}
... server=${CAPIF_HTTPS_URL}
... verify=ca.crt
... username=${INVOKER_USERNAME}
# Check Results
Check Response Variable Type And Values ${resp} 201 EventSubscription
${subscriber_id} ${subscription_id}= Check Event Location Header ${resp}
# Publish api with 2 aefIds
${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api
... ${register_user_info_provider}
... service_1
... aef_id=${aef_ids}
# Discover APIs by invoker
${resp}= Get Request Capif
... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${aef_id_1}
... server=${CAPIF_HTTPS_URL}
... verify=ca.crt
... username=${INVOKER_USERNAME}
Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs
# Check Results
Dictionary Should Contain Key ${resp.json()} serviceAPIDescriptions
Should Not Be Empty ${resp.json()['serviceAPIDescriptions']}
Length Should Be ${resp.json()['serviceAPIDescriptions']} 1
List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_published}
# Provider Remove service_1 published API
${resp}= Delete Request Capif
... ${resource_url.path}
... server=${CAPIF_HTTPS_URL}
... verify=ca.crt
... username=${APF_PROVIDER_USERNAME}
Status Should Be 204 ${resp}
# Check Event Notifications
## Create check Events to ensure all notifications were received
${service_api_available_resources}= Create List ${resource_url}
${service_api_unavailable_resources}= Create List ${resource_url}
${events_expected}= Create Expected Events For Service API Notifications
... subscription_id=${subscription_id}
... service_api_available_resources=${service_api_available_resources}
... service_api_unavailable_resources=${service_api_unavailable_resources}
... event_detail_expected=${TRUE}
... service_api_description_expected=${FALSE}
... service_api_description=${service_api_description_published}
## Check Events Expected towards received notifications at mock server
Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected}
#### -----
[Tags] api_status-x mockserver smoke
# Initialize Mock server
Init Mock Server
# Default Invoker Registration and Onboarding
${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding
# Register APF
${register_user_info_provider}= Provider Default Registration
${aef_id}= Set Variable ${register_user_info_provider['aef_id']}
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
229
230
231
232
233
234
235
236
237
# Subscribe to events
${events_list}= Create List SERVICE_API_AVAILABLE SERVICE_API_UNAVAILABLE
${aef_ids}= Create List ${register_user_info_provider['aef_id']}
${event_filter}= Create Capif Event Filter aefIds=${aef_ids}
${event_filters}= Create List ${event_filter}
${request_body}= Create Events Subscription
... events=@{events_list}
... notification_destination=${NOTIFICATION_DESTINATION_URL}/testing
... event_filters=${event_filters}
... supported_features=4
${resp}= Post Request Capif
... /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
... json=${request_body}
... server=${CAPIF_HTTPS_URL}
... verify=ca.crt
... username=${INVOKER_USERNAME}
# Check Results
Check Response Variable Type And Values ${resp} 201 EventSubscription
${subscriber_id} ${subscription_id}= Check Event Location Header ${resp}
# Publish one api
${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api
... ${register_user_info_provider}
... service_1
# Provider Remove service_1 published API
${resp}= Delete Request Capif
... ${resource_url.path}
... server=${CAPIF_HTTPS_URL}
... verify=ca.crt
... username=${APF_PROVIDER_USERNAME}
Status Should Be 204 ${resp}
# Check Event Notifications
## Create check Events to ensure all notifications were received
${service_api_available_resources}= Create List ${resource_url}
${service_api_unavailable_resources}= Create List ${resource_url}
${events_expected}= Create Expected Events For Service API Notifications
... subscription_id=${subscription_id}
... service_api_available_resources=${service_api_available_resources}
... service_api_unavailable_resources=${service_api_unavailable_resources}
## Check Events Expected towards received notifications at mock server
Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected}