smd

package
v0.0.0-...-0e97e64 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedfishRouter

func NewRedfishRouter(storage RedfishEndpointStorage) chi.Router

func NewRouter

func NewRouter(storage SMDStorage) chi.Router

func SMDComponentRoutes

func SMDComponentRoutes(storage SMDStorage, authMiddlewares []func(http.Handler) http.Handler) chi.Router

Types

type BootParams

type BootParams struct {
	Hosts     []string  `json:"hosts,omitempty"`
	Macs      []string  `json:"macs,omitempty"`
	Nids      []int32   `json:"nids,omitempty"`
	Params    string    `json:"params,omitempty"`
	Kernel    string    `json:"kernel,omitempty"`
	Initrd    string    `json:"initrd,omitempty"`
	CloudInit CloudInit `json:"cloud-init,omitempty"`
}

This is the main data structure used to communicate with the client. It allows the client to set parameters along the with kernel and initrd references. It is also used to return boot info to the user. The expected usage is that one of arrays hosts, macs, or nids is used to specify the hosts for booting. We could also allow special names for hosts such as "compute" or "service" meaning all nodes of those categories, or we could introduce an additional property for this type of selection. We also provide a "default" selection which provides a way to supply default parameters for any node which is not explicitly configured.

type CloudDataType

type CloudDataType map[string]interface{}

The main cloud-init struct. Leave the meta-data, user-data, and phone home info as generic interfaces as the user defines how much info exists in it

type CloudInit

type CloudInit struct {
	MetaData  CloudDataType `json:"meta-data"`
	UserData  CloudDataType `json:"user-data"`
	PhoneHome PhoneHome     `json:"phone-home,omitempty"`
}

type CompEthInterface

type CompEthInterface 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"`
}

CompEthInterface represents the SMD version of a network interface

type Component

type Component struct {
	UID                 uuid.UUID        `json:"UID,omitempty" db:"uid"`
	ID                  string           `json:"ID" db:"id" jsonschema:"description=Xname"`
	Type                ComponentType    `json:"Type" db:"type"`
	Subtype             string           `json:"Subtype,omitempty" db:"subtype"`
	Role                ComponentRole    `json:"Role,omitempty" db:"role"`
	SubRole             ComponentSubRole `json:"SubRole,omitempty" db:"sub_role"`
	NetType             ComponentNetType `json:"NetType,omitempty" db:"net_type"`
	Arch                ComponentArch    `json:"Arch,omitempty" db:"arch"`
	Class               ComponentClass   `json:"Class,omitempty" db:"class"`
	State               ComponentState   `json:"State,omitempty" db:"state"`
	Flag                ComponentFlag    `json:"Flag,omitempty" db:"flag"`
	Enabled             bool             `json:"Enabled,omitempty" db:"enabled"`
	SwStatus            string           `json:"SoftwareStatus,omitempty" db:"sw_status"`
	NID                 int              `json:"NID,omitempty" db:"nid"`
	ReservationDisabled bool             `json:"ReservationDisabled,omitempty" db:"reservation_disabled"`
	Locked              bool             `json:"Locked,omitempty" db:"locked"`
}

Component represents a CSM Component

type ComponentArch

type ComponentArch string
const (
	ArchX86     ComponentArch = "X86"
	ArchARM     ComponentArch = "ARM"
	ArchUnknown ComponentArch = "UNKNOWN"
	ArchOther   ComponentArch = "Other"
)

func (ComponentArch) JSONSchema

func (ComponentArch) JSONSchema() *jsonschema.Schema

type ComponentClass

type ComponentClass string
const (
	ClassRiver    ComponentClass = "River"
	ClassMountain ComponentClass = "Mountain"
	ClassHill     ComponentClass = "Hill"
	ClassOther    ComponentClass = "Other"
)

func (ComponentClass) JSONSchema

func (ComponentClass) JSONSchema() *jsonschema.Schema

type ComponentFlag

type ComponentFlag string
const (
	FlagUnknown ComponentFlag = "Unknown"
	FlagOK      ComponentFlag = "OK"      // Functioning properly
	FlagWarning ComponentFlag = "Warning" // Continues to operate, but has an issue that may require attention.
	FlagAlert   ComponentFlag = "Alert"   // No longer operating as expected.  The state may also have changed due to error.
	FlagLocked  ComponentFlag = "Locked"  // Another service has reserved this component.
)

Valid flag values.

func (ComponentFlag) JSONSchema

func (ComponentFlag) JSONSchema() *jsonschema.Schema

type ComponentNetType

type ComponentNetType string
const (
	NetSling      ComponentNetType = "Sling"
	NetInfiniband ComponentNetType = "Infiniband"
	NetEthernet   ComponentNetType = "Ethernet"
	NetOEM        ComponentNetType = "OEM" // Placeholder for non-slingshot
	NetNone       ComponentNetType = "None"
)

func (ComponentNetType) JSONSchema

func (ComponentNetType) JSONSchema() *jsonschema.Schema

type ComponentRole

type ComponentRole string
const (
	RoleCompute     ComponentRole = "Compute"
	RoleService     ComponentRole = "Service"
	RoleSystem      ComponentRole = "System"
	RoleApplication ComponentRole = "Application"
	RoleStorage     ComponentRole = "Storage"
	RoleManagement  ComponentRole = "Management"
)

Valid role values.

func (ComponentRole) JSONSchema

func (ComponentRole) JSONSchema() *jsonschema.Schema

type ComponentState

type ComponentState string

ComponentState represents the state of an CSM component

const (
	StateUnknown   ComponentState = "Unknown"   // The State is unknown.  Appears missing but has not been confirmed as empty.
	StateEmpty     ComponentState = "Empty"     // The location is not populated with a component
	StatePopulated ComponentState = "Populated" // Present (not empty), but no further track can or is being done.
	StateOff       ComponentState = "Off"       // Present but powered off
	StateOn        ComponentState = "On"        // Powered on.  If no heartbeat mechanism is available, its software state may be unknown.

	StateStandby ComponentState = "Standby" // No longer Ready and presumed dead.  It typically means HB has been lost (w/alert).
	StateHalt    ComponentState = "Halt"    // No longer Ready and halted.  OS has been gracefully shutdown or panicked (w/ alert).
	StateReady   ComponentState = "Ready"   // Both On and Ready to provide its expected services, i.e. used for jobs.
)

func (ComponentState) JSONSchema

func (ComponentState) JSONSchema() *jsonschema.Schema

type ComponentSubRole

type ComponentSubRole string
const (
	SubRoleMaster  ComponentSubRole = "Master"
	SubRoleWorker  ComponentSubRole = "Worker"
	SubRoleStorage ComponentSubRole = "Storage"
)

Valid SubRole values.

func (ComponentSubRole) JSONSchema

func (ComponentSubRole) JSONSchema() *jsonschema.Schema

type ComponentType

type ComponentType string
const (
	TypeCDU                      ComponentType = "CDU"
	TypeCabinetCDU               ComponentType = "CabinetCDU"
	TypeCabinetPDU               ComponentType = "CabinetPDU"
	TypeCabinetPDUOutlet         ComponentType = "CabinetPDUOutlet"
	TypeCabinetPDUPowerConnector ComponentType = "CabinetPDUPowerConnector"
	TypeCabinetPDUController     ComponentType = "CabinetPDUController"
	TypeCabinet                  ComponentType = "Cabinet"
	TypeChassis                  ComponentType = "Chassis"
	TypeChassisBMC               ComponentType = "ChassisBMC"
	TypeCMMRectifier             ComponentType = "CMMRectifier"
	TypeCMMFpga                  ComponentType = "CMMFpga"
	TypeCEC                      ComponentType = "CEC"
	TypeComputeModule            ComponentType = "ComputeModule"
	TypeRouterModule             ComponentType = "RouterModule"
	TypeNodeBMC                  ComponentType = "NodeBMC"
	TypeNodeEnclosure            ComponentType = "NodeEnclosure"
	TypeNodeEnclosurePowerSupply ComponentType = "NodeEnclosurePowerSupply"
	TypeHSNBoard                 ComponentType = "HSNBoard"
	TypeMgmtSwitch               ComponentType = "MgmtSwitch"
	TypeMgmtHLSwitch             ComponentType = "MgmtHLSwitch"
	TypeCDUMgmtSwitch            ComponentType = "CDUMgmtSwitch"
	TypeNode                     ComponentType = "Node"
	TypeVirtualNode              ComponentType = "VirtualNode"
	TypeProcessor                ComponentType = "Processor"
	TypeDrive                    ComponentType = "Drive"
	TypeStorageGroup             ComponentType = "StorageGroup"
	TypeNodeNIC                  ComponentType = "NodeNIC"
	TypeMemory                   ComponentType = "Memory"
	TypeNodeAccel                ComponentType = "NodeAccel"
	TypeNodeAccelRiser           ComponentType = "NodeAccelRiser"
	TypeNodeFpga                 ComponentType = "NodeFpga"
	TypeHSNAsic                  ComponentType = "HSNAsic"
	TypeRouterFpga               ComponentType = "RouterFpga"
	TypeRouterBMC                ComponentType = "RouterBMC"
	TypeHSNLink                  ComponentType = "HSNLink"
	TypeHSNConnector             ComponentType = "HSNConnector"
	TypeINVALID                  ComponentType = "INVALID"
)

func (ComponentType) JSONSchema

func (ComponentType) JSONSchema() *jsonschema.Schema

type DiscoveryInfo

type DiscoveryInfo struct {
	LastAttempt    time.Time `` /* 131-byte string literal not displayed */
	LastStatus     string    `` /* 275-byte string literal not displayed */
	RedfishVersion string    `json:"RedfishVersion,omitempty" jsonschema:"description=Version of Redfish as reported by the RF service root,readOnly=true"`
}

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

