blob: a6a01eb9644b3b123471757c80d148d6c16bbce0 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library RequestsLibrary
3Library Collections
4Library PrhLibrary.py
5Resource ../../../common.robot
6
7*** Keywords ***
8Create header
9 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
10 Set Suite Variable ${suite_headers} ${headers}
11
12Create sessions
pkarasc7abba82018-10-22 12:22:35 +020013 Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL}
14 Set Suite Variable ${dmaap_setup_session} dmaap_setup_session
pkaras55d36862018-10-17 15:08:34 +020015 Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL}
16 Set Suite Variable ${aai_setup_session} aai_setup_session
17
18Reset Simulators
19 Reset AAI simulator
pkarasc7abba82018-10-22 12:22:35 +020020 Reset DMaaP simulator
Gary Wu9abb61c2018-09-27 10:38:50 -070021
22Invalid 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 Wagner8f3f9992018-10-12 08:37:03 +020028 ${notification}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${invalid_notification}
Marcin Migdald70b3bd2019-04-04 11:13:09 +020029 #TODO to fix after CBS merge
30 #Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification}
Gary Wu9abb61c2018-09-27 10:38:50 -070031
32Valid event processing
Joanna Jeremicz0a391482019-03-14 10:58:32 +010033 [Arguments] ${input_valid__ves_event_in_dmaap}
Gary Wu9abb61c2018-09-27 10:38:50 -070034 [Timeout] 30s
Joanna Jeremicz0a391482019-03-14 10:58:32 +010035 ${data}= Get Data From File ${input_valid__ves_event_in_dmaap}
Gary Wu9abb61c2018-09-27 10:38:50 -070036 ${pnf_name}= Create PNF name ${data}
37 Set PNF name in AAI ${pnf_name}
38 Set event in DMaaP ${data}
Marcin Migdal183c8962019-02-13 15:43:12 +010039 ${expected_event_pnf_ready_in_dpaap}= create pnf ready_notification as pnf ready ${data}
Marcin Migdald70b3bd2019-04-04 11:13:09 +020040 #TODO to fix after CBS merge
41 #Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${expected_event_pnf_ready_in_dpaap}
Gary Wu9abb61c2018-09-27 10:38:50 -070042
43Check PRH log
44 [Arguments] ${searched_log}
45 ${status}= Check for log ${searched_log}
46 Should Be Equal As Strings ${status} True
47
48Check PNF_READY notification
Joanna Jeremicz0a391482019-03-14 10:58:32 +010049 [Arguments] ${expected_event_pnf_ready_in_dpaap}
pkarasc7abba82018-10-22 12:22:35 +020050 ${resp}= Get Request ${dmaap_setup_session} /events/pnfReady headers=${suite_headers}
Joanna Jeremicz0a391482019-03-14 10:58:32 +010051 Should Be Equal ${resp.text} ${expected_event_pnf_ready_in_dpaap}
Gary Wu9abb61c2018-09-27 10:38:50 -070052
53Set PNF name in AAI
Marcin Migdald70b3bd2019-04-04 11:13:09 +020054 [Arguments] ${pnf_name}
Gary Wu9abb61c2018-09-27 10:38:50 -070055 ${headers}= Create Dictionary Accept=application/json Content-Type=text/html
Marcin Migdal725c0702019-04-05 12:30:47 +020056 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
57 Log Http headers ${headers}
58 Log PNF name ${pnf_name}
Marcin Migdald70b3bd2019-04-04 11:13:09 +020059 ${resp}= Put Request ${aai_setup_session} /set_pnf headers=${headers} data=${pnf_name}
Gary Wu9abb61c2018-09-27 10:38:50 -070060 Should Be Equal As Strings ${resp.status_code} 200
61
62Set event in DMaaP
63 [Arguments] ${event_in_dmaap}
pkarasc7abba82018-10-22 12:22:35 +020064 ${resp}= Put Request ${dmaap_setup_session} /set_get_event headers=${suite_headers} data=${event_in_dmaap}
Gary Wu9abb61c2018-09-27 10:38:50 -070065 Should Be Equal As Strings ${resp.status_code} 200
pkaras55d36862018-10-17 15:08:34 +020066
67Reset AAI simulator
68 ${resp}= Post Request ${aai_setup_session} /reset
69 Should Be Equal As Strings ${resp.status_code} 200
pkarasc7abba82018-10-22 12:22:35 +020070
71Reset DMaaP simulator
72 ${resp}= Post Request ${dmaap_setup_session} /reset
73 Should Be Equal As Strings ${resp.status_code} 200