Minor refactor and update README.md

This commit is contained in:
David J. Allen 2023-09-29 09:32:06 -06:00
parent 2a6ffd16bb
commit 9f848113c7
3 changed files with 16 additions and 12 deletions

View file

@ -1,7 +1,8 @@
# Magellan
Magellan is a small tool designed to scan a network and collect BMC information
to load the data into an [`hms-smd`](https://github.com/alexlovelltroy/hms-smd/tree/master) instance.
Magellan is a board management controller discovery tool designed to scan a network
and collect information about a BMC node and load that data into an
[`hms-smd`](https://github.com/bikeshack/smd/tree/master) instance.
## How It Works
@ -13,9 +14,13 @@ Magellan is designed to do three things:
Magellan first tries to probe for specified hosts using the [`dora`](https://github.com/bmc-toolbox/dora)
API. If that fails, it then tries to use its own built-in, simpler scanner as a fallback.
Next, it tries to query information about the BMC node using `bmclib` functions, but requires
access to a redfish interface on the node to work. Once the BMC information is received,
it is then stored into `hms-smd` using its API.
This is done by sending a raw TCP request to a number of potential hosts over a
network, and noting which requests are successful. At this point, `magellan` sees
no difference between a services.
Next, it tries to query information about the BMC node using `bmclib` functions,
but requires access to a redfish interface on the node to work. Once the BMC
information is received, it is then stored into `hms-smd` using its API.
In summary, `magellan` needs at minimum the following configured to work on each node:

View file

@ -51,9 +51,7 @@ func AddRedfishEndpoint(data []byte, headers map[string]string) error {
// Add redfish endpoint via POST `/hsm/v2/Inventory/RedfishEndpoints` endpoint
url := makeEndpointUrl("/Inventory/RedfishEndpoints")
res, body, err := util.MakeRequest(url, "POST", data, headers)
fmt.Printf("smd url: %v\n", url)
fmt.Printf("res: %v\n", res.Status)
fmt.Printf("body: %v\n", string(body))
fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body))
if res != nil {
if res.StatusCode != http.StatusOK {
return fmt.Errorf("could not add redfish endpoint")
@ -69,9 +67,7 @@ func UpdateRedfishEndpoint(xname string, data []byte, headers map[string]string)
// Update redfish endpoint via PUT `/hsm/v2/Inventory/RedfishEndpoints` endpoint
url := makeEndpointUrl("/Inventory/RedfishEndpoints/" + xname)
res, body, err := util.MakeRequest(url, "PUT", data, headers)
fmt.Printf("smd url: %v\n", url)
fmt.Printf("res: %v\n", res.Status)
fmt.Printf("body: %v\n", string(body))
fmt.Printf("%v (%v)\n%s\n", url, res.Status, string(body))
if res != nil {
if res.StatusCode != http.StatusOK {
return fmt.Errorf("could not update redfish endpoint")

View file

@ -638,6 +638,9 @@ func QueryProcessors(q *QueryParams) ([]byte, error) {
func connectGofish(q *QueryParams) (*gofish.APIClient, error) {
config := makeGofishConfig(q)
c, err := gofish.Connect(config)
if err != nil {
return nil, err
}
c.Service.ProtocolFeaturesSupported = gofish.ProtocolFeaturesSupported{
ExpandQuery: gofish.Expand{
ExpandAll: true,