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 | |
| 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} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 22 | Check created Logical Link ${expected_logical_link} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 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} |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 28 | ${notification}= Create invalid notification ${invalid_ves_event} |
| 29 | ${error_msg}= Set Variable Incorrect json, consumerDmaapModel can not be created: |
| 30 | Wait Until Keyword Succeeds 10x 3000ms Check PRH json log ${error_msg} ${notification} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 31 | |
| 32 | Verify incorrect JSON event is logged |
| 33 | [Timeout] 60s |
| 34 | [Arguments] ${test_case_directory} |
| 35 | ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json |
| 36 | Set VES event in DMaaP ${invalid_ves_event} |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 37 | Check PRH log |com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonArray |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 38 | |
| 39 | Verify missing AAI record is logged |
Marcin Migdal | ee95403 | 2019-04-30 12:23:29 +0200 | [diff] [blame] | 40 | [Timeout] 100s |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 41 | [Arguments] ${test_case_directory} |
| 42 | ${incorrect_aai_entry}= Get Data From File ${test_case_directory}/incorrect-aai-entry.json |
| 43 | ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json |
| 44 | Add PNF entry in AAI ${incorrect_aai_entry} |
| 45 | Set VES event in DMaaP ${ves_event} |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 46 | 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] | 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} |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 54 | Check PRH log connection timed out: aai Host is unreachable: aai |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 55 | Ensure Container Is Running aai_simulator |
| 56 | |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 57 | Verify PNF re registration |
| 58 | [Timeout] 100s |
| 59 | [Arguments] ${test_case_directory} |
| 60 | ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json |
| 61 | Verify PNF ready sent ${test_case_directory} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 62 | Check created Logical Link ${expected_logical_link} |
| 63 | |
| 64 | ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json |
| 65 | Set VES event in DMaaP ${ves_event} |
| 66 | ${expected_pnf_update_event}= Get Data From File ${test_case_directory}/expected-pnf-update-event.json |
| 67 | 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] | 68 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 69 | Check CBS ready |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 70 | ${resp}= Get Request ${consul_setup_session} /v1/catalog/services |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 71 | Should Be Equal As Strings ${resp.status_code} 200 |
grabinsk | 78ef07a | 2019-05-06 11:26:25 +0200 | [diff] [blame] | 72 | Log Service Catalog response: ${resp.content} |
| 73 | 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] | 74 | |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 75 | Check created PNF_READY notification |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 76 | [Arguments] ${expected_event_pnf_ready_in_dpaap} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 77 | ${resp}= Get Request ${dmaap_setup_session} /verify/pnf_ready headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 78 | Should Be Equal As Strings ${resp.status_code} 200 |
| 79 | Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap} |
| 80 | |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 81 | Check created PNF_UPDATE notification |
| 82 | [Arguments] ${expected_event_pnf_update_in_dpaap} |
| 83 | ${resp}= Get Request ${dmaap_setup_session} /verify/pnf_update headers=${suite_headers} |
| 84 | Log Response from DMaaP: ${resp.content} |
| 85 | Should Be Equal As Strings ${resp.status_code} 200 |
| 86 | #Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap} |
| 87 | |
| 88 | Check created Logical Link |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 89 | [Arguments] ${expected_logical_link_in_aai} |
Marcin Migdal | 8d000c3 | 2019-06-12 11:55:05 +0200 | [diff] [blame] | 90 | ${resp}= Get Request ${aai_setup_session} /verify/created_logical_link headers=${suite_headers} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 91 | Should Be Equal As Strings ${resp.status_code} 200 |
| 92 | Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai} |
| 93 | |
| 94 | Check PRH log |
grabinsk | 2d51f2b | 2019-06-10 11:35:48 +0200 | [diff] [blame] | 95 | [Arguments] @{log_entries} |
| 96 | ${found}= Find one of log entryies ${log_entries} |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 97 | Should Be True ${found} |
| 98 | |
biniek | e98a725 | 2019-06-03 11:46:23 +0200 | [diff] [blame] | 99 | Check PRH json log |
| 100 | [Arguments] ${prefix} ${json} |
| 101 | ${found}= Find log json ${prefix} ${json} |
| 102 | Should Be True ${found} |
| 103 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 104 | Create event parsing error |
| 105 | [Arguments] ${ves_event} |
| 106 | ${notification}= Create invalid notification ${ves_event} |
| 107 | ${error_msg}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${notification} |
| 108 | [Return] ${error_msg} |
| 109 | |
| 110 | Add PNF entry in AAI |
| 111 | [Arguments] ${pnf_entry} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 112 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 113 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
| 114 | ${resp}= Put Request ${aai_setup_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry} |
| 115 | Should Be Equal As Strings ${resp.status_code} 200 |
| 116 | |
| 117 | Set VES event in DMaaP |
| 118 | [Arguments] ${ves_event} |
| 119 | ${resp}= Put Request ${dmaap_setup_session} /setup/ves_event headers=${suite_headers} data=${ves_event} |
| 120 | Should Be Equal As Strings ${resp.status_code} 200 |
| 121 | |
| 122 | Should Be Equal As JSON |
grabinsk | 08a9c63 | 2019-05-23 13:34:38 +0200 | [diff] [blame] | 123 | [Arguments] ${actual} ${expected} |
| 124 | Log EXPECTED: ${expected} |
| 125 | Log ACTUAL: ${actual} |
| 126 | ${expected_json}= Evaluate json.loads("""${expected}""") json |
| 127 | ${actual_json}= Evaluate json.loads("""${actual}""") json |
| 128 | Should Be Equal ${actual_json} ${expected_json} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 129 | |
| 130 | Create sessions |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 131 | Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL} |
| 132 | Set Suite Variable ${dmaap_setup_session} dmaap_setup_session |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 133 | Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL} |
| 134 | Set Suite Variable ${aai_setup_session} aai_setup_session |
Marcin Migdal | fba99a5 | 2019-04-15 14:36:45 +0200 | [diff] [blame] | 135 | Create Session consul_setup_session ${CONSUL_SETUP_URL} |
| 136 | Set Suite Variable ${consul_setup_session} consul_setup_session |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 137 | |
| 138 | Reset Simulators |
| 139 | Reset AAI simulator |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 140 | Reset DMaaP simulator |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 141 | |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 142 | Reset AAI simulator |
| 143 | ${resp}= Post Request ${aai_setup_session} /reset |
| 144 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 145 | |
| 146 | Reset DMaaP simulator |
| 147 | ${resp}= Post Request ${dmaap_setup_session} /reset |
Marcin Migdal | fba99a5 | 2019-04-15 14:36:45 +0200 | [diff] [blame] | 148 | Should Be Equal As Strings ${resp.status_code} 200 |
| 149 | |
kurczews | 859154a | 2019-04-26 11:31:51 +0200 | [diff] [blame] | 150 | Create headers |
| 151 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
Marcin Migdal | c47ac0f | 2019-06-10 14:36:50 +0200 | [diff] [blame] | 152 | Set Suite Variable ${suite_headers} ${headers} |