mapping

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const SLS_SEARCH_HARDWARE_ENDPOINT = "search/hardware"
View Source
const VaultURLPrefix = "vault://"

Variables

View Source
var ErrNoSuchObject = errors.New("No object found with that name")
View Source
var MGMTSwitchConnectorRegex = regexp.MustCompile("^x([0-9]{1,4})c([0-7])w([0-9]+)j([1-9][0-9]*)$")
View Source
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 GetSwitches() (*(map[string](Switch)), error)

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

func SwitchPortToXname(switchName string, port string) (*string, error)

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 Mapping

type Mapping struct {
	Version int `json:"version"`
}

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

func GetSwitchByName(switchName string) (*Switch, error)

func (Switch) String

func (s Switch) String() string

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)

Jump to

Keyboard shortcuts

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