blob: 65cd74a05b49b4d3cf034855c3135b4b5d6b90c1 [file] [log] [blame]
George Keishingfbeaecc2016-08-16 05:24:31 -05001import os
2
Sweta Potthuridaf91342017-09-07 12:05:56 -05003OPENBMC_BASE_URI = '/xyz/openbmc_project/'
4OPENBMC_BASE_DBUS = 'xyz.openbmc_project.'
George Keishingcf910442016-12-08 03:12:59 -06005
George Keishingcae6e902017-09-07 13:35:59 -05006# org open power base URI.
7OPENPOWER_BASE_URI = '/org/open_power/'
8OPENPOWER_CONTROL = OPENPOWER_BASE_URI + 'control/'
9
10# REST URI base endpoint paths.
George Keishingcf910442016-12-08 03:12:59 -060011CONTROL_URI = OPENBMC_BASE_URI + 'control/'
George Keishingcf910442016-12-08 03:12:59 -060012SETTINGS_URI = OPENBMC_BASE_URI + 'settings/'
13WATCHDOG_URI = OPENBMC_BASE_URI + 'watchdog/'
Sweta Potthuridaf91342017-09-07 12:05:56 -050014TIME_MANAGER_URI = OPENBMC_BASE_URI + 'time/'
15XYZ_NETWORK_MANAGER = OPENBMC_BASE_URI + 'network/'
George Keishingcf910442016-12-08 03:12:59 -060016
George Keishing06572472017-09-01 11:33:01 -050017# Sensors base variables.
Sweta Potthuridaf91342017-09-07 12:05:56 -050018SENSORS_URI = OPENBMC_BASE_URI + 'sensors/'
George Keishing06572472017-09-01 11:33:01 -050019
Sweta Potthuridaf91342017-09-07 12:05:56 -050020# State Manager base variables
Rahul Maheshwari2f8de6c2017-01-17 07:00:22 -060021BMC_REBOOT_TRANS = 'xyz.openbmc_project.State.BMC.Transition.Reboot'
22
George Keishingbec365b2017-01-19 01:28:41 -060023HOST_POWEROFF_TRANS = 'xyz.openbmc_project.State.Host.Transition.Off'
24HOST_POWERON_TRANS = 'xyz.openbmc_project.State.Host.Transition.On'
Rahul Maheshwarif7ead242017-02-14 01:59:42 -060025HOST_REBOOT_TRANS = 'xyz.openbmc_project.State.Host.Transition.Reboot'
George Keishingbec365b2017-01-19 01:28:41 -060026HOST_POWEROFF_STATE = 'xyz.openbmc_project.State.Host.HostState.Off'
27HOST_POWERON_STATE = 'xyz.openbmc_project.State.Host.HostState.Running'
28
29CHASSIS_POWEROFF_TRANS = 'xyz.openbmc_project.State.Chassis.Transition.Off'
30CHASSIS_POWERON_TRANS = 'xyz.openbmc_project.State.Chassis.Transition.On'
31CHASSIS_POWEROFF_STATE = 'xyz.openbmc_project.State.Chassis.PowerState.Off'
32CHASSIS_POWERON_STATE = 'xyz.openbmc_project.State.Chassis.PowerState.On'
33
34# State Manager URI variables.
Sweta Potthuridaf91342017-09-07 12:05:56 -050035SYSTEM_STATE_URI = OPENBMC_BASE_URI + 'state/'
36BMC_STATE_URI = OPENBMC_BASE_URI + 'state/bmc0/'
37HOST_STATE_URI = OPENBMC_BASE_URI + 'state/host0/'
38CHASSIS_STATE_URI = OPENBMC_BASE_URI + 'state/chassis0/'
39HOST_WATCHDOG_URI = OPENBMC_BASE_URI + 'watchdog/host0/'
George Keishingbec365b2017-01-19 01:28:41 -060040
George Keishing505d5b42017-02-21 11:01:54 -060041# Logging URI variables
Sweta Potthuridaf91342017-09-07 12:05:56 -050042BMC_LOGGING_URI = OPENBMC_BASE_URI + 'logging/'
George Keishinga71dd202017-02-24 00:49:40 -060043BMC_LOGGING_ENTRY = BMC_LOGGING_URI + 'entry/'
George Keishing505d5b42017-02-21 11:01:54 -060044
George Keishingab5157b2017-02-09 12:24:25 -060045# Software manager version
Sweta Potthuridaf91342017-09-07 12:05:56 -050046SOFTWARE_VERSION_URI = OPENBMC_BASE_URI + 'software/'
George Keishingab5157b2017-02-09 12:24:25 -060047ACTIVE = 'xyz.openbmc_project.Software.Activation.Activations.Active'
Saqib Khanbb8b63f2017-05-24 10:58:01 -050048READY = 'xyz.openbmc_project.Software.Activation.Activations.Ready'
49INVALID = 'xyz.openbmc_project.Software.Activation.Activations.Invalid'
50ACTIVATING = 'xyz.openbmc_project.Software.Activation.Activations.Activating'
51NOTREADY = 'xyz.openbmc_project.Software.Activation.Activations.NotReady'
52FAILED = 'xyz.openbmc_project.Software.Activation.Activations.Failed'
53
54SOFTWARE_ACTIVATION = 'xyz.openbmc_project.Software.Activation'
George Keishing4af8f362017-10-23 00:26:58 -050055REQUESTED_ACTIVATION = SOFTWARE_ACTIVATION + '.RequestedActivations'
56REQUESTED_ACTIVE = REQUESTED_ACTIVATION + '.Active'
Saqib Khanbb8b63f2017-05-24 10:58:01 -050057REQUESTED_NONE = REQUESTED_ACTIVATION + '.None'
58
59SOFTWARE_PURPOSE = 'xyz.openbmc_project.Software.Version.VersionPurpose'
60VERSION_PURPOSE_HOST = SOFTWARE_PURPOSE + '.Host'
61VERSION_PURPOSE_BMC = SOFTWARE_PURPOSE + '.BMC'
62VERSION_PURPOSE_SYSTEM = SOFTWARE_PURPOSE + '.System'
George Keishingab5157b2017-02-09 12:24:25 -060063
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050064# Image Upload Directory Path
65IMAGE_UPLOAD_DIR_PATH = '/tmp/images/'
66
George Keishingc8166ed2017-02-24 03:53:38 -060067# Inventory URI
Sweta Potthuridaf91342017-09-07 12:05:56 -050068HOST_INVENTORY_URI = OPENBMC_BASE_URI + 'inventory/'
George Keishingc8166ed2017-02-24 03:53:38 -060069
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060070# Led URI variable
Sweta Potthuridaf91342017-09-07 12:05:56 -050071LED_GROUPS_URI = OPENBMC_BASE_URI + 'led/groups/'
72LED_PHYSICAL_URI = OPENBMC_BASE_URI + 'led/physical/'
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060073
George Keishing1059b222017-07-21 13:24:43 -050074# Host control URI variables.
Sweta Potthuridaf91342017-09-07 12:05:56 -050075CONTROL_HOST_URI = OPENBMC_BASE_URI + 'control/host0/'
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060076
George Keishing1c3a9662017-08-11 10:16:36 -050077# Power restore variables.
78POWER_RESTORE_URI = CONTROL_HOST_URI + 'power_restore_policy'
79CONTROL_DBUS_BASE = 'xyz.openbmc_project.Control.'
80
81RESTORE_LAST_STATE = CONTROL_DBUS_BASE + 'Power.RestorePolicy.Policy.Restore'
82ALWAYS_POWER_ON = CONTROL_DBUS_BASE + 'Power.RestorePolicy.Policy.AlwaysOn'
83ALWAYS_POWER_OFF = CONTROL_DBUS_BASE + 'Power.RestorePolicy.Policy.AlwaysOff'
84
Rahul Maheshwari23b18fb2017-08-01 00:30:26 -050085# Dump URI variable
Sweta Potthuridaf91342017-09-07 12:05:56 -050086DUMP_URI = OPENBMC_BASE_URI +'/dump/'
Rahul Maheshwari23b18fb2017-08-01 00:30:26 -050087DUMP_ENTRY_URI = DUMP_URI + 'entry/'
88
George Keishing2bd6fc02017-08-10 01:15:16 -050089# Boot progress variables.
90STATE_DBUS_BASE = 'xyz.openbmc_project.State.'
91OS_BOOT_START = STATE_DBUS_BASE + 'Boot.Progress.ProgressStages.OSStart'
92OS_BOOT_OFF = STATE_DBUS_BASE + 'Boot.Progress.ProgressStages.Unspecified'
93OS_BOOT_COMPLETE = STATE_DBUS_BASE + 'OperatingSystem.Status.OSStatus.BootComplete'
94
Rahul Maheshwari85c4d342017-08-09 21:59:30 -050095# Boot variables.
96BOOT_SOURCE_DEFAULT = 'xyz.openbmc_project.Control.Boot.Source.Sources.Default'
97BOOT_SOURCE_NETWORK = 'xyz.openbmc_project.Control.Boot.Source.Sources.Network'
98BOOT_SOURCE_DISK = 'xyz.openbmc_project.Control.Boot.Source.Sources.Disk'
99BOOT_SOURCE_CDROM = 'xyz.openbmc_project.Control.Boot.Source.Sources.ExternalMedia'
100BOOT_MODE_SAFE = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Safe'
101BOOT_MODE_SETUP = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Setup'
102BOOT_MODE_REGULAR = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Regular'
103
George Keishingfbeaecc2016-08-16 05:24:31 -0500104'''
105 QEMU HTTPS variable:
106
107 By default lib/resource.txt AUTH URI construct is as
108 ${AUTH_URI} https://${OPENBMC_HOST}${AUTH_SUFFIX}
109 ${AUTH_SUFFIX} is populated here by default EMPTY else
110 the port from the OS environment
111'''
George Keishingcf910442016-12-08 03:12:59 -0600112
113
George Keishingfbeaecc2016-08-16 05:24:31 -0500114def get_port_https():
115 # defaulted to empty string
116 l_suffix = ''
117 try:
118 l_https_port = os.getenv('HTTPS_PORT')
119 if l_https_port:
George Keishingcf910442016-12-08 03:12:59 -0600120 l_suffix = ':' + l_https_port
George Keishingfbeaecc2016-08-16 05:24:31 -0500121 except:
George Keishingcf910442016-12-08 03:12:59 -0600122 print "Environment variable HTTPS_PORT not set,\
123 using default HTTPS port"
George Keishingfbeaecc2016-08-16 05:24:31 -0500124 return l_suffix
125
George Keishingcf910442016-12-08 03:12:59 -0600126AUTH_SUFFIX = {
127 "https_port": [get_port_https()],
George Keishingfbeaecc2016-08-16 05:24:31 -0500128}
129
130# Update the ':Port number' to this variable
131AUTH_SUFFIX = AUTH_SUFFIX['https_port'][0]
Chris Austenb29d2e82016-06-07 12:25:35 -0500132
133# Here contains a list of valid Properties bases on fru_type after a boot.
George Keishingcf910442016-12-08 03:12:59 -0600134INVENTORY_ITEMS = {
Chris Austenb29d2e82016-06-07 12:25:35 -0500135 "CPU": [
136 "Custom Field 1",
137 "Custom Field 2",
138 "Custom Field 3",
139 "Custom Field 4",
140 "Custom Field 5",
141 "Custom Field 6",
142 "Custom Field 7",
143 "Custom Field 8",
144 "FRU File ID",
145 "Manufacturer",
146 "Name",
147 "Part Number",
148 "Serial Number",
149 "fault",
150 "fru_type",
151 "is_fru",
152 "present",
153 "version",
154 ],
155
156 "DIMM": [
157 "Asset Tag",
158 "Custom Field 1",
159 "Custom Field 2",
160 "Custom Field 3",
161 "Custom Field 4",
162 "Custom Field 5",
163 "Custom Field 6",
164 "Custom Field 7",
165 "Custom Field 8",
166 "FRU File ID",
167 "Manufacturer",
168 "Model Number",
169 "Name",
170 "Serial Number",
171 "Version",
172 "fault",
173 "fru_type",
174 "is_fru",
175 "present",
176 "version",
177 ],
178 "MEMORY_BUFFER": [
179 "Custom Field 1",
180 "Custom Field 2",
181 "Custom Field 3",
182 "Custom Field 4",
183 "Custom Field 5",
184 "Custom Field 6",
185 "Custom Field 7",
186 "Custom Field 8",
187 "FRU File ID",
188 "Manufacturer",
189 "Name",
190 "Part Number",
191 "Serial Number",
192 "fault",
193 "fru_type",
194 "is_fru",
195 "present",
196 "version",
197 ],
198 "FAN": [
199 "fault",
200 "fru_type",
201 "is_fru",
202 "present",
203 "version",
204 ],
205 "DAUGHTER_CARD": [
206 "Custom Field 1",
207 "Custom Field 2",
208 "Custom Field 3",
209 "Custom Field 4",
210 "Custom Field 5",
211 "Custom Field 6",
212 "Custom Field 7",
213 "Custom Field 8",
214 "FRU File ID",
215 "Manufacturer",
216 "Name",
217 "Part Number",
218 "Serial Number",
219 "fault",
220 "fru_type",
221 "is_fru",
222 "present",
223 "version",
224 ],
225 "BMC": [
226 "fault",
227 "fru_type",
228 "is_fru",
229 "manufacturer",
230 "present",
231 "version",
232 ],
233 "MAIN_PLANAR": [
234 "Custom Field 1",
235 "Custom Field 2",
236 "Custom Field 3",
237 "Custom Field 4",
238 "Custom Field 5",
239 "Custom Field 6",
240 "Custom Field 7",
241 "Custom Field 8",
242 "Part Number",
243 "Serial Number",
244 "Type",
245 "fault",
246 "fru_type",
247 "is_fru",
248 "present",
249 "version",
250 ],
251 "SYSTEM": [
252 "Custom Field 1",
253 "Custom Field 2",
254 "Custom Field 3",
255 "Custom Field 4",
256 "Custom Field 5",
257 "Custom Field 6",
258 "Custom Field 7",
259 "Custom Field 8",
260 "FRU File ID",
261 "Manufacturer",
262 "Model Number",
263 "Name",
264 "Serial Number",
265 "Version",
266 "fault",
267 "fru_type",
268 "is_fru",
269 "present",
270 "version",
271 ],
272 "CORE": [
273 "fault",
274 "fru_type",
275 "is_fru",
276 "present",
277 "version",
278 ],
279}