2 Library RequestsLibrary
5 Resource ../../../common.robot
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
16 Wait Until Keyword Succeeds 10x 3000ms Check recorded PNF_READY notification ${expected_pnf_ready_event}
18 Verify 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}
24 Verify 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}
28 ${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}
32 Verify incorrect JSON event is logged
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}
37 Check PRH log |com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonArray
39 Verify missing AAI record is logged
41 [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 Check PRH log Request failed for URL 'https://aai:3334/aai/v12/network/pnfs/pnf/NOK6061ZW8'. Response code: 404 Not Found
48 Verify AAI not responding is logged
50 [Arguments] ${test_case_directory}
51 ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json
52 Ensure Container Is Exited aai_simulator
53 Set VES event in DMaaP ${ves_event}
54 Check PRH log connection timed out: aai Host is unreachable: aai
55 Ensure Container Is Running aai_simulator
58 ${resp}= Get Request ${consul_setup_session} /v1/catalog/services
59 Should Be Equal As Strings ${resp.status_code} 200
60 Log Service Catalog response: ${resp.content}
61 Dictionary Should Contain Key ${resp.json()} cbs |Consul service catalog should contain CBS entry
63 Check recorded PNF_READY notification
64 [Arguments] ${expected_event_pnf_ready_in_dpaap}
65 ${resp}= Get Request ${dmaap_setup_session} /setup/pnf_ready headers=${suite_headers}
66 Should Be Equal As Strings ${resp.status_code} 200
67 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap}
69 Check recorded Logical Link
70 [Arguments] ${expected_logical_link_in_aai}
71 ${resp}= Get Request ${aai_setup_session} /setup/created_logical_link headers=${suite_headers}
72 Should Be Equal As Strings ${resp.status_code} 200
73 Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai}
76 [Arguments] @{log_entries}
77 ${found}= Find one of log entryies ${log_entries}
78 Should Be True ${found}
81 [Arguments] ${prefix} ${json}
82 ${found}= Find log json ${prefix} ${json}
83 Should Be True ${found}
85 Create event parsing error
86 [Arguments] ${ves_event}
87 ${notification}= Create invalid notification ${ves_event}
88 ${error_msg}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${notification}
92 [Arguments] ${pnf_entry}
93 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
94 Log AAI url ${AAI_SIMULATOR_SETUP_URL}
95 ${resp}= Put Request ${aai_setup_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry}
96 Should Be Equal As Strings ${resp.status_code} 200
98 Set VES event in DMaaP
99 [Arguments] ${ves_event}
100 ${resp}= Put Request ${dmaap_setup_session} /setup/ves_event headers=${suite_headers} data=${ves_event}
101 Should Be Equal As Strings ${resp.status_code} 200
103 Should Be Equal As JSON
104 [Arguments] ${actual} ${expected}
105 Log EXPECTED: ${expected}
106 Log ACTUAL: ${actual}
107 ${expected_json}= Evaluate json.loads("""${expected}""") json
108 ${actual_json}= Evaluate json.loads("""${actual}""") json
109 Should Be Equal ${actual_json} ${expected_json}
112 Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL}
113 Set Suite Variable ${dmaap_setup_session} dmaap_setup_session
114 Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL}
115 Set Suite Variable ${aai_setup_session} aai_setup_session
116 Create Session consul_setup_session ${CONSUL_SETUP_URL}
117 Set Suite Variable ${consul_setup_session} consul_setup_session
121 Reset DMaaP simulator
124 ${resp}= Post Request ${aai_setup_session} /reset
125 Should Be Equal As Strings ${resp.status_code} 200
127 Reset DMaaP simulator
128 ${resp}= Post Request ${dmaap_setup_session} /reset
129 Should Be Equal As Strings ${resp.status_code} 200
132 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
133 Set Suite Variable ${suite_headers} ${headers}