Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigureSLSMode(mSlsUrl string, client *http.Client, secStorage *sstorage.SecureStorage, ...)
- func GetSwitchPorts(switchName string) (*([](SwitchPort)), error)
- func GetSwitches() (*(map[string](Switch)), error)
- func OnNewMapping(cb CallbackFunc)
- func SetStorage(mstorage storage.Storage, ss sstorage.SecureStorage)
- func SwitchPortToXname(switchName string, port string) (*string, error)
- func WatchSLSNewManagementNodes(quitChan chan bool)
- func WatchSLSNewSwitches(quitChan chan bool)
- type CallbackFunc
- type GenericHardware
- type Mapping
- type Switch
- type SwitchPort
Constants ¶
const SLS_SEARCH_HARDWARE_ENDPOINT = "search/hardware"
const VaultURLPrefix = "vault://"
Variables ¶
var ErrNoSuchObject = errors.New("No object found with that name")
var MGMTSwitchConnectorRegex = regexp.MustCompile("^x([0-9]{1,4})c([0-7])w([0-9]+)j([1-9][0-9]*)$")
var Running = true
Functions ¶
func ConfigureSLSMode ¶
func ConfigureSLSMode(mSlsUrl string, client *http.Client, secStorage *sstorage.SecureStorage, ccreds *compcredentials.CompCredStore, svcName string)
ConfigreSLSMode enables querying the mapping from SLS, rather than using a local mapping. Calling this function changes the mode of the mapping module and cannot be undone, except by restarting REDS.
func GetSwitchPorts ¶
func GetSwitchPorts(switchName string) (*([](SwitchPort)), error)
func GetSwitches ¶
func OnNewMapping ¶
func OnNewMapping(cb CallbackFunc)
func SetStorage ¶
func SetStorage(mstorage storage.Storage, ss sstorage.SecureStorage)
Sets the conenction to the permenent storage. Call once before anything else. Will automatically try to reload the mapping.
func SwitchPortToXname ¶
A function that translates from (switch, port) to the xname of the device on the other end. Arguments: - switchName (string): the name of the switch to look up - port (string): the name of the port on the switch to look up Returns: - *string: The xname of the device or nil if an error occurred - error: any error that occurred during lookup (or nil)
func WatchSLSNewManagementNodes ¶
func WatchSLSNewManagementNodes(quitChan chan bool)
Look for new management nodes appearing in SLS by periodically querying node list and comparing.
func WatchSLSNewSwitches ¶
func WatchSLSNewSwitches(quitChan chan bool)
Look for new switches appearing in SLS by periodically querying switch list and comparing
Types ¶
type CallbackFunc ¶
type CallbackFunc func()
Used to notify that a new mapping is available. Ensure thread safety!
type GenericHardware ¶
type GenericHardware struct { Parent string `json:"Parent"` Children []string `json:"Children"` Xname string `json:"Xname"` Type string `json:"Type"` Class string `json:"Class"` TypeString base.HMSType `json:"TypeString"` ExtraPropertiesRaw interface{} `json:"ExtraProperties"` }
func GetConnectorsByBMC ¶
func GetConnectorsByBMC(xname string) ([]GenericHardware, error)
func GetManagementNodes ¶
func GetManagementNodes() ([]GenericHardware, error)
type Switch ¶
type Switch struct { Id string `json:"id"` Address string `json:"address"` SnmpUser string `json:"snmpUser"` SnmpAuthPassword string `json:"snmpAuthPassword"` SnmpAuthProtocol string `json:"snmpAuthProtocol"` SnmpPrivPassword string `json:"snmpPrivPassword"` SnmpPrivProtocol string `json:"snmpPrivProtocol"` Model string `json:"model"` }
func GetSwitchByName ¶
type SwitchPort ¶
type SwitchPort struct { Id int `json:"id"` IfName string `json:"ifName"` PeerID string `json:"peerID"` }
External data structures
func GetSwitchPortByIFName ¶
func GetSwitchPortByIFName(switchName string, port string) (*SwitchPort, error)