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 | c4a9b7e | 2019-07-02 14:02:19 +0200 | [diff] [blame] | 18 | Verify PNF ready sent and old logical link replaced in AAI |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame] | 19 | [Arguments] ${test_case_directory} |
| 20 | ${logical_link}= Get Data From File ${test_case_directory}/logical-link.json |
Joanna Jeremicz | c4a9b7e | 2019-07-02 14:02:19 +0200 | [diff] [blame] | 21 | ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame] | 22 | Add logical link entry in AAI ${logical_link} |
| 23 | Verify PNF ready sent ${test_case_directory} |
Joanna Jeremicz | c4a9b7e | 2019-07-02 14:02:19 +0200 | [diff] [blame] | 24 | Wait Until Keyword Succeeds 10x 3000ms Check created Logical Link ${expected_logical_link} |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame] | 25 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 26 | Verify PNF ready sent and logical link created |
| 27 | [Arguments] ${test_case_directory} |
| 28 | ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json |
| 29 | Verify PNF ready sent ${test_case_directory} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 30 | Check created Logical Link ${expected_logical_link} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 31 | |
| 32 | Verify event with missing required field is logged |
| 33 | [Arguments] ${test_case_directory} |
| 34 | ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json |
| 35 | Set VES event in DMaaP ${invalid_ves_event} |
grabinsk | 8bc68e2 | 2019-06-14 13:56:17 +0200 | [diff] [blame] | 36 | Log Invalid ves event: ${invalid_ves_event} |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 37 | ${notification}= Create invalid notification ${invalid_ves_event} |
| 38 | ${error_msg}= Set Variable Incorrect json, consumerDmaapModel can not be created: |
grabinsk | 3bee489 | 2019-07-17 08:43:33 +0200 | [diff] [blame] | 39 | Wait for PRH json log entry 20s ${error_msg} ${notification} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 40 | |
| 41 | Verify incorrect JSON event is logged |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 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 | 3bee489 | 2019-07-17 08:43:33 +0200 | [diff] [blame] | 45 | Wait for PRH log entry 20s java.lang.IllegalStateException: Not a JSON Object |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 46 | |
| 47 | Verify missing AAI record is logged |
| 48 | [Arguments] ${test_case_directory} |
| 49 | ${incorrect_aai_entry}= Get Data From File ${test_case_directory}/incorrect-aai-entry.json |
| 50 | ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json |
| 51 | Add PNF entry in AAI ${incorrect_aai_entry} |
| 52 | Set VES event in DMaaP ${ves_event} |
grabinsk | 3bee489 | 2019-07-17 08:43:33 +0200 | [diff] [blame] | 53 | Wait for PRH log entry 20s 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] | 54 | |
| 55 | Verify AAI not responding is logged |
| 56 | [Arguments] ${test_case_directory} |
| 57 | ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json |
| 58 | Ensure Container Is Exited aai_simulator |
| 59 | Set VES event in DMaaP ${ves_event} |
Remigiusz Janeczek | 9ba9671 | 2020-01-22 15:59:23 +0100 | [diff] [blame] | 60 | Wait for one of PRH log entries 90s connection timed out: aai Host is unreachable: aai No route to host: aai |
grabinsk | 3bee489 | 2019-07-17 08:43:33 +0200 | [diff] [blame] | 61 | [Teardown] Ensure Container Is Running aai_simulator |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 62 | |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 63 | Verify PNF re registration |
Marcin Migdal | 1d1e565 | 2019-06-21 12:17:36 +0200 | [diff] [blame] | 64 | [Timeout] 500s |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 65 | [Arguments] ${test_case_directory} |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 66 | ${aai_entry}= Get Data From File ${test_case_directory}/aai-entry.json |
Marcin Migdal | 1d1e565 | 2019-06-21 12:17:36 +0200 | [diff] [blame] | 67 | Log PNF Re-registration: AAI entry for AAI Simulator ${aai_entry} |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 68 | Add PNF entry in AAI ${aai_entry} |
| 69 | ${service_instance}= Get Data From File ${test_case_directory}/aai-entry-service-instance.json |
| 70 | Add service instance entry in AAI ${service_instance} |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame] | 71 | ${logical_link}= Get Data From File ${test_case_directory}/logical-link.json |
| 72 | Add logical link entry in AAI ${logical_link} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 73 | |
| 74 | ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json |
| 75 | Set VES event in DMaaP ${ves_event} |
| 76 | ${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] | 77 | 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] | 78 | Wait Until Keyword Succeeds 10x 3000ms Check logical link not modified ${test_case_directory} |
| 79 | |
| 80 | Verify PNF ready sent when service instance non active |
| 81 | [Arguments] ${test_case_directory} |
| 82 | ${pnf_entry}= Get Data From File ${test_case_directory}/aai-entry.json |
| 83 | ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json |
| 84 | ${expected_pnf_ready_event}= Get Data From File ${test_case_directory}/expected-pnf-ready-event.json |
| 85 | ${service_instance}= Get Data From File ${test_case_directory}/aai-entry-service-instance.json |
| 86 | Add PNF entry in AAI ${pnf_entry} |
| 87 | Add service instance entry in AAI ${service_instance} |
| 88 | |
| 89 | Set VES event in DMaaP ${ves_event} |
| 90 | Wait Until Keyword Succeeds 10x 3000ms Check CBS ready |
| 91 | Wait Until Keyword Succeeds 10x 3000ms Check created PNF_READY notification ${expected_pnf_ready_event} |
| 92 | |
| 93 | Check logical link not modified |
| 94 | [Arguments] ${test_case_directory} |
| 95 | ${expected_logical_link}= Get Data From File ${test_case_directory}/logical-link.json |
Joanna Jeremicz | c4a9b7e | 2019-07-02 14:02:19 +0200 | [diff] [blame] | 96 | ${existing_logical_link}= Get Request ${aai_session} /verify/logical-link headers=${suite_headers} |
| 97 | Should Be Equal As JSON ${expected_logical_link} ${existing_logical_link.content} |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 98 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 99 | Check CBS ready |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 100 | ${resp}= Get Request ${consul_session} /v1/catalog/services |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 101 | Should Be Equal As Strings ${resp.status_code} 200 |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 102 | Log Service Catalog response: ${resp.content} |
| 103 | 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] | 104 | |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 105 | Check created PNF_READY notification |
Joanna Jeremicz | c4a9b7e | 2019-07-02 14:02:19 +0200 | [diff] [blame] | 106 | [Arguments] ${expected_event_pnf_ready_in_dmaap} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 107 | ${resp}= Get Request ${dmaap_session} /verify/pnf_ready headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 108 | Should Be Equal As Strings ${resp.status_code} 200 |
Joanna Jeremicz | c4a9b7e | 2019-07-02 14:02:19 +0200 | [diff] [blame] | 109 | Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dmaap} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 110 | |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 111 | Check created PNF_UPDATE notification |
Joanna Jeremicz | c4a9b7e | 2019-07-02 14:02:19 +0200 | [diff] [blame] | 112 | [Arguments] ${expected_event_pnf_update_in_dmaap} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 113 | ${resp}= Get Request ${dmaap_session} /verify/pnf_update headers=${suite_headers} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 114 | Log Response from DMaaP: ${resp.content} |
| 115 | Should Be Equal As Strings ${resp.status_code} 200 |
Joanna Jeremicz | c4a9b7e | 2019-07-02 14:02:19 +0200 | [diff] [blame] | 116 | Should Be Equal As JSON ${resp.content} ${expected_event_pnf_update_in_dmaap} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 117 | |
| 118 | Check created Logical Link |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 119 | [Arguments] ${expected_logical_link_in_aai} |
Joanna Jeremicz | c4a9b7e | 2019-07-02 14:02:19 +0200 | [diff] [blame] | 120 | ${resp}= Get Request ${aai_session} /verify/logical-link headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 121 | Should Be Equal As Strings ${resp.status_code} 200 |
| 122 | Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai} |
| 123 | |
grabinsk | 3bee489 | 2019-07-17 08:43:33 +0200 | [diff] [blame] | 124 | Wait for PRH log entry |
| 125 | [Arguments] ${timeout} ${log_entry} |
| 126 | Wait for one of PRH log entries ${timeout} ${log_entry} |
| 127 | |
| 128 | Wait for one of PRH log entries |
| 129 | [Arguments] ${timeout} @{log_entries} |
| 130 | [Timeout] ${timeout} |
| 131 | ${found}= Wait for one of docker log entries prh ${log_entries} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 132 | Should Be True ${found} |
| 133 | |
grabinsk | 3bee489 | 2019-07-17 08:43:33 +0200 | [diff] [blame] | 134 | Wait for PRH json log entry |
| 135 | [Arguments] ${timeout} ${prefix} ${json} |
| 136 | [Timeout] ${timeout} |
| 137 | ${found}= Wait for log entry with json message ${prefix} ${json} |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 138 | Should Be True ${found} |
| 139 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 140 | Create event parsing error |
| 141 | [Arguments] ${ves_event} |
| 142 | ${notification}= Create invalid notification ${ves_event} |
| 143 | ${error_msg}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${notification} |
| 144 | [Return] ${error_msg} |
| 145 | |
| 146 | Add PNF entry in AAI |
| 147 | [Arguments] ${pnf_entry} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 148 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 149 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 150 | ${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] | 151 | Should Be Equal As Strings ${resp.status_code} 200 |
| 152 | |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 153 | Add service instance entry in AAI |
| 154 | [Arguments] ${aai_service_instance} |
| 155 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 156 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
Joanna Jeremicz | bbabae7 | 2019-08-19 09:24:53 +0200 | [diff] [blame] | 157 | ${resp}= Put Request ${aai_session} /setup/add_service_instance headers=${suite_headers} data=${aai_service_instance} |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 158 | Should Be Equal As Strings ${resp.status_code} 200 |
| 159 | |
Joanna Jeremicz | 4a70dd3 | 2019-06-25 13:39:33 +0200 | [diff] [blame] | 160 | Add logical link entry in AAI |
| 161 | [Arguments] ${logical_link} |
| 162 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 163 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
| 164 | ${resp}= Put Request ${aai_session} /setup/add_logical_link headers=${suite_headers} data=${logical_link} |
| 165 | Should Be Equal As Strings ${resp.status_code} 200 |
| 166 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 167 | Set VES event in DMaaP |
| 168 | [Arguments] ${ves_event} |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 169 | ${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] | 170 | Should Be Equal As Strings ${resp.status_code} 200 |
| 171 | |
| 172 | Should Be Equal As JSON |
grabinsk | 08a9c63 | 2019-05-23 13:34:38 +0200 | [diff] [blame] | 173 | [Arguments] ${actual} ${expected} |
| 174 | Log EXPECTED: ${expected} |
| 175 | Log ACTUAL: ${actual} |
| 176 | ${expected_json}= Evaluate json.loads("""${expected}""") json |
| 177 | ${actual_json}= Evaluate json.loads("""${actual}""") json |
| 178 | Should Be Equal ${actual_json} ${expected_json} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 179 | |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 180 | Reset Simulators |
| 181 | Reset AAI simulator |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 182 | Reset DMaaP simulator |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 183 | |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 184 | Reset AAI simulator |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 185 | ${resp}= Post Request ${aai_session} /reset |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 186 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 187 | |
| 188 | Reset DMaaP simulator |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 189 | ${resp}= Post Request ${dmaap_session} /reset |
Marcin Migdal | fba99a5 | 2019-04-15 14:36:45 +0200 | [diff] [blame] | 190 | Should Be Equal As Strings ${resp.status_code} 200 |
| 191 | |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 192 | |
| 193 | Verify change logging level |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame] | 194 | ${logger}= Set Variable org.onap.dcaegen2.services.prh.controllers.AppInfoController |
| 195 | Change logging level ${logger} TRACE |
| 196 | Verify logging level ${logger} TRACE |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 197 | Verify logs with heartbeat |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame] | 198 | [Teardown] Change logging level ${logger} INFO |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 199 | |
| 200 | Change logging level |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame] | 201 | [Arguments] ${logger} ${log_level} |
| 202 | ${request_body}= Create Dictionary configuredLevel=${log_level} |
| 203 | ${resp}= Post Request prh_session /actuator/loggers/${logger} json=${request_body} |
| 204 | Should Be Equal As Integers ${resp.status_code} 204 |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame] | 205 | |
| 206 | Verify logging level |
grabinsk | ad1421e | 2019-06-21 15:08:21 +0200 | [diff] [blame] | 207 | [Arguments] ${logger} ${expected_log_level} |
| 208 | ${resp}= Get Request prh_session /actuator/loggers/${logger} |
| 209 | Should Be Equal As Integers ${resp.status_code} 200 |
| 210 | Log ${resp.content} |
| 211 | 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] | 212 | |
| 213 | Verify logs with heartbeat |
grabinsk | c68c2ee | 2019-06-19 12:36:42 +0200 | [diff] [blame] | 214 | Get Request prh_session /heartbeat |
grabinsk | 3bee489 | 2019-07-17 08:43:33 +0200 | [diff] [blame] | 215 | Verify PRH logs contains Heartbeat request received |
| 216 | |
| 217 | Verify PRH logs contains |
| 218 | [Arguments] ${expected_entry} |
| 219 | ${log}= Get docker logs since test start prh |
| 220 | Should Contain ${log} ${expected_entry} |