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} |
Marcin Migdal | d70b3bd | 2019-04-04 11:13:09 +0200 | [diff] [blame] | 29 | #TODO to fix after CBS merge |
| 30 | #Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 31 | |
| 32 | Valid event processing |
Marcin Migdal | 26125b1 | 2019-04-11 16:17:18 +0200 | [diff] [blame^] | 33 | [Arguments] ${input_valid__ves_event_in_dmaap} ${input_aai} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 34 | [Timeout] 30s |
Joanna Jeremicz | 0a39148 | 2019-03-14 10:58:32 +0100 | [diff] [blame] | 35 | ${data}= Get Data From File ${input_valid__ves_event_in_dmaap} |
Marcin Migdal | 26125b1 | 2019-04-11 16:17:18 +0200 | [diff] [blame^] | 36 | ${aai_entry_to_be_set}= Get Data From File ${input_aai} |
Marcin Migdal | 4882c74 | 2019-04-09 10:49:37 +0200 | [diff] [blame] | 37 | Set event in DMaaP ${data} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 38 | ${pnf_name}= Create PNF name ${data} |
| 39 | Set PNF name in AAI ${pnf_name} |
Marcin Migdal | 26125b1 | 2019-04-11 16:17:18 +0200 | [diff] [blame^] | 40 | Set PNF content in AAI ${aai_entry_to_be_set} |
Marcin Migdal | 183c896 | 2019-02-13 15:43:12 +0100 | [diff] [blame] | 41 | ${expected_event_pnf_ready_in_dpaap}= create pnf ready_notification as pnf ready ${data} |
Marcin Migdal | d70b3bd | 2019-04-04 11:13:09 +0200 | [diff] [blame] | 42 | #TODO to fix after CBS merge |
Marcin Migdal | 26125b1 | 2019-04-11 16:17:18 +0200 | [diff] [blame^] | 43 | #Wait Until Keyword Succeeds 10x 300ms Check PNF_READY notification ${expected_event_pnf_ready_in_dpaap} |
| 44 | #Wait Until Keyword Succeeds 10x 5000ms Check PRH log Mandingo |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 45 | |
| 46 | Check PRH log |
| 47 | [Arguments] ${searched_log} |
| 48 | ${status}= Check for log ${searched_log} |
| 49 | Should Be Equal As Strings ${status} True |
| 50 | |
| 51 | Check PNF_READY notification |
Joanna Jeremicz | 0a39148 | 2019-03-14 10:58:32 +0100 | [diff] [blame] | 52 | [Arguments] ${expected_event_pnf_ready_in_dpaap} |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 53 | ${resp}= Get Request ${dmaap_setup_session} /events/pnfReady headers=${suite_headers} |
Joanna Jeremicz | 0a39148 | 2019-03-14 10:58:32 +0100 | [diff] [blame] | 54 | Should Be Equal ${resp.text} ${expected_event_pnf_ready_in_dpaap} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 55 | |
| 56 | Set PNF name in AAI |
Marcin Migdal | d70b3bd | 2019-04-04 11:13:09 +0200 | [diff] [blame] | 57 | [Arguments] ${pnf_name} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 58 | ${headers}= Create Dictionary Accept=application/json Content-Type=text/html |
Marcin Migdal | 725c070 | 2019-04-05 12:30:47 +0200 | [diff] [blame] | 59 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
| 60 | Log Http headers ${headers} |
| 61 | Log PNF name ${pnf_name} |
Marcin Migdal | d70b3bd | 2019-04-04 11:13:09 +0200 | [diff] [blame] | 62 | ${resp}= Put Request ${aai_setup_session} /set_pnf headers=${headers} data=${pnf_name} |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 63 | Should Be Equal As Strings ${resp.status_code} 200 |
| 64 | |
Marcin Migdal | 26125b1 | 2019-04-11 16:17:18 +0200 | [diff] [blame^] | 65 | Set PNF content in AAI |
| 66 | [Arguments] ${aai_pnf_content} |
| 67 | ${headers}= Create Dictionary Accept=application/json Content-Type=text/html |
| 68 | Log AAI url ${AAI_SIMULATOR_SETUP_URL} |
| 69 | Log Http headers ${headers} |
| 70 | Log PNF AAI content ${aai_pnf_content} |
| 71 | ${resp}= Put Request ${aai_setup_session} /setup/add_pnf_entry headers=${headers} data=${aai_pnf_content} |
| 72 | Should Be Equal As Strings ${resp.status_code} 200 |
| 73 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 74 | Set event in DMaaP |
| 75 | [Arguments] ${event_in_dmaap} |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 76 | ${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] | 77 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | 55d3686 | 2018-10-17 15:08:34 +0200 | [diff] [blame] | 78 | |
| 79 | Reset AAI simulator |
| 80 | ${resp}= Post Request ${aai_setup_session} /reset |
| 81 | Should Be Equal As Strings ${resp.status_code} 200 |
pkaras | c7abba8 | 2018-10-22 12:22:35 +0200 | [diff] [blame] | 82 | |
| 83 | Reset DMaaP simulator |
| 84 | ${resp}= Post Request ${dmaap_setup_session} /reset |
| 85 | Should Be Equal As Strings ${resp.status_code} 200 |