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 devmanager
import (
"errors"
"time"
"ascend-common/devmanager/common"
"ascend-common/devmanager/dcmi"
)
var errorMsg = "mock error"
var _ DeviceInterface = &DeviceManagerMockErr{}
type DeviceManagerMockErr struct {
}
func (d *DeviceManagerMockErr) WaitDeviceOnline(resetTimeout int) {
}
func (d *DeviceManagerMockErr) GetValidBoardInfo() (common.BoardInfo, error) {
return common.BoardInfo{}, errors.New("get valid board info failed")
}
func (d *DeviceManagerMockErr) GetValidMainBoardInfo() (uint32, error) {
return 0, errors.New("get valid main board info failed")
}
func (d *DeviceManagerMockErr) StartHccsPingMesh(logicID int32, portID int, operate common.HccspingMeshOperate) error {
return errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) StopHccsPingMesh(logicID int32, portID int, taskID uint) error {
return errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetHccsPingMeshInfo(logicID int32, portID int, taskID uint) (*common.HccspingMeshInfo,
error) {
return nil, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetHccsPingMeshState(logicID int32, portID int, taskID uint) (int, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) Init() error {
return errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) ShutDown() error {
return errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDevType() string {
return common.Ascend910
}
func (d *DeviceManagerMockErr) GetAllDeviceCount() (int32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetCardList() (int32, []int32, error) {
return 1, []int32{0}, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceNumInCard(cardID int32) (int32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceList() (int32, []int32, error) {
return 1, []int32{0}, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceHealth(logicID int32) (uint32, error) {
return 0, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceNetWorkHealth(logicID int32) (uint32, error) {
return 0, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceUtilizationRate(logicID int32, deviceType common.DeviceType) (uint32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceUtilizationRateV2(logicID int32) (common.DcmiMultiUtilizationInfo, error) {
return dcmi.BuildErrNpuMultiUtilizationInfo(), errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceUtilizationRateV2Period(logicID int32) (common.DcmiMultiUtilizationInfo, error) {
return dcmi.BuildErrNpuMultiUtilizationInfo(), errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceUtilizationRateCommon(logicID int32) (common.DcmiMultiUtilizationInfo, error) {
return dcmi.BuildErrNpuMultiUtilizationInfo(), errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceTemperature(logicID int32) (int32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceVoltage(logicID int32) (float32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDevicePowerInfo(logicID int32) (float32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceFrequency(logicID int32, deviceType common.DeviceType) (uint32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceMemoryInfo(logicID int32) (*common.MemoryInfo, error) {
return &common.MemoryInfo{
MemorySize: 1,
MemoryAvailable: 1,
Frequency: 1,
Utilization: 1,
}, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceHbmInfo(logicID int32) (*common.HbmInfo, error) {
return &common.HbmInfo{
MemorySize: 1,
Frequency: 1,
Usage: 1,
Temp: 1,
BandWidthUtilRate: 1,
}, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceErrorCode(logicID int32) (int32, int64, error) {
return int32(0), int64(0), errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetChipInfo(logicID int32) (*common.ChipInfo, error) {
chip := &common.ChipInfo{
Type: "ascend",
Name: common.Chip910,
Version: "v1",
}
return chip, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetPhysicIDFromLogicID(logicID int32) (int32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetLogicIDFromPhysicID(physicID int32) (int32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceLogicID(cardID, deviceID int32) (int32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceIPAddress(logicID, ipType int32) (string, error) {
return "127.0.0.1", errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) CreateVirtualDevice(logicID int32,
vDevInfo common.CgoCreateVDevRes) (common.CgoCreateVDevOut, error) {
return common.CgoCreateVDevOut{}, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetVirtualDeviceInfo(logicID int32) (common.VirtualDevInfo, error) {
return common.VirtualDevInfo{}, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) DestroyVirtualDevice(logicID int32, vDevID uint32) error {
return errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetMcuPowerInfo(cardID int32) (float32, error) {
return 1, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetCardIDDeviceID(logicID int32) (int32, int32, error) {
return 0, 0, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetProductType(logicID int32) (string, error) {
return "", errors.New("not found product type name")
}
func (d *DeviceManagerMockErr) GetAllProductType() ([]string, error) {
return []string{}, errors.New("not found product type name")
}
func (d *DeviceManagerMockErr) GetNpuWorkMode() string {
return ""
}
func (d *DeviceManagerMockErr) SetDeviceReset(logicID int32) error {
return errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceBootStatus(logicID int32) (int, error) {
return common.RetError, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceAllErrorCode(logicID int32) (int32, []int64, error) {
return common.RetError, nil, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDeviceAllErrorCodeWithTimeOut(
logicID int32, timeout time.Duration) (int32, []int64, error) {
return common.RetError, nil, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) SubscribeDeviceFaultEvent(logicID int32) error {
return errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) SetFaultEventCallFunc(businessFunc func(common.DevFaultInfo)) error {
return errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDieID(logicID int32, dcmiDieType dcmi.DieType) (string, error) {
return "", errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetDevProcessInfo(logicID int32) (*common.DevProcessInfo, error) {
return nil, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetPCIeBusInfo(logicID int32) (string, error) {
return "", errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetBoardInfo(logicID int32) (common.BoardInfo, error) {
return common.BoardInfo{}, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetProductTypeArray() []string {
return nil
}
func (d *DeviceManagerMockErr) GetPCIEBandwidth(logicID int32, _ int) (common.PCIEBwStat, error) {
return common.PCIEBwStat{}, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) SetIsTrainingCard() error {
return errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) IsTrainingCard() bool {
return false
}
func (d *DeviceManagerMockErr) GetDcmiVersion() string {
return ""
}
func (d *DeviceManagerMockErr) GetValidChipInfo() (common.ChipInfo, error) {
return common.ChipInfo{}, errors.New("failed to find chip info")
}
func (d *DeviceManagerMockErr) GetDeviceEccInfo(logicID int32,
dcmiDeviceType common.DcmiDeviceType) (*common.ECCInfo, error) {
return nil, errors.New("failed to get device ECC info")
}
func (d *DeviceManagerMockErr) GetSuperPodInfo(logicID int32) (common.CgoSuperPodInfo, error) {
return common.CgoSuperPodInfo{}, nil
}
func (d *DeviceManagerMockErr) GetSioInfo(logicID int32) (*common.SioCrcErrStatisticInfo, error) {
return nil, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetHccsStatisticInfo(logicID int32) (*common.HccsStatisticInfo, error) {
return nil, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetHccsStatisticInfoInU64(logicID int32) (*common.HccsStatisticInfo, error) {
return nil, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetMainBoardId() uint32 {
return 0
}
func (d *DeviceManagerMockErr) GetHccsBandwidthInfo(logicID int32) (*common.HccsBandwidthInfo, error) {
return nil, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetBrotherCardID(logicID int32) (int32, error) {
return -1, nil
}
func (d *DeviceManagerMockErr) GetOutBandChannelState(logicID int32) error {
return nil
}
func (d *DeviceManagerMockErr) PreResetSoc(logicID int32) error {
return nil
}
func (d *DeviceManagerMockErr) SetDeviceResetOutBand(logicID int32) error {
return nil
}
func (d *DeviceManagerMockErr) RescanSoc(logicID int32) error {
return nil
}
func (d *DeviceManagerMockErr) GetChipBaseInfos() ([]*common.ChipBaseInfo, error) {
return nil, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) GetSuperPodStatus(int32, uint32) (int, error) { return 0, nil }
func (d *DeviceManagerMockErr) SetSuperPodStatus(int32, uint32, uint32) error { return nil }
func (d *DeviceManagerMockErr) GetCardElabelV2(cardID int32) (common.ElabelInfo, error) {
return common.ElabelInfo{}, nil
}
func (d *DeviceManagerMockErr) GetMultiDiePolicy() (dcmi.DiePolicyType, error) {
return 0, errors.New(errorMsg)
}
func (d *DeviceManagerMockErr) SetMultiDiePolicy(policy dcmi.DiePolicyType) error {
return errors.New(errorMsg)
}