crawler

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBMC added in v0.1.12

func IsBMC(manager *redfish.Manager) bool

IsBMC checks if a given Manager is a BMC based on its type and associations

Types

type BMCInfo added in v0.1.12

type BMCInfo struct {
	Manufacturer    string `json:"manufacturer"`
	Model           string `json:"model"`
	SerialNumber    string `json:"serial_number"`
	FirmwareVersion string `json:"firmware_version"`
	ManagerType     string `json:"manager_type"`
	UUID            string `json:"uuid"`
}

BMCInfo represents relevant information about a BMC

func GetBMCInfo added in v0.1.12

func GetBMCInfo(client *gofish.APIClient) ([]BMCInfo, error)

GetBMCInfo retrieves details of all available BMCs

type BMCUsernamePassword added in v0.1.11

type BMCUsernamePassword struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type CrawlerConfig

type CrawlerConfig struct {
	URI             string // URI of the BMC
	Insecure        bool   // Whether to ignore SSL errors
	CredentialStore secrets.SecretStore
}

func (*CrawlerConfig) GetUserPass added in v0.1.11

func (cc *CrawlerConfig) GetUserPass() (BMCUsernamePassword, error)

type EthernetInterface

type EthernetInterface struct {
	URI         string `json:"uri,omitempty"`         // URI of the interface
	MAC         string `json:"mac,omitempty"`         // MAC address of the interface
	IP          string `json:"ip,omitempty"`          // IP address of the interface
	Name        string `json:"name,omitempty"`        // Name of the interface
	Description string `json:"description,omitempty"` // Description of the interface
	Enabled     bool   `json:"enabled,omitempty"`     // Enabled interface
}

type InventoryDetail

type InventoryDetail struct {
	URI                  string              `json:"uri,omitempty"`                  // URI of the BMC
	UUID                 string              `json:"uuid,omitempty"`                 // UUID of Node
	Manufacturer         string              `json:"manufacturer,omitempty"`         // Manufacturer of the Node
	SystemType           string              `json:"system_type,omitempty"`          // System type of the Node
	Name                 string              `json:"name,omitempty"`                 // Name of the Node
	Model                string              `json:"model,omitempty"`                // Model of the Node
	Serial               string              `json:"serial,omitempty"`               // Serial number of the Node
	BiosVersion          string              `json:"bios_version,omitempty"`         // Version of the BIOS
	EthernetInterfaces   []EthernetInterface `json:"ethernet_interfaces,omitempty"`  // Ethernet interfaces of the Node
	NetworkInterfaces    []NetworkInterface  `json:"network_interfaces,omitempty"`   // Network interfaces of the Node
	PowerState           string              `json:"power_state,omitempty"`          // Power state of the Node
	ProcessorCount       int                 `json:"processor_count,omitempty"`      // Processors of the Node
	ProcessorType        string              `json:"processor_type,omitempty"`       // Processor type of the Node
	MemoryTotal          float32             `json:"memory_total,omitempty"`         // Total memory of the Node in Gigabytes
	TrustedModules       []string            `json:"trusted_modules,omitempty"`      // Trusted modules of the Node
	TrustedComponents    []string            `json:"trusted_components,omitempty"`   // Trusted components of the Chassis
	Chassis_SKU          string              `json:"chassis_sku,omitempty"`          // SKU of the Chassis
	Chassis_Serial       string              `json:"chassis_serial,omitempty"`       // Serial number of the Chassis
	Chassis_AssetTag     string              `json:"chassis_asset_tag,omitempty"`    // Asset tag of the Chassis
	Chassis_Manufacturer string              `json:"chassis_manufacturer,omitempty"` // Manufacturer of the Chassis
	Chassis_Model        string              `json:"chassis_model,omitempty"`        // Model of the Chassis
}

func CrawlBMCForSystems added in v0.1.6

func CrawlBMCForSystems(config CrawlerConfig) ([]InventoryDetail, error)

CrawlBMCForSystems pulls all pertinent information from a BMC. It accepts a CrawlerConfig and returns a list of InventoryDetail structs.

type Manager added in v0.1.6

type Manager struct {
	URI                string              `json:"uri,omitempty"`
	UUID               string              `json:"uuid,omitempty"`
	Name               string              `json:"name,omitempty"`
	Description        string              `json:"description,omitempty"`
	Model              string              `json:"model,omitempty"`
	Type               string              `json:"type,omitempty"`
	FirmwareVersion    string              `json:"firmware_version,omitempty"`
	EthernetInterfaces []EthernetInterface `json:"ethernet_interfaces,omitempty"`
}

func CrawlBMCForManagers added in v0.1.6

func CrawlBMCForManagers(config CrawlerConfig) ([]Manager, error)

CrawlBMCForManagers connects to a BMC (Baseboard Management Controller) using the provided configuration, retrieves the ServiceRoot, and then fetches the list of managers from the ServiceRoot.

Parameters:

  • config: A CrawlerConfig struct containing the URI, username, password, and other connection details.

Returns:

  • []Manager: A slice of Manager structs representing the managers retrieved from the BMC.
  • error: An error object if any error occurs during the connection or retrieval process.

The function performs the following steps:

  1. Initializes a gofish client with the provided configuration.
  2. Attempts to connect to the BMC using the gofish client.
  3. Handles specific connection errors such as 404 (ServiceRoot not found) and 401 (authentication failed).
  4. Logs out from the client after the operations are completed.
  5. Retrieves the ServiceRoot from the connected BMC.
  6. Fetches the list of managers from the ServiceRoot.
  7. Returns the list of managers and any error encountered during the process.

type NetworkAdapter

type NetworkAdapter struct {
	URI          string `json:"uri,omitempty"`          // URI of the adapter
	Manufacturer string `json:"manufacturer,omitempty"` // Manufacturer of the adapter
	Name         string `json:"name,omitempty"`         // Name of the adapter
	Model        string `json:"model,omitempty"`        // Model of the adapter
	Serial       string `json:"serial,omitempty"`       // Serial number of the adapter
	Description  string `json:"description,omitempty"`  // Description of the adapter
}

type NetworkInterface

type NetworkInterface struct {
	URI         string         `json:"uri,omitempty"`         // URI of the interface
	Name        string         `json:"name,omitempty"`        // Name of the interface
	Description string         `json:"description,omitempty"` // Description of the interface
	Adapter     NetworkAdapter `json:"adapter,omitempty"`     // Adapter of the interface
}

Jump to

Keyboard shortcuts

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