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
BMC: Added CLI commands runner and Serial Console access. (#419)
* BMC: Added CLI commands runner and Serial Console access.
BMC's CLI commands can be run using the bmc.RunCLICommand method,
which connects to the CLI via SSH. The method blocks until the command
ends or a timeout happens, whatever comes first. The command's output is
copied into the stdout & stderr string vars. The underlying SSH session
is created and closed internally after the command finishes.
The new method OpenSerialConsole returns a piped reader and writer
interfaces that can be used to interactively receive/send commands/text
to/from the serial console. Since the serial console is tunneled in a
SSH session, the CloseSerialConsole method must be called to release
that session to prevent leaks that would prevent CLI commands to fail
due to maximum concurrent SSH sessions reached in the BMC.
Also, added SSH port as parameter for BMC's New() method
* Addressed comments from Nikita.
* Added host on glog traces and errors.
* Updated UTs to the new error messages.
Copy file name to clipboardExpand all lines: README.md
+53Lines changed: 53 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,59 @@ exit status 1
96
96
```
97
97
Please refer to the [secret pkg](./pkg/secret/secret.go)'s use of the validate method for more information.
98
98
99
+
### BMC Package
100
+
The BMC package can be used to access the BMC's Redfish API, run BMC's CLI commands or getting the systems' serial console. Credentials for both Redfish and SSH user, the SSH port and timeouts need to be passed as parameters of the New() method. E.g.
You can check an example program for the BMC package [here](usage/bmc/bmc.go).
111
+
112
+
#### BMC's Redfish API
113
+
The access to BMC's Redfish API is done by methods that encapsulate the underlaying HTTP calls made by the external gofish library. The redfish system index is defaulted to 0, but it can be changed with `SetSystemIndex()`:
The user gets a (piped) reader and writer interfaces in order to read the output or write custom input (like CLI commands) in a interactive fashion.
143
+
A use case for this is a test case that needs to wait for some pattern to appear in the system's serial console after rebooting the system.
144
+
145
+
The `openConsoleCliCmd` is the command that will be sent to the BMC's (SSH'd) CLI to open the serial console. In case the user doesn't know the command,
146
+
it can be left empty. In that case, there's a best effort mechanism that will try to guess the CLI command based on the system's manufacturer, which will
147
+
be internally retrieved using the Redfish API.
148
+
149
+
It's important to close the serial console using the method `bmc.CloseSerialConsole()`, which closes the underlying SSH session. Otherwise, BMC's can reach
150
+
the maximum number of concurrent SSH sessions making other (SSH'd CLI) commands to fail. See an example program [here](usage/bmc/bmc.go).
151
+
99
152
# eco-goinfra - How to contribute
100
153
101
154
The project uses a development method - forking workflow
0 commit comments