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