turing-machines / bmcd Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Is your feature request related to a problem? Please describe.
Currently, inside the code, a Sender
object is passed around to provide (eventually) log messages back to the client. I see an opportunity to improve this architecture, simultaneously adding value to the bmcd.
Describe the solution you'd like
A more elegant way is to create a logging Sink for the log
crate that sends log messages to HTTP clients that are subscribed for logging information. This way, all the log statements inside our code debug!(), error!() warn!()
are automatically sent, eliminating the need to use Sender
objects.
This solution needs to be redfish compliant.
https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2023.1.pdf
LogService
and is exposed over the Restful APISender
objects are replaced with conventional log statementsDescribe the bug
A clear and concise description of what the bug is.
[email protected]:/$ bmc
# Hello bmc start build time = 19:01:28-Jul 28 2023
bmc version:v1.1.0
INFO [tpi_rs::c_interface] tpi_rs v1.3.0
start uart thread node num = 0----
pthread end
start webserver -
************************************************************************************************************************
* [libgo] rel versiion V1.0.0.7 svn version: Unversioned directory build time: 2022-11-14 23:27:17
************************************************************************************************************************
start uart thread node num = 3----
start uart thread node num = 1----
start uart thread node num = 2----
goahead: 2: Configuration for Embedthis GoAhead
goahead: 2: ---------------------------------------------
goahead: 2: Version: 3.6.5
goahead: 2: BuildType: Debug
goahead: 2: CPU: arm
goahead: 2: OS: linux
goahead: 2: Host: 127.0.0.1
goahead: 2: Directory: /tmp
goahead: 2: Documents: /mnt/var/www
goahead: 2: Configure: me -d -q -platform linux-x86-default -configure . -gen make
goahead: 2: ---------------------------------------------
goahead: 2: Started http://*:80
======= ASP_Init =====func_num 3=====
ASP_Init jst : name app_WebS_Jst_test
ASP_Init act : name app_WebS_Act_test
ASP_Init act : name bmc
*** stack smashing detected ***: terminated
Aborted
[email protected]:/$ echo $?
134
[email protected]:/$ df -h
Filesystem Size Used Available Use% Mounted on
ubi0_5 34.0M 32.2M 1.8M 95% /
devtmpfs 49.9M 0 49.9M 0% /dev
tmpfs 54.4M 0 54.4M 0% /dev/shm
tmpfs 54.4M 44.0K 54.3M 0% /tmp
tmpfs 54.4M 88.0K 54.3M 0% /run
/dev/mmcblk0p1 29.7G 32.0K 29.7G 0% /mnt/sdcard
[email protected]:/$ free -h
total used free shared buff/cache available
Mem: 108.7M 35.8M 50.1M 132.0K 22.9M 63.8M
Swap: 0 0 0
To Reproduce
I don't know what happened. The last thing I did was poweroff a node, and connected to some of the uarts. BMC (daemon) crashed while the BMC was still running. I couldn't restart it - same error. I rebooted the BMC (via reboot
), same error. BMC (daemon) has not come back.
Expected behavior
A clear and concise description of what you expected to happen.
BMC does not crash or provides a message about what it was trying to do before it crashed. Is it getting bad or constant input from some source?
Screenshots
If applicable, add screenshots to help explain your problem.
Versions
print here the version of the tpi_rs library and other applicable versions
Additional context
Add any other context about the problem here.
We want to implement a firmware update of the BMC using the 'legacy api' endpoint. This endpoint accepts streaming firmware update file and executes the update accordingly.
Is your feature request related to a problem? Please describe.
As a web developer, I want an API call that returns more node information given a particular node id.
As a web developer, I want an API endpoint to update any of these properties.
Describe the solution you'd like
api/bmc/?opt=get&type=node_info
which returns the following JSON structure:
{
"node_info":[
{
"1":{
"name":"my raspberry",
"module_name":"Nvidia Jetson nano",
"uptime": 123123,
"uart_baud": 115200
}
},
{
"2":{
"name":"foobar",
"module_name":"Nvidia Jetson nano",
"uptime": 123123,
"uart_baud": 115200
}
},
....
]
}
api/bmc/?opt=set&type=node_info
SETWhich can be used to update the items. The user can decide to update all nodes/all attributes at once. Or select specific attributes. e.g.
{
"node_info":[
{
"1":{
"module_name":"Raspberry Pi CM4",
"uart_baud": 115200
}
},
{
"2":{
"name":"New jeston",
}
},
....
]
}
will only update the module name and buad of node 1. for node 2 only the name gets updated.
This data can be persisted in the app persistency
Is your feature request related to a problem? Please describe.
During firmware-update of a given node, It is possible to power off the board (via the front-panel). Since the BMC is never turned off, it continues the firmware upgrade process, including writing to it. This will fail at some point. The annoying side effect is that the webapi is still blocking on the request.
Describe the solution you'd like
A way to cancel an ongoing firmware update request. A generic solution would be desired, as we will have more requests in the future with long execution times.
A possible solution could be to cancel or stop polling the tokio task executing a certain request.
The goal is to set up the fundamentals for our redfish interface. As a proof, a call to the redfish service root can be made
As part of Legacy and Redfish APIs, implement a reader/writer of nodes' serial interfaces in bmc_application
.
For reasons of backwards-compatibility, and as easy-to-create beginnings of a new webserver, implement support of a legacy API. This webserver will recreate functionality of its C version, which already had a lot of its functionality moved to tpi_rs
library.
The implementation details of this webserver will later be used when creating support for Redfish API.
Includes #22
tpi_rs
is renamed to bmcd
which stands for BMC Daemonc_interface
module is removedfor a better user experience for our client tools, such as tpi
, implement a service discovery mechanism as defined in the redfish spec.
The objective of discovery is for client software to locate managed devices that conform to the Redfish
Specification. Therefore, the primary SSDP functionality is incorporated in the M-SEARCH query.
HTTP/1.1 200 OK
CACHE-CONTROL:max-age=<seconds, at least 1800>
ST:urn:dmtf-org:service:redfish-rest:1
USN:uuid:<UUID of the service>::urn:dmtf-org:service:redfish-rest:1
AL:<URL of Redfish Service Root>
EXT:
urn:dmtf-org:service:redfish-rest:1
and ssdp:all
and upnp:rootdevice
Describe the bug
I recently upgraded the BMC firmware to the latest, namely version 1.1.0. After that I wanted to ensure the right version was installed by issuing bmc info
command.
The tool crashed right away no matter the argument I tried with.
To Reproduce
Steps to reproduce the behavior:
bmc
commandHello bmc start build time = 19:01:28-Jul 28 2023
bmc version:v1.1.0
INFO [tpi_rs::c_interface] tpi_rs v1.3.0
thread '<unnamed>' panicked at 'unable to initialize bmc app: pin_controller
Caused by:
0: error initializing pin [PORT1_USB_VBUS, PORT2_USB_VBUS, PORT3_USB_VBUS, PORT4_USB_VBUS]
1: Device or resource busy (os error 16)', src/c_interface.rs:49:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 9
Aborted
<img width="1299" alt="Screenshot 2023-08-24 at 16 28 28" src="https://github.com/turing-machines/bmcd/assets/23614/dca7a8fd-4bd8-4a5a-8696-69893ae28a53">
Expected behavior
bmc
tool should display usage or recognize and execute the command specified in arguments.
Describe the bug
The command to route the USB-a port as a USB device to a node is not working anymore. I compared the same reproduction scenario on TP 'v1.0.2' and the issue was not present.
To Reproduce
Steps to reproduce the behavior:
curl 'http://<TP IP>/api/bmc?opt=set&type=usb&node=0&mode=0'
KEY1
Expected behavior
keyboard to be powered and working
Versions
seen with tpi_rs 1.2.0
Is your feature request related to a problem? Please describe.
Currently, the async Read/write trait for writing firmware to the RK1 is implemented in a blocking way. This is because the crate we use to interface rockusb
, is implemented using blocking calls. I'd argue this ticket has a low priority as its a relatively high effort for a small gain.
Describe the solution you'd like
Implement async read/write for USB commands inside rockusb
. Perhaps rusb-async can support in achieving this goal.
Describe alternatives you've considered
couldn't find any other crates to date.
The goal is to enable "Basic Authentication" for the bmcd
.
Is your feature request related to a problem? Please describe.
Rockchip-based devices are typically shipped with a debug UART that communicates at 1500000 baud. bmcd
naively configures all four serial ports to 115200 baud, since that's the default for Raspberry Pi devices (and others, I'm sure). The current uart API is, therefore, unusable for these Rockchip devices.
Describe the solution you'd like
Ideally, bmcd
could auto-detect the appropriate baud rate for a given node's device. This may be through a mapping of known device types to rates, or autobaud detection. This would probably need to be overridable by the user as well, in case of unknown or broken detection.
So, for a given node, the baud rate could be configured by falling through values from this list, in order:
Maybe an initial implementation could be as simple as items 1 and 5?
Describe alternatives you've considered
Look, you can always ssh in and use picocom
to set the baud rate, but that's not ideal.
Additional context
A device that exhibits this behaviour is the Orange Pi CM4.
This is more of a question than a true feature request- is there any reason bmcd
is being built against OpenSSL rather than rustls? I've been playing with the latest build on my hardware and ported it over without much headache, but I didn't want to submit a PR without some discussion first to make sure I understand why it is built the way it is.
Loving the new tools btw, absolutely excellent work!
bmcd
listens on port 443A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.