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