func (c *C7000) StorageBlades() (storageBlades []*devices.StorageBlade, err error) {
	if c.Rimp.Infra2.Blades != nil {
		chassisSerial, _ := c.Serial()
		for _, hpStorageBlade := range c.Rimp.Infra2.Blades {
			if hpStorageBlade.Type == "STORAGE" {
				storageBlade := devices.StorageBlade{}
				storageBlade.Serial = strings.ToLower(strings.TrimSpace(hpStorageBlade.Bsn))
				storageBlade.BladePosition = hpStorageBlade.Bay.Connection
				storageBlade.Status = hpStorageBlade.Status
				storageBlade.PowerKw = hpStorageBlade.Power.PowerConsumed / 1000.00
				storageBlade.TempC = hpStorageBlade.Temp.C
				storageBlade.Vendor = hp.VendorID
				storageBlade.FwVersion = hpStorageBlade.BladeRomVer
				storageBlade.Model = hpStorageBlade.Spn
				storageBlade.ChassisSerial = chassisSerial
				for _, hpBlade := range c.Rimp.Infra2.Blades {
					if hpStorageBlade.AssociatedBlade == hpBlade.Bay.Connection {
						storageBlade.BladeSerial = strings.ToLower(strings.TrimSpace(hpBlade.Bsn))
					}
				}
				storageBlades = append(storageBlades, &storageBlade)
			}
		}
	}
	return storageBlades, err
}
StorageBlades returns all StorageBlades found in this chassis
package c7000
import (
	"context"
	"encoding/xml"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
	"github.com/bmc-toolbox/bmclib/devices"
	"github.com/bmc-toolbox/bmclib/errors"
	"github.com/bmc-toolbox/bmclib/internal/httpclient"
	"github.com/bmc-toolbox/bmclib/internal/sshclient"
	"github.com/bmc-toolbox/bmclib/providers/hp"
	"github.com/go-logr/logr"
)
const (
	BMCType = "c7000"
)
type C7000 struct {
	ip         string
	username   string
	password   string
	XMLToken   string  
	httpClient *http.Client
	sshClient  *sshclient.SSHClient
	Rimp       *hp.Rimp
	ctx        context.Context
	log        logr.Logger
}
func New(ctx context.Context, host string, username string, password string, log logr.Logger) (*C7000, error) {
	client, err := httpclient.Build()
	if err != nil {
		return nil, err
	}
	url := fmt.Sprintf("https://%s/xmldata?item=all", host)
	resp, err := client.Get(url)
	if err != nil {
		return nil, err
	}
	payload, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	Rimp := &hp.Rimp{}
	err = xml.Unmarshal(payload, Rimp)
	if err != nil {
		return nil, err
	}
	if Rimp.Infra2 == nil {
		return nil, errors.ErrUnableToReadData
	}
	sshClient, err := sshclient.New(host, username, password)
	if err != nil {
		return nil, err
	}
	return &C7000{ip: host, username: username, password: password, Rimp: Rimp, sshClient: sshClient, ctx: ctx, log: log}, nil
}
func (c *C7000) CheckCredentials() (err error) {
	err = c.httpLogin()
	if err != nil {
		return err
	}
	return err
}
func (c *C7000) Class() (class string, err error) {
	return "C7000", nil
}
func (c *C7000) Name() (name string, err error) {
	return c.Rimp.Infra2.Encl, err
}
func (c *C7000) HardwareType() (model string) {
	return BMCType
}
func (c *C7000) Model() (model string, err error) {
	return c.Rimp.MP.Pn, err
}
func (c *C7000) Serial() (serial string, err error) {
	return strings.ToLower(strings.TrimSpace(c.Rimp.Infra2.EnclSn)), err
}
func (c *C7000) PowerKw() (power float64, err error) {
	return c.Rimp.Infra2.ChassisPower.PowerConsumed / 1000.00, err
}
func (c *C7000) TempC() (temp int, err error) {
	return c.Rimp.Infra2.Temp.C, err
}
func (c *C7000) Psus() (psus []*devices.Psu, err error) {
	for _, psu := range c.Rimp.Infra2.ChassisPower.Powersupply {
		if psus == nil {
			psus = make([]*devices.Psu, 0)
		}
		p := &devices.Psu{
			Serial:     strings.ToLower(strings.TrimSpace(psu.Sn)),
			Status:     psu.Status,
			PowerKw:    psu.ActualOutput / 1000.00,
			CapacityKw: psu.Capacity / 1000.00,
			PartNumber: psu.Pn,
			Position:   psu.Bay.Connection,
		}
		psus = append(psus, p)
	}
	return psus, err
}
func (c *C7000) Nics() (nics []*devices.Nic, err error) {
	for _, manager := range c.Rimp.Infra2.Managers {
		if nics == nil {
			nics = make([]*devices.Nic, 0)
		}
		n := &devices.Nic{
			Name:       manager.Name,
			MacAddress: strings.ToLower(manager.MacAddr),
		}
		nics = append(nics, n)
	}
	return nics, err
}
func (c *C7000) Fans() (fans []*devices.Fan, err error) {
	serial, err := c.Serial()
	if err != nil {
		return fans, err
	}
	for _, fan := range c.Rimp.Infra2.Fans {
		if fans == nil {
			fans = make([]*devices.Fan, 0)
		}
		f := &devices.Fan{
			Serial:     fmt.Sprintf("%d_%s", fan.Bay.Connection, serial),
			Status:     fan.Status,
			Position:   fan.Bay.Connection,
			Model:      fan.ProducName,
			CurrentRPM: fan.RpmCUR,
			PowerKw:    float64(fan.PowerUsed) / 1000,
		}
		fans = append(fans, f)
	}
	return fans, err
}
func (c *C7000) Status() (status string, err error) {
	return c.Rimp.Infra2.Status, err
}
func (c *C7000) IsActive() bool {
	for _, manager := range c.Rimp.Infra2.Managers {
		if manager.MgmtIPAddr == strings.Split(c.ip, ":")[0] && manager.Role == "ACTIVE" {
			return true
		}
	}
	return false
}
func (c *C7000) Version() (version string, err error) {
	return c.Rimp.MP.Fwri, err
}
func (c *C7000) PassThru() (passthru string, err error) {
	passthru = "1G"
	for _, hpswitch := range c.Rimp.Infra2.Switches {
		if strings.Contains(hpswitch.Spn, "10G") {
			passthru = "10G"
		}
		break  
	}
	return passthru, err
}