Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library RequestsLibrary |
| 3 | Library Collections |
| 4 | Library PrhLibrary.py |
| 5 | Resource ../../../common.robot |
| 6 | |
| 7 | *** Keywords *** |
| 8 | Create header |
| 9 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 10 | Set Suite Variable ${suite_headers} ${headers} |
| 11 | |
| 12 | Create sessions |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 13 | Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL} |
| 14 | Set Suite Variable ${dmaap_setup_session} dmaap_setup_session |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 15 | Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL} |
| 16 | Set Suite Variable ${aai_setup_session} aai_setup_session |
| 17 | |
| 18 | Reset Simulators |
| 19 | Reset AAI simulator |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 20 | Reset DMaaP simulator |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 21 | |
| 22 | Invalid event processing |
| 23 | [Arguments] ${input_invalid_event_in_dmaap} |
| 24 | [Timeout] 30s |
| 25 | ${data}= Get Data From File ${input_invalid_event_in_dmaap} |
| 26 | Set event in DMaaP ${data} |
| 27 | ${invalid_notification}= Create invalid notification ${data} |
Mariusz Wagner | 8f3f999 | 2018-10-12 08:37:03 +0200 | [diff] [blame] | 28 | ${notification}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 29 | Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} |
| 30 | |
| 31 | Valid event processing |
| 32 | [Arguments] ${input_valid_event_in_dmaap} |
| 33 | [Timeout] 30s |
| 34 | ${data}= Get Data From File ${input_valid_event_in_dmaap} |
Marcin Migdal | 183c896 | 2019-02-13 15:43:12 +0100 | [diff] [blame^] | 35 | ${posted_event_to_dmaap}= create pnf ready notification from ves ${data} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 36 | ${pnf_name}= Create PNF name ${data} |
| 37 | Set PNF name in AAI ${pnf_name} |
| 38 | Set event in DMaaP ${data} |
Marcin Migdal | 183c896 | 2019-02-13 15:43:12 +0100 | [diff] [blame^] | 39 | ${expected_event_pnf_ready_in_dpaap}= create pnf ready_notification as pnf ready ${data} |
| 40 | Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${expected_event_pnf_ready_in_dpaap} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 41 | |
| 42 | Check PRH log |
| 43 | [Arguments] ${searched_log} |
| 44 | ${status}= Check for log ${searched_log} |
| 45 | Should Be Equal As Strings ${status} True |
| 46 | |
| 47 | Check PNF_READY notification |
| 48 | [Arguments] ${posted_event_to_dmaap} |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 49 | ${resp}= Get Request ${dmaap_setup_session} /events/pnfReady headers=${suite_headers} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 50 | Should Be Equal ${resp.text} ${posted_event_to_dmaap} |
| 51 | |
| 52 | Set PNF name in AAI |
| 53 | [Arguments] ${pnfs_name} |
| 54 | ${headers}= Create Dictionary Accept=application/json Content-Type=text/html |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 55 | ${resp}= Put Request ${aai_setup_session} /set_pnfs headers=${headers} data=${pnfs_name} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 56 | Should Be Equal As Strings ${resp.status_code} 200 |
| 57 | |
| 58 | Set event in DMaaP |
| 59 | [Arguments] ${event_in_dmaap} |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 60 | ${resp}= Put Request ${dmaap_setup_session} /set_get_event headers=${suite_headers} data=${event_in_dmaap} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 61 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 62 | |
| 63 | Reset AAI simulator |
| 64 | ${resp}= Post Request ${aai_setup_session} /reset |
| 65 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 66 | |
| 67 | Reset DMaaP simulator |
| 68 | ${resp}= Post Request ${dmaap_setup_session} /reset |
| 69 | Should Be Equal As Strings ${resp.status_code} 200 |