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) 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 ¶ added in v1.0.0
func AddNodeToInventoryHandler(f *FakeSMDClient) http.HandlerFunc
func ListNodesHandler ¶ added in v1.0.0
func ListNodesHandler(f *FakeSMDClient) http.HandlerFunc
func UpdateNodeHandler ¶ added in v1.0.0
func UpdateNodeHandler(f *FakeSMDClient) http.HandlerFunc
Types ¶
type ErrSMDResponse ¶ added in v1.3.0
ErrSMDResponse contains the HTTP response of a REST API request to SMD.
func (ErrSMDResponse) Error ¶ added in v1.3.0
func (esr ErrSMDResponse) Error() string
type FakeSMDClient ¶ added in v1.0.0
type FakeSMDClient struct {
// contains filtered or unexported fields
}
func NewFakeSMDClient ¶ added in v1.0.0
func NewFakeSMDClient(clusterName string, count int) *FakeSMDClient
func (*FakeSMDClient) AddNodeToGroups ¶ added in v1.0.0
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 ¶ added in v1.0.0
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) AddWGIP ¶ added in v1.0.0
func (f *FakeSMDClient) AddWGIP(id string, wgip string) error
func (*FakeSMDClient) ClusterName ¶ added in v1.0.0
func (f *FakeSMDClient) ClusterName() string
func (*FakeSMDClient) ComponentInformation ¶ added in v1.0.0
func (f *FakeSMDClient) ComponentInformation(id string) (base.Component, error)
func (*FakeSMDClient) ComponentInformationWithRetry ¶ added in v1.4.5
func (*FakeSMDClient) GroupMembership ¶ added in v1.0.0
func (f *FakeSMDClient) GroupMembership(id string) ([]string, error)
func (*FakeSMDClient) IDfromIP ¶ added in v1.0.0
func (f *FakeSMDClient) IDfromIP(ipaddr string) (string, error)
func (*FakeSMDClient) IDfromMAC ¶ added in v1.0.0
func (f *FakeSMDClient) IDfromMAC(mac string) (string, error)
func (*FakeSMDClient) IPfromID ¶ added in v1.0.0
func (f *FakeSMDClient) IPfromID(id string) (string, error)
func (*FakeSMDClient) ListNodes ¶ added in v1.0.0
func (f *FakeSMDClient) ListNodes() []cistore.OpenCHAMIComponent
func (*FakeSMDClient) MACfromID ¶ added in v1.0.0
func (f *FakeSMDClient) MACfromID(id string) (string, error)
func (*FakeSMDClient) PopulateNodes ¶ added in v1.0.0
func (f *FakeSMDClient) PopulateNodes()
func (*FakeSMDClient) Summary ¶ added in v1.0.0
func (f *FakeSMDClient) Summary()
func (*FakeSMDClient) UpdateNode ¶ added in v1.0.0
func (f *FakeSMDClient) UpdateNode(node cistore.OpenCHAMIComponent) error
func (*FakeSMDClient) WGIPfromID ¶ added in v1.0.0
func (f *FakeSMDClient) WGIPfromID(id string) (string, error)
type NodeInterface ¶ added in v1.0.0
type NodeMapping ¶ added in v1.0.0
type NodeMapping struct {
Xname string `json:"xname" yaml:"xname"`
Interfaces []NodeInterface `json:"interfaces" yaml:"interfaces"`
Groups []string `json:"groups" yaml:"groups"`
}
type OpenCHAMINodeWithGroups ¶ added in v1.0.0
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 ¶ added in v1.0.0
ClusterName returns the name of the cluster
func (*SMDClient) ComponentInformation ¶ added in v1.0.0
func (*SMDClient) ComponentInformationWithRetry ¶ added in v1.4.5
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) IDfromIP ¶ added in v0.1.1
IDfromIP returns the ID of the xname that has the IP address
func (*SMDClient) IPfromID ¶ added in v1.0.0
IPfromID returns the IP address of the xname with the given ID
func (*SMDClient) PopulateNodes ¶ added in v1.0.0
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 ¶ added in v1.0.0
func (s *SMDClient) RefreshCache()
RefreshCache refreshes the cache
func (*SMDClient) RefreshToken ¶ added in v0.1.0
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 ¶ added in v1.0.0
func (s *SMDClient) StopCacheRefresh()
StopCacheRefresh stops the cache refresh goroutine
type SMDClientInterface ¶ added in v1.0.0
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