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 | |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame^] | 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} |
| 24 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 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} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 29 | Check created Logical Link ${expected_logical_link} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 30 | |
| 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} |
grabinsk | 8bc68e2 | 2019-06-14 13:56:17 +0200 | [diff] [blame] | 35 | Log Invalid ves event: ${invalid_ves_event} |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 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} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 39 | |
| 40 | Verify 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} |
grabinsk | 8bc68e2 | 2019-06-14 13:56:17 +0200 | [diff] [blame] | 45 | Check PRH log |WARN |Incorrect json, consumerDmaapModel can not be created: |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 46 | |
| 47 | Verify missing AAI record is logged |
Marcin Migdal | ee95403 | 2019-04-30 12:23:29 +0200 | [diff] [blame] | 48 | [Timeout] 100s |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 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} |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 54 | 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] | 55 | |
| 56 | Verify AAI not responding is logged |
Marcin Migdal | ee95403 | 2019-04-30 12:23:29 +0200 | [diff] [blame] | 57 | [Timeout] 100s |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 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} |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 62 | Check PRH log connection timed out: aai Host is unreachable: aai |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 63 | Ensure Container Is Running aai_simulator |
| 64 | |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 65 | Verify PNF re registration |
Marcin Migdal | 1d1e565 | 2019-06-21 12:17:36 +0200 | [diff] [blame] | 66 | [Timeout] 500s |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 67 | [Arguments] ${test_case_directory} |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 68 | ${aai_entry}= Get Data From File ${test_case_directory}/aai-entry.json |
Marcin Migdal | 1d1e565 | 2019-06-21 12:17:36 +0200 | [diff] [blame] | 69 | Log PNF Re-registration: AAI entry for AAI Simulator ${aai_entry} |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 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} |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame^] | 73 | ${logical_link}= Get Data From File ${test_case_directory}/logical-link.json |
| 74 | Add logical link entry in AAI ${logical_link} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 75 | |
| 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 Migdal | 1d1e565 | 2019-06-21 12:17:36 +0200 | [diff] [blame] | 79 | Wait Until Keyword Succeeds 10x 3000ms Check created PNF_UPDATE notification ${expected_pnf_update_event} |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame^] | 80 | Wait Until Keyword Succeeds 10x 3000ms Check logical link not modified ${test_case_directory} |
| 81 | |
| 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} |
| 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 | |
| 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} |
| 100 | |
| 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} |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 105 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 106 | Check CBS ready |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 107 | ${resp}= Get Request ${consul_session} /v1/catalog/services |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 108 | Should Be Equal As Strings ${resp.status_code} 200 |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 109 | Log Service Catalog response: ${resp.content} |
| 110 | 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] | 111 | |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 112 | Check created PNF_READY notification |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 113 | [Arguments] ${expected_event_pnf_ready_in_dpaap} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 114 | ${resp}= Get Request ${dmaap_session} /verify/pnf_ready headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 115 | 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 Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 118 | Check created PNF_UPDATE notification |
| 119 | [Arguments] ${expected_event_pnf_update_in_dpaap} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 120 | ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 121 | Log Response from DMaaP: ${resp.content} |
| 122 | Should Be Equal As Strings ${resp.status_code} 200 |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame^] | 123 | Should Be Equal As JSON ${resp.content} ${expected_event_pnf_update_in_dpaap} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 124 | |
| 125 | Check created Logical Link |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 126 | [Arguments] ${expected_logical_link_in_aai} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 127 | ${resp}= Get Request ${aai_session} /verify/created_logical_link headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 128 | Should Be Equal As Strings ${resp.status_code} 200 |
| 129 | Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai} |
| 130 | |
| 131 | Check PRH log |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 132 | [Arguments] @{log_entries} |
| 133 | ${found}= Find one of log entryies ${log_entries} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 134 | Should Be True ${found} |
| 135 | |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 136 | Check PRH json log |
| 137 | [Arguments] ${prefix} ${json} |
| 138 | ${found}= Find log json ${prefix} ${json} |
| 139 | Should Be True ${found} |
| 140 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 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} |
| 146 | |
| 147 | Add PNF entry in AAI |
| 148 | [Arguments] ${pnf_entry} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 149 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 150 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 151 | ${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] | 152 | Should Be Equal As Strings ${resp.status_code} 200 |
| 153 | |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 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} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 158 | ${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] | 159 | Should Be Equal As Strings ${resp.status_code} 200 |
| 160 | |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame^] | 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 |
| 167 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 168 | Set VES event in DMaaP |
| 169 | [Arguments] ${ves_event} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 170 | ${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] | 171 | Should Be Equal As Strings ${resp.status_code} 200 |
| 172 | |
| 173 | Should Be Equal As JSON |
grabinsk | 08a9c63 | 2019-05-23 13:34:38 +0200 | [diff] [blame] | 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} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 180 | |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 181 | Reset Simulators |
| 182 | Reset AAI simulator |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 183 | Reset DMaaP simulator |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 184 | |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 185 | Reset AAI simulator |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 186 | ${resp}= Post Request ${aai_session} /reset |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 187 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 188 | |
| 189 | Reset DMaaP simulator |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 190 | ${resp}= Post Request ${dmaap_session} /reset |
Marcin Migdal | fba99a5 | 2019-04-15 14:36:45 +0200 | [diff] [blame] | 191 | Should Be Equal As Strings ${resp.status_code} 200 |
| 192 | |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 193 | |
| 194 | Verify change logging level |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame] | 195 | ${logger}= Set Variable org.onap.dcaegen2.services.prh.controllers.AppInfoController |
| 196 | Change logging level ${logger} TRACE |
| 197 | Verify logging level ${logger} TRACE |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 198 | Verify logs with heartbeat |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame] | 199 | [Teardown] Change logging level ${logger} INFO |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 200 | |
| 201 | Change logging level |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame] | 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 |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 206 | |
| 207 | Verify logging level |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame] | 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 |
| 211 | Log ${resp.content} |
| 212 | 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] | 213 | |
| 214 | Verify logs with heartbeat |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 215 | Get Request prh_session /heartbeat |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 216 | Check PRH log Heartbeat request received |