Skip to content

opiproject/opi-smbios-bridge

Folders and files

NameName
Last commit message
Last commit date
Feb 14, 2023
Feb 13, 2023
Feb 13, 2023
Feb 13, 2023
Jan 23, 2023
Dec 20, 2022
Feb 4, 2023
Jan 23, 2023
Feb 17, 2023
Feb 17, 2023
Feb 3, 2023

Repository files navigation

OPI inventory gRPC to SMBIOS DMI bridge

Linters tests Docker License codecov Go Report Card Go Doc Pulls Last Release

This is a SMBIOS plugin to OPI inventory gRPC APIs based on dmidecode and ghw go library implementing protobuf.

I Want To Contribute

This project welcomes contributions and suggestions. We are happy to have the Community involved via submission of Issues and Pull Requests (with substantive content or even just fixes). We are hoping for the documents, test framework, etc. to become a community process with active engagement. PRs can be reviewed by by any number of people, and a maintainer may accept.

See CONTRIBUTING and GitHub Basic Process for more details.

Getting started

go build -v -buildmode=plugin -o /opi-smbios-bridge.so ./...

in main app:

package main
import (
    "plugin"
    pc "github.com/opiproject/opi-api/common/v1/gen/go"
)
func main() {
    plug, err := plugin.Open("/opi-smbios-bridge.so")
    inventorySymbol, err := plug.Lookup("PluginInventory")
    var inventory pc.InventorySvcServer
    inventory, ok := inventorySymbol.(pc.InventorySvcServer)
    s := grpc.NewServer()
    pc.RegisterInventorySvcServer(s, inventory)
    reflection.Register(s)
}

Using docker

on DPU/IPU (i.e. with IP=10.10.10.1) run

$ docker run --rm -it -v /var/tmp/:/var/tmp/ -p 50051:50051 ghcr.io/opiproject/opi-smbios-bridge:main
2022/11/29 00:03:55 plugin serevr is &{{}}
2022/11/29 00:03:55 server listening at [::]:50051

on X86 management VM run

$ docker run --network=host --rm -it namely/grpc-cli ls 10.10.10.10:50051 opi_api.inventory.v1.InventorySvc -l
filename: inventory.proto
package: opi_api.inventory.v1;
service InventorySvc {
  rpc InventoryGet(opi_api.inventory.v1.InventoryGetRequest) returns (opi_api.inventory.v1.InventoryGetResponse) {}
}

# NVIDIA example:

$ docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 InventoryGet "{}"
connecting to 10.10.10.10:50051
{
 "bios": {
  "vendor": "https://www.mellanox.com",
  "version": "BlueField:3.7.0-20-g98daf29",
  "date": "Jun 26 2021"
 },
 "system": {
  "family": "BlueField",
  "name": "BlueField SoC",
  "vendor": "https://www.mellanox.com",
  "serialNumber": "Unspecified System Serial Number",
  "uuid": "63ec430e-7620-479a-8ec5-133de3972679",
  "sku": "Unspecified System SKU",
  "version": "1.0.0"
 },
 "baseboard": {
  "assetTag": "Unspecified Asset Tag",
  "serialNumber": "Unspecified Base Board Serial Number",
  "vendor": "https://www.mellanox.com",
  "version": "1.0.0",
  "product": "BlueField SoC"
 },
 "chassis": {
  "assetTag": "Unspecified Chassis Board Asset Tag",
  "serialNumber": "Unspecified Chassis Board Serial Number",
  "type": "1",
  "typeDescription": "Other",
  "vendor": "https://www.mellanox.com",
  "version": "1.0.0"
 },
 "processor": {},
 "memory": {
  "totalPhysicalBytes": "17179869184",
  "totalUsableBytes": "16733876224"
 }
}
Rpc succeeded with OK status

# MARVELL example:

docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 11.11.11.11:50051 InventoryGet "{}"
connecting to 11.11.11.11:50051
{
 "bios": {
  "vendor": "U-Boot",
  "version": "2020.10-6.0.0",
  "date": "08/25/2022"
 },
 "system": {
  "name": "cn10k",
  "vendor": "Marvell",
  "serialNumber": "CN106-A1-CRB-R1-143",
  "uuid": "30314e43-2d36-3141-2d43-52422d52312d"
 },
 "baseboard": {
  "vendor": "Marvell",
  "product": "cn10k"
 },
 "chassis": {
  "type": "23",
  "typeDescription": "Rack mount chassis",
  "vendor": "Marvell"
 },
 "processor": {},
 "memory": {
  "totalPhysicalBytes": "51099402240",
  "totalUsableBytes": "51099402240"
 }
}
Rpc succeeded with OK status