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 |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame^] | 5 | Library OperatingSystem |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 6 | Resource ../../../common.robot |
| 7 | |
| 8 | *** Keywords *** |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 9 | Verify 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 Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 17 | 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] | 18 | |
| 19 | Verify 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 Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 23 | Check created Logical Link ${expected_logical_link} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 24 | |
| 25 | Verify 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} |
grabinsk | 8bc68e2 | 2019-06-14 13:56:17 +0200 | [diff] [blame] | 29 | Log Invalid ves event: ${invalid_ves_event} |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 30 | ${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} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 33 | |
| 34 | Verify 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} |
grabinsk | 8bc68e2 | 2019-06-14 13:56:17 +0200 | [diff] [blame] | 39 | Check PRH log |WARN |Incorrect json, consumerDmaapModel can not be created: |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 40 | |
| 41 | Verify missing AAI record is logged |
Marcin Migdal | ee95403 | 2019-04-30 12:23:29 +0200 | [diff] [blame] | 42 | [Timeout] 100s |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 43 | [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} |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 48 | 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] | 49 | |
| 50 | Verify AAI not responding is logged |
Marcin Migdal | ee95403 | 2019-04-30 12:23:29 +0200 | [diff] [blame] | 51 | [Timeout] 100s |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 52 | [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} |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 56 | Check PRH log connection timed out: aai Host is unreachable: aai |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 57 | Ensure Container Is Running aai_simulator |
| 58 | |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 59 | Verify PNF re registration |
| 60 | [Timeout] 100s |
| 61 | [Arguments] ${test_case_directory} |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 62 | ${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 Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 66 | |
| 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 Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 70 | #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] | 71 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 72 | Check CBS ready |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 73 | ${resp}= Get Request ${consul_setup_session} /v1/catalog/services |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 74 | Should Be Equal As Strings ${resp.status_code} 200 |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 75 | Log Service Catalog response: ${resp.content} |
| 76 | 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] | 77 | |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 78 | Check created PNF_READY notification |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 79 | [Arguments] ${expected_event_pnf_ready_in_dpaap} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 80 | ${resp}= Get Request ${dmaap_setup_session} /verify/pnf_ready headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 81 | 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 Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 84 | Check created PNF_UPDATE notification |
| 85 | [Arguments] ${expected_event_pnf_update_in_dpaap} |
| 86 | ${resp}= Get Request ${dmaap_setup_session} /verify/pnf_update headers=${suite_headers} |
| 87 | 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 | |
| 91 | Check created Logical Link |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 92 | [Arguments] ${expected_logical_link_in_aai} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 93 | ${resp}= Get Request ${aai_setup_session} /verify/created_logical_link headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 94 | Should Be Equal As Strings ${resp.status_code} 200 |
| 95 | Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai} |
| 96 | |
| 97 | Check PRH log |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 98 | [Arguments] @{log_entries} |
| 99 | ${found}= Find one of log entryies ${log_entries} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 100 | Should Be True ${found} |
| 101 | |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 102 | Check PRH json log |
| 103 | [Arguments] ${prefix} ${json} |
| 104 | ${found}= Find log json ${prefix} ${json} |
| 105 | Should Be True ${found} |
| 106 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 107 | Create 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 | |
| 113 | Add PNF entry in AAI |
| 114 | [Arguments] ${pnf_entry} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 115 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 116 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
| 117 | ${resp}= Put Request ${aai_setup_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry} |
| 118 | Should Be Equal As Strings ${resp.status_code} 200 |
| 119 | |
Marcin Migdal | d244892 | 2019-06-17 15:22:44 +0200 | [diff] [blame] | 120 | Add 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} |
| 124 | ${resp}= Put Request ${aai_setup_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance} |
| 125 | Should Be Equal As Strings ${resp.status_code} 200 |
| 126 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 127 | Set VES event in DMaaP |
| 128 | [Arguments] ${ves_event} |
| 129 | ${resp}= Put Request ${dmaap_setup_session} /setup/ves_event headers=${suite_headers} data=${ves_event} |
| 130 | Should Be Equal As Strings ${resp.status_code} 200 |
| 131 | |
| 132 | Should Be Equal As JSON |
grabinsk | 08a9c63 | 2019-05-23 13:34:38 +0200 | [diff] [blame] | 133 | [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 Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 139 | |
| 140 | Create sessions |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 141 | Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL} |
| 142 | Set Suite Variable ${dmaap_setup_session} dmaap_setup_session |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 143 | Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL} |
| 144 | Set Suite Variable ${aai_setup_session} aai_setup_session |
Marcin Migdal | fba99a5 | 2019-04-15 14:36:45 +0200 | [diff] [blame] | 145 | Create Session consul_setup_session ${CONSUL_SETUP_URL} |
| 146 | Set Suite Variable ${consul_setup_session} consul_setup_session |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame^] | 147 | Create Session prh_setup_session ${PRH_SETUP_URL} |
| 148 | Set Suite Variable ${prh_setup_session} prh_setup_session |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 149 | |
| 150 | Reset Simulators |
| 151 | Reset AAI simulator |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 152 | Reset DMaaP simulator |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 153 | |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 154 | Reset AAI simulator |
| 155 | ${resp}= Post Request ${aai_setup_session} /reset |
| 156 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 157 | |
| 158 | Reset DMaaP simulator |
| 159 | ${resp}= Post Request ${dmaap_setup_session} /reset |
Marcin Migdal | fba99a5 | 2019-04-15 14:36:45 +0200 | [diff] [blame] | 160 | Should Be Equal As Strings ${resp.status_code} 200 |
| 161 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 162 | Create headers |
| 163 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
micdzied | 9c7d8f0 | 2019-06-17 14:08:27 +0200 | [diff] [blame^] | 164 | Set Suite Variable ${suite_headers} ${headers} |
| 165 | |
| 166 | Verify change logging level |
| 167 | Change logging level TRACE |
| 168 | Verify logs with heartbeat |
| 169 | Change logging level INFO |
| 170 | |
| 171 | Change logging level |
| 172 | [Arguments] ${expected_log_level} |
| 173 | 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 |
| 174 | |
| 175 | Verify logging level |
| 176 | [Arguments] ${expected_log_level} |
| 177 | ${resp}= Get Request prh_setup_session /actuator/loggers/org.onap.dcaegen2.services.prh |
| 178 | Should Be Equal As JSON ${resp.content} ${expected_log_level} |
| 179 | |
| 180 | Verify logs with heartbeat |
| 181 | Verify logging level ${TRACE_LOG_LEVEL_CONF} |
| 182 | Get Request prh_setup_session /heartbeat |
| 183 | Check PRH log Heartbeat request received |