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 |
| 13 | Create Session dmaap_session ${DMAAP_SIMULATOR_URL} |
| 14 | Set Suite Variable ${suite_dmaap_session} dmaap_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 |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 20 | |
| 21 | Invalid event processing |
| 22 | [Arguments] ${input_invalid_event_in_dmaap} |
| 23 | [Timeout] 30s |
| 24 | ${data}= Get Data From File ${input_invalid_event_in_dmaap} |
| 25 | Set event in DMaaP ${data} |
| 26 | ${invalid_notification}= Create invalid notification ${data} |
Mariusz Wagner | 8f3f999 | 2018-10-12 08:37:03 +0200 | [diff] [blame] | 27 | ${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] | 28 | Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} |
| 29 | |
| 30 | Valid event processing |
| 31 | [Arguments] ${input_valid_event_in_dmaap} |
| 32 | [Timeout] 30s |
| 33 | ${data}= Get Data From File ${input_valid_event_in_dmaap} |
| 34 | ${posted_event_to_dmaap}= Create PNF_Ready notification ${data} |
| 35 | ${pnf_name}= Create PNF name ${data} |
| 36 | Set PNF name in AAI ${pnf_name} |
| 37 | Set event in DMaaP ${data} |
| 38 | Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${posted_event_to_dmaap} |
| 39 | |
| 40 | Check PRH log |
| 41 | [Arguments] ${searched_log} |
| 42 | ${status}= Check for log ${searched_log} |
| 43 | Should Be Equal As Strings ${status} True |
| 44 | |
| 45 | Check PNF_READY notification |
| 46 | [Arguments] ${posted_event_to_dmaap} |
| 47 | ${resp}= Get Request ${suite_dmaap_session} /events/pnfReady headers=${suite_headers} |
| 48 | Should Be Equal ${resp.text} ${posted_event_to_dmaap} |
| 49 | |
| 50 | Set PNF name in AAI |
| 51 | [Arguments] ${pnfs_name} |
| 52 | ${headers}= Create Dictionary Accept=application/json Content-Type=text/html |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 53 | ${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] | 54 | Should Be Equal As Strings ${resp.status_code} 200 |
| 55 | |
| 56 | Set event in DMaaP |
| 57 | [Arguments] ${event_in_dmaap} |
| 58 | ${resp}= Put Request ${suite_dmaap_session} /set_get_event headers=${suite_headers} data=${event_in_dmaap} |
| 59 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 60 | |
| 61 | Reset AAI simulator |
| 62 | ${resp}= Post Request ${aai_setup_session} /reset |
| 63 | Should Be Equal As Strings ${resp.status_code} 200 |