blob: cf3f1097e829eec9606d24b6a4cd16c07a5b5e72 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library RequestsLibrary
grabinsk78ef07a2019-05-06 11:26:25 +02003Library Collections
Gary Wu9abb61c2018-09-27 10:38:50 -07004Library PrhLibrary.py
5Resource ../../../common.robot
6
7*** Keywords ***
kurczews859154a2019-04-26 11:31:51 +02008Verify PNF ready sent
9 [Arguments] ${test_case_directory}
10 ${pnf_entry}= Get Data From File ${test_case_directory}/aai-entry.json
11 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
12 ${expected_pnf_ready_event}= Get Data From File ${test_case_directory}/expected-pnf-ready-event.json
13 Add PNF entry in AAI ${pnf_entry}
14 Set VES event in DMaaP ${ves_event}
15 Wait Until Keyword Succeeds 10x 3000ms Check CBS ready
Marcin Migdal8d000c32019-06-12 11:55:05 +020016 Wait Until Keyword Succeeds 10x 3000ms Check created PNF_READY notification ${expected_pnf_ready_event}
kurczews859154a2019-04-26 11:31:51 +020017
Joanna Jeremicz4a70dd32019-06-25 13:39:33 +020018Verify PNF ready sent and old logical link removed from AAI
19 [Arguments] ${test_case_directory}
20 ${logical_link}= Get Data From File ${test_case_directory}/logical-link.json
21 Add logical link entry in AAI ${logical_link}
22 Verify PNF ready sent ${test_case_directory}
23 Wait Until Keyword Succeeds 10x 3000ms Check no logical link in AAI ${test_case_directory}
24
kurczews859154a2019-04-26 11:31:51 +020025Verify PNF ready sent and logical link created
26 [Arguments] ${test_case_directory}
27 ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json
28 Verify PNF ready sent ${test_case_directory}
Marcin Migdal8d000c32019-06-12 11:55:05 +020029 Check created Logical Link ${expected_logical_link}
kurczews859154a2019-04-26 11:31:51 +020030
31Verify event with missing required field is logged
32 [Arguments] ${test_case_directory}
33 ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
34 Set VES event in DMaaP ${invalid_ves_event}
grabinsk8bc68e22019-06-14 13:56:17 +020035 Log Invalid ves event: ${invalid_ves_event}
binieke98a7252019-06-03 11:46:23 +020036 ${notification}= Create invalid notification ${invalid_ves_event}
37 ${error_msg}= Set Variable Incorrect json, consumerDmaapModel can not be created:
38 Wait Until Keyword Succeeds 10x 3000ms Check PRH json log ${error_msg} ${notification}
kurczews859154a2019-04-26 11:31:51 +020039
40Verify incorrect JSON event is logged
41 [Timeout] 60s
42 [Arguments] ${test_case_directory}
43 ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
44 Set VES event in DMaaP ${invalid_ves_event}
grabinsk8bc68e22019-06-14 13:56:17 +020045 Check PRH log |WARN |Incorrect json, consumerDmaapModel can not be created:
kurczews859154a2019-04-26 11:31:51 +020046
47Verify missing AAI record is logged
Marcin Migdalee954032019-04-30 12:23:29 +020048 [Timeout] 100s
kurczews859154a2019-04-26 11:31:51 +020049 [Arguments] ${test_case_directory}
50 ${incorrect_aai_entry}= Get Data From File ${test_case_directory}/incorrect-aai-entry.json
51 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
52 Add PNF entry in AAI ${incorrect_aai_entry}
53 Set VES event in DMaaP ${ves_event}
grabinsk2d51f2b2019-06-10 11:35:48 +020054 Check PRH log Request failed for URL 'https://aai:3334/aai/v12/network/pnfs/pnf/NOK6061ZW8'. Response code: 404 Not Found
kurczews859154a2019-04-26 11:31:51 +020055
56Verify AAI not responding is logged
Marcin Migdalee954032019-04-30 12:23:29 +020057 [Timeout] 100s
kurczews859154a2019-04-26 11:31:51 +020058 [Arguments] ${test_case_directory}
59 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
60 Ensure Container Is Exited aai_simulator
61 Set VES event in DMaaP ${ves_event}
grabinsk2d51f2b2019-06-10 11:35:48 +020062 Check PRH log connection timed out: aai Host is unreachable: aai
kurczews859154a2019-04-26 11:31:51 +020063 Ensure Container Is Running aai_simulator
64
Marcin Migdalc47ac0f2019-06-10 14:36:50 +020065Verify PNF re registration
Marcin Migdal1d1e5652019-06-21 12:17:36 +020066 [Timeout] 500s
Marcin Migdalc47ac0f2019-06-10 14:36:50 +020067 [Arguments] ${test_case_directory}
Marcin Migdald2448922019-06-17 15:22:44 +020068 ${aai_entry}= Get Data From File ${test_case_directory}/aai-entry.json
Marcin Migdal1d1e5652019-06-21 12:17:36 +020069 Log PNF Re-registration: AAI entry for AAI Simulator ${aai_entry}
Marcin Migdald2448922019-06-17 15:22:44 +020070 Add PNF entry in AAI ${aai_entry}
71 ${service_instance}= Get Data From File ${test_case_directory}/aai-entry-service-instance.json
72 Add service instance entry in AAI ${service_instance}
Joanna Jeremicz4a70dd32019-06-25 13:39:33 +020073 ${logical_link}= Get Data From File ${test_case_directory}/logical-link.json
74 Add logical link entry in AAI ${logical_link}
Marcin Migdal8d000c32019-06-12 11:55:05 +020075
76 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
77 Set VES event in DMaaP ${ves_event}
78 ${expected_pnf_update_event}= Get Data From File ${test_case_directory}/expected-pnf-update-event.json
Marcin Migdal1d1e5652019-06-21 12:17:36 +020079 Wait Until Keyword Succeeds 10x 3000ms Check created PNF_UPDATE notification ${expected_pnf_update_event}
Joanna Jeremicz4a70dd32019-06-25 13:39:33 +020080 Wait Until Keyword Succeeds 10x 3000ms Check logical link not modified ${test_case_directory}
81
82Verify PNF ready sent when service instance non active
83 [Arguments] ${test_case_directory}
84 ${pnf_entry}= Get Data From File ${test_case_directory}/aai-entry.json
85 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
86 ${expected_pnf_ready_event}= Get Data From File ${test_case_directory}/expected-pnf-ready-event.json
87 ${service_instance}= Get Data From File ${test_case_directory}/aai-entry-service-instance.json
88 Add PNF entry in AAI ${pnf_entry}
89 Add service instance entry in AAI ${service_instance}
90
91 Set VES event in DMaaP ${ves_event}
92 Wait Until Keyword Succeeds 10x 3000ms Check CBS ready
93 Wait Until Keyword Succeeds 10x 3000ms Check created PNF_READY notification ${expected_pnf_ready_event}
94
95Check logical link not modified
96 [Arguments] ${test_case_directory}
97 ${expected_logical_link}= Get Data From File ${test_case_directory}/logical-link.json
98 ${actual_logical_link}= Get Request ${aai_session} /verify/logical-link/bbs-link headers=${suite_headers}
99 Should Be Equal As JSON ${expected_logical_link} ${actual_logical_link.content}
100
101Check no logical link in AAI
102 [Arguments] ${test_case_directory}
103 ${logical_links}= Get Request ${aai_session} /verify/logical-links headers=${suite_headers}
104 Should Be Equal As JSON {} ${logical_links.content}
Marcin Migdalc47ac0f2019-06-10 14:36:50 +0200105
kurczews859154a2019-04-26 11:31:51 +0200106Check CBS ready
grabinskc68c2ee2019-06-19 12:36:42 +0200107 ${resp}= Get Request ${consul_session} /v1/catalog/services
kurczews859154a2019-04-26 11:31:51 +0200108 Should Be Equal As Strings ${resp.status_code} 200
grabinsk78ef07a2019-05-06 11:26:25 +0200109 Log Service Catalog response: ${resp.content}
110 Dictionary Should Contain Key ${resp.json()} cbs |Consul service catalog should contain CBS entry
kurczews859154a2019-04-26 11:31:51 +0200111
Marcin Migdal8d000c32019-06-12 11:55:05 +0200112Check created PNF_READY notification
kurczews859154a2019-04-26 11:31:51 +0200113 [Arguments] ${expected_event_pnf_ready_in_dpaap}
grabinskc68c2ee2019-06-19 12:36:42 +0200114 ${resp}= Get Request ${dmaap_session} /verify/pnf_ready headers=${suite_headers}
kurczews859154a2019-04-26 11:31:51 +0200115 Should Be Equal As Strings ${resp.status_code} 200
116 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
117
Marcin Migdal8d000c32019-06-12 11:55:05 +0200118Check created PNF_UPDATE notification
119 [Arguments] ${expected_event_pnf_update_in_dpaap}
grabinskc68c2ee2019-06-19 12:36:42 +0200120 ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers}
Marcin Migdal8d000c32019-06-12 11:55:05 +0200121 Log Response from DMaaP: ${resp.content}
122 Should Be Equal As Strings ${resp.status_code} 200
Joanna Jeremicz4a70dd32019-06-25 13:39:33 +0200123 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_update_in_dpaap}
Marcin Migdal8d000c32019-06-12 11:55:05 +0200124
125Check created Logical Link
kurczews859154a2019-04-26 11:31:51 +0200126 [Arguments] ${expected_logical_link_in_aai}
grabinskc68c2ee2019-06-19 12:36:42 +0200127 ${resp}= Get Request ${aai_session} /verify/created_logical_link headers=${suite_headers}
kurczews859154a2019-04-26 11:31:51 +0200128 Should Be Equal As Strings ${resp.status_code} 200
129 Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai}
130
131Check PRH log
grabinsk2d51f2b2019-06-10 11:35:48 +0200132 [Arguments] @{log_entries}
133 ${found}= Find one of log entryies ${log_entries}
kurczews859154a2019-04-26 11:31:51 +0200134 Should Be True ${found}
135
binieke98a7252019-06-03 11:46:23 +0200136Check PRH json log
137 [Arguments] ${prefix} ${json}
138 ${found}= Find log json ${prefix} ${json}
139 Should Be True ${found}
140
kurczews859154a2019-04-26 11:31:51 +0200141Create event parsing error
142 [Arguments] ${ves_event}
143 ${notification}= Create invalid notification ${ves_event}
144 ${error_msg}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${notification}
145 [Return] ${error_msg}
146
147Add PNF entry in AAI
148 [Arguments] ${pnf_entry}
Gary Wu9abb61c2018-09-27 10:38:50 -0700149 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
kurczews859154a2019-04-26 11:31:51 +0200150 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
grabinskc68c2ee2019-06-19 12:36:42 +0200151 ${resp}= Put Request ${aai_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry}
kurczews859154a2019-04-26 11:31:51 +0200152 Should Be Equal As Strings ${resp.status_code} 200
153
Marcin Migdald2448922019-06-17 15:22:44 +0200154Add service instance entry in AAI
155 [Arguments] ${aai_service_instance}
156 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
157 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
grabinskc68c2ee2019-06-19 12:36:42 +0200158 ${resp}= Put Request ${aai_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance}
Marcin Migdald2448922019-06-17 15:22:44 +0200159 Should Be Equal As Strings ${resp.status_code} 200
160
Joanna Jeremicz4a70dd32019-06-25 13:39:33 +0200161Add logical link entry in AAI
162 [Arguments] ${logical_link}
163 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
164 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
165 ${resp}= Put Request ${aai_session} /setup/add_logical_link headers=${suite_headers} data=${logical_link}
166 Should Be Equal As Strings ${resp.status_code} 200
167
kurczews859154a2019-04-26 11:31:51 +0200168Set VES event in DMaaP
169 [Arguments] ${ves_event}
grabinskc68c2ee2019-06-19 12:36:42 +0200170 ${resp}= Put Request ${dmaap_session} /setup/ves_event headers=${suite_headers} data=${ves_event}
kurczews859154a2019-04-26 11:31:51 +0200171 Should Be Equal As Strings ${resp.status_code} 200
172
173Should Be Equal As JSON
grabinsk08a9c632019-05-23 13:34:38 +0200174 [Arguments] ${actual} ${expected}
175 Log EXPECTED: ${expected}
176 Log ACTUAL: ${actual}
177 ${expected_json}= Evaluate json.loads("""${expected}""") json
178 ${actual_json}= Evaluate json.loads("""${actual}""") json
179 Should Be Equal ${actual_json} ${expected_json}
Gary Wu9abb61c2018-09-27 10:38:50 -0700180
pkaras55d36862018-10-17 15:08:34 +0200181Reset Simulators
182 Reset AAI simulator
pkarasc7abba82018-10-22 12:22:35 +0200183 Reset DMaaP simulator
Gary Wu9abb61c2018-09-27 10:38:50 -0700184
pkaras55d36862018-10-17 15:08:34 +0200185Reset AAI simulator
grabinskc68c2ee2019-06-19 12:36:42 +0200186 ${resp}= Post Request ${aai_session} /reset
pkaras55d36862018-10-17 15:08:34 +0200187 Should Be Equal As Strings ${resp.status_code} 200
pkarasc7abba82018-10-22 12:22:35 +0200188
189Reset DMaaP simulator
grabinskc68c2ee2019-06-19 12:36:42 +0200190 ${resp}= Post Request ${dmaap_session} /reset
Marcin Migdalfba99a52019-04-15 14:36:45 +0200191 Should Be Equal As Strings ${resp.status_code} 200
192
micdzied9c7d8f02019-06-17 14:08:27 +0200193
194Verify change logging level
grabinskad1421e2019-06-21 15:08:21 +0200195 ${logger}= Set Variable org.onap.dcaegen2.services.prh.controllers.AppInfoController
196 Change logging level ${logger} TRACE
197 Verify logging level ${logger} TRACE
micdzied9c7d8f02019-06-17 14:08:27 +0200198 Verify logs with heartbeat
grabinskad1421e2019-06-21 15:08:21 +0200199 [Teardown] Change logging level ${logger} INFO
micdzied9c7d8f02019-06-17 14:08:27 +0200200
201Change logging level
grabinskad1421e2019-06-21 15:08:21 +0200202 [Arguments] ${logger} ${log_level}
203 ${request_body}= Create Dictionary configuredLevel=${log_level}
204 ${resp}= Post Request prh_session /actuator/loggers/${logger} json=${request_body}
205 Should Be Equal As Integers ${resp.status_code} 204
micdzied9c7d8f02019-06-17 14:08:27 +0200206
207Verify logging level
grabinskad1421e2019-06-21 15:08:21 +0200208 [Arguments] ${logger} ${expected_log_level}
209 ${resp}= Get Request prh_session /actuator/loggers/${logger}
210 Should Be Equal As Integers ${resp.status_code} 200
211 Log ${resp.content}
212 Should Be Equal As Strings ${resp.json()["configuredLevel"]} ${expected_log_level} ignore_case=true
micdzied9c7d8f02019-06-17 14:08:27 +0200213
214Verify logs with heartbeat
grabinskc68c2ee2019-06-19 12:36:42 +0200215 Get Request prh_session /heartbeat
micdzied9c7d8f02019-06-17 14:08:27 +0200216 Check PRH log Heartbeat request received