blob: c00f012ff45c100a3545d25c455b7662ab7add32 [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
18Verify PNF ready sent and logical link created
19 [Arguments] ${test_case_directory}
20 ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json
21 Verify PNF ready sent ${test_case_directory}
Marcin Migdal8d000c32019-06-12 11:55:05 +020022 Check created Logical Link ${expected_logical_link}
kurczews859154a2019-04-26 11:31:51 +020023
24Verify event with missing required field is logged
25 [Arguments] ${test_case_directory}
26 ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
27 Set VES event in DMaaP ${invalid_ves_event}
grabinsk8bc68e22019-06-14 13:56:17 +020028 Log Invalid ves event: ${invalid_ves_event}
binieke98a7252019-06-03 11:46:23 +020029 ${notification}= Create invalid notification ${invalid_ves_event}
30 ${error_msg}= Set Variable Incorrect json, consumerDmaapModel can not be created:
31 Wait Until Keyword Succeeds 10x 3000ms Check PRH json log ${error_msg} ${notification}
kurczews859154a2019-04-26 11:31:51 +020032
33Verify incorrect JSON event is logged
34 [Timeout] 60s
35 [Arguments] ${test_case_directory}
36 ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
37 Set VES event in DMaaP ${invalid_ves_event}
grabinsk8bc68e22019-06-14 13:56:17 +020038 Check PRH log |WARN |Incorrect json, consumerDmaapModel can not be created:
kurczews859154a2019-04-26 11:31:51 +020039
40Verify missing AAI record is logged
Marcin Migdalee954032019-04-30 12:23:29 +020041 [Timeout] 100s
kurczews859154a2019-04-26 11:31:51 +020042 [Arguments] ${test_case_directory}
43 ${incorrect_aai_entry}= Get Data From File ${test_case_directory}/incorrect-aai-entry.json
44 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
45 Add PNF entry in AAI ${incorrect_aai_entry}
46 Set VES event in DMaaP ${ves_event}
grabinsk2d51f2b2019-06-10 11:35:48 +020047 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 +020048
49Verify AAI not responding is logged
Marcin Migdalee954032019-04-30 12:23:29 +020050 [Timeout] 100s
kurczews859154a2019-04-26 11:31:51 +020051 [Arguments] ${test_case_directory}
52 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
53 Ensure Container Is Exited aai_simulator
54 Set VES event in DMaaP ${ves_event}
grabinsk2d51f2b2019-06-10 11:35:48 +020055 Check PRH log connection timed out: aai Host is unreachable: aai
kurczews859154a2019-04-26 11:31:51 +020056 Ensure Container Is Running aai_simulator
57
Marcin Migdalc47ac0f2019-06-10 14:36:50 +020058Verify PNF re registration
59 [Timeout] 100s
60 [Arguments] ${test_case_directory}
Marcin Migdald2448922019-06-17 15:22:44 +020061 ${aai_entry}= Get Data From File ${test_case_directory}/aai-entry.json
62 Add PNF entry in AAI ${aai_entry}
63 ${service_instance}= Get Data From File ${test_case_directory}/aai-entry-service-instance.json
64 Add service instance entry in AAI ${service_instance}
Marcin Migdal8d000c32019-06-12 11:55:05 +020065
66 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
67 Set VES event in DMaaP ${ves_event}
68 ${expected_pnf_update_event}= Get Data From File ${test_case_directory}/expected-pnf-update-event.json
Marcin Migdald2448922019-06-17 15:22:44 +020069 #Wait Until Keyword Succeeds 10x 3000ms Check created PNF_UPDATE notification ${expected_pnf_update_event}
Marcin Migdalc47ac0f2019-06-10 14:36:50 +020070
kurczews859154a2019-04-26 11:31:51 +020071Check CBS ready
grabinskc68c2ee2019-06-19 12:36:42 +020072 ${resp}= Get Request ${consul_session} /v1/catalog/services
kurczews859154a2019-04-26 11:31:51 +020073 Should Be Equal As Strings ${resp.status_code} 200
grabinsk78ef07a2019-05-06 11:26:25 +020074 Log Service Catalog response: ${resp.content}
75 Dictionary Should Contain Key ${resp.json()} cbs |Consul service catalog should contain CBS entry
kurczews859154a2019-04-26 11:31:51 +020076
Marcin Migdal8d000c32019-06-12 11:55:05 +020077Check created PNF_READY notification
kurczews859154a2019-04-26 11:31:51 +020078 [Arguments] ${expected_event_pnf_ready_in_dpaap}
grabinskc68c2ee2019-06-19 12:36:42 +020079 ${resp}= Get Request ${dmaap_session} /verify/pnf_ready headers=${suite_headers}
kurczews859154a2019-04-26 11:31:51 +020080 Should Be Equal As Strings ${resp.status_code} 200
81 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
82
Marcin Migdal8d000c32019-06-12 11:55:05 +020083Check created PNF_UPDATE notification
84 [Arguments] ${expected_event_pnf_update_in_dpaap}
grabinskc68c2ee2019-06-19 12:36:42 +020085 ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers}
Marcin Migdal8d000c32019-06-12 11:55:05 +020086 Log Response from DMaaP: ${resp.content}
87 Should Be Equal As Strings ${resp.status_code} 200
88 #Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
89
90Check created Logical Link
kurczews859154a2019-04-26 11:31:51 +020091 [Arguments] ${expected_logical_link_in_aai}
grabinskc68c2ee2019-06-19 12:36:42 +020092 ${resp}= Get Request ${aai_session} /verify/created_logical_link headers=${suite_headers}
kurczews859154a2019-04-26 11:31:51 +020093 Should Be Equal As Strings ${resp.status_code} 200
94 Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai}
95
96Check PRH log
grabinsk2d51f2b2019-06-10 11:35:48 +020097 [Arguments] @{log_entries}
98 ${found}= Find one of log entryies ${log_entries}
kurczews859154a2019-04-26 11:31:51 +020099 Should Be True ${found}
100
binieke98a7252019-06-03 11:46:23 +0200101Check PRH json log
102 [Arguments] ${prefix} ${json}
103 ${found}= Find log json ${prefix} ${json}
104 Should Be True ${found}
105
kurczews859154a2019-04-26 11:31:51 +0200106Create event parsing error
107 [Arguments] ${ves_event}
108 ${notification}= Create invalid notification ${ves_event}
109 ${error_msg}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${notification}
110 [Return] ${error_msg}
111
112Add PNF entry in AAI
113 [Arguments] ${pnf_entry}
Gary Wu9abb61c2018-09-27 10:38:50 -0700114 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
kurczews859154a2019-04-26 11:31:51 +0200115 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
grabinskc68c2ee2019-06-19 12:36:42 +0200116 ${resp}= Put Request ${aai_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry}
kurczews859154a2019-04-26 11:31:51 +0200117 Should Be Equal As Strings ${resp.status_code} 200
118
Marcin Migdald2448922019-06-17 15:22:44 +0200119Add service instance entry in AAI
120 [Arguments] ${aai_service_instance}
121 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
122 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
grabinskc68c2ee2019-06-19 12:36:42 +0200123 ${resp}= Put Request ${aai_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance}
Marcin Migdald2448922019-06-17 15:22:44 +0200124 Should Be Equal As Strings ${resp.status_code} 200
125
kurczews859154a2019-04-26 11:31:51 +0200126Set VES event in DMaaP
127 [Arguments] ${ves_event}
grabinskc68c2ee2019-06-19 12:36:42 +0200128 ${resp}= Put Request ${dmaap_session} /setup/ves_event headers=${suite_headers} data=${ves_event}
kurczews859154a2019-04-26 11:31:51 +0200129 Should Be Equal As Strings ${resp.status_code} 200
130
131Should Be Equal As JSON
grabinsk08a9c632019-05-23 13:34:38 +0200132 [Arguments] ${actual} ${expected}
133 Log EXPECTED: ${expected}
134 Log ACTUAL: ${actual}
135 ${expected_json}= Evaluate json.loads("""${expected}""") json
136 ${actual_json}= Evaluate json.loads("""${actual}""") json
137 Should Be Equal ${actual_json} ${expected_json}
Gary Wu9abb61c2018-09-27 10:38:50 -0700138
pkaras55d36862018-10-17 15:08:34 +0200139Reset Simulators
140 Reset AAI simulator
pkarasc7abba82018-10-22 12:22:35 +0200141 Reset DMaaP simulator
Gary Wu9abb61c2018-09-27 10:38:50 -0700142
pkaras55d36862018-10-17 15:08:34 +0200143Reset AAI simulator
grabinskc68c2ee2019-06-19 12:36:42 +0200144 ${resp}= Post Request ${aai_session} /reset
pkaras55d36862018-10-17 15:08:34 +0200145 Should Be Equal As Strings ${resp.status_code} 200
pkarasc7abba82018-10-22 12:22:35 +0200146
147Reset DMaaP simulator
grabinskc68c2ee2019-06-19 12:36:42 +0200148 ${resp}= Post Request ${dmaap_session} /reset
Marcin Migdalfba99a52019-04-15 14:36:45 +0200149 Should Be Equal As Strings ${resp.status_code} 200
150
micdzied9c7d8f02019-06-17 14:08:27 +0200151
152Verify change logging level
grabinskad1421e2019-06-21 15:08:21 +0200153 ${logger}= Set Variable org.onap.dcaegen2.services.prh.controllers.AppInfoController
154 Change logging level ${logger} TRACE
155 Verify logging level ${logger} TRACE
micdzied9c7d8f02019-06-17 14:08:27 +0200156 Verify logs with heartbeat
grabinskad1421e2019-06-21 15:08:21 +0200157 [Teardown] Change logging level ${logger} INFO
micdzied9c7d8f02019-06-17 14:08:27 +0200158
159Change logging level
grabinskad1421e2019-06-21 15:08:21 +0200160 [Arguments] ${logger} ${log_level}
161 ${request_body}= Create Dictionary configuredLevel=${log_level}
162 ${resp}= Post Request prh_session /actuator/loggers/${logger} json=${request_body}
163 Should Be Equal As Integers ${resp.status_code} 204
micdzied9c7d8f02019-06-17 14:08:27 +0200164
165Verify logging level
grabinskad1421e2019-06-21 15:08:21 +0200166 [Arguments] ${logger} ${expected_log_level}
167 ${resp}= Get Request prh_session /actuator/loggers/${logger}
168 Should Be Equal As Integers ${resp.status_code} 200
169 Log ${resp.content}
170 Should Be Equal As Strings ${resp.json()["configuredLevel"]} ${expected_log_level} ignore_case=true
micdzied9c7d8f02019-06-17 14:08:27 +0200171
172Verify logs with heartbeat
grabinskc68c2ee2019-06-19 12:36:42 +0200173 Get Request prh_session /heartbeat
micdzied9c7d8f02019-06-17 14:08:27 +0200174 Check PRH log Heartbeat request received