Documentation
¶
Index ¶
- Variables
- func AddNodeToInventoryHandler(f *FakeSMDClient) http.HandlerFunc
- func ListNodesHandler(f *FakeSMDClient) http.HandlerFunc
- func UpdateNodeHandler(f *FakeSMDClient) http.HandlerFunc
- type ErrSMDResponse
- type FakeSMDClient
- func (f *FakeSMDClient) AddNodeToGroups(id string, groups []string) error
- func (f *FakeSMDClient) AddNodeToInventory(node cistore.OpenCHAMIComponent) error
- func (f *FakeSMDClient) AddWGIP(id string, wgip string) error
- func (f *FakeSMDClient) ClusterName() string
- func (f *FakeSMDClient) ComponentInformation(id string) (base.Component, error)
- func (f *FakeSMDClient) ComponentInformationWithRetry(id string, maxRetries int) (base.Component, error)
- func (f *FakeSMDClient) GroupMembership(id string) ([]string, error)
- func (f *FakeSMDClient) IDfromIP(ipaddr string) (string, error)
- func (f *FakeSMDClient) IDfromMAC(mac string) (string, error)
- func (f *FakeSMDClient) IPfromID(id string) (string, error)
- func (f *FakeSMDClient) ListMemberships() []sm.Membership
- func (f *FakeSMDClient) ListNodes() []cistore.OpenCHAMIComponent
- func (f *FakeSMDClient) MACfromID(id string) (string, error)
- func (f *FakeSMDClient) PopulateNodes()
- func (f *FakeSMDClient) Summary()
- func (f *FakeSMDClient) UpdateNode(node cistore.OpenCHAMIComponent) error
- func (f *FakeSMDClient) WGIPfromID(id string) (string, error)
- type NodeInterface
- type NodeMapping
- type OpenCHAMINodeWithGroups
- type SMDClient
- func (s *SMDClient) AddWGIP(id string, wgip string) error
- func (s *SMDClient) ClusterName() string
- func (s *SMDClient) ComponentInformation(id string) (base.Component, error)
- func (s *SMDClient) ComponentInformationWithRetry(id string, maxRetries int) (base.Component, error)
- func (s *SMDClient) GroupMembership(id string) ([]string, error)
- func (s *SMDClient) IDfromIP(ipaddr string) (string, error)
- func (s *SMDClient) IDfromMAC(mac string) (string, error)
- func (s *SMDClient) IPfromID(id string) (string, error)
- func (s *SMDClient) MACfromID(id string) (string, error)
- func (s *SMDClient) PopulateNodes()
- func (s *SMDClient) RefreshCache()
- func (s *SMDClient) RefreshToken() error
- func (s *SMDClient) StopCacheRefresh()
- func (s *SMDClient) WGIPfromID(id string) (string, error)
- type SMDClientInterface
- type SMDRosettaStone
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnmarshal = errors.New("cannot unmarshal JSON") ErrEmptyID = errors.New("empty id") )
Functions ¶
func AddNodeToInventoryHandler ¶
func AddNodeToInventoryHandler(f *FakeSMDClient) http.HandlerFunc
func ListNodesHandler ¶
func ListNodesHandler(f *FakeSMDClient) http.HandlerFunc
func UpdateNodeHandler ¶
func UpdateNodeHandler(f *FakeSMDClient) http.HandlerFunc
Types ¶
type ErrSMDResponse ¶
ErrSMDResponse contains the HTTP response of a REST API request to SMD.
func (ErrSMDResponse) Error ¶
func (esr ErrSMDResponse) Error() string
type FakeSMDClient ¶
type FakeSMDClient struct {
// contains filtered or unexported fields
}
func NewFakeSMDClient ¶
func NewFakeSMDClient(clusterName string, count int) *FakeSMDClient
func (*FakeSMDClient) AddNodeToGroups ¶
func (f *FakeSMDClient) AddNodeToGroups(id string, groups []string) error
AddNodeToGroups adds a node to the specified groups. This is not part of the SMDClient Interface and only useful as part of the simulator
func (*FakeSMDClient) AddNodeToInventory ¶
func (f *FakeSMDClient) AddNodeToInventory(node cistore.OpenCHAMIComponent) error
AddNodeToInventory adds a node to the inventory. This is not part of the SMDClient Interface and only useful as part of the simulator
func (*FakeSMDClient) ClusterName ¶
func (f *FakeSMDClient) ClusterName() string
func (*FakeSMDClient) ComponentInformation ¶
func (f *FakeSMDClient) ComponentInformation(id string) (base.Component, error)
func (*FakeSMDClient) ComponentInformationWithRetry ¶
func (*FakeSMDClient) GroupMembership ¶
func (f *FakeSMDClient) GroupMembership(id string) ([]string, error)
func (*FakeSMDClient) ListMemberships ¶
func (f *FakeSMDClient) ListMemberships() []sm.Membership
ListMemberships returns memberships derived from the simulator's group state.
func (*FakeSMDClient) ListNodes ¶
func (f *FakeSMDClient) ListNodes() []cistore.OpenCHAMIComponent
func (*FakeSMDClient) PopulateNodes ¶
func (f *FakeSMDClient) PopulateNodes()
func (*FakeSMDClient) Summary ¶
func (f *FakeSMDClient) Summary()
func (*FakeSMDClient) UpdateNode ¶
func (f *FakeSMDClient) UpdateNode(node cistore.OpenCHAMIComponent) error
func (*FakeSMDClient) WGIPfromID ¶
func (f *FakeSMDClient) WGIPfromID(id string) (string, error)
type NodeInterface ¶
type NodeMapping ¶
type NodeMapping struct {
Xname string `json:"xname" yaml:"xname"`
Interfaces []NodeInterface `json:"interfaces" yaml:"interfaces"`
Groups []string `json:"groups" yaml:"groups"`
}
type OpenCHAMINodeWithGroups ¶
type OpenCHAMINodeWithGroups struct {
cistore.OpenCHAMIComponent
Groups []string `json:"groups,omitempty" yaml:"groups,omitempty"`
}
type SMDClient ¶
type SMDClient struct {
// contains filtered or unexported fields
}
SMDClient is a client for SMD
func NewSMDClient ¶
func NewSMDClient(clusterName, baseurl, jwtURL, accessToken, certPath string, insecure bool) (*SMDClient, error)
NewSMDClient creates a new SMDClient which connects to the SMD server at baseurl and uses the provided JWT server for authentication
func (*SMDClient) ClusterName ¶
ClusterName returns the name of the cluster
func (*SMDClient) ComponentInformation ¶
func (*SMDClient) ComponentInformationWithRetry ¶
func (s *SMDClient) ComponentInformationWithRetry(id string, maxRetries int) (base.Component, error)
ComponentInformationWithRetry wraps ComponentInformation with exponential backoff retry logic for transient network errors and timeouts. This is critical during boot storms when SMD may be temporarily overloaded.
func (*SMDClient) GroupMembership ¶
GroupMembership returns the group labels for the xname with the given ID
func (*SMDClient) PopulateNodes ¶
func (s *SMDClient) PopulateNodes()
PopulateNodes fetches the Ethernet interface data from the SMD server and populates the nodes map with the corresponding node information, including MAC addresses, IP addresses, descriptions, and group membership.
func (*SMDClient) RefreshCache ¶
func (s *SMDClient) RefreshCache()
RefreshCache refreshes the cache
func (*SMDClient) RefreshToken ¶
Refresh the cached access token, using the provided JWT server TODO: OPAAL returns a token without having to perform the usual OAuth2 authorization grant. Support for said grant should probably be implemented at some point.
func (*SMDClient) StopCacheRefresh ¶
func (s *SMDClient) StopCacheRefresh()
StopCacheRefresh stops the cache refresh goroutine
type SMDClientInterface ¶
type SMDClientInterface interface {
IDfromMAC(mac string) (string, error)
IDfromIP(ipaddr string) (string, error)
IPfromID(id string) (string, error)
MACfromID(id string) (string, error)
GroupMembership(id string) ([]string, error)
ComponentInformation(id string) (base.Component, error)
ComponentInformationWithRetry(id string, maxRetries int) (base.Component, error)
PopulateNodes()
ClusterName() string
AddWGIP(id string, wgip string) error
WGIPfromID(id string) (string, error)
}
Create an SMDClient Interface which can be more easily tested and mocked