blob: 1aeb17dda9e68f0ca3cbfe4e48d2882fba0071a8 [file] [log] [blame]
Anusha Dathatri1cd34b52019-08-13 04:43:12 -05001*** Settings ***
2Documentation Event notification test cases.
3
4Library ../lib/gen_cmd.py
5Library ../lib/var_funcs.py
6Library ../lib/gen_robot_valid.py
7Library ../lib/gen_robot_keyword.py
8Resource ../lib/resource.robot
9Resource ../lib/openbmc_ffdc.robot
10Resource ../lib/rest_client.robot
11
12Test Setup Printn
13
14Test Teardown FFDC On Test Case Fail
15
16*** Test Cases ***
17
18Subscribe And Verify Event Notification
19 [Documentation] Subscribe and verify event notification.
20 [Tags] Subscribe_And_Verify_Event_Notification
21 [Teardown] Run Keyword And Ignore Error Kill Cmd ${popen}
22
23 ${cmd_buf}= Catenate event_notification_util.py --quiet=1 --host=${OPENBMC_HOST}
24 ... --password=${OPENBMC_PASSWORD} --dbus_path=${CONTROL_HOST_URI}power_cap
25 ${popen}= Shell Cmd ${cmd_buf} return_stderr=1 fork=1
26 Rprint Vars popen.pid
27 Qprint Timen Allow child event_notification_util.py job to begin to wait for the event notification.
28 Run Key U Sleep \ 5 seconds
29
30 # Get current reading for debug.
31 ${original_power_cap_settings}= Read Properties ${CONTROL_HOST_URI}power_cap quiet=1
32 Rprint Vars original_power_cap_settings
33
34 # Set power limit out of range.
35 ${power_cap}= Evaluate random.randint(1000, 3000) modules=random
36 Rprint Vars original_power_cap_settings power_cap
37 ${data}= Create Dictionary data=${power_cap}
38 Write Attribute ${CONTROL_HOST_URI}power_cap PowerCap data=${data}
39
40 Qprint Timen Wait for child event_notification_util.py job to see the event notification.
41 Run Key U Sleep \ 5 seconds
42
43 Qprint Timen Retrieving output from spawned event_notification_util.py job.
44 ${rc} ${stdout} ${stderr}= Kill Cmd ${popen}
45 Run Keyword If ${rc} Log to Console ${stderr}
46 Valid Value rc [0]
47 ${event_notification}= Key Value Outbuf To Dict ${stdout} process_indent=1
48 Rprint Vars event_notification
49
50 # Example output:
51 # interface: xyz.openbmc_project.Control.Power.Cap
52 # path: /xyz/openbmc_project/control/host0/power_cap
53 # event: PropertiesChanged
54 # properties:
55 # PowerCap: 1318
56
57 Valid Value event_notification['event'] ['PropertiesChanged']
58 Valid Value event_notification['properties']['powercap'] ['${power_cap}']