1import os
2
3# Enable when ready with openbmc/openbmc-test-automation#203
4# replace with new path /xyz/openbmc_project
5OPENBMC_BASE_URI = '/org/openbmc/'
6OPENBMC_BASE_DBUS = 'org.openbmc'
7
8# org open power base URI.
9OPENPOWER_BASE_URI = '/org/open_power/'
10OPENPOWER_CONTROL = OPENPOWER_BASE_URI + 'control/'
11
12# REST URI base endpoint paths.
13CONTROL_URI = OPENBMC_BASE_URI + 'control/'
14RECORDS_URI = OPENBMC_BASE_URI + 'records/'
15BUTTONS_URI = OPENBMC_BASE_URI + 'buttons/'
16SETTINGS_URI = OPENBMC_BASE_URI + 'settings/'
17WATCHDOG_URI = OPENBMC_BASE_URI + 'watchdog/'
18INVENTORY_URI = OPENBMC_BASE_URI + 'inventory/'
19USER_MANAGER_URI = OPENBMC_BASE_URI + 'UserManager/'
20NETWORK_MANAGER_URI = OPENBMC_BASE_URI + 'NetworkManager/'
21TIME_MANAGER_URI = OPENBMC_BASE_URI + 'TimeManager/'
22XYZ_NETWORK_MANAGER = '/xyz/openbmc_project/network/'
23
24# Sensors base variables.
25SENSORS_URI = '/xyz/openbmc_project/sensors/'
26
27# State Manager base variables.
28BMC_REBOOT_TRANS = 'xyz.openbmc_project.State.BMC.Transition.Reboot'
29
30HOST_POWEROFF_TRANS = 'xyz.openbmc_project.State.Host.Transition.Off'
31HOST_POWERON_TRANS = 'xyz.openbmc_project.State.Host.Transition.On'
32HOST_REBOOT_TRANS = 'xyz.openbmc_project.State.Host.Transition.Reboot'
33HOST_POWEROFF_STATE = 'xyz.openbmc_project.State.Host.HostState.Off'
34HOST_POWERON_STATE = 'xyz.openbmc_project.State.Host.HostState.Running'
35
36CHASSIS_POWEROFF_TRANS = 'xyz.openbmc_project.State.Chassis.Transition.Off'
37CHASSIS_POWERON_TRANS = 'xyz.openbmc_project.State.Chassis.Transition.On'
38CHASSIS_POWEROFF_STATE = 'xyz.openbmc_project.State.Chassis.PowerState.Off'
39CHASSIS_POWERON_STATE = 'xyz.openbmc_project.State.Chassis.PowerState.On'
40
41# State Manager URI variables.
42SYSTEM_STATE_URI = '/xyz/openbmc_project/state/'
43BMC_STATE_URI = '/xyz/openbmc_project/state/bmc0/'
44HOST_STATE_URI = '/xyz/openbmc_project/state/host0/'
45CHASSIS_STATE_URI = '/xyz/openbmc_project/state/chassis0/'
46HOST_WATCHDOG_URI = '/xyz/openbmc_project/watchdog/host0/'
47
48# Logging URI variables
49BMC_LOGGING_URI = '/xyz/openbmc_project/logging/'
50BMC_LOGGING_ENTRY = BMC_LOGGING_URI + 'entry/'
51
52# Software manager version
53SOFTWARE_VERSION_URI = '/xyz/openbmc_project/software/'
54ACTIVE = 'xyz.openbmc_project.Software.Activation.Activations.Active'
55READY = 'xyz.openbmc_project.Software.Activation.Activations.Ready'
56INVALID = 'xyz.openbmc_project.Software.Activation.Activations.Invalid'
57ACTIVATING = 'xyz.openbmc_project.Software.Activation.Activations.Activating'
58NOTREADY = 'xyz.openbmc_project.Software.Activation.Activations.NotReady'
59FAILED = 'xyz.openbmc_project.Software.Activation.Activations.Failed'
60
61SOFTWARE_ACTIVATION = 'xyz.openbmc_project.Software.Activation'
62REQUESTED_ACTIVATION = SOFTWARE_ACTIVATION + '.RequestedActivations'
63REQUESTED_ACTIVE = REQUESTED_ACTIVATION + '.Active'
64REQUESTED_NONE = REQUESTED_ACTIVATION + '.None'
65
66SOFTWARE_PURPOSE = 'xyz.openbmc_project.Software.Version.VersionPurpose'
67VERSION_PURPOSE_HOST = SOFTWARE_PURPOSE + '.Host'
68VERSION_PURPOSE_BMC = SOFTWARE_PURPOSE + '.BMC'
69VERSION_PURPOSE_SYSTEM = SOFTWARE_PURPOSE + '.System'
70
71# Image Upload Directory Path
72IMAGE_UPLOAD_DIR_PATH = '/tmp/images/'
73
74# Inventory URI
75HOST_INVENTORY_URI = '/xyz/openbmc_project/inventory/'
76
77# Led URI variable
78LED_GROUPS_URI = '/xyz/openbmc_project/led/groups/'
79LED_PHYSICAL_URI = '/xyz/openbmc_project/led/physical/'
80
81# Host control URI variables.
82CONTROL_HOST_URI = '/xyz/openbmc_project/control/host0/'
83
84# Power restore variables.
85POWER_RESTORE_URI = CONTROL_HOST_URI + 'power_restore_policy'
86CONTROL_DBUS_BASE = 'xyz.openbmc_project.Control.'
87
88RESTORE_LAST_STATE = CONTROL_DBUS_BASE + 'Power.RestorePolicy.Policy.Restore'
89ALWAYS_POWER_ON = CONTROL_DBUS_BASE + 'Power.RestorePolicy.Policy.AlwaysOn'
90ALWAYS_POWER_OFF = CONTROL_DBUS_BASE + 'Power.RestorePolicy.Policy.AlwaysOff'
91
92# Dump URI variable
93DUMP_URI = '/xyz/openbmc_project/dump/'
94DUMP_ENTRY_URI = DUMP_URI + 'entry/'
95
96# Boot progress variables.
97STATE_DBUS_BASE = 'xyz.openbmc_project.State.'
98OS_BOOT_START = STATE_DBUS_BASE + 'Boot.Progress.ProgressStages.OSStart'
99OS_BOOT_OFF = STATE_DBUS_BASE + 'Boot.Progress.ProgressStages.Unspecified'
100OS_BOOT_COMPLETE = STATE_DBUS_BASE + 'OperatingSystem.Status.OSStatus.BootComplete'
101
102# Boot variables.
103BOOT_SOURCE_DEFAULT = 'xyz.openbmc_project.Control.Boot.Source.Sources.Default'
104BOOT_SOURCE_NETWORK = 'xyz.openbmc_project.Control.Boot.Source.Sources.Network'
105BOOT_SOURCE_DISK = 'xyz.openbmc_project.Control.Boot.Source.Sources.Disk'
106BOOT_SOURCE_CDROM = 'xyz.openbmc_project.Control.Boot.Source.Sources.ExternalMedia'
107BOOT_MODE_SAFE = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Safe'
108BOOT_MODE_SETUP = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Setup'
109BOOT_MODE_REGULAR = 'xyz.openbmc_project.Control.Boot.Mode.Modes.Regular'
110
111'''
112  QEMU HTTPS variable:
113
114  By default lib/resource.txt AUTH URI construct is as
115  ${AUTH_URI}   https://${OPENBMC_HOST}${AUTH_SUFFIX}
116  ${AUTH_SUFFIX} is populated here by default EMPTY else
117  the port from the OS environment
118'''
119
120
121def get_port_https():
122    # defaulted to empty string
123    l_suffix = ''
124    try:
125        l_https_port = os.getenv('HTTPS_PORT')
126        if l_https_port:
127            l_suffix = ':' + l_https_port
128    except:
129        print "Environment variable HTTPS_PORT not set,\
130              using default HTTPS port"
131    return l_suffix
132
133AUTH_SUFFIX = {
134    "https_port": [get_port_https()],
135}
136
137# Update the ':Port number' to this variable
138AUTH_SUFFIX = AUTH_SUFFIX['https_port'][0]
139
140# Here contains a list of valid Properties bases on fru_type after a boot.
141INVENTORY_ITEMS = {
142    "CPU": [
143        "Custom Field 1",
144        "Custom Field 2",
145        "Custom Field 3",
146        "Custom Field 4",
147        "Custom Field 5",
148        "Custom Field 6",
149        "Custom Field 7",
150        "Custom Field 8",
151        "FRU File ID",
152        "Manufacturer",
153        "Name",
154        "Part Number",
155        "Serial Number",
156        "fault",
157        "fru_type",
158        "is_fru",
159        "present",
160        "version",
161        ],
162
163    "DIMM": [
164        "Asset Tag",
165        "Custom Field 1",
166        "Custom Field 2",
167        "Custom Field 3",
168        "Custom Field 4",
169        "Custom Field 5",
170        "Custom Field 6",
171        "Custom Field 7",
172        "Custom Field 8",
173        "FRU File ID",
174        "Manufacturer",
175        "Model Number",
176        "Name",
177        "Serial Number",
178        "Version",
179        "fault",
180        "fru_type",
181        "is_fru",
182        "present",
183        "version",
184        ],
185    "MEMORY_BUFFER": [
186        "Custom Field 1",
187        "Custom Field 2",
188        "Custom Field 3",
189        "Custom Field 4",
190        "Custom Field 5",
191        "Custom Field 6",
192        "Custom Field 7",
193        "Custom Field 8",
194        "FRU File ID",
195        "Manufacturer",
196        "Name",
197        "Part Number",
198        "Serial Number",
199        "fault",
200        "fru_type",
201        "is_fru",
202        "present",
203        "version",
204        ],
205    "FAN": [
206        "fault",
207        "fru_type",
208        "is_fru",
209        "present",
210        "version",
211        ],
212    "DAUGHTER_CARD": [
213        "Custom Field 1",
214        "Custom Field 2",
215        "Custom Field 3",
216        "Custom Field 4",
217        "Custom Field 5",
218        "Custom Field 6",
219        "Custom Field 7",
220        "Custom Field 8",
221        "FRU File ID",
222        "Manufacturer",
223        "Name",
224        "Part Number",
225        "Serial Number",
226        "fault",
227        "fru_type",
228        "is_fru",
229        "present",
230        "version",
231        ],
232    "BMC": [
233        "fault",
234        "fru_type",
235        "is_fru",
236        "manufacturer",
237        "present",
238        "version",
239        ],
240    "MAIN_PLANAR": [
241        "Custom Field 1",
242        "Custom Field 2",
243        "Custom Field 3",
244        "Custom Field 4",
245        "Custom Field 5",
246        "Custom Field 6",
247        "Custom Field 7",
248        "Custom Field 8",
249        "Part Number",
250        "Serial Number",
251        "Type",
252        "fault",
253        "fru_type",
254        "is_fru",
255        "present",
256        "version",
257        ],
258    "SYSTEM": [
259        "Custom Field 1",
260        "Custom Field 2",
261        "Custom Field 3",
262        "Custom Field 4",
263        "Custom Field 5",
264        "Custom Field 6",
265        "Custom Field 7",
266        "Custom Field 8",
267        "FRU File ID",
268        "Manufacturer",
269        "Model Number",
270        "Name",
271        "Serial Number",
272        "Version",
273        "fault",
274        "fru_type",
275        "is_fru",
276        "present",
277        "version",
278        ],
279    "CORE": [
280        "fault",
281        "fru_type",
282        "is_fru",
283        "present",
284        "version",
285        ],
286}
287