4 Library RequestsLibrary
6 Library OperatingSystem
8 Suite Teardown Delete All Sessions
11 ${SON_HANDLER_BASE_URL} http://${SONHMS_IP}:8080
12 ${HEALTHCHECK_ENDPOINT} /healthcheck
13 ${DMAAP_URL} http://${DMAAP_IP}:3904/events
14 ${unauthenticated.DCAE_CL_OUTPUT} /unauthenticated.DCAE_CL_OUTPUT/23/23
15 ${POST_DMAAP_EVENT_FOR_FM_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.SEC_FAULT_OUTPUT
16 ${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.VES_MEASUREMENT_OUTPUT
17 ${POST_DMAAP_EVENT_FOR_POLICY_RESPONSE} http://${DMAAP_IP}:3904/events/DCAE_CL_RSP
24 Create Session sonhms ${SON_HANDLER_BASE_URL}
25 ${resp}= Get Request sonhms ${HEALTHCHECK_ENDPOINT}
26 Should Be Equal As Strings ${resp.status_code} 200
29 Post fm notification to dmaap
30 Create Session dmaap ${DMAAP_URL}
31 ${headers}= Create Dictionary Content-Type application/json
32 ${data}= Get File ${TEST_ROBOT_DIR}/data/cps_fault_notification.json
33 ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_FM_NOTIF_URL}', data=$data)
34 Should Be Equal As Strings ${response.status_code} 200
37 Verify fm notification trigger in sonhms
38 Create Session dmaap ${DMAAP_URL}
40 ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT}
41 Exit For Loop If ${result.json()} != @{EMPTY}
42 Log Waiting for sonhms to handle trigger... console=${True}
45 ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/cps_expected_payload_fm.json
46 ${result}= Convert To String ${result.content}
47 ${result_string}= Get Substring ${result} 2 -2
48 ${actual_data}= Evaluate json.loads("""${result_string}""") json
49 ${actual_payload}= Set Variable ${actual_data['payload']}
50 Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip()
53 Post pm notification to dmaap
54 ${data}= Get File ${TEST_ROBOT_DIR}/data/performance_notification.json
55 ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data)
56 Should Be Equal As Strings ${response.status_code} 200
59 Verify pm notification trigger in sonhms
60 Create Session dmaap ${DMAAP_URL}
62 ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT}
63 Exit For Loop If ${result.json()} != @{EMPTY}
64 Log Waiting for sonhms to handle trigger... console=${True}
67 ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/cps_expected_payload_pm.json
68 ${result}= Convert To String ${result.content}
69 ${result_string}= Get Substring ${result} 2 -2
70 ${actual_data}= Evaluate json.loads("""${result_string}""") json
71 ${actual_payload}= Set Variable ${actual_data['payload']}
72 Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip()
75 Post policy negative acknowledgement to dmaap
76 ${data}= Get File ${TEST_ROBOT_DIR}/data/negative_ack_from_policy.json
78 ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_POLICY_RESPONSE}', data=$data)
80 Should Be Equal As Strings ${response.status_code} 200
83 Oof trigger for fixed Pci cells
85 Create Session dmaap ${DMAAP_URL}
86 ${headers}= Create Dictionary Content-Type application/json
87 ${data}= Get File ${TEST_ROBOT_DIR}/data/cps_fault_notification.json
88 ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_FM_NOTIF_URL}', data=$data)
90 Create Session dmaap ${DMAAP_URL}
92 ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT}
93 Exit For Loop If ${result.json()} != @{EMPTY}
94 Log Waiting for sonhms to handle trigger... console=${True}
97 ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/cps_expected_payload_fm.json
98 ${result}= Convert To String ${result.content}
99 ${result_string}= Get Substring ${result} 2 -2
100 ${actual_data}= Evaluate json.loads("""${result_string}""") json
101 ${actual_payload}= Set Variable ${actual_data['payload']}
102 Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip()