1/**
2 * common Constant service
3 *
4 * @module app/common/services/constants
5 * @exports Constants
6 * @name Constants
7
8 */
9
10window.angular && (function(angular) {
11  'use strict';
12
13  angular.module('app.common.services', []).service('Constants', function() {
14    return {
15      API_CREDENTIALS:
16          {host_storage_key: 'API_HOST_KEY', default_protocol: 'https'},
17      API_RESPONSE: {
18        ERROR_STATUS: 'error',
19        ERROR_MESSAGE: '401 Unauthorized',
20        SUCCESS_STATUS: 'ok',
21        SUCCESS_MESSAGE: '200 OK'
22      },
23      CERTIFICATE_TYPES: [
24        {
25          'Description': 'HTTPS Certificate',
26          'location':
27              '/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/',
28          'name': 'HTTPS Certificate'
29        },
30        {
31          'Description': 'LDAP Certificate',
32          'location': '/redfish/v1/AccountService/LDAP/Certificates/',
33          'name': 'LDAP Certificate'
34        },
35        {
36          'Description': 'TrustStore Certificate',
37          'location': '/redfish/v1/Managers/bmc/Truststore/Certificates/',
38          'name': 'CA Certificate'
39        }
40      ],
41      HOST_STATE_TEXT: {
42        on: 'Running',
43        on_code: 'xyz.openbmc_project.State.Host.HostState.Running',
44        off: 'Off',
45        off_code: 'xyz.openbmc_project.State.Host.HostState.Off',
46        error: 'Quiesced',
47        error_code: 'xyz.openbmc_project.State.Host.HostState.Quiesced',
48        unreachable: 'Unreachable'
49      },
50      LED_STATE: {on: true, off: false},
51      LED_STATE_TEXT: {on: 'on', off: 'off'},
52      SEVERITY_TO_PRIORITY_MAP: {
53        Emergency: 'High',
54        Alert: 'High',
55        Critical: 'High',
56        Error: 'High',
57        Warning: 'Medium',
58        Notice: 'Low',
59        Debug: 'Low',
60        Informational: 'Low'
61      },
62      PAGINATION: {LOG_ITEMS_PER_PAGE: 25},
63      HARDWARE: {
64        component_key_filter: '/xyz/openbmc_project/inventory/system',
65        parent_components: [
66          /xyz\/openbmc_project\/inventory\/system\/chassis\/motherboard\/cpu\d+\//
67        ],
68        uppercase_titles: ['cpu', 'dimm']
69      },
70      SENSOR_UNIT_MAP: {
71        'xyz.openbmc_project.Sensor.Value.Unit.RPMS': 'rpms',
72        'xyz.openbmc_project.Sensor.Value.Unit.DegreesC': 'C',
73        'xyz.openbmc_project.Sensor.Value.Unit.Volts': 'volts',
74        'xyz.openbmc_project.Sensor.Value.Unit.Meters': 'meters',
75        'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'watts',
76        'xyz.openbmc_project.Sensor.Value.Unit.Amperes': 'amperes',
77        'xyz.openbmc_project.Sensor.Value.Unit.Joules': 'joules'
78      },
79      SERVER_HEALTH: {
80        critical: 'Critical',
81        warning: 'Warning',
82        good: 'Good',
83        unknown: 'Unknown'
84      },
85      SENSOR_SORT_ORDER: [
86        'xyz.openbmc_project.Sensor.Value.Unit.DegreesC',
87        'xyz.openbmc_project.Sensor.Value.Unit.RPMS',
88        'xyz.openbmc_project.Sensor.Value.Unit.Watts',
89        'xyz.openbmc_project.Sensor.Value.Unit.Volts',
90        'xyz.openbmc_project.Sensor.Value.Unit.Amperes',
91        'xyz.openbmc_project.Sensor.Value.Unit.Joules',
92        'xyz.openbmc_project.Sensor.Value.Unit.Meters'
93      ],
94      SENSOR_SORT_ORDER_DEFAULT: 8,
95      FIRMWARE: {
96        ACTIVATE_FIRMWARE:
97            'xyz.openbmc_project.Software.Activation.RequestedActivations.Active',
98        FUNCTIONAL_OBJPATH: '/xyz/openbmc_project/software/functional'
99      },
100      POLL_INTERVALS: {
101        ACTIVATION: 5000,
102        DOWNLOAD_IMAGE: 5000,
103        POWER_OP: 5000,
104      },
105      TIMEOUT: {
106        ACTIVATION: 1000 * 60 * 10,        // 10 mins
107        DOWNLOAD_IMAGE: 1000 * 60 * 2,     // 2 mins
108        HOST_ON: 1000 * 60 * 5,            // 5 mins
109        HOST_OFF: 1000 * 60 * 5,           // 5 mins
110        HOST_OFF_IMMEDIATE: 1000 * 60 * 2  // 2 mins
111      },
112      CERTIFICATE: {
113        KEY_BIT_LENGTH: [2048],
114        KEY_PAIR_ALGORITHM: ['EC', 'RSA'],
115        KEY_CURVE_ID: ['prime256v1', 'secp521r1', 'secp384r1']
116      },
117      COUNTRIES: [
118        {Name: 'Afghanistan', code: 'AF'},
119        {Name: 'Albania', code: 'AL'},
120        {Name: 'Algeria', code: 'DZ'},
121        {Name: 'American Samoa', code: 'AS'},
122        {Name: 'Andorra', code: 'AD'},
123        {Name: 'Angola', code: 'AO'},
124        {Name: 'Anguilla', code: 'AI'},
125        {Name: 'Antarctica', code: 'AQ'},
126        {Name: 'Antigua and Barbuda', code: 'AG'},
127        {Name: 'Argentina', code: 'AR'},
128        {Name: 'Armenia', code: 'AM'},
129        {Name: 'Aruba', code: 'AW'},
130        {Name: 'Australia', code: 'AU'},
131        {Name: 'Austria', code: 'AT'},
132        {Name: 'Azerbaijan', code: 'AZ'},
133        {Name: 'Bahamas, The', code: 'BS'},
134        {Name: 'Bahrain', code: 'BH'},
135        {Name: 'Bangladesh', code: 'BD'},
136        {Name: 'Barbados', code: 'BB'},
137        {Name: 'Belarus', code: 'BY'},
138        {Name: 'Belgium', code: 'BE'},
139        {Name: 'Belize', code: 'BZ'},
140        {Name: 'Benin', code: 'BJ'},
141        {Name: 'Bermuda', code: 'BM'},
142        {Name: 'Bhutan', code: 'BT'},
143        {Name: 'Bolivia', code: 'BO'},
144        {Name: 'Bonaire, Sint Eustatius and Saba', code: 'BQ'},
145        {Name: 'Bosnia and Herzegovina ', code: 'BA'},
146        {Name: 'Bostwana', code: 'BW'},
147        {Name: 'Bouvet Island', code: 'BV'},
148        {Name: 'Brazil', code: 'BR'},
149        {Name: 'British Indian Ocean Territory', code: 'IO'},
150        {Name: 'Brunei Darussalam ', code: 'BN'},
151        {Name: 'Bulgaria', code: 'BG'},
152        {Name: 'Burkina Faso', code: 'BF'},
153        {Name: 'Burundi', code: 'BI'},
154        {Name: 'Cabo Verde', code: 'CV'},
155        {Name: 'Cambodia', code: 'KH'},
156        {Name: 'Cameroon', code: 'CM'},
157        {Name: 'Canada', code: 'CA'},
158        {Name: 'Cayman Islands', code: 'KY'},
159        {Name: 'Central African Republic', code: 'CF'},
160        {Name: 'Chad', code: 'TD'},
161        {Name: 'Chile', code: 'CL'},
162        {Name: 'China', code: 'CN'},
163        {Name: 'Christmas Island ', code: 'CX'},
164        {Name: 'Cocos(Keeling) Islands', code: 'CC'},
165        {Name: 'Columbia', code: 'CO'},
166        {Name: 'Comoros', code: 'KM'},
167        {Name: 'Congo, The Democratic Republic of the', code: 'CD'},
168        {Name: 'Congo', code: 'CG'},
169        {Name: 'Cook Islands', code: 'CK'},
170        {Name: 'Costa Rica', code: 'CR'},
171        {Name: 'Croatia', code: 'HR'},
172        {Name: 'Cuba', code: 'CU'},
173        {Name: 'Curaçao', code: 'CW'},
174        {Name: 'Cyprus', code: 'CY'},
175        {Name: 'Czechia', code: 'CZ'},
176        {Name: 'Côte d\'Ivoire', code: 'CI'},
177        {Name: 'Denmark', code: 'DK'},
178        {Name: 'Djibouti', code: 'DJ'},
179        {Name: 'Dominica', code: 'DM'},
180        {Name: 'Dominican Republic', code: 'DO'},
181        {Name: 'Ecuador', code: 'EC'},
182        {Name: 'Egypt', code: 'EG'},
183        {Name: 'El Salvador', code: 'SV'},
184        {Name: 'Equatorial Guinea ', code: 'GQ'},
185        {Name: 'Eritrea', code: 'ER'},
186        {Name: 'Estonia', code: 'EE'},
187        {Name: 'Eswatini', code: 'SZ'},
188        {Name: 'Ethiopia', code: 'ET'},
189        {Name: 'Falkland Islands (Malvinas)', code: 'FK'},
190        {Name: 'Faroe Islands', code: 'FO'},
191        {Name: 'Fiji', code: 'FJ'},
192        {Name: 'Finland', code: 'FI'},
193        {Name: 'France', code: 'FR'},
194        {Name: 'French Guiana', code: 'GF'},
195        {Name: 'French Polynesia', code: 'PF'},
196        {Name: 'French Southern Territories', code: 'TF'},
197        {Name: 'Gabon', code: 'GA'},
198        {Name: 'Gambia, The', code: 'GM'},
199        {Name: 'Georgia', code: 'GE'},
200        {Name: 'Germany', code: 'DE'},
201        {Name: 'Ghana', code: 'GH'},
202        {Name: 'Gibraltar', code: 'GI'},
203        {Name: 'Greece', code: 'GR'},
204        {Name: 'Greenland', code: 'GL'},
205        {Name: 'Grenada', code: 'GD'},
206        {Name: 'Guadeloupe', code: 'GP'},
207        {Name: 'Guam', code: 'GU'},
208        {Name: 'Guatemala', code: 'GT'},
209        {Name: 'Guernsey', code: 'GG'},
210        {Name: 'Guinea', code: 'GN'},
211        {Name: 'Guinea-Bissau', code: 'GW'},
212        {Name: 'Guyana', code: 'GY'},
213        {Name: 'Haiti', code: 'HT'},
214        {Name: 'Heard Island and McDonald Islands', code: 'HM'},
215        {Name: 'Holy See', code: 'VA'},
216        {Name: 'Honduras', code: 'HN'},
217        {Name: 'Hong Kong', code: 'HK'},
218        {Name: 'Hungary', code: 'HU'},
219        {Name: 'Iceland', code: 'IS'},
220        {Name: 'India', code: 'IN'},
221        {Name: 'Indonesia', code: 'ID'},
222        {Name: 'Iran, Islamic Republic of', code: 'IR'},
223        {Name: 'Iraq', code: 'IQ'},
224        {Name: 'Ireland', code: 'IE'},
225        {Name: 'Isle of Man', code: 'IM'},
226        {Name: 'Israel', code: 'IL'},
227        {Name: 'Italy', code: 'IT'},
228        {Name: 'Jamaica', code: 'JM'},
229        {Name: 'Japan', code: 'JP'},
230        {Name: 'Jersey', code: 'JE'},
231        {Name: 'Jordan', code: 'JO'},
232        {Name: 'Kazakhstan', code: 'KZ'},
233        {Name: 'Kenya', code: 'KE'},
234        {Name: 'Kiribati', code: 'KI'},
235        {Name: 'Korea, Republic of', code: 'KR'},
236        {Name: 'Korea, Democratic People\'s Republic of', code: 'KP'},
237        {Name: 'Kuwait', code: 'KW'},
238        {Name: 'Kyrgyzstan', code: 'KG'},
239        {Name: 'Lao People\'s Democratic Republic', code: 'LA'},
240        {Name: 'Latvia', code: 'LV'},
241        {Name: 'Lebanon', code: 'LB'},
242        {Name: 'Lesotho', code: 'LS'},
243        {Name: 'Liberia', code: 'LR'},
244        {Name: 'Libya', code: 'LY'},
245        {Name: 'Liechtenstein', code: 'LI'},
246        {Name: 'Lithuania', code: 'LT'},
247        {Name: 'Luxembourg', code: 'LU'},
248        {Name: 'Macao', code: 'MO'},
249        {Name: 'Macedonia, The Former Yugoslav Republic of', code: 'MK'},
250        {Name: 'Madagascar', code: 'MG'},
251        {Name: 'Malawi', code: 'MW'},
252        {Name: 'Malaysia', code: 'MY'},
253        {Name: 'Maldives', code: 'MV'},
254        {Name: 'Mali', code: 'ML'},
255        {Name: 'Malta', code: 'MT'},
256        {Name: 'Marshall Islands', code: 'MH'},
257        {Name: 'Martinique', code: 'MQ'},
258        {Name: 'Mauritania', code: 'MR'},
259        {Name: 'Mauritius', code: 'MU'},
260        {Name: 'Mayotte', code: 'YT'},
261        {Name: 'Mexico', code: 'MX'},
262        {Name: 'Micronesia, Federated States of', code: 'FM'},
263        {Name: 'Moldova, Republic of', code: 'MD'},
264        {Name: 'Monaco', code: 'MC'},
265        {Name: 'Mongolia', code: 'MN'},
266        {Name: 'Montenegro', code: 'ME'},
267        {Name: 'Montserrat', code: 'MS'},
268        {Name: 'Morocco', code: 'MA'},
269        {Name: 'Mozambique', code: 'MZ'},
270        {Name: 'Myanmar', code: 'MM'},
271        {Name: 'Namibia', code: 'NA'},
272        {Name: 'Nauru', code: 'NR'},
273        {Name: 'Nepal', code: 'NP'},
274        {Name: 'Netherlands', code: 'NL'},
275        {Name: 'New Caledonia', code: 'NC'},
276        {Name: 'New Zealand', code: 'NZ'},
277        {Name: 'Nicaragua', code: 'NI'},
278        {Name: 'Niger', code: 'NE'},
279        {Name: 'Nigeria', code: 'NG'},
280        {Name: 'Niue', code: 'NU'},
281        {Name: 'Norfolk Island', code: 'NF'},
282        {Name: 'Northern Mariana Islands', code: 'MP'},
283        {Name: 'Norway', code: 'NO'},
284        {Name: 'Oman', code: 'OM'},
285        {Name: 'Pakistan', code: 'PK'},
286        {Name: 'Palau', code: 'PW'},
287        {Name: 'Palestine', code: 'PS'},
288        {Name: 'Panama', code: 'PA'},
289        {Name: 'Papua New Guinea', code: 'PG'},
290        {Name: 'Paraguay', code: 'PY'},
291        {Name: 'Peru', code: 'PE'},
292        {Name: 'Philippines', code: 'PH'},
293        {Name: 'Pitcairn', code: 'PN'},
294        {Name: 'Poland', code: 'PL'},
295        {Name: 'Portugal', code: 'PT'},
296        {Name: 'Puerto Rico', code: 'PR'},
297        {Name: 'Qatar', code: 'QA'},
298        {Name: 'Romania', code: 'RO'},
299        {Name: 'Russian Federation', code: 'RU'},
300        {Name: 'Rwanda', code: 'RW'},
301        {Name: 'Réunion', code: 'RE'},
302        {Name: 'Saint Barthélemy', code: 'BL'},
303        {Name: 'Saint Helena, Ascension and Tristan da Cunha', code: 'SH'},
304        {Name: 'Saint Kitts and Nevis ', code: 'KN'},
305        {Name: 'Saint Lucia', code: 'LC'},
306        {Name: 'Saint Martin', code: 'MF'},
307        {Name: 'Saint Pierre and Miquelon', code: 'PM'},
308        {Name: 'Saint Vincent and the Grenadines', code: 'VC'},
309        {Name: 'Samoa', code: 'WS'},
310        {Name: 'San Marino ', code: 'SM'},
311        {Name: 'Sao Tome and Principe', code: 'ST'},
312        {Name: 'Saudi Arabia', code: 'SA'},
313        {Name: 'Senegal', code: 'SN'},
314        {Name: 'Serbia', code: 'RS'},
315        {Name: 'Seychelles', code: 'SC'},
316        {Name: 'Sierra Leone', code: 'SL'},
317        {Name: 'Singapore', code: 'SG'},
318        {Name: 'Sint Maarten', code: 'SX'},
319        {Name: 'Slovakia', code: 'SK'},
320        {Name: 'Slovenia', code: 'SI'},
321        {Name: 'Solomon Islands', code: 'SB'},
322        {Name: 'Somalia', code: 'SO'},
323        {Name: 'South Africa ', code: 'ZA'},
324        {Name: 'South Georgia and the South Sandwich Islands', code: 'GS'},
325        {Name: 'South Sudan', code: 'SS'},
326        {Name: 'Spain', code: 'ES'},
327        {Name: 'Sri Lanka', code: 'LK'},
328        {Name: 'Sudan', code: 'SD'},
329        {Name: 'Suriname', code: 'SR'},
330        {Name: 'Svalbard and Jan Mayen', code: 'SJ'},
331        {Name: 'Sweden', code: 'SE'},
332        {Name: 'Switzerland', code: 'CH'},
333        {Name: 'Syrian Arab Republic', code: 'SY'},
334        {Name: 'Taiwan', code: 'TW'},
335        {Name: 'Tajikistan', code: 'TJ'},
336        {Name: 'Tanzania, United Republic of', code: 'TZ'},
337        {Name: 'Thailand', code: 'TH'},
338        {Name: 'Timor-Leste', code: 'TL'},
339        {Name: 'Togo', code: 'TG'},
340        {Name: 'Tokelau', code: 'TK'},
341        {Name: 'Tonga', code: 'TO'},
342        {Name: 'Trinidad and Tobago', code: 'TT'},
343        {Name: 'Tunisia', code: 'TN'},
344        {Name: 'Turkey', code: 'TR'},
345        {Name: 'Turkmenistan', code: 'TM'},
346        {Name: 'Turks and Caicos Islands', code: 'TC'},
347        {Name: 'Tuvalu', code: 'TV'},
348        {Name: 'Uganda', code: 'UG'},
349        {Name: 'Ukraine', code: 'UA'},
350        {Name: 'United Arab Emirates', code: 'AE'},
351        {Name: 'United Kingdom', code: 'GB'},
352        {Name: 'United States Minor Outlying Islands', code: 'UM'},
353        {Name: 'United States of America', code: 'US'},
354        {Name: 'Uruguay', code: 'UY'},
355        {Name: 'Uzbekistan', code: 'UZ'},
356        {Name: 'Vanuatu', code: 'VU'},
357        {Name: 'Venezuela', code: 'VE'},
358        {Name: 'Viet Nam', code: 'VN'},
359        {Name: 'Virgin Islands, British', code: 'VG'},
360        {Name: 'Virgin Islands, U.S', code: 'VI'},
361        {Name: 'Wallis and Futuna', code: 'WF'},
362        {Name: 'Western Sahara', code: 'EH'},
363        {Name: 'Yemen', code: 'YE'},
364        {Name: 'Zambia', code: 'ZM'},
365        {Name: 'Zimbabwe', code: 'ZW'},
366        {Name: 'Åland Islands', code: 'AX'}
367      ],
368      MESSAGES: {
369        POLL: {
370          HOST_ON_TIMEOUT:
371              'Time out. System did not reach Running state in allotted time.',
372          HOST_OFF_TIMEOUT:
373              'Time out. System did not reach Off state in allotted time.',
374          HOST_QUIESCED: 'System is in Error state.',
375          DOWNLOAD_IMAGE_TIMEOUT:
376              'Time out. Did not download image in allotted time.',
377        },
378        POWER_OP: {
379          POWER_ON_FAILED: 'Power on failed.',
380          WARM_REBOOT_FAILED: 'Warm reboot failed.',
381          COLD_REBOOT_FAILED: 'Cold reboot failed.',
382          ORDERLY_SHUTDOWN_FAILED: 'Orderly shutdown failed.',
383          IMMEDIATE_SHUTDOWN_FAILED: 'Immediate shutdown failed.',
384        },
385        SENSOR: {
386          NO_SENSOR_DATA: 'There are no sensors found.',
387          CRITICAL_NO_SENSOR_DATA: 'There are no sensors in Critical state.',
388          WARNING_NO_SENSOR_DATA: 'There are no sensors in Warning state.',
389          NORMAL_NO_SENSOR_DATA: 'There are no sensors in Normal state.'
390        },
391        ERROR_MESSAGE_DESC_TEMPLATE: '{{status}} - {{description}}',
392      },
393      POWER_CAP_TEXT: {unit: 'W', disabled: 'Not Enabled'},
394      POWER_CONSUMPTION_TEXT: {
395        'xyz.openbmc_project.Sensor.Value.Unit.Watts': 'W',
396        notavailable: 'Not Available'
397      },
398    };
399  });
400})(window.angular);
401