2 Library RequestsLibrary
5 Resource ../../../common.robot
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
16 Wait Until Keyword Succeeds 10x 3000ms Check created PNF_READY notification ${expected_pnf_ready_event}
18 Verify 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}
25 Verify 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}
29 Check created Logical Link ${expected_logical_link}
31 Verify 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}
35 Log Invalid ves event: ${invalid_ves_event}
36 ${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}
40 Verify incorrect JSON event is logged
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}
45 Check PRH log |WARN |Incorrect json, consumerDmaapModel can not be created:
47 Verify missing AAI record is logged
49 [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}
54 Check PRH log Request failed for URL 'https://aai:3334/aai/v12/network/pnfs/pnf/NOK6061ZW8'. Response code: 404 Not Found
56 Verify AAI not responding is logged
58 [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}
62 Check PRH log connection timed out: aai Host is unreachable: aai
63 Ensure Container Is Running aai_simulator
65 Verify PNF re registration
67 [Arguments] ${test_case_directory}
68 ${aai_entry}= Get Data From File ${test_case_directory}/aai-entry.json
69 Log PNF Re-registration: AAI entry for AAI Simulator ${aai_entry}
70 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}
73 ${logical_link}= Get Data From File ${test_case_directory}/logical-link.json
74 Add logical link entry in AAI ${logical_link}
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
79 Wait Until Keyword Succeeds 10x 3000ms Check created PNF_UPDATE notification ${expected_pnf_update_event}
80 Wait Until Keyword Succeeds 10x 3000ms Check logical link not modified ${test_case_directory}
82 Verify 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}
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}
95 Check 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}
101 Check 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}
107 ${resp}= Get Request ${consul_session} /v1/catalog/services
108 Should Be Equal As Strings ${resp.status_code} 200
109 Log Service Catalog response: ${resp.content}
110 Dictionary Should Contain Key ${resp.json()} cbs |Consul service catalog should contain CBS entry
112 Check created PNF_READY notification
113 [Arguments] ${expected_event_pnf_ready_in_dpaap}
114 ${resp}= Get Request ${dmaap_session} /verify/pnf_ready headers=${suite_headers}
115 Should Be Equal As Strings ${resp.status_code} 200
116 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
118 Check created PNF_UPDATE notification
119 [Arguments] ${expected_event_pnf_update_in_dpaap}
120 ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers}
121 Log Response from DMaaP: ${resp.content}
122 Should Be Equal As Strings ${resp.status_code} 200
123 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_update_in_dpaap}
125 Check created Logical Link
126 [Arguments] ${expected_logical_link_in_aai}
127 ${resp}= Get Request ${aai_session} /verify/created_logical_link headers=${suite_headers}
128 Should Be Equal As Strings ${resp.status_code} 200
129 Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai}
132 [Arguments] @{log_entries}
133 ${found}= Find one of log entryies ${log_entries}
134 Should Be True ${found}
137 [Arguments] ${prefix} ${json}
138 ${found}= Find log json ${prefix} ${json}
139 Should Be True ${found}
141 Create 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}
148 [Arguments] ${pnf_entry}
149 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
150 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
151 ${resp}= Put Request ${aai_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry}
152 Should Be Equal As Strings ${resp.status_code} 200
154 Add 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}
158 ${resp}= Put Request ${aai_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance}
159 Should Be Equal As Strings ${resp.status_code} 200
161 Add 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
168 Set VES event in DMaaP
169 [Arguments] ${ves_event}
170 ${resp}= Put Request ${dmaap_session} /setup/ves_event headers=${suite_headers} data=${ves_event}
171 Should Be Equal As Strings ${resp.status_code} 200
173 Should Be Equal As JSON
174 [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}
183 Reset DMaaP simulator
186 ${resp}= Post Request ${aai_session} /reset
187 Should Be Equal As Strings ${resp.status_code} 200
189 Reset DMaaP simulator
190 ${resp}= Post Request ${dmaap_session} /reset
191 Should Be Equal As Strings ${resp.status_code} 200
194 Verify change logging level
195 ${logger}= Set Variable org.onap.dcaegen2.services.prh.controllers.AppInfoController
196 Change logging level ${logger} TRACE
197 Verify logging level ${logger} TRACE
198 Verify logs with heartbeat
199 [Teardown] Change logging level ${logger} INFO
202 [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
208 [Arguments] ${logger} ${expected_log_level}
209 ${resp}= Get Request prh_session /actuator/loggers/${logger}
210 Should Be Equal As Integers ${resp.status_code} 200
212 Should Be Equal As Strings ${resp.json()["configuredLevel"]} ${expected_log_level} ignore_case=true
214 Verify logs with heartbeat
215 Get Request prh_session /heartbeat
216 Check PRH log Heartbeat request received