blob: 73ce2a2c43177f902c1c20bb564856971b243be9 [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
13 Create Session dmaap_session ${DMAAP_SIMULATOR_URL}
14 Set Suite Variable ${suite_dmaap_session} dmaap_session
15 Create Session aai_session ${AAI_SIMULATOR_URL}
16 Set Suite Variable ${suite_aai_session} aai_session
17
18Invalid event processing
19 [Arguments] ${input_invalid_event_in_dmaap}
20 [Timeout] 30s
21 ${data}= Get Data From File ${input_invalid_event_in_dmaap}
22 Set event in DMaaP ${data}
23 ${invalid_notification}= Create invalid notification ${data}
24 ${notification}= Catenate SEPARATOR= \\n |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created: ${invalid_notification}
25 Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification}
26
27Valid event processing
28 [Arguments] ${input_valid_event_in_dmaap}
29 [Timeout] 30s
30 ${data}= Get Data From File ${input_valid_event_in_dmaap}
31 ${posted_event_to_dmaap}= Create PNF_Ready notification ${data}
32 ${pnf_name}= Create PNF name ${data}
33 Set PNF name in AAI ${pnf_name}
34 Set event in DMaaP ${data}
35 Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${posted_event_to_dmaap}
36
37Check PRH log
38 [Arguments] ${searched_log}
39 ${status}= Check for log ${searched_log}
40 Should Be Equal As Strings ${status} True
41
42Check PNF_READY notification
43 [Arguments] ${posted_event_to_dmaap}
44 ${resp}= Get Request ${suite_dmaap_session} /events/pnfReady headers=${suite_headers}
45 Should Be Equal ${resp.text} ${posted_event_to_dmaap}
46
47Set PNF name in AAI
48 [Arguments] ${pnfs_name}
49 ${headers}= Create Dictionary Accept=application/json Content-Type=text/html
50 ${resp}= Put Request ${suite_aai_session} /set_pnfs headers=${headers} data=${pnfs_name}
51 Should Be Equal As Strings ${resp.status_code} 200
52
53Set event in DMaaP
54 [Arguments] ${event_in_dmaap}
55 ${resp}= Put Request ${suite_dmaap_session} /set_get_event headers=${suite_headers} data=${event_in_dmaap}
56 Should Be Equal As Strings ${resp.status_code} 200