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