1*** Settings ***
2Documentation       This suite is for Verifying BMC device tree.
3
4Resource            ../lib/utils.robot
5Resource            ../lib/openbmc_ffdc.robot
6Resource            ../lib/ipmi_client.robot
7Library             String
8
9Test Setup          Open Connection And Log In
10Test Teardown       Run Keywords  Close All Connections  AND FFDC On Test Case Fail
11
12*** Variables ***
13${devicetree_base}  /sys/firmware/devicetree/base/
14
15*** Test Cases ***
16Check BMC Model Property Is Set
17   [Documentation]  Verify if the BMC Model is populated in the device tree.
18   [Tags]  Check_BMC_Model_Property_Is_Set
19   [Template]  Template Check Property
20
21   #Property
22   model
23
24
25Check BMC Compatible Property Is Set
26   [Documentation]  Verify if the BMC compatible property is populated.
27   [Tags]  Check_BMC_Compatible_Property_Is_Set
28   [Template]  Template Check Property
29
30   #Property
31   compatible
32
33
34Check BMC CPU Name Property Is Set
35   [Documentation]  Verify if the BMC CPU name property is populated.
36   [Tags]  Check_BMC_CPU_Name_Property_Is_Set
37   [Template]  Template Check Property
38
39   #Property
40   cpus/name
41
42
43Check BMC CPU Compatible Property Is Set
44   [Documentation]  Verify if the BMC CPU compatible property is populated.
45   [Tags]  Check_BMC_CPU_Compatible_Property_Is_Set
46   [Template]  Template Check Property
47
48   #Property
49   cpus/cpu@0/compatible
50
51
52Check BMC Memory Name Property Is Set
53   [Documentation]  Verify if the BMC Memory name property is populated.
54   [Tags]  Check_BMC_Memory_Name_Property_Is_Set
55   [Template]  Template Check Property
56
57   #Property
58   memory@80000000/name
59
60
61Check BMC Memory Device Type Property Is Set
62   [Documentation]  Verify if the BMC Memory Device Type property is
63   ...  populated.
64   [Tags]  Check_BMC_Memory_Device_Type_Property_Is_Set
65   [Template]  Template Check Property
66
67   #Property
68   memory@80000000/device_type
69
70
71Check BMC FSI Name Property Is Set
72   [Documentation]  Verify if the BMC FSI name property is populated.
73   [Tags]  Check_BMC_FSI_Name_Property_Is_Set
74   [Template]  Template Check Property
75
76   #Property
77   gpio-fsi/name
78
79
80Check BMC FSI Compatible Property Is Set
81   [Documentation]  Verify if the BMC FSI compatible property is populated.
82   [Tags]  Check_BMC_FSI_Compatible_Property_Is_Set
83   [Template]  Template Check Property
84
85   #Property
86   gpio-fsi/compatible
87
88
89Check BMC GPIO FSI Name Property Is Set
90   [Documentation]  Verify if the BMC GPIO-FSI name property is populated.
91   [Tags]  Check_BMC_GPIO_FSI_Name_Property_Is_Set
92   [Template]  Template Check Property
93
94   #Property
95   gpio-fsi/name
96
97
98Check BMC GPIO FSI Compatible Property Is Set
99   [Documentation]  Verify if the BMC GPIO-FSI compatible property is populated.
100   [Tags]  Check_BMC_GPIO_FSI_Compatible_Property_Is_Set
101   [Template]  Template Check Property
102
103   #Property
104   gpio-fsi/compatible
105
106
107Check BMC GPIO Keys Name Property Is Set
108   [Documentation]  Verify if the BMC GPIO-keys name property is
109   ...  populated.
110   [Tags]  Check_BMC_GPIO_Keys_Name_Property_Is_Set
111   [Template]  Template Check Property
112
113   #Property
114   gpio-keys/name
115
116
117Check BMC GPIO Keys Compatible Property Is Set
118   [Documentation]  Verify if the BMC GPIO-keys compatible property is
119   ...  populated.
120   [Tags]  Check_BMC_GPIO_Keys_Compatible_Property_Is_Set
121   [Template]  Template Check Property
122
123   #Property
124   gpio-keys/compatible
125
126
127Check BMC IIO-HWMON Name Property Is Set
128   [Documentation]  Verify if the BMC IIO-HWMON-DPS310 name property is
129   ...  populated.
130   [Tags]  Check_BMC_IIO-HWMON_Name_Property_Is_Set
131   [Template]  Template Check Property
132
133   #Property
134   iio-hwmon-dps310/name
135
136
137Check BMC IIO-HWMON Compatible Property Is Set
138   [Documentation]  Verify if the BMC IIO-HWMON-DPS310 compatible property is
139   ...  populated.
140   [Tags]  Check_BMC_IIO-HWMON_Compatible_Property_Is_Set
141   [Template]  Template Check Property
142
143   #Property
144   iio-hwmon-dps310/compatible
145
146
147Check BMC LED Name Property Is Set
148   [Documentation]  Verify if the BMC LED name property is populated.
149   [Tags]  Check_BMC_LED_Name_Property_Is_Set
150   [Template]  Template Check Property
151
152   #Property
153   leds/name
154
155
156Check BMC LED Compatible Property Is Set
157   [Documentation]  Verify if the BMC LED compatible property is populated.
158   [Tags]  Check_BMC_LED_Compatible_Property_Is_Set
159   [Template]  Template Check Property
160
161   #Property
162   leds/compatible
163
164
165*** Keywords ***
166
167Template Check Property
168    [Documentation]  Check for the existence of a property in the device tree.
169    [Arguments]  ${property}
170    #property: Value of Property
171
172    ${devicetree_path}=  Catenate  SEPARATOR=
173    ...  ${devicetree_base}  ${property}
174    ${output}  ${stderr}=  Execute Command  cat ${devicetree_path}
175    ...  return_stderr=True
176    Should Be Empty  ${stderr}
177    ${length}=  Get Length  ${output}
178    Should Be True  ${length} > 1
179
180