You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+72-21Lines changed: 72 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,7 @@ The `magellan` CLI tool is a Redfish-based, board management controller (BMC) di
16
16
-[Arch Linux (AUR)](#arch-linux-aur)
17
17
-[Usage](#usage)
18
18
-[Checking for Redfish](#checking-for-redfish)
19
+
-[BMC ID Mapping](#bmc-id-mapping)
19
20
-[Running the Tool](#running-the-tool)
20
21
-[Managing Secrets](#managing-secrets)
21
22
-[Starting the Emulator](#starting-the-emulator)
@@ -45,7 +46,7 @@ See the [TODO](#todo) section for a list of soon-ish goals planned.
45
46
46
47
## Getting Started
47
48
48
-
[Build](#building) and [run on bare metal](#running-the-tool) or run and test with Docker using the [latest prebuilt image](#running-with-docker). For quick testing, the repository integrates a Redfish emulator that can be ran by executing the `emulator/setup.sh` script or running `make emulator`.
49
+
[Build](#building) and [run on bare metal](#running-the-tool) or run and test with Docker using the [latest prebuilt image](#running-with-docker). For quick testing, the repository integrates a Redfish emulator that can be run by executing the `emulator/setup.sh` script or running `make emulator`.
49
50
50
51
## Building the Executable
51
52
@@ -137,11 +138,61 @@ This should return a JSON response with general information. The output below ha
137
138
}
138
139
```
139
140
141
+
### BMC ID Mapping
142
+
143
+
While the `magellan collect` command collects data from RedFish servers and can produce node data suitable for use with SMD, the RedFish data has no defined way to provide BMC IDs that SMD can use. SMD consumes BMC IDs in the form of XNAMEs, which are names that provide both unique identification within a cluster and the topographical location information needed to phyically identify a BMC. Since RedFish does not provide a way to communicate BMC XNAMEs or other meaningful BMC IDs, `magellan` provides a mechanism to generate meaningfule BMC IDs based on an external mapping. The `--bmc-id-map` (`-m`) option to `magellan` provides this mapping either in the form of a command line JSON string or in the form of a JSON or YAML file. The YAML form of the mapping data is as follows:
144
+
145
+
```yaml
146
+
map_key: bmc-ip-addr
147
+
id_map:
148
+
172.21.0.1: x0c0s1b0
149
+
172.21.0.2: x0c0s2b0
150
+
...
151
+
```
152
+
153
+
Where the `map_key` is the name of the attribute known to `magellan` that identifies the BMC (currently the only supported `map_key` is `bmc-ip-addr` which is the IPv4 address of the BMC) and the `id_map` section is a map between that attribute an the ID string to be passed to the consumer of the data. In the case of SMD that is an XNAME in the form:
154
+
155
+
```
156
+
x<cabinet>c<chassis>s<shelf>b<blade>
157
+
```
158
+
159
+
160
+
where `<cabinet>` is a cabinet number in the cluster, `<chassis>` is a chassis within the cabinet, `<shelf>` is the shelf within the chassis and `<blade>` is the blade within a shelf where the BMC is located. The above mapping file (minus the elipsis) will work with the example described in the [Starting the Emulator](#starting-the-emulator) section.
161
+
162
+
If you are using `magellan` within a system deployed using RIE in the [Quickstart Deployment Recipe](https://github.com/OpenCHAMI/deployment-recipes/blob/main/quickstart/README.md) you will need to generate a BMC ID Map from the RIE instances running under `docker-compose`. You can do this outside of the docker containers by running this script:
directing the output into a ID mapping file, then copying the ID mapping file into whatever container you are using to run `magellan` in your OpenCHAMI system an using it as follows on the magellan command line:
If you have real BMCs present in your system in addition to those presented by RIE, you will need to add their IP Address to XNAME mapping to the BMC ID Map. How you do that for any given configuration is beyond the scope of this README.
188
+
189
+
If you are using `magellan` in an application that is not OpenCHAMI and have a need for a different BMC ID mapping, you can construct a different kind of mapping file by replacing the XNAMEs with whatever your IDs should be.
190
+
140
191
### Running the Tool
141
192
142
193
There are three main commands to use with the tool: `scan`, `list`, and `collect`. To see all of the available commands, run `magellan` with the `help` subcommand which will print this output:
143
194
144
-
```bash
195
+
```
145
196
Redfish-based BMC discovery tool
146
197
147
198
Usage:
@@ -179,7 +230,7 @@ To start a network scan for BMC nodes, use the `scan` command. If the port is no
179
230
--subnet 172.16.0.0 \
180
231
--subnet-mask 255.255.255.0 \
181
232
--format json \
182
-
--cache data/assets.db \
233
+
--cache data/assets.db
183
234
```
184
235
185
236
This will scan the `172.16.0.0` subnet returning the host and port that return a response and store the results in a local cache with at the `data/assets.db` path. Additional flags can be set such as `--host` to add more hosts to scan that are not included on the subnet, `--timeout` to set how long to wait for a response from the BMC node, or `--concurrency` to set the number of requests to make concurrently with goroutines. Try using `./magellan help scan` for a complete set of options this subcommand. Alternatively, the same scan can be started using CIDR notation and with additional hosts:
@@ -204,13 +255,15 @@ We can then save the output and make a request with the `send` subcommand or pip
204
255
--timeout 5 \
205
256
--username $USERNAME \
206
257
--password $PASSWORD \
207
-
--host https://example.openchami.cluster:8443 \
208
258
--format yaml \
209
259
--output-file nodes.yaml \
210
-
--cacert cacert.pem
260
+
--cacert cacert.pem \
261
+
--bmc-id-map @my_bmc_id_map.yaml
211
262
```
212
263
213
-
This will initiate a crawler that fetch inventory data from the specified BMC host. The data can be saved, viewed, or modified from standard output by setting the `-v/--verbose` flag. Similarly, this output can also be saved by using the `-o/--output-file` flag and providing a path argument.
264
+
This will initiate a crawler to fetch inventory data from the specified BMC host. The data can be saved, viewed, or modified from standard output by setting the `-v/--verbose` flag. Similarly, this output can also be saved by using the `-o/--output-file` flag and providing a path argument.
265
+
266
+
To prepare a BMC ID Map (`my_bmc_id_map.yaml`) see the [BMC ID Mapping](#bmc-id-mapping).
214
267
215
268
To make a request with the `collect` output, we specify the `-d/--data` flag for `send`. For files, use the `@` symbol before the file path. Make sure that you set the correct input format with `-F/--format`. Finally, specify the host as a positional argument.
216
269
@@ -330,45 +383,43 @@ This will start a flask server that you can make requests to using `curl`.
330
383
export emulator_host=https://172.21.0.2:5000
331
384
export emulator_username=root # set in the `rf_emulator.yml` file
332
385
export emulator_password=root_password # set in the `rf_emulator.yml` file
magellan secrets store default $emulator_username:$emulator_password
395
+
magellan collect -o node_info.json
344
396
```
345
397
346
-
This example should work just like running on real hardware.
398
+
This example should work just like running on real hardware, and produce a `node-info.json` output file that contains the collected data.
347
399
348
400
> [!NOTE]
349
-
> The emulator host may be different from the one in the README. Make sure to double-check the host!
401
+
> The output from the above `magellan collect`command will not be compatible with SMD because it contains IP addresses instead of XNAMEs as BMC IDs. To generate correct XNAME BMC IDs, you must supply a BMC ID Mapping. See [BMC ID Mapping](#bmc-id-mapping) for details on how to create and specify a BMC ID Mapping when running `magellan collect`.
350
402
351
403
### Updating Firmware
352
404
353
-
The `magellan` tool is capable of updating firmware with using the `update` subcommand via the Redfish API. This may sometimes necessary if some of the `collect` output is missing or is not including what is expected. The subcommand expects there to be a running HTTP/HTTPS server running that has an accessible URL path to the firmware download. Specify the URL with the `--firmware-path` flag and the firmware type with the `--component` flag (optional) with all the other usual arguments like in the example below:
405
+
The `magellan` tool is capable of updating firmware with using the `update` subcommand via the Redfish API. This may sometimes necessary if some of the `collect` output is missing or is not including what is expected. The subcommand expects to find a running HTTP/HTTPS server that has an accessible URL path to the firmware download. Specify the URL with the `--firmware-path` flag and the firmware type with the `--component` flag (optional) with all the other usual arguments like in the example below:
The `magellan` tool can be ranin a Docker container after pulling the latest image:
447
+
The `magellan` tool can be runin a Docker container after pulling the latest image:
397
448
398
449
```bash
399
450
docker pull ghcr.io/openchami/magellan:latest
@@ -417,7 +468,7 @@ At its core, `magellan` is designed to do three basic things:
417
468
418
469
First, the tool performs a scan to find running services on a network. This is done by sending a raw TCP packet to all specified hosts (either IP or host name) and taking note which services respond. At this point, `magellan` has no way of knowing whether this is a Redfish service or not, so another HTTP request is made to verify. Once the BMC responds with an OK status code, `magellan` will store the necessary information in a local cache database to allow collecting more information about the node later. This allows for users to only have to scan their cluster once to find systems that are currently available and scannable.
419
470
420
-
Next, the tool queries information about the BMC node using `gofish` API functions, but requires access to BMC node found in the scanning step mentioned above to work. If the node requires basic authentication, a user name and password is required to be supplied as well. Once the BMC information is retrieved from each node, the info is aggregated and a HTTP request is made to a SMD instance to be stored. Optionally, the information can be written to disk for inspection and debugging purposes.
471
+
Next, the tool queries information about the BMC node using `gofish` API functions, but requires access to BMC node found in the scanning step mentioned above to work. If the node requires basic authentication, a user name and password is required to be supplied as well. Once the BMC information is retrieved from each node, the info is aggregated and place either in a file or on standard output which can be read by the `magellan send`command which makes an HTTP request to an SMD instance to store the data. This can be donein a command line pipeline in the shell or Optionally, the information can be written to disk for inspection and debugging purposes.
421
472
422
473
In summary, `magellan` needs at minimum the following configured to work on each node:
Short: "Collect system information by interrogating BMC node",
38
38
Long: "Send request(s) to a collection of hosts running Redfish services found stored from the 'scan' in cache.\nSee the 'scan' command on how to perform a scan.",
@@ -50,12 +50,6 @@ var CollectCmd = &cobra.Command{
50
50
log.Error().Err(err).Msgf("failed to get scanned results from cache")
51
51
}
52
52
53
-
// URL sanitanization for host argument
54
-
host, err=urlx.Sanitize(host)
55
-
iferr!=nil {
56
-
log.Error().Err(err).Msg("failed to sanitize host")
57
-
}
58
-
59
53
// try to load access token either from env var, file, or config if var not set
60
54
ifaccessToken=="" {
61
55
varerrerror
@@ -125,7 +119,6 @@ var CollectCmd = &cobra.Command{
125
119
126
120
// set the collect parameters from CLI params
127
121
params:=&magellan.CollectParams{
128
-
URI: host,
129
122
Timeout: timeout,
130
123
Concurrency: concurrency,
131
124
Verbose: verbose,
@@ -136,7 +129,7 @@ var CollectCmd = &cobra.Command{
136
129
ForceUpdate: forceUpdate,
137
130
AccessToken: accessToken,
138
131
SecretStore: store,
139
-
BMCIdMap: idMapPath,
132
+
BMCIdMap: idMap,
140
133
}
141
134
142
135
// show all of the 'collect' parameters being set from CLI if verbose
@@ -155,19 +148,17 @@ func init() {
155
148
CollectCmd.Flags().StringVarP(&username, "username", "u", "", "Set the master BMC username")
156
149
CollectCmd.Flags().StringVarP(&password, "password", "p", "", "Set the master BMC password")
157
150
CollectCmd.Flags().StringVar(&secretsFile, "secrets-file", "", "Set path to the node secrets file")
158
-
CollectCmd.Flags().StringVar(&scheme, "scheme", "https", "Set the default scheme used to query when not included in URI")
159
151
CollectCmd.Flags().StringVar(&protocol, "protocol", "tcp", "Set the protocol used to query")
160
152
CollectCmd.Flags().StringVarP(&outputPath, "output-file", "o", "", "Set the path to store collection data using HIVE partitioning")
161
153
CollectCmd.Flags().StringVarP(&outputDir, "output-dir", "O", "", "Set the path to store collection data using HIVE partitioning")
162
154
CollectCmd.Flags().BoolVar(&forceUpdate, "force-update", false, "Set flag to force update data sent to SMD")
163
155
CollectCmd.Flags().StringVar(&cacertPath, "cacert", "", "Set the path to CA cert file (defaults to system CAs when blank)")
164
156
CollectCmd.Flags().StringVarP(&collectOutputFormat, "format", "F", util.FORMAT_JSON, "Set the default output data format (json|yaml) can be overridden by file extensions")
165
-
CollectCmd.Flags().StringVarP(&idMapPath, "bmc-id-map", "m", "", "Set the BMC ID mapping from raw json data or use @<path> to specify a file path (json or yaml input)")
157
+
CollectCmd.Flags().StringVarP(&idMap, "bmc-id-map", "m", "", "Set the BMC ID mapping from raw json data or use @<path> to specify a file path (json or yaml input)")
0 commit comments