summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
Diffstat (limited to 'src/store')
-rw-r--r--src/store/modules/Configuration/NetworkSettingsStore.js50
1 files changed, 23 insertions, 27 deletions
diff --git a/src/store/modules/Configuration/NetworkSettingsStore.js b/src/store/modules/Configuration/NetworkSettingsStore.js
index ee58a77b..3b1f2320 100644
--- a/src/store/modules/Configuration/NetworkSettingsStore.js
+++ b/src/store/modules/Configuration/NetworkSettingsStore.js
@@ -3,40 +3,36 @@ import api from '../../api';
const NetworkSettingsStore = {
namespaced: true,
state: {
- networkData: null,
- ipAddress: '--',
- macAddress: '--'
+ ethernetData: []
},
getters: {
- networkData: state => state.networkData,
- ipAddress: state => state.ipAddress,
- macAddress: state => state.macAddress
+ ethernetData: state => state.ethernetData
},
mutations: {
- setNetworkData: (state, networkData) => (state.networkData = networkData),
- setIpAddress: (state, ipAddress) => (state.ipAddress = ipAddress),
- setMacAddress: (state, macAddress) => (state.macAddress = macAddress)
+ setEthernetData: (state, ethernetData) =>
+ (state.ethernetData = ethernetData)
},
actions: {
- getNetworkData({ commit }) {
+ getEthernetData({ commit }) {
api
- .get('/xyz/openbmc_project/network/enumerate')
- .then(response => {
- const networkData = response.data.data;
- const ipAddresses = [];
- const interfaceId = /eth[0-9]/;
- for (let key in networkData) {
- if (key.includes('ipv4')) {
- ipAddresses.push(networkData[key].Address);
- }
- if (
- key.match(interfaceId) &&
- networkData[key].MACAddress !== undefined
- ) {
- commit('setMacAddress', networkData[key].MACAddress);
- }
- }
- commit('setIpAddress', ipAddresses);
+ .get('/redfish/v1/Managers/bmc/EthernetInterfaces')
+ .then(response =>
+ response.data.Members.map(
+ ethernetInterface => ethernetInterface['@odata.id']
+ )
+ )
+ .then(ethernetInterfaceIds =>
+ api.all(
+ ethernetInterfaceIds.map(ethernetInterface =>
+ api.get(ethernetInterface)
+ )
+ )
+ )
+ .then(ethernetInterfaces => {
+ const ethernetData = ethernetInterfaces.map(
+ ethernetInterface => ethernetInterface.data
+ );
+ commit('setEthernetData', ethernetData);
})
.catch(error => {
console.log('Network Data:', error);