syntax = "proto3";
package m48;
option go_package = "./m48";
import "google/protobuf/empty.proto";
service BmcServer {
// 系统信息相关
rpc GetMachineInfo(google.protobuf.Empty) returns (MachineInfoResponse);
rpc GetMachineResourceUsage(google.protobuf.Empty) returns (MachineResourceUsageResponse);
// 电源管理
rpc GetPowerInfo(google.protobuf.Empty) returns (PowerInfoResponse);
rpc SetPowerMode(SetPowerModeRequest) returns (CommonResponse);
// 风扇控制
rpc GetFanSpeed(google.protobuf.Empty) returns (FanSpeedResponse);
rpc SetFanSpeed(FanSpeedRequest) returns (CommonResponse);
// 交换机信息和管理
rpc GetSwitcherInfo(google.protobuf.Empty) returns (SwitcherInfoResponse);
rpc UpgradeSwitcher(google.protobuf.Empty) returns (CommonResponse);
// 设备管理
rpc GetDeviceInfoList(google.protobuf.Empty) returns (DeviceInfoListResponse);
// 板卡状态管理
rpc SetBoardStatus(SetBoardStatusRequest) returns (CommonResponse);
// SSH管理
rpc SetSshStatus(SshStatusRequest) returns (CommonResponse);
rpc SetSshPublicKey(SshPublicKeyRequest) returns (CommonResponse);
// 系统配置
rpc SetHostname(HostnameRequest) returns (CommonResponse);
// 固件管理
rpc GetFirmwareList(google.protobuf.Empty) returns (FirmwareListResponse);
rpc DeleteFirmware(DeleteFirmwareRequest) returns (CommonResponse);
// 刷机功能
rpc StartMaskRom(MaskRomRequest) returns (CommonResponse);
}
// 通用响应
message CommonResponse {
bool success = 1;
string message = 2;
}
// 系统信息相关
message MachineInfoResponse {
string type = 1;
string ipAddr = 2;
string macAddr = 3;
string hostName = 4;
string bmcVersion = 5;
}
message MachineResourceUsageResponse {
int32 cpuUsage = 1;
int64 memFree = 2;
int64 memTotal = 3;
int64 mmcUsage = 4;
int64 mmcTotal = 5;
}
message SystemConfigResponse {
string ipAddr = 1;
string macAddr = 2;
string hostName = 3;
map<string, string> systemConfig = 4;
}
// 电源管理
message PowerInfoResponse {
bool switcher = 1;
bool mainPower = 2;
bool upPower = 3;
bool downPower = 4;
map<string, bool> usbPower = 5; // USB电源状态,key为usb_编号
}
message PowerModeInfo {
string name = 1;
bool mode = 2;
}
message SetPowerModeRequest {
repeated PowerModeInfo powerModes = 1;
}
// 风扇控制
message FanSpeedResponse {
int32 speed = 1;
}
message FanSpeedRequest {
int32 speed = 1;
}
// 交换机信息
message SwitcherInfoResponse{
string version = 1;
bool onMask = 2;
string maskProgress = 3;
bool powerStatus = 4;
string boot = 5;
int32 temp = 6;
int32 upTime = 7;
int32 freeRam = 8;
}
// 设备信息
message DeviceInfoResponse {
int32 position = 1;
string deviceId = 2;
string firmwareVersion = 3;
string ipAddress = 4;
bool powerStatus = 5;
bool onMask = 6;
int32 maskTaskQueue = 7;
string mac = 8;
int32 cpuTemp = 9;
string cpuLoad = 10;
string memTotal = 11;
string memUsed = 12;
string mmcTotal = 13;
string mmcUsed = 14;
string type = 15;
int32 bindStatus = 16;
string networkSpeed = 17;
bool networkInterfaceStatus = 18;
}
message DeviceInfoListResponse{
repeated DeviceInfoResponse deviceInfo = 1;
}
// 板卡状态
message SetBoardStatusRequest {
string serialNumber = 1; // 空字符串表示设置所有板卡
string status = 2;
repeated int32 positions = 3; // 指定位置列表
}
// SSH管理
message SshStatusRequest {
bool status = 1;
}
message SshPublicKeyRequest {
string publicKey = 1;
}
// 系统配置
message HostnameRequest {
string name = 1;
}
// 固件管理
message FirmwareInfo {
string name = 1;
string platform = 2;
string path = 3;
int64 size = 4;
string createTime = 5;
}
message FirmwareListResponse {
repeated FirmwareInfo firmwareList = 1;
}
message DeleteFirmwareRequest {
string name = 1;
}
// 刷机功能
message MaskRomRequest {
int32 serialNumber = 1;
string model = 2;
string firmwareName = 3;
}