type PhoneHome

type PhoneHome struct {
	PublicKeyDSA     string `form:"pub_key_dsa" json:"pub_key_dsa" binding:"omitempty"`
	PublicKeyRSA     string `form:"pub_key_rsa" json:"pub_key_rsa" binding:"omitempty"`
	PublicKeyECDSA   string `form:"pub_key_ecdsa" json:"pub_key_ecdsa" binding:"omitempty"`
	PublicKeyED25519 string `form:"pub_key_ed25519" json:"pub_key_ed25519,omitempty"`
	InstanceID       string `form:"instance_id" json:"instance_id" binding:"omitempty"`
	Hostname         string `form:"hostname" json:"hostname" binding:"omitempty"`
	FQDN             string `form:"fqdn" json:"fqdn" binding:"omitempty"`
}

type RedfishDiscovery

type RedfishDiscovery struct {
	EntrypointID string          `json:"EntrypointID,omitempty" jsonschema:"description=ID of the entrypoint that was used to discover the endpoint"`
	UID          uuid.UUID       `json:"UID,omitempty" jsonschema:"$ref=#/definitions/UUID.1.0.0"`
	URI          string          `json:"EndpointID,omitempty" jsonschema:"description=ID of the endpoint that was discovered"`
	Attempted    time.Time       `json:"Attempted,omitempty" jsonschema:"description=Time the discovery was started,format=date-time"`
	Completed    time.Time       `json:"Completed,omitempty" jsonschema:"description=Time the discovery was completed,format=date-time"`
	Status       string          `` /* 252-byte string literal not displayed */
	Payload      RedfishEndpoint `json:"Payload,omitempty" jsonschema:"description=The discovered endpoint"`
}

type RedfishEndpoint

type RedfishEndpoint struct {
	ID                 string        `json:"ID" jsonschema:"description=HMS Logical component type e.g. NodeBMC, ChassisBMC.,$ref=#/definitions/HMSType.1.0.0"`
	Type               ComponentType `json:"Type,omitempty"`
	Name               string        `` /* 168-byte string literal not displayed */
	Hostname           string        `` /* 255-byte string literal not displayed */
	Domain             string        `` /* 167-byte string literal not displayed */
	FQDN               string        `` /* 183-byte string literal not displayed */
	Enabled            bool          `` /* 150-byte string literal not displayed */
	URI                string        `json:"URI,omitempty" jsonschema:"description=URI of the Redfish service root"`
	UID                uuid.UUID     `json:"UUID,omitempty" jsonschema:"$ref=#/definitions/UUID.1.0.0"`
	User               string        `json:"User,omitempty" jsonschema:"description=Username to use when interrogating endpoint"`
	Password           string        `` /* 126-byte string literal not displayed */
	UseSSDP            bool          `json:"UseSSDP,omitempty" jsonschema:"description=Whether to use SSDP for discovery if the EP supports it."`
	MacRequired        bool          `` /* 322-byte string literal not displayed */
	MACAddr            string        `` /* 383-byte string literal not displayed */
	IPAddress          string        `` /* 255-byte string literal not displayed */
	RediscoverOnUpdate bool          `json:"RediscoverOnUpdate,omitempty" jsonschema:"description=Trigger a rediscovery when endpoint info is updated."`
	TemplateID         string        `` /* 130-byte string literal not displayed */
	DiscoveryInfo      DiscoveryInfo `` /* 132-byte string literal not displayed */
}

type RedfishEndpointStorage

type RedfishEndpointStorage interface {
	GetRedfishEndpoints() ([]RedfishEndpoint, error)
	GetRedfishEndpointByID(id string) (RedfishEndpoint, error)
	CreateorUpdateRedfishDiscoveryLog(log RedfishDiscovery) error
	GetRedfishDiscoveryLogByEndpointID(id string) ([]RedfishDiscovery, error)
	GetRedfishDiscoveryLogByURI(uri string) ([]RedfishDiscovery, error)
	CreateOrUpdateRedfishEndpoints(endpoints []RedfishEndpoint) error
	DeleteRedfishEndpointByID(id string) error
}

type SMDStorage

type SMDStorage interface {
	GetComponents() ([]Component, error)
	GetComponentByXname(xname string) (Component, error)
	GetComponentByNID(nid int) (Component, error)
	GetComponentByUID(uid uuid.UUID) (Component, error)
	QueryComponents(xname string, params map[string]string) ([]Component, error)
	CreateOrUpdateComponents(components []Component) error
	DeleteComponents() error
	DeleteComponentByXname(xname string) error
	UpdateComponentData(xnames []string, data map[string]interface{}) error
}

type ValidationErrorResponse

type ValidationErrorResponse struct {
	Message string `json:"message"`
}

ValidationErrorResponse represents a detailed error response

Jump to

Keyboard shortcuts

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