1*** Settings ***
2Documentation       This suite tests IPMI Payload in OpenBMC.
3
4Resource            ../lib/ipmi_client.robot
5Resource            ../lib/openbmc_ffdc.robot
6Variables           ../data/ipmi_raw_cmd_table.py
7
8
9*** Test Cases ***
10
11Test Get Payload Activation Status
12    [Documentation]  Test get payload activation status.
13    [Tags]  Test_Get_Payload_Activation_Status
14
15    # SOL is the payload currently supported for payload status.
16    # Currently supports only one SOL session.
17    # Response Data
18    # 01   instance 1 is activated.
19    # 00   instance 1 is deactivated.
20    ${payload_status}=  Get Payload Activation Status
21    Should Contain Any  ${payload_status}  01  00
22
23
24Test Activate Payload
25    [Documentation]  Test activate payload via IPMI raw command.
26    [Tags]  Test_Activate_Payload
27
28    ${payload_status}=  Get Payload Activation Status
29    Run Keyword If  '${payload_status}' == '01'  Deactivate Payload
30
31    Activate Payload
32
33    ${payload_status}=  Get Payload Activation Status
34    Should Contain  ${payload_status}  01
35
36
37Test Deactivate Payload
38    [Documentation]  Test deactivate payload via IPMI raw command.
39    [Tags]  Test_Deactivate_Payload
40
41    ${payload_status}=  Get Payload Activation Status
42    Run Keyword If  '${payload_status}' == '00'  Activate Payload
43
44    Deactivate Payload
45
46    ${payload_status}=  Get Payload Activation Status
47    Should Contain  ${payload_status}  00
48
49
50Test Get Payload Instance Info
51    [Documentation]  Test Get Payload Instance via IPMI raw command.
52    [Tags]  Test_Get_Payload_Instance_Info
53
54    ${payload_status}=  Get Payload Activation Status
55    Run keyword If  '${payload_status}' == '01'
56    ...  Deactivate Payload
57
58    # First four bytes should be 00 if given instance is not activated.
59    ${resp}=  Run IPMI Command
60    ...  ${IPMI_RAW_CMD['Payload']['Get_Payload_Instance_Info'][0]}
61    Should Contain  ${resp}  ${IPMI_RAW_CMD['Payload']['Get_Payload_Instance_Info'][1]}
62    Activate Payload
63
64    # First four bytes should be session ID when payload is activated.
65    ${resp}=  Run IPMI Command
66    ...  ${IPMI_RAW_CMD['Payload']['Get_Payload_Instance_Info'][0]}
67    Should Not Contain  ${resp}  ${IPMI_RAW_CMD['Payload']['Get_Payload_Instance_Info'][1]}
68
69
70*** Keywords ***
71
72Get Payload Activation Status
73    [Documentation]  Get payload activation status.
74
75    ${resp}=  Run IPMI Command
76    ...  ${IPMI_RAW_CMD['Payload']['Get_Payload_Activation_Status'][0]}
77
78    @{resp}=  Split String  ${resp}
79
80    ${payload_status}=  Set Variable  ${resp[1]}
81
82    [return]  ${payload_status}
83
84
85Activate Payload
86    [Documentation]  Activate Payload.
87
88    ${resp}=  Run IPMI Command
89    ...  ${IPMI_RAW_CMD['Payload']['Activate_Payload'][0]}
90    Should Contain  ${resp}  ${IPMI_RAW_CMD['Payload']['Activate_Payload'][1]}
91
92
93Deactivate Payload
94    [Documentation]  Deactivate Payload.
95
96    ${resp}=  Run IPMI Command
97    ...  ${IPMI_RAW_CMD['Payload']['Deactivate_Payload'][0]}
98    Should Be Empty  ${resp}
99