blob: 73df10b89071c5c195d92e883d4e0ac6c7a33c1e [file] [log] [blame]
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -07001import api from '@/store/api';
2
3const ChassisStore = {
4 namespaced: true,
5 state: {
Derick Montague602e98a2020-10-21 16:20:00 -05006 bmc: null,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -07007 },
8 getters: {
Derick Montague602e98a2020-10-21 16:20:00 -05009 bmc: (state) => state.bmc,
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070010 },
11 mutations: {
12 setBmcInfo: (state, data) => {
13 const bmc = {};
14 bmc.description = data.Description;
15 bmc.firmwareVersion = data.FirmwareVersion;
16 bmc.graphicalConsoleConnectTypes =
17 data.GraphicalConsole.ConnectTypesSupported;
18 bmc.graphicalConsoleEnabled = data.GraphicalConsole.ServiceEnabled;
19 bmc.graphicalConsoleMaxSessions =
20 data.GraphicalConsole.MaxConcurrentSessions;
21 bmc.health = data.Status.Health;
22 bmc.healthRollup = data.Status.HealthRollup;
23 bmc.id = data.Id;
24 bmc.model = data.Model;
25 bmc.partNumber = data.PartNumber;
26 bmc.powerState = data.PowerState;
27 bmc.serialConsoleConnectTypes = data.SerialConsole.ConnectTypesSupported;
28 bmc.serialConsoleEnabled = data.SerialConsole.ServiceEnabled;
29 bmc.serialConsoleMaxSessions = data.SerialConsole.MaxConcurrentSessions;
30 bmc.serialNumber = data.SerialNumber;
31 bmc.serviceEntryPointUuid = data.ServiceEntryPointUUID;
32 bmc.statusState = data.Status.State;
33 bmc.uuid = data.UUID;
34 state.bmc = bmc;
Derick Montague602e98a2020-10-21 16:20:00 -050035 },
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070036 },
37 actions: {
38 async getBmcInfo({ commit }) {
39 return await api
40 .get('/redfish/v1/Managers/bmc')
41 .then(({ data }) => commit('setBmcInfo', data))
Derick Montague602e98a2020-10-21 16:20:00 -050042 .catch((error) => console.log(error));
43 },
44 },
Yoshie Muranaka54c6bfc2020-06-12 08:29:42 -070045};
46
47export default ChassisStore;