sm

package
v1.29.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 10 Imported by: 5

Documentation

Overview

This file is contains struct defines for CompEthInterfaces

Index

Constants

View Source
const (
	CLProcessingModelRigid = "rigid"
	CLProcessingModelFlex  = "flexible"
)
View Source
const (
	CLResultSuccess     = "Success"
	CLResultNotFound    = "NotFound"
	CLResultLocked      = "Locked"
	CLResultUnlocked    = "Unlocked"
	CLResultDisabled    = "Disabled"
	CLResultReserved    = "Reserved"
	CLResultServerError = "ServerError"
)
View Source
const (
	CompEPTypeChassis = "ComponentEndpointChassis"
	CompEPTypeSystem  = "ComponentEndpointComputerSystem"
	CompEPTypeManager = "ComponentEndpointManager"
	CompEPTypePDU     = "ComponentEndpointPowerDistribution"
	CompEPTypeOutlet  = "ComponentEndpointOutlet"
)

Valid values for ComponentEndpointType discriminator field above.

View Source
const (
	HWInvFormatFullyFlat     = "FullyFlat"
	HWInvFormatHierarchical  = "Hierarchical"  // Not implemented yet.
	HWInvFormatNestNodesOnly = "NestNodesOnly" // Default
)

Valid values for Format field above

View Source
const (
	HWInvByLocCabinet                  string = "HWInvByLocCabinet"
	HWInvByLocChassis                  string = "HWInvByLocChassis"
	HWInvByLocComputeModule            string = "HWInvByLocComputeModule"
	HWInvByLocRouterModule             string = "HWInvByLocRouterModule"
	HWInvByLocNodeEnclosure            string = "HWInvByLocNodeEnclosure"
	HWInvByLocHSNBoard                 string = "HWInvByLocHSNBoard"
	HWInvByLocNode                     string = "HWInvByLocNode"
	HWInvByLocProcessor                string = "HWInvByLocProcessor"
	HWInvByLocNodeAccel                string = "HWInvByLocNodeAccel"
	HWInvByLocDrive                    string = "HWInvByLocDrive"
	HWInvByLocMemory                   string = "HWInvByLocMemory"
	HWInvByLocHSNNIC                   string = "HWInvByLocNodeHsnNic"
	HWInvByLocPDU                      string = "HWInvByLocPDU"
	HWInvByLocOutlet                   string = "HWInvByLocOutlet"
	HWInvByLocCMMRectifier             string = "HWInvByLocCMMRectifier"
	HWInvByLocNodeEnclosurePowerSupply string = "HWInvByLocNodeEnclosurePowerSupply"
	HWInvByLocNodeBMC                  string = "HWInvByLocNodeBMC"
	HWInvByLocRouterBMC                string = "HWInvByLocRouterBMC"
	HWInvByLocNodeAccelRiser           string = "HWInvByLocNodeAccelRiser"
)

HWInventoryByLocationType TODO: Remaining types

View Source
const (
	HWInvByFRUCabinet                  string = "HWInvByFRUCabinet"
	HWInvByFRUChassis                  string = "HWInvByFRUChassis"
	HWInvByFRUComputeModule            string = "HWInvByFRUComputeModule"
	HWInvByFRURouterModule             string = "HWInvByFRURouterModule"
	HWInvByFRUNodeEnclosure            string = "HWInvByFRUNodeEnclosure"
	HWInvByFRUHSNBoard                 string = "HWInvByFRUHSNBoard"
	HWInvByFRUNode                     string = "HWInvByFRUNode"
	HWInvByFRUProcessor                string = "HWInvByFRUProcessor"
	HWInvByFRUNodeAccel                string = "HWInvByFRUNodeAccel"
	HWInvByFRUMemory                   string = "HWInvByFRUMemory"
	HWInvByFRUDrive                    string = "HWInvByFRUDrive"
	HWInvByFRUHSNNIC                   string = "HWInvByFRUNodeHsnNic"
	HWInvByFRUPDU                      string = "HWInvByFRUPDU"
	HWInvByFRUOutlet                   string = "HWInvByFRUOutlet"
	HWInvByFRUCMMRectifier             string = "HWInvByFRUCMMRectifier"
	HWInvByFRUNodeEnclosurePowerSupply string = "HWInvByFRUNodeEnclosurePowerSupply"
	HWInvByFRUNodeBMC                  string = "HWInvByFRUNodeBMC"
	HWInvByFRURouterBMC                string = "HWInvByFRURouterBMC"
	HWInvByFRUNodeAccelRiser           string = "HWInvByFRUNodeAccelRiser"
)

HWInventoryByFRUType properties. Used to select proper subtype in api schema. TODO: Remaining types

View Source
const (
	HWInvHistEventTypeAdded    = "Added"
	HWInvHistEventTypeRemoved  = "Removed"
	HWInvHistEventTypeScanned  = "Scanned"
	HWInvHistEventTypeDetected = "Detected"
)

Valid values for event types

View Source
const (
	DiscNotStarted = "NotStarted"
	DiscPending    = "Pending"
	DiscComplete   = "Complete"
	DiscInProgress = "InProgress"
)

Valid values for the DiscoveryStatus Status field below.

View Source
const (
	JobNotStarted = "NotStarted"
	JobPending    = "Pending"
	JobComplete   = "Complete"
	JobInProgress = "InProgress"
	JobError      = "Error"
)

Valid values for the DiscoveryStatus Status field below.

View Source
const (
	JobTypeSRFP = "StateRFPoll"
)

Variables

