Skip to content

Commit

Permalink
Vc/module rename (#8)
Browse files Browse the repository at this point in the history
* search-and-replace for bmc-toolbox/bmclib/v2

* add renovate.json

* change the PR config

* remove unneeded test args
  • Loading branch information
DoctorVin authored Nov 12, 2024
1 parent 1ea8d9e commit 8078fc3
Show file tree
Hide file tree
Showing 74 changed files with 228 additions and 231 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/ci.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/push-pr-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: lint and test
on: [pull_request, push]

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --config .golangci.yml --timeout 2m
version: v1.61.0

- name: Test
run: go test ./...

build:
runs-on: ubuntu-latest
needs: [lint-test]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
50 changes: 13 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# bmclib v2 - board management controller library

[![Status](https://github.com/bmc-toolbox/bmclib/actions/workflows/ci.yaml/badge.svg)](https://github.com/bmc-toolbox/bmclib/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/bmc-toolbox/bmclib)](https://goreportcard.com/report/github.com/bmc-toolbox/bmclib/v2)
[![GoDoc](https://godoc.org/github.com/bmc-toolbox/bmclib/v2?status.svg)](https://godoc.org/github.com/bmc-toolbox/bmclib/v2)
[![Status](https://github.com/metal-toolbox/bmclib/actions/workflows/ci.yaml/badge.svg)](https://github.com/metal-toolbox/bmclib/actions)
[![Go Report Card](https://goreportcard.com/badge/github.com/metal-toolbox/bmclib)](https://goreportcard.com/report/github.com/metal-toolbox/bmclib)
[![GoDoc](https://godoc.org/github.com/metal-toolbox/bmclib?status.svg)](https://godoc.org/github.com/metal-toolbox/bmclib)

bmclib v2 is a library to abstract interacting with baseboard management controllers.

## Supported BMC interfaces.

- [Redfish](https://github.com/bmc-toolbox/bmclib/tree/main/providers/redfish)
- [IPMItool](https://github.com/bmc-toolbox/bmclib/tree/main/providers/ipmitool)
- [Intel AMT](https://github.com/bmc-toolbox/bmclib/tree/main/providers/intelamt)
- [Asrockrack](https://github.com/bmc-toolbox/bmclib/tree/main/providers/asrockrack)
- [Redfish](https://github.com/metal-toolbox/bmclib/tree/main/providers/redfish)
- [IPMItool](https://github.com/metal-toolbox/bmclib/tree/main/providers/ipmitool)
- [Intel AMT](https://github.com/metal-toolbox/bmclib/tree/main/providers/intelamt)
- [Asrockrack](https://github.com/metal-toolbox/bmclib/tree/main/providers/asrockrack)
- [RPC](providers/rpc/)

## Installation

```bash
go get github.com/bmc-toolbox/bmclib/v2
go get github.com/metal-toolbox/bmclib
```

## Import

```go
import (
bmclib "github.com/bmc-toolbox/bmclib/v2"
bmclib "github.com/metal-toolbox/bmclib"
)
```

Expand All @@ -34,7 +34,7 @@ The snippet below connects to a BMC and retrieves the device hardware, firmware

```go
import (
bmclib "github.com/bmc-toolbox/bmclib/v2"
bmclib "github.com/metal-toolbox/bmclib"
)

// setup logger
Expand Down Expand Up @@ -73,7 +73,7 @@ More sample code can be found in [examples](./examples/)

## BMC connections

bmclib performs queries on BMCs using [multiple `drivers`](https://github.com/bmc-toolbox/bmclib/blob/main/bmc/connection.go#L30),
bmclib performs queries on BMCs using [multiple `drivers`](https://github.com/metal-toolbox/bmclib/blob/main/bmc/connection.go#L30),
these `drivers` are the various services exposed by a BMC - `redfish` `IPMI` `SSH` and `vendor API` which is basically a custom vendor API endpoint.

The bmclib client determines which driver to use for an action like `Power cycle` or `Create user`
Expand Down Expand Up @@ -102,7 +102,7 @@ client.Registry.Drivers = driver
```

Filter drivers to query based on compatibility, this will attempt to check if the driver is
[compatible](https://github.com/bmc-toolbox/bmclib/blob/main/providers/redfish/redfish.go#L70)
[compatible](https://github.com/metal-toolbox/bmclib/blob/main/providers/redfish/redfish.go#L70)
ideally, this method should be invoked when the client is ready to perform a BMC action.

```go
Expand Down Expand Up @@ -191,7 +191,7 @@ state, err := cl.GetPowerState(ctx)

The `bmclib.Client` can be configured to filter BMC calls based on a few different criteria. Filtering modifies the order and/or the number of providers for BMC calls. This filtering can be permanent or on a one-time basis.

All providers are stored in a registry (see [`Client.Registry`](https://github.com/bmc-toolbox/bmclib/blob/b5cdfa3ffe026d3cc3257953abe3234b278ca20a/client.go#L29)) and the default order for providers in the registry is `ipmitool`, `asrockrack`, `gofish`, `IntelAMT`. The default order is defined [here](https://github.com/bmc-toolbox/bmclib/blob/b5cdfa3ffe026d3cc3257953abe3234b278ca20a/client.go#L152).
All providers are stored in a registry (see [`Client.Registry`](https://github.com/metal-toolbox/bmclib/blob/b5cdfa3ffe026d3cc3257953abe3234b278ca20a/client.go#L29)) and the default order for providers in the registry is `ipmitool`, `asrockrack`, `gofish`, `IntelAMT`. The default order is defined [here](https://github.com/metal-toolbox/bmclib/blob/b5cdfa3ffe026d3cc3257953abe3234b278ca20a/client.go#L152).

### Permanent Filtering

Expand Down Expand Up @@ -248,27 +248,3 @@ cl := bmclib.NewClient(
bmclib.WithTracerProvider(otel.GetTracerProvider()),
)
```

## Versions

The current bmclib version is `v2` and is being developed on the `main` branch.

The previous bmclib version is in maintenance mode and can be found here [v1](https://github.com/bmc-toolbox/bmclib/v1).

## Go version in `go.mod`

As a library we will only bump the version of Go in the `go.mod` file when there are required dependencies in bmclib that necessitate
a version bump. When consuming bmclib in your project, we recommend always building with the latest Go version but this
should be in your hands as a user as much as possible.

## Acknowledgments

bmclib v2 interfaces with Redfish on BMCs through the Gofish library https://github.com/stmcginnis/gofish

bmclib was originally developed for [Booking.com](http://www.booking.com). With approval from [Booking.com](http://www.booking.com),
the code and specification were generalized and published as Open Source on github, for which the authors would like to express their gratitude.

### Authors

- [Joel Rebello](https://github.com/joelrebel)
- [Jacob Weinstock](https://github.com/jacobweinstock)
2 changes: 1 addition & 1 deletion bmc/bios.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"fmt"

bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/hashicorp/go-multierror"
bmclibErrs "github.com/metal-toolbox/bmclib/errors"
"github.com/pkg/errors"
)

Expand Down
6 changes: 3 additions & 3 deletions bmc/firmware.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"io"
"os"

"github.com/bmc-toolbox/bmclib/v2/constants"
bconsts "github.com/bmc-toolbox/bmclib/v2/constants"
bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/metal-toolbox/bmclib/constants"
bconsts "github.com/metal-toolbox/bmclib/constants"
bmclibErrs "github.com/metal-toolbox/bmclib/errors"

"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
Expand Down
6 changes: 3 additions & 3 deletions bmc/firmware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"testing"
"time"

"github.com/bmc-toolbox/bmclib/v2/constants"
bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/bmc-toolbox/common"
common "github.com/metal-toolbox/bmc-common"
"github.com/metal-toolbox/bmclib/constants"
bmclibErrs "github.com/metal-toolbox/bmclib/errors"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion bmc/floppy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"io"

bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/hashicorp/go-multierror"
bmclibErrs "github.com/metal-toolbox/bmclib/errors"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion bmc/floppy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
bmclibErrs "github.com/metal-toolbox/bmclib/errors"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions bmc/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"fmt"

"github.com/hashicorp/go-multierror"
common "github.com/metal-toolbox/bmc-common"
"github.com/pkg/errors"

bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/bmc-toolbox/common"
bmclibErrs "github.com/metal-toolbox/bmclib/errors"
)

// InventoryGetter defines methods to retrieve device hardware and firmware inventory
Expand Down
7 changes: 3 additions & 4 deletions bmc/inventory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import (
"testing"
"time"

"github.com/bmc-toolbox/bmclib/v2/errors"
bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/bmc-toolbox/common"
common "github.com/metal-toolbox/bmc-common"
"github.com/metal-toolbox/bmclib/errors"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -73,7 +72,7 @@ func TestInventoryFromInterfaces(t *testing.T) {
badImplementation bool
}{
{"success with metadata", &common.Device{Common: common.Common{Vendor: "foo"}}, nil, 5 * time.Second, "foo", 1, false},
{"failure with bad implementation", nil, bmclibErrs.ErrProviderImplementation, 5 * time.Second, "foo", 1, true},
{"failure with bad implementation", nil, errors.ErrProviderImplementation, 5 * time.Second, "foo", 1, true},
}

for _, tc := range testCases {
Expand Down
2 changes: 1 addition & 1 deletion bmc/postcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"fmt"

bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/hashicorp/go-multierror"
bmclibErrs "github.com/metal-toolbox/bmclib/errors"
"github.com/pkg/errors"
)

Expand Down
4 changes: 2 additions & 2 deletions bmc/postcode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

"github.com/bmc-toolbox/bmclib/v2/constants"
bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/metal-toolbox/bmclib/constants"
bmclibErrs "github.com/metal-toolbox/bmclib/errors"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion bmc/screenshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"fmt"

bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/hashicorp/go-multierror"
bmclibErrs "github.com/metal-toolbox/bmclib/errors"
"github.com/pkg/errors"
)

Expand Down
26 changes: 13 additions & 13 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ import (
"time"

"dario.cat/mergo"
"github.com/bmc-toolbox/bmclib/v2/bmc"
"github.com/bmc-toolbox/bmclib/v2/constants"
"github.com/bmc-toolbox/bmclib/v2/internal/httpclient"
"github.com/bmc-toolbox/bmclib/v2/providers/asrockrack"
"github.com/bmc-toolbox/bmclib/v2/providers/dell"
"github.com/bmc-toolbox/bmclib/v2/providers/intelamt"
"github.com/bmc-toolbox/bmclib/v2/providers/ipmitool"
"github.com/bmc-toolbox/bmclib/v2/providers/openbmc"
"github.com/bmc-toolbox/bmclib/v2/providers/redfish"
"github.com/bmc-toolbox/bmclib/v2/providers/rpc"
"github.com/bmc-toolbox/bmclib/v2/providers/supermicro"
"github.com/bmc-toolbox/common"
"github.com/go-logr/logr"
"github.com/jacobweinstock/registrar"
common "github.com/metal-toolbox/bmc-common"
"github.com/metal-toolbox/bmclib/bmc"
"github.com/metal-toolbox/bmclib/constants"
"github.com/metal-toolbox/bmclib/internal/httpclient"
"github.com/metal-toolbox/bmclib/providers/asrockrack"
"github.com/metal-toolbox/bmclib/providers/dell"
"github.com/metal-toolbox/bmclib/providers/intelamt"
"github.com/metal-toolbox/bmclib/providers/ipmitool"
"github.com/metal-toolbox/bmclib/providers/openbmc"
"github.com/metal-toolbox/bmclib/providers/redfish"
"github.com/metal-toolbox/bmclib/providers/rpc"
"github.com/metal-toolbox/bmclib/providers/supermicro"
"go.opentelemetry.io/otel/attribute"
oteltrace "go.opentelemetry.io/otel/trace"
tracenoop "go.opentelemetry.io/otel/trace/noop"
Expand All @@ -35,7 +35,7 @@ import (
const (
// default connection timeout
defaultConnectTimeout = 30 * time.Second
pkgName = "github.com/bmc-toolbox/bmclib"
pkgName = "github.com/metal-toolbox/bmclib"
)

// Client for BMC interactions
Expand Down
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"time"

"github.com/bmc-toolbox/bmclib/v2/logging"
"github.com/google/go-cmp/cmp"
"github.com/jacobweinstock/registrar"
"github.com/metal-toolbox/bmclib/logging"
"gopkg.in/go-playground/assert.v1"
)

Expand Down
4 changes: 2 additions & 2 deletions examples/bios/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"strings"
"time"

bmclib "github.com/bmc-toolbox/bmclib/v2"
"github.com/bmc-toolbox/bmclib/v2/providers"
logrusr "github.com/bombsimon/logrusr/v2"
bmclib "github.com/metal-toolbox/bmclib"
"github.com/metal-toolbox/bmclib/providers"

"github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion examples/create-users/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"os"
"time"

bmclib "github.com/bmc-toolbox/bmclib/v2"
"github.com/bombsimon/logrusr/v2"
bmclib "github.com/metal-toolbox/bmclib"
"github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion examples/floppy-image/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"os"
"time"

bmclib "github.com/bmc-toolbox/bmclib/v2"
"github.com/bombsimon/logrusr/v2"
"github.com/metal-toolbox/bmclib"
"github.com/sirupsen/logrus"
)

Expand Down
Loading

0 comments on commit 8078fc3

Please sign in to comment.