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/'
39
40# Logging URI variables
41BMC_LOGGING_URI = '/xyz/openbmc_project/logging/'
42BMC_LOGGING_ENTRY = BMC_LOGGING_URI + 'entry/'
43
44# Software manager version
45SOFTWARE_VERSION_URI = '/xyz/openbmc_project/software/'
46ACTIVE = 'xyz.openbmc_project.Software.Activation.Activations.Active'
47READY = 'xyz.openbmc_project.Software.Activation.Activations.Ready'
48INVALID = 'xyz.openbmc_project.Software.Activation.Activations.Invalid'
49ACTIVATING = 'xyz.openbmc_project.Software.Activation.Activations.Activating'
50NOTREADY = 'xyz.openbmc_project.Software.Activation.Activations.NotReady'
51FAILED = 'xyz.openbmc_project.Software.Activation.Activations.Failed'
52
53SOFTWARE_ACTIVATION = 'xyz.openbmc_project.Software.Activation'
54REQUESTED_ACTIVATION = SOFTWARE_ACTIVATION + '.RequestedActivations'
55REQUESTED_ACTIVE = REQUESTED_ACTIVATION + '.Active'
56REQUESTED_NONE = REQUESTED_ACTIVATION + '.None'
57
58SOFTWARE_PURPOSE = 'xyz.openbmc_project.Software.Version.VersionPurpose'
59VERSION_PURPOSE_HOST = SOFTWARE_PURPOSE + '.Host'
60VERSION_PURPOSE_BMC = SOFTWARE_PURPOSE + '.BMC'
61VERSION_PURPOSE_SYSTEM = SOFTWARE_PURPOSE + '.System'
62
63# Inventory URI
64HOST_INVENTORY_URI = '/xyz/openbmc_project/inventory/'
65
66# Led URI variable
67LED_GROUPS_URI = '/xyz/openbmc_project/led/groups/'
68LED_PHYSICAL_URI = '/xyz/openbmc_project/led/physical/'
69
70# Host control URI variables.
71CONTROL_HOST_URI = '/xyz/openbmc_project/control/host0/'
72
73# Dump URI variable
74DUMP_URI = '/xyz/openbmc_project/dump/'
75DUMP_ENTRY_URI = DUMP_URI + 'entry/'
76
77'''
78  QEMU HTTPS variable:
79
80  By default lib/resource.txt AUTH URI construct is as
81  ${AUTH_URI}   https://${OPENBMC_HOST}${AUTH_SUFFIX}
82  ${AUTH_SUFFIX} is populated here by default EMPTY else
83  the port from the OS environment
84'''
85
86
87def get_port_https():
88    # defaulted to empty string
89    l_suffix = ''
90    try:
91        l_https_port = os.getenv('HTTPS_PORT')
92        if l_https_port:
93            l_suffix = ':' + l_https_port
94    except:
95        print "Environment variable HTTPS_PORT not set,\
96              using default HTTPS port"
97    return l_suffix
98
99AUTH_SUFFIX = {
100    "https_port": [get_port_https()],
101}
102
103# Update the ':Port number' to this variable
104AUTH_SUFFIX = AUTH_SUFFIX['https_port'][0]
105
106# Here contains a list of valid Properties bases on fru_type after a boot.
107INVENTORY_ITEMS = {
108    "CPU": [
109        "Custom Field 1",
110        "Custom Field 2",
111        "Custom Field 3",
112        "Custom Field 4",
113        "Custom Field 5",
114        "Custom Field 6",
115        "Custom Field 7",
116        "Custom Field 8",
117        "FRU File ID",
118        "Manufacturer",
119        "Name",
120        "Part Number",
121        "Serial Number",
122        "fault",
123        "fru_type",
124        "is_fru",
125        "present",
126        "version",
127        ],
128
129    "DIMM": [
130        "Asset Tag",
131        "Custom Field 1",
132        "Custom Field 2",
133        "Custom Field 3",
134        "Custom Field 4",
135        "Custom Field 5",
136        "Custom Field 6",
137        "Custom Field 7",
138        "Custom Field 8",
139        "FRU File ID",
140        "Manufacturer",
141        "Model Number",
142        "Name",
143        "Serial Number",
144        "Version",
145        "fault",
146        "fru_type",
147        "is_fru",
148        "present",
149        "version",
150        ],
151    "MEMORY_BUFFER": [
152        "Custom Field 1",
153        "Custom Field 2",
154        "Custom Field 3",
155        "Custom Field 4",
156        "Custom Field 5",
157        "Custom Field 6",
158        "Custom Field 7",
159        "Custom Field 8",
160        "FRU File ID",
161        "Manufacturer",
162        "Name",
163        "Part Number",
164        "Serial Number",
165        "fault",
166        "fru_type",
167        "is_fru",
168        "present",
169        "version",
170        ],
171    "FAN": [
172        "fault",
173        "fru_type",
174        "is_fru",
175        "present",
176        "version",
177        ],
178    "DAUGHTER_CARD": [
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    "BMC": [
199        "fault",
200        "fru_type",
201        "is_fru",
202        "manufacturer",
203        "present",
204        "version",
205        ],
206    "MAIN_PLANAR": [
207        "Custom Field 1",
208        "Custom Field 2",
209        "Custom Field 3",
210        "Custom Field 4",
211        "Custom Field 5",
212        "Custom Field 6",
213        "Custom Field 7",
214        "Custom Field 8",
215        "Part Number",
216        "Serial Number",
217        "Type",
218        "fault",
219        "fru_type",
220        "is_fru",
221        "present",
222        "version",
223        ],
224    "SYSTEM": [
225        "Custom Field 1",
226        "Custom Field 2",
227        "Custom Field 3",
228        "Custom Field 4",
229        "Custom Field 5",
230        "Custom Field 6",
231        "Custom Field 7",
232        "Custom Field 8",
233        "FRU File ID",
234        "Manufacturer",
235        "Model Number",
236        "Name",
237        "Serial Number",
238        "Version",
239        "fault",
240        "fru_type",
241        "is_fru",
242        "present",
243        "version",
244        ],
245    "CORE": [
246        "fault",
247        "fru_type",
248        "is_fru",
249        "present",
250        "version",
251        ],
252}
253