blob: 6302ef769682712d1b41938f66535ac7ac261b84 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library RequestsLibrary
grabinsk78ef07a2019-05-06 11:26:25 +02003Library Collections
Gary Wu9abb61c2018-09-27 10:38:50 -07004Library PrhLibrary.py
5Resource ../../../common.robot
6
7*** Keywords ***
kurczews859154a2019-04-26 11:31:51 +02008Verify PNF ready sent
9 [Arguments] ${test_case_directory}
10 ${pnf_entry}= Get Data From File ${test_case_directory}/aai-entry.json
11 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
12 ${expected_pnf_ready_event}= Get Data From File ${test_case_directory}/expected-pnf-ready-event.json
13 Add PNF entry in AAI ${pnf_entry}
14 Set VES event in DMaaP ${ves_event}
15 Wait Until Keyword Succeeds 10x 3000ms Check CBS ready
grabinsk0fc9eab2019-05-23 13:34:38 +020016 Wait Until Keyword Succeeds 10x 3000ms Check recorded PNF_READY notification ${expected_pnf_ready_event}
kurczews859154a2019-04-26 11:31:51 +020017
18Verify PNF ready sent and logical link created
19 [Arguments] ${test_case_directory}
20 ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json
21 Verify PNF ready sent ${test_case_directory}
22 Check recorded Logical Link ${expected_logical_link}
23
24Verify event with missing required field is logged
25 [Arguments] ${test_case_directory}
26 ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
27 Set VES event in DMaaP ${invalid_ves_event}
binieke98a7252019-06-03 11:46:23 +020028 ${notification}= Create invalid notification ${invalid_ves_event}
29 ${error_msg}= Set Variable Incorrect json, consumerDmaapModel can not be created:
30 Wait Until Keyword Succeeds 10x 3000ms Check PRH json log ${error_msg} ${notification}
kurczews859154a2019-04-26 11:31:51 +020031
32Verify incorrect JSON event is logged
33 [Timeout] 60s
34 [Arguments] ${test_case_directory}
35 ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json
36 Set VES event in DMaaP ${invalid_ves_event}
grabinskdb4c4a52019-05-22 14:59:02 +020037 Wait Until Keyword Succeeds 10x 3000ms Check PRH log |com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonArray
kurczews859154a2019-04-26 11:31:51 +020038
39Verify missing AAI record is logged
Marcin Migdalee954032019-04-30 12:23:29 +020040 [Timeout] 100s
kurczews859154a2019-04-26 11:31:51 +020041 [Arguments] ${test_case_directory}
42 ${incorrect_aai_entry}= Get Data From File ${test_case_directory}/incorrect-aai-entry.json
43 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
44 Add PNF entry in AAI ${incorrect_aai_entry}
45 Set VES event in DMaaP ${ves_event}
46 Wait Until Keyword Succeeds 10x 3000ms Check PRH log |AAIProducerTask exception has been registered
47 Wait Until Keyword Succeeds 10x 3000ms Check PRH log |Chain of tasks have been aborted due to errors in PRH workflow
48
49Verify AAI not responding is logged
Marcin Migdalee954032019-04-30 12:23:29 +020050 [Timeout] 100s
kurczews859154a2019-04-26 11:31:51 +020051 [Arguments] ${test_case_directory}
52 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
53 Ensure Container Is Exited aai_simulator
54 Set VES event in DMaaP ${ves_event}
55 Wait Until Keyword Succeeds 10x 3000ms Check PRH log java.net.UnknownHostException: aai
56 Ensure Container Is Running aai_simulator
57
58Check CBS ready
grabinsk78ef07a2019-05-06 11:26:25 +020059 ${resp}= Get Request ${consul_setup_session} /v1/catalog/services
kurczews859154a2019-04-26 11:31:51 +020060 Should Be Equal As Strings ${resp.status_code} 200
grabinsk78ef07a2019-05-06 11:26:25 +020061 Log Service Catalog response: ${resp.content}
62 Dictionary Should Contain Key ${resp.json()} cbs |Consul service catalog should contain CBS entry
kurczews859154a2019-04-26 11:31:51 +020063
64Check recorded PNF_READY notification
65 [Arguments] ${expected_event_pnf_ready_in_dpaap}
66 ${resp}= Get Request ${dmaap_setup_session} /setup/pnf_ready headers=${suite_headers}
67 Should Be Equal As Strings ${resp.status_code} 200
68 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
69
70Check recorded Logical Link
71 [Arguments] ${expected_logical_link_in_aai}
72 ${resp}= Get Request ${aai_setup_session} /setup/created_logical_link headers=${suite_headers}
73 Should Be Equal As Strings ${resp.status_code} 200
74 Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai}
75
76Check PRH log
77 [Arguments] ${log_entry}
78 ${found}= Find log entry ${log_entry}
79 Should Be True ${found}
80
binieke98a7252019-06-03 11:46:23 +020081Check PRH json log
82 [Arguments] ${prefix} ${json}
83 ${found}= Find log json ${prefix} ${json}
84 Should Be True ${found}
85
kurczews859154a2019-04-26 11:31:51 +020086Create event parsing error
87 [Arguments] ${ves_event}
88 ${notification}= Create invalid notification ${ves_event}
89 ${error_msg}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${notification}
90 [Return] ${error_msg}
91
92Add PNF entry in AAI
93 [Arguments] ${pnf_entry}
Gary Wu9abb61c2018-09-27 10:38:50 -070094 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
kurczews859154a2019-04-26 11:31:51 +020095 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
96 ${resp}= Put Request ${aai_setup_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry}
97 Should Be Equal As Strings ${resp.status_code} 200
98
99Set VES event in DMaaP
100 [Arguments] ${ves_event}
101 ${resp}= Put Request ${dmaap_setup_session} /setup/ves_event headers=${suite_headers} data=${ves_event}
102 Should Be Equal As Strings ${resp.status_code} 200
103
104Should Be Equal As JSON
grabinsk08a9c632019-05-23 13:34:38 +0200105 [Arguments] ${actual} ${expected}
106 Log EXPECTED: ${expected}
107 Log ACTUAL: ${actual}
108 ${expected_json}= Evaluate json.loads("""${expected}""") json
109 ${actual_json}= Evaluate json.loads("""${actual}""") json
110 Should Be Equal ${actual_json} ${expected_json}
Gary Wu9abb61c2018-09-27 10:38:50 -0700111
112Create sessions
pkarasc7abba82018-10-22 12:22:35 +0200113 Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL}
114 Set Suite Variable ${dmaap_setup_session} dmaap_setup_session
pkaras55d36862018-10-17 15:08:34 +0200115 Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL}
116 Set Suite Variable ${aai_setup_session} aai_setup_session
Marcin Migdalfba99a52019-04-15 14:36:45 +0200117 Create Session consul_setup_session ${CONSUL_SETUP_URL}
118 Set Suite Variable ${consul_setup_session} consul_setup_session
pkaras55d36862018-10-17 15:08:34 +0200119
120Reset Simulators
121 Reset AAI simulator
pkarasc7abba82018-10-22 12:22:35 +0200122 Reset DMaaP simulator
Gary Wu9abb61c2018-09-27 10:38:50 -0700123
pkaras55d36862018-10-17 15:08:34 +0200124Reset AAI simulator
125 ${resp}= Post Request ${aai_setup_session} /reset
126 Should Be Equal As Strings ${resp.status_code} 200
pkarasc7abba82018-10-22 12:22:35 +0200127
128Reset DMaaP simulator
129 ${resp}= Post Request ${dmaap_setup_session} /reset
Marcin Migdalfba99a52019-04-15 14:36:45 +0200130 Should Be Equal As Strings ${resp.status_code} 200
131
kurczews859154a2019-04-26 11:31:51 +0200132Create headers
133 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
134 Set Suite Variable ${suite_headers} ${headers}