View Source
var ErrCompEthInterfaceBadCompID = base.NewHMSError("sm", "Invalid CompEthInterface component ID")
View Source
var ErrCompEthInterfaceBadIPAddress = base.NewHMSError("sm", "Invalid CompEthInterface IP Address")
View Source
var ErrCompEthInterfaceBadMAC = base.NewHMSError("sm", "Invalid CompEthInterface MAC Address")
View Source
var ErrCompLockBadLifetime = base.NewHMSError("sm",
	"Invalid CompLock lifetime")
View Source
var ErrCompLockV2BadDuration = base.NewHMSError("sm",
	"Invalid Reservation Duration")
View Source
var ErrCompLockV2BadProcessingModel = base.NewHMSError("sm",
	"Invalid Processing Model")
View Source
var ErrCompLockV2CompDisabled = base.NewHMSError("sm",
	"Component reservations are disabled")
View Source
var ErrCompLockV2CompLocked = base.NewHMSError("sm",
	"Component is Locked")
View Source
var ErrCompLockV2CompReserved = base.NewHMSError("sm",
	"Component is Reserved")
View Source
var ErrCompLockV2CompUnlocked = base.NewHMSError("sm",
	"Component is Unlocked")
View Source
var ErrCompLockV2DKey = base.NewHMSError("sm",
	"Deputy Key required for operation")
View Source
var ErrCompLockV2DupLock = base.NewHMSError("sm",
	"Component is Locked")
View Source
var ErrCompLockV2NotFound = base.NewHMSError("sm",
	"Component not found")
View Source
var ErrCompLockV2RKey = base.NewHMSError("sm",
	"Reservation Key required for operation")
View Source
var ErrCompLockV2Unknown = base.NewHMSError("sm",
	"Unknown locking error")
View Source
var ErrGroupBadField = base.NewHMSError("sm",
	"group or partition field has invalid characters")
View Source
var ErrHWFRUIDInvalid = base.NewHMSError("sm", "FRUID is empty or invalid")
View Source
var ErrHWHistEventTypeInvalid = base.NewHMSError("sm", "Invalid hardware inventory history event type")
View Source
var ErrHWInvFmtInvalid = base.NewHMSError("sm", "Invalid HW Inventory format")
View Source
var ErrHWInvFmtNI = base.NewHMSError("sm", "HW Inv format not yet implemented")
View Source
var ErrHWInvHistFmtInvalid = base.NewHMSError("sm", "Invalid HW Inventory History format")
View Source
var ErrHWInvMissingFRU = base.NewHMSError("sm", "PopulatedFRU must be populated")
View Source
var ErrHWInvMissingFRUInfo = base.NewHMSError("sm", "FRU info is empty")
View Source
var ErrHWInvMissingLoc = base.NewHMSError("sm", "Component location info is empty")
View Source
var ErrHWLocInvalid = base.NewHMSError("sm", "ID is empty or not a valid xname")
View Source
var ErrPartBadName = base.NewHMSError("sm",
	"Bad partition name. Must be p# or p#.#")

Functions

func NormalizeGroupField

func NormalizeGroupField(f string) string

Normalize group field by lowercasing

func SetDebug

func SetDebug(level int)

func SetLogger

func SetLogger(l *log.Logger)

func SetVerbose

func SetVerbose(level int)

func VerifyGroupField

func VerifyGroupField(f string) error

Verify group field.

func VerifyNormalizeHWInvHistEventType

func VerifyNormalizeHWInvHistEventType(eventType string) string

Validate and Normalize event types used in queries

func VerifyNormalizeProcessingModel

func VerifyNormalizeProcessingModel(pm string) string

Types

type CompEthInterface

type CompEthInterface struct {
	ID         string `json:"ID"`
	Desc       string `json:"Description"`
	MACAddr    string `json:"MACAddress"`
	IPAddr     string `json:"IPAddress"`
	LastUpdate string `json:"LastUpdate"`
	CompID     string `json:"ComponentID"`
	Type       string `json:"Type"`
}

A component ethernet interface is an IP address <-> MAC address relation. This structure is used on the v1 CompEthInterface APIs

func NewCompEthInterface

func NewCompEthInterface(desc, macAddr, ipAddr, compID string) (*CompEthInterface, error)

Allocate and initialize new CompEthInterface struct, validating it.

type CompEthInterfacePatch

type CompEthInterfacePatch struct {
	Desc   *string `json:"Description"`
	IPAddr *string `json:"IPAddress"`
	CompID *string `json:"ComponentID"`
}

Patchable fields if included in payload.

type CompEthInterfaceV2

type CompEthInterfaceV2 struct {
	ID         string `json:"ID"`
	Desc       string `json:"Description"`
	MACAddr    string `json:"MACAddress"`
	LastUpdate string `json:"LastUpdate"`
	CompID     string `json:"ComponentID"`
	Type       string `json:"Type"`

	IPAddrs []IPAddressMapping `json:"IPAddresses"`
}

A component ethernet interface is an IP addresses <-> MAC address relation. This structure is used on the v2 CompEthInterface APIs

func NewCompEthInterfaceV2

func NewCompEthInterfaceV2(desc, macAddr, compID string, ipAddrs []IPAddressMapping) (*CompEthInterfaceV2, error)

Allocate and initialize new CompEthInterfaceV2 struct, validating it.

func (*CompEthInterfaceV2) ToV1

func (cei *CompEthInterfaceV2) ToV1() *CompEthInterface

type CompEthInterfaceV2Patch

type CompEthInterfaceV2Patch struct {
	Desc    *string             `json:"Description"`
	CompID  *string             `json:"ComponentID"`
	IPAddrs *[]IPAddressMapping `json:"IPAddresses"`
}

Patchable fields if included in payload.

type CompLock

