Skip to content

opiproject/opi-smbios-bridge

Repository files navigation

OPI inventory gRPC to SMBIOS DMI bridge

Linters CodeQL OpenSSF Scorecard tests Docker License codecov Go Report Card Go Doc Pulls Last Release GitHub stars GitHub Contributors

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

build like this:

go build -v -o /opi-smbios-bridge ./cmd/...

import like this:

import "github.com/opiproject/opi-smbios-bridge/pkg/inventory"

Using docker

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

$ docker run --rm -it -p 50051:50051 -p 8082:8082 ghcr.io/opiproject/opi-smbios-bridge:main
2024/06/13 23:07:43 gRPC Server listening at [::]:50051
2024/06/13 23:07:43 HTTP Server listening at 8082

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 GetInventory(opi_api.inventory.v1.GetInventoryRequest) returns (opi_api.inventory.v1.Inventory) {}
}

HTTP example using grpc gateway

curl -kL http://10.10.10.10:8082/v1/inventory/1/inventory/2

Nvidia example

$ docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.10.10:50051 GetInventory "{}"
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": "2e3bc1d1-e205-4830-a817-968ed1978bac",
    "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": {
    "totalCores": 8,
    "totalThreads": 8
  },
  "memory": {
    "totalPhysicalBytes": "17179869184",
    "totalUsableBytes": "16733876224"
  },
  "pci": [
    {
      "driver": "pcieport",
      "address": "0000:00:00.0",
      "vendor": "Mellanox Technologies",
      "product": "MT42822 BlueField-2 SoC Crypto enabled",
      "revision": "0x00",
      "subsystem": "unknown",
      "class": "Bridge",
      "subclass": "PCI bridge"
    },
    {
      "driver": "pcieport",
      "address": "0000:01:00.0",
      "vendor": "Mellanox Technologies",
      "product": "MT42822 Family [BlueField-2 SoC PCIe Bridge]",
      "revision": "0x00",
      "subsystem": "unknown",
      "class": "Bridge",
      "subclass": "PCI bridge"
    },
    {
      "driver": "pcieport",
      "address": "0000:02:00.0",
      "vendor": "Mellanox Technologies",
      "product": "MT42822 Family [BlueField-2 SoC PCIe Bridge]",
      "revision": "0x00",
      "subsystem": "unknown",
      "class": "Bridge",
      "subclass": "PCI bridge"
    },
    {
      "driver": "mlx5_core",
      "address": "0000:03:00.0",
      "vendor": "Mellanox Technologies",
      "product": "MT42822 BlueField-2 integrated ConnectX-6 Dx network controller",
      "revision": "0x00",
      "subsystem": "unknown",
      "class": "Network controller",
      "subclass": "Ethernet controller"
    },
    {
      "driver": "mlx5_core",
      "address": "0000:03:00.1",
      "vendor": "Mellanox Technologies",
      "product": "MT42822 BlueField-2 integrated ConnectX-6 Dx network controller",
      "revision": "0x00",
      "subsystem": "unknown",
      "class": "Network controller",
      "subclass": "Ethernet controller"
    }
  ]
}
Rpc succeeded with OK status

Marvell example

Reduced output a little bit...

$ docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 11.11.11.11:50051 GetInventory "{}"
connecting to 11.11.11.11:50051
{
"bios": {
  "vendor": "U-Boot",
  "version": "2020.10-6.0.0",
  "date": "11/29/2021"
},
"system": {
  "name": "octeontx2",
  "vendor": "Marvell",
  "serialNumber": "CN9600-CRB-BOARD-PR3-CP-R3P1-209",
  "uuid": "36394e43-3030-432d-5242-2d424f415244"
},
"baseboard": {
  "vendor": "Marvell",
  "product": "octeontx2"
},
 "chassis": {
  "type": "23",
  "typeDescription": "Rack mount chassis",
  "vendor": "Marvell"
},
 "processor": {
  "totalCores": 24,
  "totalThreads": 24
},
 "memory": {
  "totalPhysicalBytes": "51118669824",
  "totalUsableBytes": "51118669824"
},
 "pci": [
  {
   "address": "0000:00:01.0",
   "vendor": "Cavium, Inc.",
   "product": "THUNDERX PCC Bridge",
   "revision": "0x11",
   "subsystem": "unknown",
   "class": "Bridge",
   "subclass": "PCI bridge"
  },
   {
   "address": "0000:01:01.0",
   "vendor": "Cavium, Inc.",
   "product": "THUNDERX NCSI (Network Controller Sideband Interface)",
   "revision": "0x11",
   "subsystem": "unknown",
   "class": "Network controller",
   "subclass": "Network controller"
  },
   {
   "driver": "thunderx_mmc",
   "address": "0000:01:01.4",
   "vendor": "Cavium, Inc.",
   "product": "THUNDERX eMMC/SD Controller",
   "revision": "0x11",
   "subsystem": "unknown",
   "class": "Memory controller",
   "subclass": "Memory controller"
  },
   {
   "address": "0000:01:06.1",
    "vendor": "Cavium, Inc.",
    "product": "unknown",
    "revision": "0x11",
    "subsystem": "unknown",
    "class": "Memory controller",
    "subclass": "Memory controller"
   },
   {
    "address": "0000:01:08.0",
    "vendor": "Cavium, Inc.",
    "product": "unknown",
    "revision": "0x11",
    "subsystem": "unknown",
    "class": "Generic system peripheral",
    "subclass": "System peripheral"
   },
   {
    "driver": "Marvell-CGX!RPM",
    "address": "0000:01:10.0",
    "vendor": "Cavium, Inc.",
    "product": "Octeon TX2 CGX (MAC)",
    "revision": "0x11",
    "subsystem": "unknown",
    "class": "Network controller",
    "subclass": "Network controller"
   },
   {
    "driver": "cavium_rng_pf",
    "address": "0000:03:00.0",
    "vendor": "Cavium, Inc.",
    "product": "THUNDERX Random Number Generator",
    "revision": "0x11",
    "subsystem": "unknown",
    "class": "Processing accelerators",
    "subclass": "Processing accelerators"
   },
   {
    "address": "0005:00:00.0",
    "vendor": "Cavium, Inc.",
    "product": "THUNDERX PCIERC (PCIe Root Complex)",
    "revision": "0x00",
    "subsystem": "unknown",
    "class": "Bridge",
    "subclass": "PCI bridge"
   },
   {
    "driver": "nvme",
    "address": "0005:01:00.0",
    "vendor": "Samsung Electronics Co Ltd",
    "product": "NVMe SSD Controller PM9A1/PM9A3/980PRO",
    "revision": "0x00",
    "subsystem": "unknown",
    "class": "Mass storage controller",
    "subclass": "Non-Volatile memory controller"
   }
 ]
 }
Rpc succeeded with OK status

Intel example

Values market as ------------- will be populated in future FW releases.

$ docker run --network=host --rm -it namely/grpc-cli call --json_input --json_output 10.10.0.18:50051 GetInventory "{}"
connecting to 10.10.0.18:50051
{
"bios": {
  "vendor": "Intel",
  "version": "Intel(R) IPU Embedded UEFI FW 0.6.7 for AArch64",
  "date": "Dec  9 2022"
},
"system": {
  "family": "-------------",
  "name": "Intel(R) Infrastructure Processing Unit (Intel(R) IPU)",
  "vendor": "Intel",
  "serialNumber": "-------------",
  "uuid": "8a95d198-7f46-11e5-bf8b-08002704d48e",
  "sku": "-------------",
  "version": "A0"
},
"baseboard": {
  "assetTag": "unknown",
  "serialNumber": "unknown",
  "vendor": "unknown",
  "version": "unknown",
  "product": "unknown"
},
"chassis": {
  "assetTag": "N/A",
  "serialNumber": "N/A",
  "type": "1",
  "typeDescription": "Other",
  "vendor": "Intel",
  "version": "N/A"
},
"processor": {},
"memory": {
  "totalPhysicalBytes": "13732470784",
  "totalUsableBytes": "13732470784"
}
}
Rpc succeeded with OK status

AMD example

tbd