blob: b52b27c380e5aa6d1f515f475b41ac0cf8067562 [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
micdzied9c7d8f02019-06-17 14:08:27 +02005Library OperatingSystem
Gary Wu9abb61c2018-09-27 10:38:50 -07006Resource ../../../common.robot
7
8*** Keywords ***
kurczews859154a2019-04-26 11:31:51 +02009Verify PNF ready sent
10 [Arguments] ${test_case_directory}
11 ${pnf_entry}= Get Data From File ${test_case_directory}/aai-entry.json
12 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
13 ${expected_pnf_ready_event}= Get Data From File ${test_case_directory}/expected-pnf-ready-event.json
14 Add PNF entry in AAI ${pnf_entry}
15 Set VES event in DMaaP ${ves_event}
16 Wait Until Keyword Succeeds 10x 3000ms Check CBS ready
Marcin Migdal8d000c32019-06-12 11:55:05 +020017 Wait Until Keyword Succeeds 10x 3000ms Check created PNF_READY notification ${expected_pnf_ready_event}
kurczews859154a2019-04-26 11:31:51 +020018
19Verify PNF ready sent and logical link created
20 [Arguments] ${test_case_directory}
21 ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json
22 Verify PNF ready sent ${test_case_directory}
Marcin Migdal8d000c32019-06-12 11:55:05 +020023 Check created Logical Link ${expected_logical_link}
kurczews859154a2019-04-26 11:31:51 +020024
25Verify event with missing required field is logged
26 [Arguments] ${test_case_directory}
27 ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
28 Set VES event in DMaaP ${invalid_ves_event}
grabinsk8bc68e22019-06-14 13:56:17 +020029 Log Invalid ves event: ${invalid_ves_event}
binieke98a7252019-06-03 11:46:23 +020030 ${notification}= Create invalid notification ${invalid_ves_event}
31 ${error_msg}= Set Variable Incorrect json, consumerDmaapModel can not be created:
32 Wait Until Keyword Succeeds 10x 3000ms Check PRH json log ${error_msg} ${notification}
kurczews859154a2019-04-26 11:31:51 +020033
34Verify incorrect JSON event is logged
35 [Timeout] 60s
36 [Arguments] ${test_case_directory}
37 ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
38 Set VES event in DMaaP ${invalid_ves_event}
grabinsk8bc68e22019-06-14 13:56:17 +020039 Check PRH log |WARN |Incorrect json, consumerDmaapModel can not be created:
kurczews859154a2019-04-26 11:31:51 +020040
41Verify missing AAI record is logged
Marcin Migdalee954032019-04-30 12:23:29 +020042 [Timeout] 100s
kurczews859154a2019-04-26 11:31:51 +020043 [Arguments] ${test_case_directory}
44 ${incorrect_aai_entry}= Get Data From File ${test_case_directory}/incorrect-aai-entry.json
45 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
46 Add PNF entry in AAI ${incorrect_aai_entry}
47 Set VES event in DMaaP ${ves_event}
grabinsk2d51f2b2019-06-10 11:35:48 +020048 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 +020049
50Verify AAI not responding is logged
Marcin Migdalee954032019-04-30 12:23:29 +020051 [Timeout] 100s
kurczews859154a2019-04-26 11:31:51 +020052 [Arguments] ${test_case_directory}
53 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
54 Ensure Container Is Exited aai_simulator
55 Set VES event in DMaaP ${ves_event}
grabinsk2d51f2b2019-06-10 11:35:48 +020056 Check PRH log connection timed out: aai Host is unreachable: aai
kurczews859154a2019-04-26 11:31:51 +020057 Ensure Container Is Running aai_simulator
58
Marcin Migdalc47ac0f2019-06-10 14:36:50 +020059Verify PNF re registration
60 [Timeout] 100s
61 [Arguments] ${test_case_directory}
Marcin Migdald2448922019-06-17 15:22:44 +020062 ${aai_entry}= Get Data From File ${test_case_directory}/aai-entry.json
63 Add PNF entry in AAI ${aai_entry}
64 ${service_instance}= Get Data From File ${test_case_directory}/aai-entry-service-instance.json
65 Add service instance entry in AAI ${service_instance}
Marcin Migdal8d000c32019-06-12 11:55:05 +020066
67 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
68 Set VES event in DMaaP ${ves_event}
69 ${expected_pnf_update_event}= Get Data From File ${test_case_directory}/expected-pnf-update-event.json
Marcin Migdald2448922019-06-17 15:22:44 +020070 #Wait Until Keyword Succeeds 10x 3000ms Check created PNF_UPDATE notification ${expected_pnf_update_event}
Marcin Migdalc47ac0f2019-06-10 14:36:50 +020071
kurczews859154a2019-04-26 11:31:51 +020072Check CBS ready
grabinskc68c2ee2019-06-19 12:36:42 +020073 ${resp}= Get Request ${consul_session} /v1/catalog/services
kurczews859154a2019-04-26 11:31:51 +020074 Should Be Equal As Strings ${resp.status_code} 200
grabinsk78ef07a2019-05-06 11:26:25 +020075 Log Service Catalog response: ${resp.content}
76 Dictionary Should Contain Key ${resp.json()} cbs |Consul service catalog should contain CBS entry
kurczews859154a2019-04-26 11:31:51 +020077
Marcin Migdal8d000c32019-06-12 11:55:05 +020078Check created PNF_READY notification
kurczews859154a2019-04-26 11:31:51 +020079 [Arguments] ${expected_event_pnf_ready_in_dpaap}
grabinskc68c2ee2019-06-19 12:36:42 +020080 ${resp}= Get Request ${dmaap_session} /verify/pnf_ready headers=${suite_headers}
kurczews859154a2019-04-26 11:31:51 +020081 Should Be Equal As Strings ${resp.status_code} 200
82 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
83
Marcin Migdal8d000c32019-06-12 11:55:05 +020084Check created PNF_UPDATE notification
85 [Arguments] ${expected_event_pnf_update_in_dpaap}
grabinskc68c2ee2019-06-19 12:36:42 +020086 ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers}
Marcin Migdal8d000c32019-06-12 11:55:05 +020087 Log Response from DMaaP: ${resp.content}
88 Should Be Equal As Strings ${resp.status_code} 200
89 #Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
90
91Check created Logical Link
kurczews859154a2019-04-26 11:31:51 +020092 [Arguments] ${expected_logical_link_in_aai}
grabinskc68c2ee2019-06-19 12:36:42 +020093 ${resp}= Get Request ${aai_session} /verify/created_logical_link headers=${suite_headers}
kurczews859154a2019-04-26 11:31:51 +020094 Should Be Equal As Strings ${resp.status_code} 200
95 Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai}
96
97Check PRH log
grabinsk2d51f2b2019-06-10 11:35:48 +020098 [Arguments] @{log_entries}
99 ${found}= Find one of log entryies ${log_entries}
kurczews859154a2019-04-26 11:31:51 +0200100 Should Be True ${found}
101
binieke98a7252019-06-03 11:46:23 +0200102Check PRH json log
103 [Arguments] ${prefix} ${json}
104 ${found}= Find log json ${prefix} ${json}
105 Should Be True ${found}
106
kurczews859154a2019-04-26 11:31:51 +0200107Create event parsing error
108 [Arguments] ${ves_event}
109 ${notification}= Create invalid notification ${ves_event}
110 ${error_msg}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${notification}
111 [Return] ${error_msg}
112
113Add PNF entry in AAI
114 [Arguments] ${pnf_entry}
Gary Wu9abb61c2018-09-27 10:38:50 -0700115 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
kurczews859154a2019-04-26 11:31:51 +0200116 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
grabinskc68c2ee2019-06-19 12:36:42 +0200117 ${resp}= Put Request ${aai_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry}
kurczews859154a2019-04-26 11:31:51 +0200118 Should Be Equal As Strings ${resp.status_code} 200
119
Marcin Migdald2448922019-06-17 15:22:44 +0200120Add service instance entry in AAI
121 [Arguments] ${aai_service_instance}
122 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
123 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
grabinskc68c2ee2019-06-19 12:36:42 +0200124 ${resp}= Put Request ${aai_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance}
Marcin Migdald2448922019-06-17 15:22:44 +0200125 Should Be Equal As Strings ${resp.status_code} 200
126
kurczews859154a2019-04-26 11:31:51 +0200127Set VES event in DMaaP
128 [Arguments] ${ves_event}
grabinskc68c2ee2019-06-19 12:36:42 +0200129 ${resp}= Put Request ${dmaap_session} /setup/ves_event headers=${suite_headers} data=${ves_event}
kurczews859154a2019-04-26 11:31:51 +0200130 Should Be Equal As Strings ${resp.status_code} 200
131
132Should Be Equal As JSON
grabinsk08a9c632019-05-23 13:34:38 +0200133 [Arguments] ${actual} ${expected}
134 Log EXPECTED: ${expected}
135 Log ACTUAL: ${actual}
136 ${expected_json}= Evaluate json.loads("""${expected}""") json
137 ${actual_json}= Evaluate json.loads("""${actual}""") json
138 Should Be Equal ${actual_json} ${expected_json}
Gary Wu9abb61c2018-09-27 10:38:50 -0700139
pkaras55d36862018-10-17 15:08:34 +0200140Reset Simulators
141 Reset AAI simulator
pkarasc7abba82018-10-22 12:22:35 +0200142 Reset DMaaP simulator
Gary Wu9abb61c2018-09-27 10:38:50 -0700143
pkaras55d36862018-10-17 15:08:34 +0200144Reset AAI simulator
grabinskc68c2ee2019-06-19 12:36:42 +0200145 ${resp}= Post Request ${aai_session} /reset
pkaras55d36862018-10-17 15:08:34 +0200146 Should Be Equal As Strings ${resp.status_code} 200
pkarasc7abba82018-10-22 12:22:35 +0200147
148Reset DMaaP simulator
grabinskc68c2ee2019-06-19 12:36:42 +0200149 ${resp}= Post Request ${dmaap_session} /reset
Marcin Migdalfba99a52019-04-15 14:36:45 +0200150 Should Be Equal As Strings ${resp.status_code} 200
151
micdzied9c7d8f02019-06-17 14:08:27 +0200152
153Verify change logging level
154 Change logging level TRACE
155 Verify logs with heartbeat
156 Change logging level INFO
157
158Change logging level
159 [Arguments] ${expected_log_level}
160 Run curl -i -X POST -H 'Content-Type: application/json' -d '{"configuredLevel": "${expected_log_level}"}' http://localhost:8100/actuator/loggers/org.onap.dcaegen2.services.prh
161
162Verify logging level
163 [Arguments] ${expected_log_level}
grabinskc68c2ee2019-06-19 12:36:42 +0200164 ${resp}= Get Request prh_session /actuator/loggers/org.onap.dcaegen2.services.prh
micdzied9c7d8f02019-06-17 14:08:27 +0200165 Should Be Equal As JSON ${resp.content} ${expected_log_level}
166
167Verify logs with heartbeat
168 Verify logging level ${TRACE_LOG_LEVEL_CONF}
grabinskc68c2ee2019-06-19 12:36:42 +0200169 Get Request prh_session /heartbeat
micdzied9c7d8f02019-06-17 14:08:27 +0200170 Check PRH log Heartbeat request received