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 |
grabinsk | 0fc9eab | 2019-05-23 13:34:38 +0200 | [diff] [blame^] | 16 | Wait Until Keyword Succeeds 10x 3000ms Check recorded 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} |
| 22 | Check recorded Logical Link ${expected_logical_link} |
| 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} |
| 28 | ${error_msg}= Create event parsing error ${invalid_ves_event} |
| 29 | Wait Until Keyword Succeeds 10x 3000ms Check PRH log ${error_msg} |
| 30 | |
| 31 | Verify incorrect JSON event is logged |
| 32 | [Timeout] 60s |
| 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 | db4c4a5 | 2019-05-22 14:59:02 +0200 | [diff] [blame] | 36 | Wait Until Keyword Succeeds 10x 3000ms Check PRH log |com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonArray |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 37 | |
| 38 | Verify missing AAI record is logged |
Marcin Migdal | ee95403 | 2019-04-30 12:23:29 +0200 | [diff] [blame] | 39 | [Timeout] 100s |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 40 | [Arguments] ${test_case_directory} |
| 41 | ${incorrect_aai_entry}= Get Data From File ${test_case_directory}/incorrect-aai-entry.json |
| 42 | ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json |
| 43 | Add PNF entry in AAI ${incorrect_aai_entry} |
| 44 | Set VES event in DMaaP ${ves_event} |
| 45 | Wait Until Keyword Succeeds 10x 3000ms Check PRH log |AAIProducerTask exception has been registered |
| 46 | Wait Until Keyword Succeeds 10x 3000ms Check PRH log |Chain of tasks have been aborted due to errors in PRH workflow |
| 47 | |
| 48 | Verify AAI not responding is logged |
Marcin Migdal | ee95403 | 2019-04-30 12:23:29 +0200 | [diff] [blame] | 49 | [Timeout] 100s |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 50 | [Arguments] ${test_case_directory} |
| 51 | ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json |
| 52 | Ensure Container Is Exited aai_simulator |
| 53 | Set VES event in DMaaP ${ves_event} |
| 54 | Wait Until Keyword Succeeds 10x 3000ms Check PRH log java.net.UnknownHostException: aai |
| 55 | Ensure Container Is Running aai_simulator |
| 56 | |
| 57 | Check CBS ready |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 58 | ${resp}= Get Request ${consul_setup_session} /v1/catalog/services |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 59 | Should Be Equal As Strings ${resp.status_code} 200 |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 60 | Log Service Catalog response: ${resp.content} |
| 61 | 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] | 62 | |
| 63 | Check recorded PNF_READY notification |
| 64 | [Arguments] ${expected_event_pnf_ready_in_dpaap} |
| 65 | ${resp}= Get Request ${dmaap_setup_session} /setup/pnf_ready headers=${suite_headers} |
| 66 | Should Be Equal As Strings ${resp.status_code} 200 |
| 67 | Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap} |
| 68 | |
| 69 | Check recorded Logical Link |
| 70 | [Arguments] ${expected_logical_link_in_aai} |
| 71 | ${resp}= Get Request ${aai_setup_session} /setup/created_logical_link headers=${suite_headers} |
| 72 | Should Be Equal As Strings ${resp.status_code} 200 |
| 73 | Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai} |
| 74 | |
| 75 | Check PRH log |
| 76 | [Arguments] ${log_entry} |
| 77 | ${found}= Find log entry ${log_entry} |
| 78 | Should Be True ${found} |
| 79 | |
| 80 | Create event parsing error |
| 81 | [Arguments] ${ves_event} |
| 82 | ${notification}= Create invalid notification ${ves_event} |
| 83 | ${error_msg}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${notification} |
| 84 | [Return] ${error_msg} |
| 85 | |
| 86 | Add PNF entry in AAI |
| 87 | [Arguments] ${pnf_entry} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 88 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 89 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
| 90 | ${resp}= Put Request ${aai_setup_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry} |
| 91 | Should Be Equal As Strings ${resp.status_code} 200 |
| 92 | |
| 93 | Set VES event in DMaaP |
| 94 | [Arguments] ${ves_event} |
| 95 | ${resp}= Put Request ${dmaap_setup_session} /setup/ves_event headers=${suite_headers} data=${ves_event} |
| 96 | Should Be Equal As Strings ${resp.status_code} 200 |
| 97 | |
| 98 | Should Be Equal As JSON |
grabinsk | 08a9c63 | 2019-05-23 13:34:38 +0200 | [diff] [blame] | 99 | [Arguments] ${actual} ${expected} |
| 100 | Log EXPECTED: ${expected} |
| 101 | Log ACTUAL: ${actual} |
| 102 | ${expected_json}= Evaluate json.loads("""${expected}""") json |
| 103 | ${actual_json}= Evaluate json.loads("""${actual}""") json |
| 104 | Should Be Equal ${actual_json} ${expected_json} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 105 | |
| 106 | Create sessions |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 107 | Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL} |
| 108 | Set Suite Variable ${dmaap_setup_session} dmaap_setup_session |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 109 | Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL} |
| 110 | Set Suite Variable ${aai_setup_session} aai_setup_session |
Marcin Migdal | fba99a5 | 2019-04-15 14:36:45 +0200 | [diff] [blame] | 111 | Create Session consul_setup_session ${CONSUL_SETUP_URL} |
| 112 | Set Suite Variable ${consul_setup_session} consul_setup_session |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 113 | |
| 114 | Reset Simulators |
| 115 | Reset AAI simulator |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 116 | Reset DMaaP simulator |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 117 | |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 118 | Reset AAI simulator |
| 119 | ${resp}= Post Request ${aai_setup_session} /reset |
| 120 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 121 | |
| 122 | Reset DMaaP simulator |
| 123 | ${resp}= Post Request ${dmaap_setup_session} /reset |
Marcin Migdal | fba99a5 | 2019-04-15 14:36:45 +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 | Create headers |
| 127 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 128 | Set Suite Variable ${suite_headers} ${headers} |