blob: 6e93ffb9a03e37b02b4f228667617ef18f984c4e [file] [log] [blame]
Niranjana3d457a02020-08-12 13:33:22 +05301*** Settings ***
2Library Collections
3Library Process
4Library RequestsLibrary
5Library String
6Library OperatingSystem
7
8Suite Teardown Delete All Sessions
9
10*** Variables ***
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
18
19*** Test Cases ***
20
21HealthCheck
22
23 Create Session sonhms ${SON_HANDLER_BASE_URL}
24 ${resp}= Get Request sonhms ${HEALTHCHECK_ENDPOINT}
25 Should Be Equal As Strings ${resp.status_code} 200
26
27
28Post fm notification to dmaap
29 Create Session dmaap ${DMAAP_URL}
30 ${headers}= Create Dictionary Content-Type application/json
31 ${data}= Get File ${TEST_ROBOT_DIR}/data/fault_notification.json
32 ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_FM_NOTIF_URL}', data=$data)
33 Should Be Equal As Strings ${response.status_code} 200
34
35
36Verify fm notification trigger in sonhms
37 Create Session dmaap ${DMAAP_URL}
38 FOR ${i} IN RANGE 10
39 ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT}
40 Exit For Loop If ${result.json()} != @{EMPTY}
41 Log Waiting for sonhms to handle trigger... console=${True}
42 Sleep 30s
43 END
44 ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_fm.json
45 ${result}= Convert To String ${result.content}
46 ${result_string}= Get Substring ${result} 2 -2
47 ${actual_data}= Evaluate json.loads("""${result_string}""") json
48 ${actual_payload}= Set Variable ${actual_data['payload']}
49 Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip()
50
51
52Post pm notification to dmaap
53 ${data}= Get File ${TEST_ROBOT_DIR}/data/performance_notification.json
54 ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data)
55 Should Be Equal As Strings ${response.status_code} 200
56
57
58Verify pm notification trigger in sonhms
59 Create Session dmaap ${DMAAP_URL}
60 FOR ${i} IN RANGE 5
61 ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT}
62 Exit For Loop If ${result.json()} != @{EMPTY}
63 Log Waiting for sonhms to handle trigger... console=${True}
64 Sleep 30s
65 END
66 ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_pm.json
67 ${result}= Convert To String ${result.content}
68 ${result_string}= Get Substring ${result} 2 -2
69 ${actual_data}= Evaluate json.loads("""${result_string}""") json
70 ${actual_payload}= Set Variable ${actual_data['payload']}
71 Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip()
72
73
74Post policy negative acknowledgement to dmaap
75 ${data}= Get File ${TEST_ROBOT_DIR}/data/negative_ack_from_policy.json
76 FOR ${i} IN RANGE 3
77 ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_POLICY_RESPONSE}', data=$data)
78 END
79 Should Be Equal As Strings ${response.status_code} 200
80
81
82Oof trigger for fixed Pci cells
83 Create Session dmaap ${DMAAP_URL}
84 FOR ${i} IN RANGE 15
85 ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT}
86 Exit For Loop If ${result.json()} != @{EMPTY}
87 Log Waiting for sonhms to handle trigger... console=${True}
88 Sleep 30s
89 END
90 ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_fm.json
91 ${result}= Convert To String ${result.content}
92 ${result_string}= Get Substring ${result} 2 -2
93 ${actual_data}= Evaluate json.loads("""${result_string}""") json
94 ${actual_payload}= Set Variable ${actual_data['payload']}
95 Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip()