Skip to content

Commit 09fd4a6

Browse files
authored
Refactor BMC interface to support vendor-specific implementations (#689)
* Introduce vendor-specific BMC implementations * Refactor BMC package into vendor-specific structs and remove OEM indirection * Address critical issues * Address nitpick issues * Refactoring after gofish version bump * Address pr review issues after rebasing
1 parent 4854c23 commit 09fd4a6

16 files changed

Lines changed: 1203 additions & 1550 deletions

bmc/bmc.go

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ package bmc
66
import (
77
"context"
88
"encoding/json"
9-
"fmt"
109

11-
"github.com/stmcginnis/gofish"
1210
"github.com/stmcginnis/gofish/schemas"
1311
"k8s.io/apimachinery/pkg/api/resource"
14-
15-
"github.com/ironcore-dev/metal-operator/bmc/oem"
1612
)
1713

1814
type Manufacturer string
@@ -283,47 +279,3 @@ type Manager struct {
283279
MACAddress string
284280
OemLinks json.RawMessage
285281
}
286-
287-
func NewOEMManager(manager *schemas.Manager, service *gofish.Service) (oem.ManagerInterface, error) {
288-
var OEMManager oem.ManagerInterface
289-
switch manager.Manufacturer {
290-
case string(ManufacturerDell):
291-
OEMManager = &oem.DellIdracManager{
292-
BMC: manager,
293-
Service: service,
294-
}
295-
case string(ManufacturerHPE):
296-
OEMManager = &oem.HPEILOManager{
297-
BMC: manager,
298-
Service: service,
299-
}
300-
case string(ManufacturerLenovo):
301-
OEMManager = &oem.LenovoXCCManager{
302-
BMC: manager,
303-
Service: service,
304-
}
305-
default:
306-
return nil, fmt.Errorf("unsupported manufacturer: %v", manager.Manufacturer)
307-
}
308-
return OEMManager, nil
309-
}
310-
311-
func NewOEMInterface(manufacturer string, service *gofish.Service) (oem.OEMInterface, error) {
312-
var oemInterface oem.OEMInterface
313-
switch manufacturer {
314-
case string(ManufacturerDell):
315-
return &oem.Dell{
316-
Service: service,
317-
}, nil
318-
case string(ManufacturerHPE):
319-
return &oem.HPE{
320-
Service: service,
321-
}, nil
322-
case string(ManufacturerLenovo):
323-
return &oem.Lenovo{
324-
Service: service,
325-
}, nil
326-
default:
327-
return oemInterface, fmt.Errorf("unsupported manufacturer: %v", manufacturer)
328-
}
329-
}

bmc/common/helpers.go

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)