type CompLock struct {
	ID       string   `json:"id"`
	Created  string   `json:"created,omitempty"`
	Reason   string   `json:"reason"`
	Owner    string   `json:"owner"`
	Lifetime int      `json:"lifetime"`
	Xnames   []string `json:"xnames"` // List of xname ids, required.
	// contains filtered or unexported fields
}

A component lock is a formal, non-overlapping group of components that are reserved by a service.

func NewCompLock

func NewCompLock(reason, owner string, lifetime int, xnames []string) (*CompLock, error)

Allocate and initialize new CompLock struct, validating it. If you already have a created CompLock, you can check the inputs with CompLock.Verify()

func (*CompLock) Normalize

func (cl *CompLock) Normalize()

Normalize xnames in CompLockMembers.

func (*CompLock) Verify

func (cl *CompLock) Verify() error

Check input fields of a group. If no error is returned, the result should be ok to put into the database.

type CompLockPatch

type CompLockPatch struct {
	Reason   *string
	Owner    *string
	Lifetime *int
}

Patchable fields if included in payload.

func (*CompLockPatch) Normalize

func (clp *CompLockPatch) Normalize()

Normalize CompLockPatch (just lower case tags, basically, but keeping same interface as others.

func (*CompLockPatch) Verify

func (clp *CompLockPatch) Verify() error

Analgous Verify call for CompLockPatch objects.

type CompLockV2

type CompLockV2 struct {
	ID                  string `json:"ID"`
	Locked              bool   `json:"Locked"`
	Reserved            bool   `json:"Reserved"`
	CreationTime        string `json:"CreationTime,omitempty"`
	ExpirationTime      string `json:"ExpirationTime,omitempty"`
	ReservationDisabled bool   `json:"ReservationDisabled"`
}

Lock Status

type CompLockV2Count

type CompLockV2Count struct {
	Total   int `json:"Total"`
	Success int `json:"Success"`
	Failure int `json:"Failure"`
}

Renew/Release ServRes, Release/Remove Res, Create/Unlock/Repair/Disable locks

type CompLockV2DeputyKeyArray

type CompLockV2DeputyKeyArray struct {
	DeputyKeys []CompLockV2Key `json:"DeputyKeys"`
}

Check ServRes

func (*CompLockV2DeputyKeyArray) VerifyNormalize

func (cldk *CompLockV2DeputyKeyArray) VerifyNormalize() error

type CompLockV2Failure

type CompLockV2Failure struct {
	ID     string `json:"ID"`
	Reason string `json:"Reason"`
}

type CompLockV2Filter

type CompLockV2Filter struct {
	ID                  []string `json:"ComponentIDs"`
	NID                 []string `json:"NID"`
	Type                []string `json:"Sype"`
	State               []string `json:"State"`
	Flag                []string `json:"Flag"`
	Enabled             []string `json:"Enabled"`
	SwStatus            []string `json:"SoftwareStatus"`
	Role                []string `json:"Role"`
	SubRole             []string `json:"Subrole"`
	Subtype             []string `json:"Subtype"`
	Arch                []string `json:"Arch"`
	Class               []string `json:"Class"`
	Group               []string `json:"Group"`
	Partition           []string `json:"Partition"`
	ProcessingModel     string   `json:"ProcessingModel"`
	ReservationDuration int      `json:"ReservationDuration"`
}

Create/Remove Res, Create ServRes, Check/Lock/Unlock/Repair/Disable Lock

func (*CompLockV2Filter) VerifyNormalize

func (cl *CompLockV2Filter) VerifyNormalize() error

type CompLockV2Key

type CompLockV2Key struct {
	ID  string `json:"ID"`
	Key string `json:"Key"`
}

Release Res, Release/Renew ServRes

func (*CompLockV2Key) VerifyNormalize

func (clk *CompLockV2Key) VerifyNormalize() error

type CompLockV2ReservationFilter

type CompLockV2ReservationFilter struct {
	ReservationKeys     []CompLockV2Key `json:"ReservationKeys"`
	ProcessingModel     string          `json:"ProcessingModel"`
	ReservationDuration int             `json:"ReservationDuration"`
}

func (*CompLockV2ReservationFilter) VerifyNormalize

func (clr *CompLockV2ReservationFilter) VerifyNormalize() error

type CompLockV2ReservationResult

type CompLockV2ReservationResult struct {
	Success []CompLockV2Success `json:"Success"`
	Failure []CompLockV2Failure `json:"Failure"`
}

type CompLockV2Status

type CompLockV2Status struct {
	Components []CompLockV2 `json:"Components"`
	NotFound   []string     `json:"NotFound"`
}

type CompLockV2Success

type CompLockV2Success struct {
	ID             string `json:"ID"`
	DeputyKey      string `json:"DeputyKey"`
	ReservationKey string `json:"ReservationKey,omitempty"`
	CreationTime   string `json:"CreationTime,omitempty"`
	ExpirationTime string `json:"ExpirationTime,omitempty"`
}

Create/Check (Serv)Res

type CompLockV2SuccessArray

type CompLockV2SuccessArray struct {
	ComponentIDs []string `json:"ComponentIDs"`
}

type CompLockV2UpdateResult

type CompLockV2UpdateResult struct {
	Counts  CompLockV2Count        `json:"Counts"`
	Success CompLockV2SuccessArray `json:"Success"`
	Failure []CompLockV2Failure    `json:"Failure"`
}

type ComponentEndpoint

type ComponentEndpoint struct {
	// Embedded struct
	rf.ComponentDescription

	Enabled        bool   `json:"Enabled"`
	RfEndpointFQDN string `json:"RedfishEndpointFQDN"`
	URL            string `json:"RedfishURL"`

	// This is used as a descriminator to determine the type of *Info
	// struct that will be included below.
	ComponentEndpointType string `json:"ComponentEndpointType"`

	// These are all stored in the same JSON blob, only one of these
	// one of these will be set, based on the value of RedfishType,
	// and will match the ComponentEndpointType
	RedfishChassisInfo *rf.ComponentChassisInfo `json:"RedfishChassisInfo,omitempty"`
	RedfishSystemInfo  *rf.ComponentSystemInfo  `json:"RedfishSystemInfo,omitempty"`
	RedfishManagerInfo *rf.ComponentManagerInfo `json:"RedfishManagerInfo,omitempty"`
	RedfishPDUInfo     *rf.ComponentPDUInfo     `json:"RedfishPDUInfo,omitempty"`
	RedfishOutletInfo  *rf.ComponentOutletInfo  `json:"RedfishOutletInfo,omitempty"`
}

func (*ComponentEndpoint) DecodeComponentInfo

func (cep *ComponentEndpoint) DecodeComponentInfo(infoJSON []byte) error

This routine takes raw ComponentEndpoint type-specific extended info captured as free-form JSON (e.g. from a schema-free database field) and unmarshals it into the correct struct for the type with the proper RF type-specific name.

NOTEs: The location info should be that produced by EncodeComponentInfo.

MODIFIES caller.

func (*ComponentEndpoint) EncodeComponentInfo

func (cep *ComponentEndpoint) EncodeComponentInfo() ([]byte, error)

Takes ComponentEndpoint type-specific extended info and converts it into raw JSON, e.g. to store as a generic JSON blob.

type ComponentEndpointArray

type ComponentEndpointArray struct {
	ComponentEndpoints []*ComponentEndpoint `json:"ComponentEndpoints"`
}

A collection of 0-n ComponentEndpoints. It could just be an ordinary array but we want to save the option to have indentifying info, etc. packaged with it, e.g. the query parameters or options that produced it, especially if there are fewer fields than normal being included.

type ComponentPut

type ComponentPut struct {
	Component base.Component `json:"component"`
	Force     bool           `json:"force"`
}

The payload for a Component PUT

func NewCompPut

func NewCompPut(comp base.Component, force bool) (*ComponentPut, error)

This creates a ComponentPut payload and verifies that the component is valid. At the very least ID and State for the component are required.

func (*ComponentPut) VerifyNormalize

func (cp *ComponentPut) VerifyNormalize() error

type ComponentsPost

type ComponentsPost struct {
	base.ComponentArray
	Force bool `json:"force"`
}

The payload for a Components POST

func NewCompPost

func NewCompPost(comps []base.Component, force bool) (*ComponentsPost, error)

This creates a ComponentsPost payload and verifies that the components are valid. At the very least ID and State for each component are required.

func (*ComponentsPost) VerifyNormalize

func (cp *ComponentsPost) VerifyNormalize() error

type DiscoverIn

type DiscoverIn struct {
	XNames []string `json:"xnames"`
	Force  bool     `json:"force"`
}

POST object to kick of discovery

type DiscoveryStatus

type DiscoveryStatus struct {
	ID         uint             `json:"ID"`
	Status     string           `json:"Status"`
	LastUpdate string           `json:"LastUpdateTime"`
	Details    *json.RawMessage `json:"Details,omitempty"`
}

Returns info on the current status of discovery for id (just 0 for now)

type Group

type Group struct {
	Label          string   `json:"label"`
	Description    string   `json:"description"`
	ExclusiveGroup string   `json:"exclusiveGroup,omitempty"`
	Tags           []string `json:"tags,omitempty"`
	Members        Members  `json:"members"` // List of xnames, required.
	// contains filtered or unexported fields
}

Component Group, typically nodes. Like a partition but just a free form collection, not necessarily non-overlapping, and with no predetermined purpose.

func NewGroup

func NewGroup(label, desc, exclGrp string, tags, member_ids []string) (*Group, error)

Allocate and initialize new Group struct, validating it. This copies tags and members vs. just the pointer to the slice. If you already have a created group, you can check the inputs with group.Verify()

func (*Group) Normalize

func (g *Group) Normalize()

Lowercase field names and normalize xnames in Members.

func (*Group) Verify

func (g *Group) Verify() error

Check input fields of a group. If no error is returned, the result should be ok to put into the database.

type GroupPatch

type GroupPatch struct {
	Description *string   `json:"description"`
	Tags        *[]string `json:"tags"`
}

Patchable fields if included in payload.

func (*GroupPatch) Normalize

func (gp *GroupPatch) Normalize()

Normalize groupPatch (just lower case tags, basically, but keeping same interface as others.

func (*GroupPatch) Verify

func (gp *GroupPatch) Verify() error

Analgous Verify call for GroupPatch objects.

type HWInvByFRU

type HWInvByFRU struct {
	FRUID   string `json:"FRUID"`
	Type    string `json:"Type"`
	Subtype string `json:"Subtype"`

	// This is used as a descriminator to specify the type of *Info
	// struct that will be included below.
	HWInventoryByFRUType string `json:"HWInventoryByFRUType"`

	// One of (based on HWFRUInfoType):
	//   HMSType             Underlying RF Type      How named in json object
	HMSCabinetFRUInfo       *rf.ChassisFRUInfoRF   `json:"CabinetFRUInfo,omitempty"`
	HMSChassisFRUInfo       *rf.ChassisFRUInfoRF   `json:"ChassisFRUInfo,omitempty"` // Mountain chassis
	HMSComputeModuleFRUInfo *rf.ChassisFRUInfoRF   `json:"ComputeModuleFRUInfo,omitempty"`
	HMSRouterModuleFRUInfo  *rf.ChassisFRUInfoRF   `json:"RouterModuleFRUInfo,omitempty"`
	HMSNodeEnclosureFRUInfo *rf.ChassisFRUInfoRF   `json:"NodeEnclosureFRUInfo,omitempty"`
	HMSHSNBoardFRUInfo      *rf.ChassisFRUInfoRF   `json:"HSNBoardFRUInfo,omitempty"`
	HMSNodeFRUInfo          *rf.SystemFRUInfoRF    `json:"NodeFRUInfo,omitempty"`
	HMSProcessorFRUInfo     *rf.ProcessorFRUInfoRF `json:"ProcessorFRUInfo,omitempty"`
	HMSNodeAccelFRUInfo     *rf.ProcessorFRUInfoRF `json:"NodeAccelFRUInfo,omitempty"`
	HMSMemoryFRUInfo        *rf.MemoryFRUInfoRF    `json:"MemoryFRUInfo,omitempty"`
	HMSDriveFRUInfo         *rf.DriveFRUInfoRF     `json:"DriveFRUInfo,omitempty"`
	HMSHSNNICFRUInfo        *rf.NAFRUInfoRF        `json:"NodeHsnNicFRUInfo,omitempty"`

	HMSPDUFRUInfo                      *rf.PowerDistributionFRUInfo `json:"PDUFRUInfo,omitempty"`
	HMSOutletFRUInfo                   *rf.OutletFRUInfo            `json:"OutletFRUInfo,omitempty"`
	HMSCMMRectifierFRUInfo             *rf.PowerSupplyFRUInfoRF     `json:"CMMRectifierFRUInfo,omitempty"`
	HMSNodeEnclosurePowerSupplyFRUInfo *rf.PowerSupplyFRUInfoRF     `json:"NodeEnclosurePowerSupplyFRUInfo,omitempty"`
	HMSNodeBMCFRUInfo                  *rf.ManagerFRUInfoRF         `json:"NodeBMCFRUInfo,omitempty"`
	HMSRouterBMCFRUInfo                *rf.ManagerFRUInfoRF         `json:"RouterBMCFRUInfo,omitempty"`
	HMSNodeAccelRiserFRUInfo           *rf.NodeAccelRiserFRUInfoRF  `json:"NodeAccelRiserFRUInfo,omitempty"`
}

func (*HWInvByFRU) DecodeFRUInfo

func (hf *HWInvByFRU) DecodeFRUInfo(fruInfoJSON []byte) error

This routine takes raw FRU info captured as free-form JSON (e.g. from a schema-free database field) and unmarshals it into the correct struct for the type with the proper type-specific name.

NOTEs: The fruInfoJSON array should be that produced by EncodeFRUInfo.

MODIFIES caller.

Return: If err != nil hf is unmodified and operation failed.

Else, the type's *FRUInfo pointer is set to the expected struct.

func (*HWInvByFRU) EncodeFRUInfo

func (hf *HWInvByFRU) EncodeFRUInfo() ([]byte, error)

This function encode's the hwinv's type-specific FRU info struct into a free-form JSON byte array that can be stored schema-less in the database.

NOTE: This function is the counterpart to DecodeFRUInfo().

Returns: FRU's info as JSON []byte representation, err = nil

Else, err != nil if encoding failed (plus, []byte value is empty)

type HWInvByLoc

type HWInvByLoc struct {
	ID      string `json:"ID"`
	Type    string `json:"Type"`
	Ordinal int    `json:"Ordinal"`
	Status  string `json:"Status"`

	// This is used as a descriminator to determine the type of *Info
	// struct that will be included below.
	HWInventoryByLocationType string `json:"HWInventoryByLocationType"`

	// One of:var ErrHMSXnameInvalid = errors.New("got HMSTypeInvalid instead of valid type")
	//    HMSType                  Underlying RF Type          How named in json object
	HMSCabinetLocationInfo       *rf.ChassisLocationInfoRF   `json:"CabinetLocationInfo,omitempty"`
	HMSChassisLocationInfo       *rf.ChassisLocationInfoRF   `json:"ChassisLocationInfo,omitempty"` // Mountain chassis
	HMSComputeModuleLocationInfo *rf.ChassisLocationInfoRF   `json:"ComputeModuleLocationInfo,omitempty"`
	HMSRouterModuleLocationInfo  *rf.ChassisLocationInfoRF   `json:"RouterModuleLocationInfo,omitempty"`
	HMSNodeEnclosureLocationInfo *rf.ChassisLocationInfoRF   `json:"NodeEnclosureLocationInfo,omitempty"`
	HMSHSNBoardLocationInfo      *rf.ChassisLocationInfoRF   `json:"HSNBoardLocationInfo,omitempty"`
	HMSNodeLocationInfo          *rf.SystemLocationInfoRF    `json:"NodeLocationInfo,omitempty"`
	HMSProcessorLocationInfo     *rf.ProcessorLocationInfoRF `json:"ProcessorLocationInfo,omitempty"`
	HMSNodeAccelLocationInfo     *rf.ProcessorLocationInfoRF `json:"NodeAccelLocationInfo,omitempty"`
	HMSMemoryLocationInfo        *rf.MemoryLocationInfoRF    `json:"MemoryLocationInfo,omitempty"`
	HMSDriveLocationInfo         *rf.DriveLocationInfoRF     `json:"DriveLocationInfo,omitempty"`
	HMSHSNNICLocationInfo        *rf.NALocationInfoRF        `json:"NodeHsnNicLocationInfo,omitempty"`

	HMSPDULocationInfo                      *rf.PowerDistributionLocationInfo `json:"PDULocationInfo,omitempty"`
	HMSOutletLocationInfo                   *rf.OutletLocationInfo            `json:"OutletLocationInfo,omitempty"`
	HMSCMMRectifierLocationInfo             *rf.PowerSupplyLocationInfoRF     `json:"CMMRectifierLocationInfo,omitempty"`
	HMSNodeEnclosurePowerSupplyLocationInfo *rf.PowerSupplyLocationInfoRF     `json:"NodeEnclosurePowerSupplyLocationInfo,omitempty"`
	HMSNodeBMCLocationInfo                  *rf.ManagerLocationInfoRF         `json:"NodeBMCLocationInfo,omitempty"`
	HMSRouterBMCLocationInfo                *rf.ManagerLocationInfoRF         `json:"RouterBMCLocationInfo,omitempty"`
	HMSNodeAccelRiserLocationInfo           *rf.NodeAccelRiserLocationInfoRF  `json:"NodeAccelRiserLocationInfo,omitempty"`

	// If status != empty, up to one of following, matching above *Info.
	PopulatedFRU *HWInvByFRU `json:"PopulatedFRU,omitempty"`
	// contains filtered or unexported fields
}

func NewHWInvByLocs

func NewHWInvByLocs(hwlocs []HWInvByLoc) ([]*HWInvByLoc, error)

Fills out and verifies HW Inventory entries coming from external sources

func (*HWInvByLoc) DecodeLocationInfo

func (hw *HWInvByLoc) DecodeLocationInfo(locInfoJSON []byte) error

This routine takes raw location info captured as free-form JSON (e.g. from a schema-free database field) and unmarshals it into the correct struct for the type with the proper type-specific name.

NOTEs: The location info should be that produced by EncodeLocationInfo.

MODIFIES caller.

Return: If err != nil hw is unmodified,

Else, the type's *LocationInfo pointer is set to the expected struct.

func (*HWInvByLoc) EncodeLocationInfo

func (hw *HWInvByLoc) EncodeLocationInfo() ([]byte, error)

This function encode's the hwinv's type-specific LocationInfo struct into a free-form JSON byte array that can be stored schema-less in the database.

NOTE: This function is the counterpart to DecodeLocationInfo().

Returns: type's location info as JSON []byte representation, err = nil

Else, err != nil if encoding failed (and location_info is empty)

type HWInvHist

type HWInvHist struct {
	ID        string `json:"ID"`        // xname location where the event happened
	FruId     string `json:"FRUID"`     // FRU ID of the affected FRU
	Timestamp string `json:"Timestamp"` // Timestamp of the event
	EventType string `json:"EventType"` // (i.e. Added, Removed, Scanned)
}

type HWInvHistArray

type HWInvHistArray struct {
	ID      string       `json:"ID"` // xname or FruId (if ByFRU)
	History []*HWInvHist `json:"History"`
}

type HWInvHistFmt

type HWInvHistFmt int
const (
	HWInvHistFmtByLoc HWInvHistFmt = iota
	HWInvHistFmtByFRU
)

type HWInvHistResp

type HWInvHistResp struct {
	Components []HWInvHistArray `json:"Components"`
}

func NewHWInvHistResp

func NewHWInvHistResp(hwHists []*HWInvHist, format HWInvHistFmt) (*HWInvHistResp, error)

Create formatted HWInvHistResp from a random array of HWInvHist entries. No sorting is done (with components of the same type), so pre/post-sort if needed.

type IPAddressMapping

type IPAddressMapping struct {
	IPAddr  string `json:"IPAddress"`
	Network string `json:"Network,omitempty"`
}

IPAddressMapping represents an IP Address to network mapping. The network field is optional

func NewIPAddressMapping

func NewIPAddressMapping(ipAddr, network string) (*IPAddressMapping, error)

Allocate and initialize new IPAddressMapping struct, validating it.

func (*IPAddressMapping) Verify

func (ipm *IPAddressMapping) Verify() error

Validate the contents of the IP Address mapping

type IPAddressMappingPatch

type IPAddressMappingPatch struct {
	Network *string `json:"Network"`
}

Patchable fields if included in payload.

type Job

type Job struct {
	JobData
	Data interface{}
}

func NewStateRFPollJob

func NewStateRFPollJob(xname string, delay, poll, lifetime, keepAlive int) (*Job, error)

type JobData

type JobData struct {
	Id         string
	Type       string
	Status     string
	LastUpdate string
	Lifetime   int
	KeepAlive  int
}

type MemberAddBody

type MemberAddBody struct {
	ID string `json:"id"` // xname
}

For POST to members endpoint to create new member

type Members

type Members struct {
	IDs []string `json:"ids"` // xname array
	// contains filtered or unexported fields
}

This just stores a list of component xname ids for now, but could grow if we need it to.

func NewMembers

func NewMembers() *Members

Create new empty members

func (*Members) Normalize

func (ms *Members) Normalize()

Normalize xnames in Members

func (*Members) Verify

func (ms *Members) Verify() error

Check ids array for xname fitneess. If no error is returned, the ids are valid.

type Membership

type Membership struct {
	ID            string   `json:"id"`
	GroupLabels   []string `json:"groupLabels"`
	PartitionName string   `json:"partitionName"`
}

type NodeMap

type NodeMap struct {
	ID       string           `json:"ID"`
	NID      int              `json:"NID"`
	Role     string           `json:"Role,omitempty"`
	SubRole  string           `json:"SubRole,omitempty"`
	NodeInfo *json.RawMessage `json:"NodeInfo,omitempty"`
}

An entry mapping a node xname to a NID

func NewNodeMap

func NewNodeMap(id, role, subRole string, nid int, nodeInfo *json.RawMessage) (*NodeMap, error)

This wraps basic RedfishEndpointDescription data with the structure used for query responses.

type NodeMapArray

type NodeMapArray struct {
	NodeMaps []*NodeMap `json:"NodeMaps"`
}

Named array of NodeMap entries, for representing a collection of them.

type Partition

type Partition struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Members     Members  `json:"members"` // List of xname ids, required.
	// contains filtered or unexported fields
}

A partition is a formal, non-overlapping division of the system that forms an administratively distinct sub-system e.g. for implementing multi-tenancy.

func NewPartition

func NewPartition(name, desc string, tags, member_ids []string) (*Partition, error)

Allocate and initialize new Group struct, validating it. This copies tags and members vs. just the pointer to the slice. If you already have a created group, you can check the inputs with group.Verify()

func (*Partition) Normalize

func (p *Partition) Normalize()

Lowercase field names and normalize xnames in Members.

func (*Partition) Verify

func (p *Partition) Verify() error

Check input fields of a group. If no error is returned, the result should be ok to put into the database.

type PartitionPatch

type PartitionPatch struct {
	Description *string   `json:"description"`
	Tags        *[]string `json:"tags"`
}

Patchable fields if included in payload.

func (*PartitionPatch) Normalize

func (pp *PartitionPatch) Normalize()

Normalize PartitionPatch (just lower case tags, basically, but keeping same interface as others.

func (*PartitionPatch) Verify

func (pp *PartitionPatch) Verify() error

Analgous Verify call for PartitionPatch objects.

type PowerMap

type PowerMap struct {
	ID        string   `json:"id"`
	PoweredBy []string `json:"poweredBy,omitempty"`
}

An entry mapping an xname to a power supplies

func NewPowerMap

func NewPowerMap(id string, poweredBy []string) (*PowerMap, error)

This wraps basic PowerMap data with the structure used for query responses.

type RedfishEndpoint

type RedfishEndpoint struct {
	// Embedded struct
	rf.RedfishEPDescription

	ComponentEndpoints []*ComponentEndpoint `json:"ComponentEndpoints,omitempty"`
	ServiceEndpoints   []*ServiceEndpoint   `json:"ServiceEndpoints,omitempty"`
}

Representation of a RedfishEndpoint, a network endpoint running a Redfish entry point

func NewRedfishEndpoint

func NewRedfishEndpoint(epd *rf.RedfishEPDescription) *RedfishEndpoint

This wraps basic RedfishEndpointDescription data with the structure used for query responses.

type RedfishEndpointArray

type RedfishEndpointArray struct {
	RedfishEndpoints []*RedfishEndpoint `json:"RedfishEndpoints"`
}

A collection of 0-n RedfishEndpoints. It could just be an ordinary array but we want to save the option to have indentifying info, etc. packaged with it, e.g. the query parameters or options that produced it, especially if there are fewer fields than normal being included.

func (*RedfishEndpointArray) GetResourceURIArray

func (eps *RedfishEndpointArray) GetResourceURIArray(uriBase string) []*ResourceURI

From a given RedfishEndpointArray, return a ResourceURI array using the endpoint IDs appended to the base path uriBase (which should NOT end in '/').

type RedfishEndpointPatch

type RedfishEndpointPatch struct {
	ID             *string `json:"ID"`
	Type           *string `json:"Type"`
	Name           *string `json:"Name"`
	Hostname       *string `json:"Hostname"`
	Domain         *string `json:"Domain"`
	FQDN           *string `json:"FQDN"`
	Enabled        *bool   `json:"Enabled"`
	UUID           *string `json:"UUID"`
	User           *string `json:"User"`
	Password       *string `json:"Password"`
	UseSSDP        *bool   `json:"UseSSDP"`
	MACRequired    *bool   `json:"MACRequired"`
	MACAddr        *string `json:"MACAddr"`
	IPAddr         *string `json:"IPAddress"`
	RediscOnUpdate *bool   `json:"RediscoverOnUpdate"`
	TemplateID     *string `json:"TemplateID"`
}

RedfishEndpointPatch is just rf.RedfishEPDescription but everything is a pointer.

type ResourceURI

type ResourceURI struct {
	URI string `json:"URI"`
}

This is a generic link to a resource owned by state manager, i.e. a GET on this URI will return the expected resource.

type SCNPatchSubscription

type SCNPatchSubscription struct {
	Op             string   `json:"Op"`
	Enabled        *bool    `json:"Enabled,omitempty"`
	Roles          []string `json:"Roles,omitempty"`
	SubRoles       []string `json:"SubRoles,omitempty"`
	SoftwareStatus []string `json:"SoftwareStatus,omitempty"`
	States         []string `json:"States,omitempty"`
}

type SCNPayload

type SCNPayload struct {
	Components     []string `json:"Components"`
	Enabled        *bool    `json:"Enabled,omitempty"`
	Flag           string   `json:"Flag,omitempty"`
	Role           string   `json:"Role,omitempty"`
	SubRole        string   `json:"SubRole,omitempty"`
	SoftwareStatus string   `json:"SoftwareStatus,omitempty"`
	State          string   `json:"State,omitempty"`
}

type SCNPostSubscription

type SCNPostSubscription struct {
	Subscriber     string   `json:"Subscriber"`
	Enabled        *bool    `json:"Enabled,omitempty"`
	Roles          []string `json:"Roles,omitempty"`
	SubRoles       []string `json:"SubRoles,omitempty"`
	SoftwareStatus []string `json:"SoftwareStatus,omitempty"`
	States         []string `json:"States,omitempty"`
	Url            string   `json:"Url"`
}

type SCNSubscription

type SCNSubscription struct {
	ID             int64    `json:"ID"`
	Subscriber     string   `json:"Subscriber"`
	Enabled        *bool    `json:"Enabled,omitempty"`
	Roles          []string `json:"Roles,omitempty"`
	SubRoles       []string `json:"SubRoles,omitempty"`
	SoftwareStatus []string `json:"SoftwareStatus,omitempty"`
	States         []string `json:"States,omitempty"`
	Url            string   `json:"Url"`
}

type SCNSubscriptionArray

type SCNSubscriptionArray struct {
	SubscriptionList []SCNSubscription `json:"SubscriptionList"`
}

type SMEvent

type SMEvent struct {
	EventType    string `json:"EventType"`
	EventSubtype string `json:"EventSubtype"`

	// At least one of, as per event type:
	ComponentArray       *base.ComponentArray  `json:"ComponentArray,omitempty"`
	HWInventory          *SystemHWInventory    `json:"HWInventory,omitempty"`
	RedfishEndpointArray *RedfishEndpointArray `json:"RedfishEndpointArray,omitempty"`
}

type SMEventArray

type SMEventArray struct {
	Name      string     `json:"Name,omitempty"`
	Version   string     `json:"Version"`
	Timestamp string     `json:"Timestamp"`
	Events    []*SMEvent `json:"Events"`
}

type SMEventSubtype

type SMEventSubtype string
const (
	StateTransitionOK       SMEventSubtype = "StateTransitionOK"       // StateChange - Successful state change
	StateTransitionAbnormal SMEventSubtype = "StateTransitionAbnormal" // StateChange - Change due to problem, warn/alert
	StateTransitionDisable  SMEventSubtype = "StateTransitionDisable"  // StateChange
	StateTransitionEnable   SMEventSubtype = "StateTransitionEnable"   // StateChange
	NodeAvailable           SMEventSubtype = "NodeAvailable"           // NodeStateChange
	NodeUnavailable         SMEventSubtype = "NodeUnavailable"         // NodeStateChange
	NodeFailed              SMEventSubtype = "NodeFailed"              // NodeStateChange
	NodeStandby             SMEventSubtype = "NodeStandby"             // NodeStateChange
	NodeRoleChanged         SMEventSubtype = "NodeRoleChanged"         // NodeStateChange
	NodeSubRoleChanged      SMEventSubtype = "NodeSubRoleChanged"      // NodeStateChange
	NodeNIDChanged          SMEventSubtype = "NodeNIDChanged"          // NodeStateChange
	RedfishEndpointAdded    SMEventSubtype = "RedfishEndpointAdded"    // RedfishEndpointChange
	RedfishEndpointModified SMEventSubtype = "RedfishEndpointModified" // RedfishEndpointChange
	RedfishEndpointEnabled  SMEventSubtype = "RedfishEndpointEnabled"  // RedfishEndpointChange
	RedfishEndpointDisabled SMEventSubtype = "RedfishEndpointDisabled" // RedfishEndpointChange
	RedfishEndpointRemoved  SMEventSubtype = "RedfishEndpointRemoved"  // RedfishEndpointChange
	HWInventoryAdded        SMEventSubtype = "HWInventoryAdded"        // HWInventoryChange
	HWInventoryModifed      SMEventSubtype = "HWInventoryModified"     // HWInventoryChange
	HWInventoryRemoved      SMEventSubtype = "HWInventoryRemoved"      // HWInventoryChange
)

type SMEventType

type SMEventType string
const (
	NodeStateChange       SMEventType = "NodeStateChange"
	StateChange           SMEventType = "StateChange"
	RedfishEndpointChange SMEventType = "RedfishEndpointChange"
	HWInventoryChange     SMEventType = "HWInventoryChange"
)

type SMPatchOp

type SMPatchOp int
const (
	PatchOpInvalid SMPatchOp = 0
	PatchOpAdd     SMPatchOp = 1
	PatchOpRemove  SMPatchOp = 2
	PatchOpReplace SMPatchOp = 3
)

func GetPatchOp

func GetPatchOp(op string) SMPatchOp

type ServiceEndpoint

type ServiceEndpoint struct {
	// Embedded struct
	rf.ServiceDescription

	// These are read-only, derived from associated RfEndpointId in
	// rf.ServiceDescription
	RfEndpointFQDN string `json:"RedfishEndpointFQDN"`
	URL            string `json:"RedfishURL"`

	// These are all stored in the same JSON blob, only one of these
	// one of these will be set, based on the value of RedfishType
	ServiceInfo json.RawMessage `json:"ServiceInfo,omitempty"`
}

type ServiceEndpointArray

type ServiceEndpointArray struct {
	ServiceEndpoints []*ServiceEndpoint `json:"ServiceEndpoints"`
}

A collection of 0-n ComponentEndpoints. It could just be an ordinary array but we want to save the option to have indentifying info, etc. packaged with it, e.g. the query parameters or options that produced it, especially if there are fewer fields than normal being included.

type SrfpJobData

type SrfpJobData struct {
	CompId string
	Delay  int
	Poll   int
}

type SystemHWInventory

type SystemHWInventory struct {
	XName  string
	Format string
	// contains filtered or unexported fields
}

This is a top-level hardware inventory. We can do a flat mapping where every component tracked is its own top-level array, a completely hierarchical mapping (since the entry for a component can contain it's own set of hmsTypeArrays), or some combination (such as node subcomponents being nested, but not higher-level components).

func NewSystemHWInventory

func NewSystemHWInventory(hwlocs []*HWInvByLoc, xName, format string) (*SystemHWInventory, error)

Create formatted SystemHWInventory from a random array of HWInvByLoc entries. No sorting is done (with components of the same type), so pre/post-sort if needed. Note: entries in *HWInvByLoc are not copied if modified. Child entries will be appended if format is not FullyFlat, but otherwise no changes will be made.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL