Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library RequestsLibrary |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 3 | Library Collections |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 4 | Library PrhLibrary.py |
| 5 | Resource ../../../common.robot |
| 6 | |
| 7 | *** Keywords *** |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 8 | Verify 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 Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 16 | Wait Until Keyword Succeeds 10x 3000ms Check created PNF_READY notification ${expected_pnf_ready_event} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 17 | |
| 18 | Verify 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 Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 22 | Check created Logical Link ${expected_logical_link} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 23 | |
| 24 | Verify 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} |
grabinsk | 8bc68e2 | 2019-06-14 13:56:17 +0200 | [diff] [blame] | 28 | Log Invalid ves event: ${invalid_ves_event} |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 29 | ${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} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 32 | |
| 33 | Verify 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} |
grabinsk | 8bc68e2 | 2019-06-14 13:56:17 +0200 | [diff] [blame] | 38 | Check PRH log |WARN |Incorrect json, consumerDmaapModel can not be created: |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 39 | |
| 40 | Verify missing AAI record is logged |
Marcin Migdal | ee95403 | 2019-04-30 12:23:29 +0200 | [diff] [blame] | 41 | [Timeout] 100s |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 42 | [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} |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 47 | Check PRH log Request failed for URL 'https://aai:3334/aai/v12/network/pnfs/pnf/NOK6061ZW8'. Response code: 404 Not Found |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 48 | |
| 49 | Verify AAI not responding is logged |
Marcin Migdal | ee95403 | 2019-04-30 12:23:29 +0200 | [diff] [blame] | 50 | [Timeout] 100s |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 51 | [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} |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 55 | Check PRH log connection timed out: aai Host is unreachable: aai |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 56 | Ensure Container Is Running aai_simulator |
| 57 | |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 58 | Verify PNF re registration |
| 59 | [Timeout] 100s |
| 60 | [Arguments] ${test_case_directory} |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 61 | ${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 Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 65 | |
| 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 Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 69 | #Wait Until Keyword Succeeds 10x 3000ms Check created PNF_UPDATE notification ${expected_pnf_update_event} |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 70 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 71 | Check CBS ready |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 72 | ${resp}= Get Request ${consul_session} /v1/catalog/services |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 73 | Should Be Equal As Strings ${resp.status_code} 200 |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 74 | Log Service Catalog response: ${resp.content} |
| 75 | Dictionary Should Contain Key ${resp.json()} cbs |Consul service catalog should contain CBS entry |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 76 | |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 77 | Check created PNF_READY notification |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 78 | [Arguments] ${expected_event_pnf_ready_in_dpaap} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 79 | ${resp}= Get Request ${dmaap_session} /verify/pnf_ready headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 80 | 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 Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 83 | Check created PNF_UPDATE notification |
| 84 | [Arguments] ${expected_event_pnf_update_in_dpaap} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 85 | ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 86 | 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 | |
| 90 | Check created Logical Link |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 91 | [Arguments] ${expected_logical_link_in_aai} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 92 | ${resp}= Get Request ${aai_session} /verify/created_logical_link headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 93 | Should Be Equal As Strings ${resp.status_code} 200 |
| 94 | Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai} |
| 95 | |
| 96 | Check PRH log |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 97 | [Arguments] @{log_entries} |
| 98 | ${found}= Find one of log entryies ${log_entries} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 99 | Should Be True ${found} |
| 100 | |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 101 | Check PRH json log |
| 102 | [Arguments] ${prefix} ${json} |
| 103 | ${found}= Find log json ${prefix} ${json} |
| 104 | Should Be True ${found} |
| 105 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 106 | Create 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 | |
| 112 | Add PNF entry in AAI |
| 113 | [Arguments] ${pnf_entry} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 114 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 115 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 116 | ${resp}= Put Request ${aai_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 117 | Should Be Equal As Strings ${resp.status_code} 200 |
| 118 | |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 119 | Add 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} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 123 | ${resp}= Put Request ${aai_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance} |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 124 | Should Be Equal As Strings ${resp.status_code} 200 |
| 125 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 126 | Set VES event in DMaaP |
| 127 | [Arguments] ${ves_event} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 128 | ${resp}= Put Request ${dmaap_session} /setup/ves_event headers=${suite_headers} data=${ves_event} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 129 | Should Be Equal As Strings ${resp.status_code} 200 |
| 130 | |
| 131 | Should Be Equal As JSON |
grabinsk | 08a9c63 | 2019-05-23 13:34:38 +0200 | [diff] [blame] | 132 | [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 Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 138 | |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 139 | Reset Simulators |
| 140 | Reset AAI simulator |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 141 | Reset DMaaP simulator |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 142 | |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 143 | Reset AAI simulator |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 144 | ${resp}= Post Request ${aai_session} /reset |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 145 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 146 | |
| 147 | Reset DMaaP simulator |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 148 | ${resp}= Post Request ${dmaap_session} /reset |
Marcin Migdal | fba99a5 | 2019-04-15 14:36:45 +0200 | [diff] [blame] | 149 | Should Be Equal As Strings ${resp.status_code} 200 |
| 150 | |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 151 | |
| 152 | Verify change logging level |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame^] | 153 | ${logger}= Set Variable org.onap.dcaegen2.services.prh.controllers.AppInfoController |
| 154 | Change logging level ${logger} TRACE |
| 155 | Verify logging level ${logger} TRACE |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 156 | Verify logs with heartbeat |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame^] | 157 | [Teardown] Change logging level ${logger} INFO |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 158 | |
| 159 | Change logging level |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame^] | 160 | [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 |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 164 | |
| 165 | Verify logging level |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame^] | 166 | [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 |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 171 | |
| 172 | Verify logs with heartbeat |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 173 | Get Request prh_session /heartbeat |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 174 | Check PRH log Heartbeat request received |