Documentation
¶
Overview ¶
MIT License
(C) Copyright 2018-2023 Hewlett Packard Enterprise Development LP
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- func ControllerHasChassis(hmsType HMSType) bool
- func ControllerHasChassisStr(hmsTypeStr string) bool
- func ControllerHasSystems(hmsType HMSType) bool
- func ControllerHasSystemsStr(hmsTypeStr string) bool
- func GetHMSCompParent(xname string) string
- func GetHMSCompRecognitionTable() map[string]HMSCompRecognitionEntry
- func GetHMSTypeFormatString(hmsType HMSType) (string, int, error)
- func GetHMSTypeList() []string
- func GetHMSTypeRegex(hmsType HMSType) (*regexp.Regexp, error)
- func GetHMSTypeString(xname string) string
- func IsHMSCompIDValid(xname string) bool
- func IsHMSTypeContainer(hmsType HMSType) bool
- func IsHMSTypeController(hmsType HMSType) bool
- func IsHMSTypeStrContainer(hmsTypeStr string) bool
- func IsHMSTypeStrController(hmsTypeStr string) bool
- func NormalizeHMSCompID(xname string) string
- func RemoveLeadingZeros(s string) string
- func ValidateCompIDs(compIDs []string, dupsValid bool) ([]string, []string)
- func VerifyNormalizeCompID(idStr string) string
- func VerifyNormalizeType(typeStr string) string
- type HMSCompRecognitionEntry
- type HMSType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ControllerHasChassis ¶
Normally every controller should has 1+ Chassis, but certain special types may not, and we don't use them if even if they are there.
func ControllerHasChassisStr ¶
String version of above.
func ControllerHasSystems ¶
Returns whether hmsType does not expect System collections to be present, or if so, non-empty.
func ControllerHasSystemsStr ¶
String version of above.
func GetHMSCompParent ¶
Given a properly formatted xname, get its immediate parent.
i.e. x0c0s22b11 would become x0c0s22
func GetHMSCompRecognitionTable ¶
func GetHMSCompRecognitionTable() map[string]HMSCompRecognitionEntry
func GetHMSTypeFormatString ¶
GetHMSTypeFormatString for a given HMSType will return the corresponding fmt.Sprintf compatible format string, and the number of verbs are required for the format string.
func GetHMSTypeList ¶
func GetHMSTypeList() []string
func GetHMSTypeRegex ¶
GetHMSTypeRegex for a given HMSType will return the regular expression that matches to match xnames of that HMSType.
func GetHMSTypeString ¶
Get the HMSType for a given xname, based on its pattern in the recognition table above (string version). If no type matches, the empty string is returned.
func IsHMSCompIDValid ¶
Returns true if xname is valid, i.e. matches some format for a valid HMS component type. False if it is invalid.
func IsHMSTypeContainer ¶
Returns whether hmsType is a container type, i.e. that contains other components but is not a logical type (i.e. Node, that may or may not be a discrete hardware module), or a specialized terminal subcomponent (HSNAsic, Processor, etc.)
NOTE: This is used specifically for Redfish "Chassis" components. so non-Chassis (e.g. PDUs) don't apply (different type, outlets are not really separate physical pieces)
func IsHMSTypeController ¶
Returns whether hmsType is a controller type, i.e. that would host a Redfish entry point
func IsHMSTypeStrContainer ¶
Returns whether hmsTypeStr matches a container type, i.e. that contains other components but is not a logical type (i.e. Node, that may or may not be a discrete hardware module), or a specialized terminal subcomponent (HSNAsic, Processor, etc.)
func IsHMSTypeStrController ¶
Returns whether hmsTypeStr matches a controller type, i.e. that would host a Redfish entry point
func NormalizeHMSCompID ¶
This lower-cases the xname id does other normalization so we always represent the same location with the same string. NOTE: this does not validate the xname, so do not use it to see if it is valid. However, any string post normalization should still be as invalid or valid as an xname as it was prior to this call.
func RemoveLeadingZeros ¶ added in v1.0.1
Remove leading zeros, i.e. for each run of numbers, trim off leading zeros so each run starts with either non-zero, or is a single zero. This has been duplicated from hms-base, but it allows the packages to be independent.
func ValidateCompIDs ¶
ValidateCompIDs validates an array of component IDs (xnames) into valid and invalid arrays optionally adding duplicates to the invalid array or discarding them.
func VerifyNormalizeCompID ¶
Returns the given xname ID string (adjusting for any capitalization and whitespace and leading zero differences) if a valid xname was given. Else, return the empty string.
func VerifyNormalizeType ¶
Returns the given HMS type string (adjusting any capitalization differences), if a valid HMS component type was given. Else, return the empty string.
Types ¶
type HMSCompRecognitionEntry ¶
type HMSType ¶
type HMSType string
const ( CDU HMSType = "CDU" // dD CDUMgmtSwitch HMSType = "CDUMgmtSwitch" // dDwW CabinetCDU HMSType = "CabinetCDU" // xXdD Cabinet HMSType = "Cabinet" // xX CabinetBMC HMSType = "CabinetBMC" // xXbB CabinetPDUController HMSType = "CabinetPDUController" // xXmM CabinetPDU HMSType = "CabinetPDU" // xXmMpP CabinetPDUNic HMSType = "CabinetPDUNic" // xXmMiI CabinetPDUOutlet HMSType = "CabinetPDUOutlet" // xXmMpPjJ DEPRECATED CabinetPDUPowerConnector HMSType = "CabinetPDUPowerConnector" // xXmMpPvV Chassis HMSType = "Chassis" // xXcC ChassisBMC HMSType = "ChassisBMC" // xXcCbB ChassisBMCNic HMSType = "ChassisBMCNic" // xXcCbBiI CMMRectifier HMSType = "CMMRectifier" // xXcCtT CMMFpga HMSType = "CMMFpga" // xXcCfF CEC HMSType = "CEC" // xXeE ComputeModule HMSType = "ComputeModule" // xXcCsS RouterModule HMSType = "RouterModule" // xXcCrR NodeBMC HMSType = "NodeBMC" // xXcCsSbB NodeBMCNic HMSType = "NodeBMCNic" // xXcCsSbBiI NodeEnclosure HMSType = "NodeEnclosure" // xXcCsSeE NodeEnclosurePowerSupply HMSType = "NodeEnclosurePowerSupply" // xXcCsSeEtT NodePowerConnector HMSType = "NodePowerConnector" // xXcCsSjJ Node HMSType = "Node" // xXcCsSbBnN VirtualNode HMSType = "VirtualNode" // xXcCsSbBnNvV Processor HMSType = "Processor" // xXcCsSbBnNpP StorageGroup HMSType = "StorageGroup" // xXcCsSbBnNgG Drive HMSType = "Drive" // xXcCsSbBnNgGkK NodeNic HMSType = "NodeNic" // xXcCsSbBnNiI NodeHsnNic HMSType = "NodeHsnNic" // xXcCsSbBnNhH Memory HMSType = "Memory" // xXcCsSbBnNdD NodeAccel HMSType = "NodeAccel" // xXcCsSbBnNaA NodeAccelRiser HMSType = "NodeAccelRiser" // xXcCsSbBnNrR NodeFpga HMSType = "NodeFpga" // xXcCsSbBfF HSNAsic HMSType = "HSNAsic" // xXcCrRaA RouterFpga HMSType = "RouterFpga" // xXcCrRfF RouterTOR HMSType = "RouterTOR" // xXcCrRtT RouterTORFpga HMSType = "RouterTORFpga" // xXcCrRtTfF RouterBMC HMSType = "RouterBMC" // xXcCrRbB RouterBMCNic HMSType = "RouterBMCNic" // xXcCrRbBiI RouterPowerConnector HMSType = "RouterPowerConnector" // xXcCrRvV HSNBoard HMSType = "HSNBoard" // xXcCrReE HSNLink HMSType = "HSNLink" // xXcCrRaAlL HSNConnector HMSType = "HSNConnector" // xXcCrRjJ HSNConnectorPort HMSType = "HSNConnectorPort" // xXcCrRjJpP MgmtSwitch HMSType = "MgmtSwitch" // xXcCwW MgmtHLSwitchEnclosure HMSType = "MgmtHLSwitchEnclosure" // xXcChH MgmtHLSwitch HMSType = "MgmtHLSwitch" // xXcChHsS MgmtSwitchConnector HMSType = "MgmtSwitchConnector" // xXcCwWjJ // Special types and wildcards SMSBox HMSType = "SMSBox" // smsN Partition HMSType = "Partition" // pH.S System HMSType = "System" // s0 HMSTypeAll HMSType = "All" // all HMSTypeAllComp HMSType = "AllComp" // all_comp HMSTypeAllSvc HMSType = "AllSvc" // all_svc HMSTypeInvalid HMSType = "INVALID" // Not a valid type/xname )
This is an enum (though they have no numeric values in ReST and we don't want to store them that way since we could get bit by renumbering. the down-side is that we will have to normalize capitalization differences. This isn't a huge problem since the type field should only be modified by discovery. It shouldn't be changed by the user, since it must map to a corresponding cname and we can't change its hierarchical relationship.
func GetHMSType ¶
Get the HMSType for a given xname, based on its pattern in the recognition table above. If no string matches, HMSTypeInvalid is returned.