nsmapi

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

  • SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0 *

  • Licensed under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an "AS IS" BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

  • SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0 *

  • Licensed under the Apache License, Version 2.0 (the "License");

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at *

  • http://www.apache.org/licenses/LICENSE-2.0 *

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an "AS IS" BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

Package nsmapi abstracts the gRPC interface used to communicate with the NV-Switch Manager (NSM) service. New connection pools can be created with NewClient to create a real client or NewMockClient which fakes everything for unit tests.

  • SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
  • SPDX-License-Identifier: Apache-2.0 *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetNVSwitches returns NV-Switch information for the specified switch UUIDs.
	// If uuids is empty, returns all registered switches.
	GetNVSwitches(ctx context.Context, uuids []string) ([]NVSwitchTray, error)

	// RegisterNVSwitches registers NV-Switch trays and returns service-generated UUIDs.
	RegisterNVSwitches(ctx context.Context, requests []RegisterNVSwitchRequest) ([]RegisterNVSwitchResponse, error)

	// PowerControl performs a power action on the specified NV-Switch trays.
	PowerControl(ctx context.Context, uuids []string, action PowerAction) ([]PowerControlResult, error)

	// QueueUpdates queues firmware updates for one or more components for multiple switches.
	// If components is empty, all components in the bundle are updated in sequence.
	QueueUpdates(ctx context.Context, switchUUIDs []string, bundleVersion string, components []NVSwitchComponent) ([]FirmwareUpdateInfo, error)

	// GetUpdates returns the status of firmware updates for a given switch.
	GetUpdates(ctx context.Context, switchUUID string) ([]FirmwareUpdateInfo, error)

	// ListBundles returns all available firmware bundles.
	ListBundles(ctx context.Context) ([]FirmwareBundle, error)

	// Close closes the underlying gRPC connection.
	Close() error

	// The following are only valid in the mock environment and should only be called by unit tests.
	AddNVSwitch(NVSwitchTray)
	SetNVSwitchFirmware(bmcMAC string, firmware string)
}

Client allows us to have both a real implementation and a mock implementation for unit tests which can be switched transparently.

func NewClient

func NewClient(grpcTimeout time.Duration) (Client, error)

NewClient creates a gRPC connection pool to NV-Switch Manager. Returning success does not mean that we have yet made an actual connection; that happens when making an actual request.

func NewMockClient

func NewMockClient() Client

NewMockClient returns a gRPC client that returns mock values so it can be used in unit tests.

type ComponentInfo

type ComponentInfo struct {
	Name     string
	Version  string
	Strategy string
}

ComponentInfo describes a component within a firmware bundle.

type FirmwareBundle

type FirmwareBundle struct {
	Version     string
	Description string
	Components  []ComponentInfo
}

FirmwareBundle represents a firmware package with multiple components.

type FirmwareUpdateInfo

type FirmwareUpdateInfo struct {
	ID             string
	SwitchUUID     string
	Component      NVSwitchComponent
	BundleVersion  string
	State          UpdateState
	VersionFrom    string
	VersionTo      string
	VersionActual  string
	ErrorMessage   string
	CreatedAt      time.Time
	UpdatedAt      time.Time
	BundleUpdateID string
	SequenceOrder  int32
	PredecessorID  string
}

FirmwareUpdateInfo contains full details of a firmware update operation.

type NVSwitchComponent

type NVSwitchComponent int

NVSwitchComponent enumerates the updatable components of an NV-Switch tray.

const (
	NVSwitchComponentUnknown NVSwitchComponent = 0
	NVSwitchComponentBMC     NVSwitchComponent = 1
	NVSwitchComponentCPLD    NVSwitchComponent = 2
	NVSwitchComponentBIOS    NVSwitchComponent = 3
	NVSwitchComponentNVOS    NVSwitchComponent = 4
)

func (NVSwitchComponent) String

func (c NVSwitchComponent) String() string

type NVSwitchTray added in v1.2.0

type NVSwitchTray struct {
	UUID                string
	BMCMACAddress       string
	BMCIPAddress        string
	BMCFirmware         string
	NVOSVersion         string
	CPLDVersion         string
	ChassisSerial       string
	ChassisModel        string
	ChassisManufacturer string
	RackID              string
}

NVSwitchTray represents a complete NV-Switch tray registered with NSM.

type PowerAction

type PowerAction int

PowerAction enumerates the power actions supported by NV-Switch Manager.

const (
	PowerActionUnknown          PowerAction = 0
	PowerActionForceOff         PowerAction = 1
	PowerActionPowerCycle       PowerAction = 2
	PowerActionGracefulShutdown PowerAction = 3
	PowerActionOn               PowerAction = 4
	PowerActionForceOn          PowerAction = 5
	PowerActionGracefulRestart  PowerAction = 6
	PowerActionForceRestart     PowerAction = 7
)

func (PowerAction) String

func (a PowerAction) String() string

type PowerControlResult

type PowerControlResult struct {
	UUID   string
	Status StatusCode
	Error  string
}

PowerControlResult contains the result of a power control operation for a single switch.

type RegisterNVSwitchRequest added in v1.2.0

type RegisterNVSwitchRequest struct {
	BMCMACAddress  string
	BMCIPAddress   string
	NVOSMACAddress string
	NVOSIPAddress  string
}

RegisterNVSwitchRequest contains the information needed to register an NV-Switch. Credentials are omitted; Carbide writes them to Vault and NSM looks them up by MAC address at the time of use.

type RegisterNVSwitchResponse added in v1.2.0

type RegisterNVSwitchResponse struct {
	UUID   string
	IsNew  bool
	Status StatusCode
	Error  string
}

RegisterNVSwitchResponse contains the result of registering an NV-Switch.

type StatusCode

type StatusCode int

StatusCode represents the result of an operation.

const (
	StatusSuccess         StatusCode = 0
	StatusInvalidArgument StatusCode = 1
	StatusInternalError   StatusCode = 2
)

type UpdateState

type UpdateState int

UpdateState represents the granular state of a firmware update.

const (
	UpdateStateUnknown        UpdateState = 0
	UpdateStateQueued         UpdateState = 1
	UpdateStatePowerCycle     UpdateState = 2
	UpdateStateWaitReachable  UpdateState = 3
	UpdateStateCopy           UpdateState = 4
	UpdateStateUpload         UpdateState = 5
	UpdateStateInstall        UpdateState = 6
	UpdateStatePollCompletion UpdateState = 7
	UpdateStateVerify         UpdateState = 8
	UpdateStateCleanup        UpdateState = 9
	UpdateStateCompleted      UpdateState = 10
	UpdateStateFailed         UpdateState = 11
	UpdateStateCancelled      UpdateState = 12
)

func (UpdateState) IsTerminal

func (s UpdateState) IsTerminal() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL