diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 7648a2b3..9da97d95 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Run tests - run: docker run -v $PWD:/workdir ghcr.io/igorshubovych/markdownlint-cli:latest --ignore "**/autogen.md" --disable=MD013 "**/*.md" + run: docker run -v $PWD:/workdir ghcr.io/igorshubovych/markdownlint-cli:latest --ignore "**/autogen.md" --disable MD013 MD060 -- "**/*.md" api-lint: runs-on: ubuntu-latest diff --git a/lifecycle/lifecycle.proto b/lifecycle/lifecycle.proto new file mode 100644 index 00000000..90599435 --- /dev/null +++ b/lifecycle/lifecycle.proto @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (c) 2025 The OPI Project Authors +// Extracted from OpenShift DPU Operator + +syntax = "proto3"; + +package opi_api.lifecycle.v1; + +import "google/api/annotations.proto"; + +option go_package = "github.com/opiproject/opi-api/lifecycle/v1/gen/go"; +option java_multiple_files = true; +option java_outer_classname = "LifecycleProto"; +option java_package = "opi_api.lifecycle.v1"; + +// Lifecycle management service for xPU initialization +service LifeCycleService { + // Initialize the xPU (DPU/IPU/etc) + rpc Init(InitRequest) returns (IpPort) { + option (google.api.http) = { + post: "/v1/lifecycle/init" + body: "*" + }; + } +} + +// Device lifecycle management service for device enumeration and configuration +service DeviceService { + // Retrieve available devices managed by the xPU + rpc GetDevices(GetDevicesRequest) returns (DeviceListResponse) { + option (google.api.http) = {get: "/v1/lifecycle/devices"}; + } + + // Configure number of virtual functions for a device + rpc SetNumVfs(SetNumVfsRequest) returns (VfCount) { + option (google.api.http) = { + post: "/v1/lifecycle/devices/vfs" + body: "*" + }; + } +} + +// Heartbeat service for lifecycle health monitoring +service HeartbeatService { + // Check xPU lifecycle health status + rpc Ping(PingRequest) returns (PingResponse) { + option (google.api.http) = {get: "/v1/lifecycle/heartbeat/ping"}; + } +} + +// xPU initialization request +message InitRequest { + // xPU mode flag (e.g., DPU mode vs host mode) + bool dpu_mode = 1; + // xPU identifier string + string dpu_identifier = 2; +} + +// Request message for GetDevices +message GetDevicesRequest { + // Empty request - no parameters needed +} + +// Request message for SetNumVfs +message SetNumVfsRequest { + // Number of virtual functions to configure + int32 vf_cnt = 1; +} + +// IP and port response for initialization +message IpPort { + // IP address for xPU communication + string ip = 1; + // Port number for xPU communication + int32 port = 2; +} + +// Virtual function count configuration +message VfCount { + // Number of virtual functions to configure + int32 vf_cnt = 1; +} + +// Topology information for device location +message TopologyInfo { + // Node identifier where device is located + string node = 1; +} + +// Device information structure +message Device { + // Device identifier (e.g., "ens5f0", "eth0") + string id = 1; + // Device health status + string health = 2; + // Topology location information + TopologyInfo topology = 3; +} + +// Device enumeration response +message DeviceListResponse { + // Map of device ID to device information + map devices = 1; +} + +// Ping request for health monitoring +message PingRequest { + // Request timestamp (nanoseconds since epoch) + int64 timestamp = 1; + // Identifier of the sender + string sender_id = 2; +} + +// Ping response for health monitoring +message PingResponse { + // Response timestamp (nanoseconds since epoch) + int64 timestamp = 1; + // Identifier of the responder + string responder_id = 2; + // Health status indicator + bool healthy = 3; +} diff --git a/storage/README.md b/storage/README.md index c931122f..1105d9af 100644 --- a/storage/README.md +++ b/storage/README.md @@ -109,7 +109,7 @@ docker run --rm -it -e GO111MODULE=on -v `pwd`:/app -w /app golang:alpine go get | Block Volume | A volume that will appear as a block device inside the host OS. | | NVMe Subsystem | holding all other objects in NVMe world | | NVMe Controller | responsible for Queues and Commands handlings. Have to belong to some subsystem. | -| NVMe Namespac | representing remote namespace. Belongs to a specific controller (private NS) or shared between controllers (usually for Multipathing).| +| NVMe Namespace | representing remote namespace. Belongs to a specific controller (private NS) or shared between controllers (usually for Multipathing).| | tbd | tbd | ## Storage APIs diff --git a/v1/gen/go/lifecycle/lifecycle.pb.go b/v1/gen/go/lifecycle/lifecycle.pb.go new file mode 100644 index 00000000..f1bbc72e --- /dev/null +++ b/v1/gen/go/lifecycle/lifecycle.pb.go @@ -0,0 +1,707 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (c) 2025 The OPI Project Authors +// Extracted from OpenShift DPU Operator + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.3 +// protoc (unknown) +// source: lifecycle/lifecycle.proto + +package _go + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// xPU initialization request +type InitRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // xPU mode flag (e.g., DPU mode vs host mode) + DpuMode bool `protobuf:"varint,1,opt,name=dpu_mode,json=dpuMode,proto3" json:"dpu_mode,omitempty"` + // xPU identifier string + DpuIdentifier string `protobuf:"bytes,2,opt,name=dpu_identifier,json=dpuIdentifier,proto3" json:"dpu_identifier,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InitRequest) Reset() { + *x = InitRequest{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InitRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InitRequest) ProtoMessage() {} + +func (x *InitRequest) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InitRequest.ProtoReflect.Descriptor instead. +func (*InitRequest) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{0} +} + +func (x *InitRequest) GetDpuMode() bool { + if x != nil { + return x.DpuMode + } + return false +} + +func (x *InitRequest) GetDpuIdentifier() string { + if x != nil { + return x.DpuIdentifier + } + return "" +} + +// Request message for GetDevices +type GetDevicesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetDevicesRequest) Reset() { + *x = GetDevicesRequest{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetDevicesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDevicesRequest) ProtoMessage() {} + +func (x *GetDevicesRequest) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetDevicesRequest.ProtoReflect.Descriptor instead. +func (*GetDevicesRequest) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{1} +} + +// Request message for SetNumVfs +type SetNumVfsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Number of virtual functions to configure + VfCnt int32 `protobuf:"varint,1,opt,name=vf_cnt,json=vfCnt,proto3" json:"vf_cnt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SetNumVfsRequest) Reset() { + *x = SetNumVfsRequest{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SetNumVfsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetNumVfsRequest) ProtoMessage() {} + +func (x *SetNumVfsRequest) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetNumVfsRequest.ProtoReflect.Descriptor instead. +func (*SetNumVfsRequest) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{2} +} + +func (x *SetNumVfsRequest) GetVfCnt() int32 { + if x != nil { + return x.VfCnt + } + return 0 +} + +// IP and port response for initialization +type IpPort struct { + state protoimpl.MessageState `protogen:"open.v1"` + // IP address for xPU communication + Ip string `protobuf:"bytes,1,opt,name=ip,proto3" json:"ip,omitempty"` + // Port number for xPU communication + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *IpPort) Reset() { + *x = IpPort{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *IpPort) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IpPort) ProtoMessage() {} + +func (x *IpPort) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IpPort.ProtoReflect.Descriptor instead. +func (*IpPort) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{3} +} + +func (x *IpPort) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *IpPort) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +// Virtual function count configuration +type VfCount struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Number of virtual functions to configure + VfCnt int32 `protobuf:"varint,1,opt,name=vf_cnt,json=vfCnt,proto3" json:"vf_cnt,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *VfCount) Reset() { + *x = VfCount{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *VfCount) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VfCount) ProtoMessage() {} + +func (x *VfCount) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VfCount.ProtoReflect.Descriptor instead. +func (*VfCount) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{4} +} + +func (x *VfCount) GetVfCnt() int32 { + if x != nil { + return x.VfCnt + } + return 0 +} + +// Topology information for device location +type TopologyInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Node identifier where device is located + Node string `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TopologyInfo) Reset() { + *x = TopologyInfo{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TopologyInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TopologyInfo) ProtoMessage() {} + +func (x *TopologyInfo) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TopologyInfo.ProtoReflect.Descriptor instead. +func (*TopologyInfo) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{5} +} + +func (x *TopologyInfo) GetNode() string { + if x != nil { + return x.Node + } + return "" +} + +// Device information structure +type Device struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Device identifier (e.g., "ens5f0", "eth0") + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // Device health status + Health string `protobuf:"bytes,2,opt,name=health,proto3" json:"health,omitempty"` + // Topology location information + Topology *TopologyInfo `protobuf:"bytes,3,opt,name=topology,proto3" json:"topology,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Device) Reset() { + *x = Device{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Device) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Device) ProtoMessage() {} + +func (x *Device) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Device.ProtoReflect.Descriptor instead. +func (*Device) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{6} +} + +func (x *Device) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Device) GetHealth() string { + if x != nil { + return x.Health + } + return "" +} + +func (x *Device) GetTopology() *TopologyInfo { + if x != nil { + return x.Topology + } + return nil +} + +// Device enumeration response +type DeviceListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Map of device ID to device information + Devices map[string]*Device `protobuf:"bytes,1,rep,name=devices,proto3" json:"devices,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeviceListResponse) Reset() { + *x = DeviceListResponse{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeviceListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceListResponse) ProtoMessage() {} + +func (x *DeviceListResponse) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceListResponse.ProtoReflect.Descriptor instead. +func (*DeviceListResponse) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{7} +} + +func (x *DeviceListResponse) GetDevices() map[string]*Device { + if x != nil { + return x.Devices + } + return nil +} + +// Ping request for health monitoring +type PingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Request timestamp (nanoseconds since epoch) + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // Identifier of the sender + SenderId string `protobuf:"bytes,2,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PingRequest) Reset() { + *x = PingRequest{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PingRequest) ProtoMessage() {} + +func (x *PingRequest) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PingRequest.ProtoReflect.Descriptor instead. +func (*PingRequest) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{8} +} + +func (x *PingRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *PingRequest) GetSenderId() string { + if x != nil { + return x.SenderId + } + return "" +} + +// Ping response for health monitoring +type PingResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Response timestamp (nanoseconds since epoch) + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // Identifier of the responder + ResponderId string `protobuf:"bytes,2,opt,name=responder_id,json=responderId,proto3" json:"responder_id,omitempty"` + // Health status indicator + Healthy bool `protobuf:"varint,3,opt,name=healthy,proto3" json:"healthy,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PingResponse) Reset() { + *x = PingResponse{} + mi := &file_lifecycle_lifecycle_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PingResponse) ProtoMessage() {} + +func (x *PingResponse) ProtoReflect() protoreflect.Message { + mi := &file_lifecycle_lifecycle_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PingResponse.ProtoReflect.Descriptor instead. +func (*PingResponse) Descriptor() ([]byte, []int) { + return file_lifecycle_lifecycle_proto_rawDescGZIP(), []int{9} +} + +func (x *PingResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *PingResponse) GetResponderId() string { + if x != nil { + return x.ResponderId + } + return "" +} + +func (x *PingResponse) GetHealthy() bool { + if x != nil { + return x.Healthy + } + return false +} + +var File_lifecycle_lifecycle_proto protoreflect.FileDescriptor + +var file_lifecycle_lifecycle_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x6c, 0x69, 0x66, 0x65, + 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x6f, 0x70, 0x69, + 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, + 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x4f, 0x0a, 0x0b, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, + 0x0a, 0x08, 0x64, 0x70, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x07, 0x64, 0x70, 0x75, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x70, 0x75, + 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0d, 0x64, 0x70, 0x75, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, + 0x22, 0x13, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x29, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x4e, 0x75, 0x6d, 0x56, + 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x76, 0x66, 0x5f, + 0x63, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x66, 0x43, 0x6e, 0x74, + 0x22, 0x2c, 0x0a, 0x06, 0x49, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, + 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x20, + 0x0a, 0x07, 0x56, 0x66, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x15, 0x0a, 0x06, 0x76, 0x66, 0x5f, + 0x63, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x66, 0x43, 0x6e, 0x74, + 0x22, 0x22, 0x0a, 0x0c, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6e, 0x6f, 0x64, 0x65, 0x22, 0x70, 0x0a, 0x06, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x3e, 0x0a, 0x08, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, + 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x70, 0x69, 0x5f, 0x61, + 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x74, 0x6f, + 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x22, 0xbf, 0x01, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, + 0x07, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, + 0x2e, 0x6f, 0x70, 0x69, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, + 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x4c, 0x69, 0x73, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x1a, 0x58, + 0x0a, 0x0c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x32, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x6f, 0x70, 0x69, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, + 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x48, 0x0a, 0x0b, 0x50, 0x69, 0x6e, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x49, 0x64, 0x22, 0x69, 0x0a, 0x0c, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x64, 0x65, + 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x32, 0x7a, 0x0a, + 0x10, 0x4c, 0x69, 0x66, 0x65, 0x43, 0x79, 0x63, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x66, 0x0a, 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x21, 0x2e, 0x6f, 0x70, 0x69, 0x5f, + 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, + 0x70, 0x69, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, + 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x70, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, + 0x02, 0x17, 0x3a, 0x01, 0x2a, 0x22, 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, + 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x32, 0x89, 0x02, 0x0a, 0x0d, 0x44, 0x65, + 0x76, 0x69, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x7e, 0x0a, 0x0a, 0x47, + 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x27, 0x2e, 0x6f, 0x70, 0x69, 0x5f, + 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x47, 0x65, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6f, 0x70, 0x69, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, + 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, + 0x63, 0x6c, 0x65, 0x2f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x78, 0x0a, 0x09, 0x53, + 0x65, 0x74, 0x4e, 0x75, 0x6d, 0x56, 0x66, 0x73, 0x12, 0x26, 0x2e, 0x6f, 0x70, 0x69, 0x5f, 0x61, + 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, + 0x53, 0x65, 0x74, 0x4e, 0x75, 0x6d, 0x56, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1d, 0x2e, 0x6f, 0x70, 0x69, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, + 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x66, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1e, 0x3a, 0x01, 0x2a, 0x22, 0x19, 0x2f, 0x76, 0x31, 0x2f, + 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2f, 0x76, 0x66, 0x73, 0x32, 0x87, 0x01, 0x0a, 0x10, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, + 0x65, 0x61, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x73, 0x0a, 0x04, 0x50, 0x69, + 0x6e, 0x67, 0x12, 0x21, 0x2e, 0x6f, 0x70, 0x69, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, + 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6f, 0x70, 0x69, 0x5f, 0x61, 0x70, 0x69, 0x2e, + 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x24, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x1e, 0x12, 0x1c, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, 0x6c, 0x65, + 0x2f, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x2f, 0x70, 0x69, 0x6e, 0x67, 0x42, + 0x5b, 0x0a, 0x14, 0x6f, 0x70, 0x69, 0x5f, 0x61, 0x70, 0x69, 0x2e, 0x6c, 0x69, 0x66, 0x65, 0x63, + 0x79, 0x63, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0e, 0x4c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, + 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x69, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x2f, 0x6f, 0x70, 0x69, 0x2d, 0x61, 0x70, 0x69, 0x2f, 0x6c, 0x69, 0x66, 0x65, 0x63, 0x79, 0x63, + 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_lifecycle_lifecycle_proto_rawDescOnce sync.Once + file_lifecycle_lifecycle_proto_rawDescData = file_lifecycle_lifecycle_proto_rawDesc +) + +func file_lifecycle_lifecycle_proto_rawDescGZIP() []byte { + file_lifecycle_lifecycle_proto_rawDescOnce.Do(func() { + file_lifecycle_lifecycle_proto_rawDescData = protoimpl.X.CompressGZIP(file_lifecycle_lifecycle_proto_rawDescData) + }) + return file_lifecycle_lifecycle_proto_rawDescData +} + +var file_lifecycle_lifecycle_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_lifecycle_lifecycle_proto_goTypes = []any{ + (*InitRequest)(nil), // 0: opi_api.lifecycle.v1.InitRequest + (*GetDevicesRequest)(nil), // 1: opi_api.lifecycle.v1.GetDevicesRequest + (*SetNumVfsRequest)(nil), // 2: opi_api.lifecycle.v1.SetNumVfsRequest + (*IpPort)(nil), // 3: opi_api.lifecycle.v1.IpPort + (*VfCount)(nil), // 4: opi_api.lifecycle.v1.VfCount + (*TopologyInfo)(nil), // 5: opi_api.lifecycle.v1.TopologyInfo + (*Device)(nil), // 6: opi_api.lifecycle.v1.Device + (*DeviceListResponse)(nil), // 7: opi_api.lifecycle.v1.DeviceListResponse + (*PingRequest)(nil), // 8: opi_api.lifecycle.v1.PingRequest + (*PingResponse)(nil), // 9: opi_api.lifecycle.v1.PingResponse + nil, // 10: opi_api.lifecycle.v1.DeviceListResponse.DevicesEntry +} +var file_lifecycle_lifecycle_proto_depIdxs = []int32{ + 5, // 0: opi_api.lifecycle.v1.Device.topology:type_name -> opi_api.lifecycle.v1.TopologyInfo + 10, // 1: opi_api.lifecycle.v1.DeviceListResponse.devices:type_name -> opi_api.lifecycle.v1.DeviceListResponse.DevicesEntry + 6, // 2: opi_api.lifecycle.v1.DeviceListResponse.DevicesEntry.value:type_name -> opi_api.lifecycle.v1.Device + 0, // 3: opi_api.lifecycle.v1.LifeCycleService.Init:input_type -> opi_api.lifecycle.v1.InitRequest + 1, // 4: opi_api.lifecycle.v1.DeviceService.GetDevices:input_type -> opi_api.lifecycle.v1.GetDevicesRequest + 2, // 5: opi_api.lifecycle.v1.DeviceService.SetNumVfs:input_type -> opi_api.lifecycle.v1.SetNumVfsRequest + 8, // 6: opi_api.lifecycle.v1.HeartbeatService.Ping:input_type -> opi_api.lifecycle.v1.PingRequest + 3, // 7: opi_api.lifecycle.v1.LifeCycleService.Init:output_type -> opi_api.lifecycle.v1.IpPort + 7, // 8: opi_api.lifecycle.v1.DeviceService.GetDevices:output_type -> opi_api.lifecycle.v1.DeviceListResponse + 4, // 9: opi_api.lifecycle.v1.DeviceService.SetNumVfs:output_type -> opi_api.lifecycle.v1.VfCount + 9, // 10: opi_api.lifecycle.v1.HeartbeatService.Ping:output_type -> opi_api.lifecycle.v1.PingResponse + 7, // [7:11] is the sub-list for method output_type + 3, // [3:7] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_lifecycle_lifecycle_proto_init() } +func file_lifecycle_lifecycle_proto_init() { + if File_lifecycle_lifecycle_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_lifecycle_lifecycle_proto_rawDesc, + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 3, + }, + GoTypes: file_lifecycle_lifecycle_proto_goTypes, + DependencyIndexes: file_lifecycle_lifecycle_proto_depIdxs, + MessageInfos: file_lifecycle_lifecycle_proto_msgTypes, + }.Build() + File_lifecycle_lifecycle_proto = out.File + file_lifecycle_lifecycle_proto_rawDesc = nil + file_lifecycle_lifecycle_proto_goTypes = nil + file_lifecycle_lifecycle_proto_depIdxs = nil +} diff --git a/v1/gen/go/lifecycle/lifecycle.pb.gw.go b/v1/gen/go/lifecycle/lifecycle.pb.gw.go new file mode 100644 index 00000000..46461e3d --- /dev/null +++ b/v1/gen/go/lifecycle/lifecycle.pb.gw.go @@ -0,0 +1,455 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: lifecycle/lifecycle.proto + +/* +Package _go is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package _go + +import ( + "context" + "errors" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var ( + _ codes.Code + _ io.Reader + _ status.Status + _ = errors.New + _ = runtime.String + _ = utilities.NewDoubleArray + _ = metadata.Join +) + +func request_LifeCycleService_Init_0(ctx context.Context, marshaler runtime.Marshaler, client LifeCycleServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq InitRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.Init(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_LifeCycleService_Init_0(ctx context.Context, marshaler runtime.Marshaler, server LifeCycleServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq InitRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.Init(ctx, &protoReq) + return msg, metadata, err +} + +func request_DeviceService_GetDevices_0(ctx context.Context, marshaler runtime.Marshaler, client DeviceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetDevicesRequest + metadata runtime.ServerMetadata + ) + msg, err := client.GetDevices(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_DeviceService_GetDevices_0(ctx context.Context, marshaler runtime.Marshaler, server DeviceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GetDevicesRequest + metadata runtime.ServerMetadata + ) + msg, err := server.GetDevices(ctx, &protoReq) + return msg, metadata, err +} + +func request_DeviceService_SetNumVfs_0(ctx context.Context, marshaler runtime.Marshaler, client DeviceServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq SetNumVfsRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.SetNumVfs(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_DeviceService_SetNumVfs_0(ctx context.Context, marshaler runtime.Marshaler, server DeviceServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq SetNumVfsRequest + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.SetNumVfs(ctx, &protoReq) + return msg, metadata, err +} + +var filter_HeartbeatService_Ping_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + +func request_HeartbeatService_Ping_0(ctx context.Context, marshaler runtime.Marshaler, client HeartbeatServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq PingRequest + metadata runtime.ServerMetadata + ) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_HeartbeatService_Ping_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.Ping(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_HeartbeatService_Ping_0(ctx context.Context, marshaler runtime.Marshaler, server HeartbeatServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq PingRequest + metadata runtime.ServerMetadata + ) + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_HeartbeatService_Ping_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.Ping(ctx, &protoReq) + return msg, metadata, err +} + +// RegisterLifeCycleServiceHandlerServer registers the http handlers for service LifeCycleService to "mux". +// UnaryRPC :call LifeCycleServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLifeCycleServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterLifeCycleServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LifeCycleServiceServer) error { + mux.Handle(http.MethodPost, pattern_LifeCycleService_Init_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/opi_api.lifecycle.v1.LifeCycleService/Init", runtime.WithHTTPPathPattern("/v1/lifecycle/init")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_LifeCycleService_Init_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_LifeCycleService_Init_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + + return nil +} + +// RegisterDeviceServiceHandlerServer registers the http handlers for service DeviceService to "mux". +// UnaryRPC :call DeviceServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterDeviceServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterDeviceServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DeviceServiceServer) error { + mux.Handle(http.MethodGet, pattern_DeviceService_GetDevices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/opi_api.lifecycle.v1.DeviceService/GetDevices", runtime.WithHTTPPathPattern("/v1/lifecycle/devices")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_DeviceService_GetDevices_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_DeviceService_GetDevices_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_DeviceService_SetNumVfs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/opi_api.lifecycle.v1.DeviceService/SetNumVfs", runtime.WithHTTPPathPattern("/v1/lifecycle/devices/vfs")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_DeviceService_SetNumVfs_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_DeviceService_SetNumVfs_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + + return nil +} + +// RegisterHeartbeatServiceHandlerServer registers the http handlers for service HeartbeatService to "mux". +// UnaryRPC :call HeartbeatServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterHeartbeatServiceHandlerFromEndpoint instead. +// GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call. +func RegisterHeartbeatServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HeartbeatServiceServer) error { + mux.Handle(http.MethodGet, pattern_HeartbeatService_Ping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/opi_api.lifecycle.v1.HeartbeatService/Ping", runtime.WithHTTPPathPattern("/v1/lifecycle/heartbeat/ping")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_HeartbeatService_Ping_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_HeartbeatService_Ping_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + + return nil +} + +// RegisterLifeCycleServiceHandlerFromEndpoint is same as RegisterLifeCycleServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterLifeCycleServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + return RegisterLifeCycleServiceHandler(ctx, mux, conn) +} + +// RegisterLifeCycleServiceHandler registers the http handlers for service LifeCycleService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterLifeCycleServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterLifeCycleServiceHandlerClient(ctx, mux, NewLifeCycleServiceClient(conn)) +} + +// RegisterLifeCycleServiceHandlerClient registers the http handlers for service LifeCycleService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LifeCycleServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LifeCycleServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "LifeCycleServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterLifeCycleServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LifeCycleServiceClient) error { + mux.Handle(http.MethodPost, pattern_LifeCycleService_Init_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/opi_api.lifecycle.v1.LifeCycleService/Init", runtime.WithHTTPPathPattern("/v1/lifecycle/init")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_LifeCycleService_Init_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_LifeCycleService_Init_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + return nil +} + +var ( + pattern_LifeCycleService_Init_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lifecycle", "init"}, "")) +) + +var ( + forward_LifeCycleService_Init_0 = runtime.ForwardResponseMessage +) + +// RegisterDeviceServiceHandlerFromEndpoint is same as RegisterDeviceServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterDeviceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + return RegisterDeviceServiceHandler(ctx, mux, conn) +} + +// RegisterDeviceServiceHandler registers the http handlers for service DeviceService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterDeviceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterDeviceServiceHandlerClient(ctx, mux, NewDeviceServiceClient(conn)) +} + +// RegisterDeviceServiceHandlerClient registers the http handlers for service DeviceService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DeviceServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DeviceServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "DeviceServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterDeviceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DeviceServiceClient) error { + mux.Handle(http.MethodGet, pattern_DeviceService_GetDevices_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/opi_api.lifecycle.v1.DeviceService/GetDevices", runtime.WithHTTPPathPattern("/v1/lifecycle/devices")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_DeviceService_GetDevices_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_DeviceService_GetDevices_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + mux.Handle(http.MethodPost, pattern_DeviceService_SetNumVfs_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/opi_api.lifecycle.v1.DeviceService/SetNumVfs", runtime.WithHTTPPathPattern("/v1/lifecycle/devices/vfs")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_DeviceService_SetNumVfs_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_DeviceService_SetNumVfs_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + return nil +} + +var ( + pattern_DeviceService_GetDevices_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lifecycle", "devices"}, "")) + pattern_DeviceService_SetNumVfs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "lifecycle", "devices", "vfs"}, "")) +) + +var ( + forward_DeviceService_GetDevices_0 = runtime.ForwardResponseMessage + forward_DeviceService_SetNumVfs_0 = runtime.ForwardResponseMessage +) + +// RegisterHeartbeatServiceHandlerFromEndpoint is same as RegisterHeartbeatServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterHeartbeatServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.NewClient(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Errorf("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + return RegisterHeartbeatServiceHandler(ctx, mux, conn) +} + +// RegisterHeartbeatServiceHandler registers the http handlers for service HeartbeatService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterHeartbeatServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterHeartbeatServiceHandlerClient(ctx, mux, NewHeartbeatServiceClient(conn)) +} + +// RegisterHeartbeatServiceHandlerClient registers the http handlers for service HeartbeatService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HeartbeatServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HeartbeatServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "HeartbeatServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares. +func RegisterHeartbeatServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HeartbeatServiceClient) error { + mux.Handle(http.MethodGet, pattern_HeartbeatService_Ping_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/opi_api.lifecycle.v1.HeartbeatService/Ping", runtime.WithHTTPPathPattern("/v1/lifecycle/heartbeat/ping")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_HeartbeatService_Ping_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_HeartbeatService_Ping_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) + return nil +} + +var ( + pattern_HeartbeatService_Ping_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"v1", "lifecycle", "heartbeat", "ping"}, "")) +) + +var ( + forward_HeartbeatService_Ping_0 = runtime.ForwardResponseMessage +) diff --git a/v1/gen/go/lifecycle/lifecycle_grpc.pb.go b/v1/gen/go/lifecycle/lifecycle_grpc.pb.go new file mode 100644 index 00000000..dcee1b94 --- /dev/null +++ b/v1/gen/go/lifecycle/lifecycle_grpc.pb.go @@ -0,0 +1,387 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright (c) 2025 The OPI Project Authors +// Extracted from OpenShift DPU Operator + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: lifecycle/lifecycle.proto + +package _go + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + LifeCycleService_Init_FullMethodName = "/opi_api.lifecycle.v1.LifeCycleService/Init" +) + +// LifeCycleServiceClient is the client API for LifeCycleService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Lifecycle management service for xPU initialization +type LifeCycleServiceClient interface { + // Initialize the xPU (DPU/IPU/etc) + Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*IpPort, error) +} + +type lifeCycleServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewLifeCycleServiceClient(cc grpc.ClientConnInterface) LifeCycleServiceClient { + return &lifeCycleServiceClient{cc} +} + +func (c *lifeCycleServiceClient) Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*IpPort, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(IpPort) + err := c.cc.Invoke(ctx, LifeCycleService_Init_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LifeCycleServiceServer is the server API for LifeCycleService service. +// All implementations must embed UnimplementedLifeCycleServiceServer +// for forward compatibility. +// +// Lifecycle management service for xPU initialization +type LifeCycleServiceServer interface { + // Initialize the xPU (DPU/IPU/etc) + Init(context.Context, *InitRequest) (*IpPort, error) + mustEmbedUnimplementedLifeCycleServiceServer() +} + +// UnimplementedLifeCycleServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedLifeCycleServiceServer struct{} + +func (UnimplementedLifeCycleServiceServer) Init(context.Context, *InitRequest) (*IpPort, error) { + return nil, status.Errorf(codes.Unimplemented, "method Init not implemented") +} +func (UnimplementedLifeCycleServiceServer) mustEmbedUnimplementedLifeCycleServiceServer() {} +func (UnimplementedLifeCycleServiceServer) testEmbeddedByValue() {} + +// UnsafeLifeCycleServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LifeCycleServiceServer will +// result in compilation errors. +type UnsafeLifeCycleServiceServer interface { + mustEmbedUnimplementedLifeCycleServiceServer() +} + +func RegisterLifeCycleServiceServer(s grpc.ServiceRegistrar, srv LifeCycleServiceServer) { + // If the following call pancis, it indicates UnimplementedLifeCycleServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&LifeCycleService_ServiceDesc, srv) +} + +func _LifeCycleService_Init_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(InitRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LifeCycleServiceServer).Init(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LifeCycleService_Init_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LifeCycleServiceServer).Init(ctx, req.(*InitRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// LifeCycleService_ServiceDesc is the grpc.ServiceDesc for LifeCycleService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var LifeCycleService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "opi_api.lifecycle.v1.LifeCycleService", + HandlerType: (*LifeCycleServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Init", + Handler: _LifeCycleService_Init_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "lifecycle/lifecycle.proto", +} + +const ( + DeviceService_GetDevices_FullMethodName = "/opi_api.lifecycle.v1.DeviceService/GetDevices" + DeviceService_SetNumVfs_FullMethodName = "/opi_api.lifecycle.v1.DeviceService/SetNumVfs" +) + +// DeviceServiceClient is the client API for DeviceService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Device lifecycle management service for device enumeration and configuration +type DeviceServiceClient interface { + // Retrieve available devices managed by the xPU + GetDevices(ctx context.Context, in *GetDevicesRequest, opts ...grpc.CallOption) (*DeviceListResponse, error) + // Configure number of virtual functions for a device + SetNumVfs(ctx context.Context, in *SetNumVfsRequest, opts ...grpc.CallOption) (*VfCount, error) +} + +type deviceServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewDeviceServiceClient(cc grpc.ClientConnInterface) DeviceServiceClient { + return &deviceServiceClient{cc} +} + +func (c *deviceServiceClient) GetDevices(ctx context.Context, in *GetDevicesRequest, opts ...grpc.CallOption) (*DeviceListResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeviceListResponse) + err := c.cc.Invoke(ctx, DeviceService_GetDevices_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *deviceServiceClient) SetNumVfs(ctx context.Context, in *SetNumVfsRequest, opts ...grpc.CallOption) (*VfCount, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(VfCount) + err := c.cc.Invoke(ctx, DeviceService_SetNumVfs_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// DeviceServiceServer is the server API for DeviceService service. +// All implementations must embed UnimplementedDeviceServiceServer +// for forward compatibility. +// +// Device lifecycle management service for device enumeration and configuration +type DeviceServiceServer interface { + // Retrieve available devices managed by the xPU + GetDevices(context.Context, *GetDevicesRequest) (*DeviceListResponse, error) + // Configure number of virtual functions for a device + SetNumVfs(context.Context, *SetNumVfsRequest) (*VfCount, error) + mustEmbedUnimplementedDeviceServiceServer() +} + +// UnimplementedDeviceServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedDeviceServiceServer struct{} + +func (UnimplementedDeviceServiceServer) GetDevices(context.Context, *GetDevicesRequest) (*DeviceListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetDevices not implemented") +} +func (UnimplementedDeviceServiceServer) SetNumVfs(context.Context, *SetNumVfsRequest) (*VfCount, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetNumVfs not implemented") +} +func (UnimplementedDeviceServiceServer) mustEmbedUnimplementedDeviceServiceServer() {} +func (UnimplementedDeviceServiceServer) testEmbeddedByValue() {} + +// UnsafeDeviceServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DeviceServiceServer will +// result in compilation errors. +type UnsafeDeviceServiceServer interface { + mustEmbedUnimplementedDeviceServiceServer() +} + +func RegisterDeviceServiceServer(s grpc.ServiceRegistrar, srv DeviceServiceServer) { + // If the following call pancis, it indicates UnimplementedDeviceServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&DeviceService_ServiceDesc, srv) +} + +func _DeviceService_GetDevices_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetDevicesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DeviceServiceServer).GetDevices(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DeviceService_GetDevices_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DeviceServiceServer).GetDevices(ctx, req.(*GetDevicesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DeviceService_SetNumVfs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetNumVfsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DeviceServiceServer).SetNumVfs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DeviceService_SetNumVfs_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DeviceServiceServer).SetNumVfs(ctx, req.(*SetNumVfsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// DeviceService_ServiceDesc is the grpc.ServiceDesc for DeviceService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var DeviceService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "opi_api.lifecycle.v1.DeviceService", + HandlerType: (*DeviceServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetDevices", + Handler: _DeviceService_GetDevices_Handler, + }, + { + MethodName: "SetNumVfs", + Handler: _DeviceService_SetNumVfs_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "lifecycle/lifecycle.proto", +} + +const ( + HeartbeatService_Ping_FullMethodName = "/opi_api.lifecycle.v1.HeartbeatService/Ping" +) + +// HeartbeatServiceClient is the client API for HeartbeatService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Heartbeat service for lifecycle health monitoring +type HeartbeatServiceClient interface { + // Check xPU lifecycle health status + Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) +} + +type heartbeatServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewHeartbeatServiceClient(cc grpc.ClientConnInterface) HeartbeatServiceClient { + return &heartbeatServiceClient{cc} +} + +func (c *heartbeatServiceClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(PingResponse) + err := c.cc.Invoke(ctx, HeartbeatService_Ping_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// HeartbeatServiceServer is the server API for HeartbeatService service. +// All implementations must embed UnimplementedHeartbeatServiceServer +// for forward compatibility. +// +// Heartbeat service for lifecycle health monitoring +type HeartbeatServiceServer interface { + // Check xPU lifecycle health status + Ping(context.Context, *PingRequest) (*PingResponse, error) + mustEmbedUnimplementedHeartbeatServiceServer() +} + +// UnimplementedHeartbeatServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedHeartbeatServiceServer struct{} + +func (UnimplementedHeartbeatServiceServer) Ping(context.Context, *PingRequest) (*PingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented") +} +func (UnimplementedHeartbeatServiceServer) mustEmbedUnimplementedHeartbeatServiceServer() {} +func (UnimplementedHeartbeatServiceServer) testEmbeddedByValue() {} + +// UnsafeHeartbeatServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to HeartbeatServiceServer will +// result in compilation errors. +type UnsafeHeartbeatServiceServer interface { + mustEmbedUnimplementedHeartbeatServiceServer() +} + +func RegisterHeartbeatServiceServer(s grpc.ServiceRegistrar, srv HeartbeatServiceServer) { + // If the following call pancis, it indicates UnimplementedHeartbeatServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&HeartbeatService_ServiceDesc, srv) +} + +func _HeartbeatService_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HeartbeatServiceServer).Ping(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: HeartbeatService_Ping_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HeartbeatServiceServer).Ping(ctx, req.(*PingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// HeartbeatService_ServiceDesc is the grpc.ServiceDesc for HeartbeatService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var HeartbeatService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "opi_api.lifecycle.v1.HeartbeatService", + HandlerType: (*HeartbeatServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Ping", + Handler: _HeartbeatService_Ping_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "lifecycle/lifecycle.proto", +} diff --git a/v1/gen/python/lifecycle/lifecycle_pb2.py b/v1/gen/python/lifecycle/lifecycle_pb2.py new file mode 100644 index 00000000..74aa52af --- /dev/null +++ b/v1/gen/python/lifecycle/lifecycle_pb2.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: lifecycle/lifecycle.proto +# Protobuf Python Version: 5.29.3 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 5, + 29, + 3, + '', + 'lifecycle/lifecycle.proto' +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19lifecycle/lifecycle.proto\x12\x14opi_api.lifecycle.v1\x1a\x1cgoogle/api/annotations.proto\"O\n\x0bInitRequest\x12\x19\n\x08\x64pu_mode\x18\x01 \x01(\x08R\x07\x64puMode\x12%\n\x0e\x64pu_identifier\x18\x02 \x01(\tR\rdpuIdentifier\"\x13\n\x11GetDevicesRequest\")\n\x10SetNumVfsRequest\x12\x15\n\x06vf_cnt\x18\x01 \x01(\x05R\x05vfCnt\",\n\x06IpPort\x12\x0e\n\x02ip\x18\x01 \x01(\tR\x02ip\x12\x12\n\x04port\x18\x02 \x01(\x05R\x04port\" \n\x07VfCount\x12\x15\n\x06vf_cnt\x18\x01 \x01(\x05R\x05vfCnt\"\"\n\x0cTopologyInfo\x12\x12\n\x04node\x18\x01 \x01(\tR\x04node\"p\n\x06\x44\x65vice\x12\x0e\n\x02id\x18\x01 \x01(\tR\x02id\x12\x16\n\x06health\x18\x02 \x01(\tR\x06health\x12>\n\x08topology\x18\x03 \x01(\x0b\x32\".opi_api.lifecycle.v1.TopologyInfoR\x08topology\"\xbf\x01\n\x12\x44\x65viceListResponse\x12O\n\x07\x64\x65vices\x18\x01 \x03(\x0b\x32\x35.opi_api.lifecycle.v1.DeviceListResponse.DevicesEntryR\x07\x64\x65vices\x1aX\n\x0c\x44\x65vicesEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x32\n\x05value\x18\x02 \x01(\x0b\x32\x1c.opi_api.lifecycle.v1.DeviceR\x05value:\x02\x38\x01\"H\n\x0bPingRequest\x12\x1c\n\ttimestamp\x18\x01 \x01(\x03R\ttimestamp\x12\x1b\n\tsender_id\x18\x02 \x01(\tR\x08senderId\"i\n\x0cPingResponse\x12\x1c\n\ttimestamp\x18\x01 \x01(\x03R\ttimestamp\x12!\n\x0cresponder_id\x18\x02 \x01(\tR\x0bresponderId\x12\x18\n\x07healthy\x18\x03 \x01(\x08R\x07healthy2z\n\x10LifeCycleService\x12\x66\n\x04Init\x12!.opi_api.lifecycle.v1.InitRequest\x1a\x1c.opi_api.lifecycle.v1.IpPort\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/v1/lifecycle/init:\x01*2\x89\x02\n\rDeviceService\x12~\n\nGetDevices\x12\'.opi_api.lifecycle.v1.GetDevicesRequest\x1a(.opi_api.lifecycle.v1.DeviceListResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\x12\x15/v1/lifecycle/devices\x12x\n\tSetNumVfs\x12&.opi_api.lifecycle.v1.SetNumVfsRequest\x1a\x1d.opi_api.lifecycle.v1.VfCount\"$\x82\xd3\xe4\x93\x02\x1e\"\x19/v1/lifecycle/devices/vfs:\x01*2\x87\x01\n\x10HeartbeatService\x12s\n\x04Ping\x12!.opi_api.lifecycle.v1.PingRequest\x1a\".opi_api.lifecycle.v1.PingResponse\"$\x82\xd3\xe4\x93\x02\x1e\x12\x1c/v1/lifecycle/heartbeat/pingB[\n\x14opi_api.lifecycle.v1B\x0eLifecycleProtoP\x01Z1github.com/opiproject/opi-api/lifecycle/v1/gen/gob\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'lifecycle.lifecycle_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None + _globals['DESCRIPTOR']._serialized_options = b'\n\024opi_api.lifecycle.v1B\016LifecycleProtoP\001Z1github.com/opiproject/opi-api/lifecycle/v1/gen/go' + _globals['_DEVICELISTRESPONSE_DEVICESENTRY']._loaded_options = None + _globals['_DEVICELISTRESPONSE_DEVICESENTRY']._serialized_options = b'8\001' + _globals['_LIFECYCLESERVICE'].methods_by_name['Init']._loaded_options = None + _globals['_LIFECYCLESERVICE'].methods_by_name['Init']._serialized_options = b'\202\323\344\223\002\027\"\022/v1/lifecycle/init:\001*' + _globals['_DEVICESERVICE'].methods_by_name['GetDevices']._loaded_options = None + _globals['_DEVICESERVICE'].methods_by_name['GetDevices']._serialized_options = b'\202\323\344\223\002\027\022\025/v1/lifecycle/devices' + _globals['_DEVICESERVICE'].methods_by_name['SetNumVfs']._loaded_options = None + _globals['_DEVICESERVICE'].methods_by_name['SetNumVfs']._serialized_options = b'\202\323\344\223\002\036\"\031/v1/lifecycle/devices/vfs:\001*' + _globals['_HEARTBEATSERVICE'].methods_by_name['Ping']._loaded_options = None + _globals['_HEARTBEATSERVICE'].methods_by_name['Ping']._serialized_options = b'\202\323\344\223\002\036\022\034/v1/lifecycle/heartbeat/ping' + _globals['_INITREQUEST']._serialized_start=81 + _globals['_INITREQUEST']._serialized_end=160 + _globals['_GETDEVICESREQUEST']._serialized_start=162 + _globals['_GETDEVICESREQUEST']._serialized_end=181 + _globals['_SETNUMVFSREQUEST']._serialized_start=183 + _globals['_SETNUMVFSREQUEST']._serialized_end=224 + _globals['_IPPORT']._serialized_start=226 + _globals['_IPPORT']._serialized_end=270 + _globals['_VFCOUNT']._serialized_start=272 + _globals['_VFCOUNT']._serialized_end=304 + _globals['_TOPOLOGYINFO']._serialized_start=306 + _globals['_TOPOLOGYINFO']._serialized_end=340 + _globals['_DEVICE']._serialized_start=342 + _globals['_DEVICE']._serialized_end=454 + _globals['_DEVICELISTRESPONSE']._serialized_start=457 + _globals['_DEVICELISTRESPONSE']._serialized_end=648 + _globals['_DEVICELISTRESPONSE_DEVICESENTRY']._serialized_start=560 + _globals['_DEVICELISTRESPONSE_DEVICESENTRY']._serialized_end=648 + _globals['_PINGREQUEST']._serialized_start=650 + _globals['_PINGREQUEST']._serialized_end=722 + _globals['_PINGRESPONSE']._serialized_start=724 + _globals['_PINGRESPONSE']._serialized_end=829 + _globals['_LIFECYCLESERVICE']._serialized_start=831 + _globals['_LIFECYCLESERVICE']._serialized_end=953 + _globals['_DEVICESERVICE']._serialized_start=956 + _globals['_DEVICESERVICE']._serialized_end=1221 + _globals['_HEARTBEATSERVICE']._serialized_start=1224 + _globals['_HEARTBEATSERVICE']._serialized_end=1359 +# @@protoc_insertion_point(module_scope) diff --git a/v1/gen/python/lifecycle/lifecycle_pb2_grpc.py b/v1/gen/python/lifecycle/lifecycle_pb2_grpc.py new file mode 100644 index 00000000..cb53351d --- /dev/null +++ b/v1/gen/python/lifecycle/lifecycle_pb2_grpc.py @@ -0,0 +1,277 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from lifecycle import lifecycle_pb2 as lifecycle_dot_lifecycle__pb2 + + +class LifeCycleServiceStub(object): + """Lifecycle management service for xPU initialization + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Init = channel.unary_unary( + '/opi_api.lifecycle.v1.LifeCycleService/Init', + request_serializer=lifecycle_dot_lifecycle__pb2.InitRequest.SerializeToString, + response_deserializer=lifecycle_dot_lifecycle__pb2.IpPort.FromString, + _registered_method=True) + + +class LifeCycleServiceServicer(object): + """Lifecycle management service for xPU initialization + """ + + def Init(self, request, context): + """Initialize the xPU (DPU/IPU/etc) + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_LifeCycleServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'Init': grpc.unary_unary_rpc_method_handler( + servicer.Init, + request_deserializer=lifecycle_dot_lifecycle__pb2.InitRequest.FromString, + response_serializer=lifecycle_dot_lifecycle__pb2.IpPort.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'opi_api.lifecycle.v1.LifeCycleService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('opi_api.lifecycle.v1.LifeCycleService', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class LifeCycleService(object): + """Lifecycle management service for xPU initialization + """ + + @staticmethod + def Init(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/opi_api.lifecycle.v1.LifeCycleService/Init', + lifecycle_dot_lifecycle__pb2.InitRequest.SerializeToString, + lifecycle_dot_lifecycle__pb2.IpPort.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + +class DeviceServiceStub(object): + """Device lifecycle management service for device enumeration and configuration + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.GetDevices = channel.unary_unary( + '/opi_api.lifecycle.v1.DeviceService/GetDevices', + request_serializer=lifecycle_dot_lifecycle__pb2.GetDevicesRequest.SerializeToString, + response_deserializer=lifecycle_dot_lifecycle__pb2.DeviceListResponse.FromString, + _registered_method=True) + self.SetNumVfs = channel.unary_unary( + '/opi_api.lifecycle.v1.DeviceService/SetNumVfs', + request_serializer=lifecycle_dot_lifecycle__pb2.SetNumVfsRequest.SerializeToString, + response_deserializer=lifecycle_dot_lifecycle__pb2.VfCount.FromString, + _registered_method=True) + + +class DeviceServiceServicer(object): + """Device lifecycle management service for device enumeration and configuration + """ + + def GetDevices(self, request, context): + """Retrieve available devices managed by the xPU + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SetNumVfs(self, request, context): + """Configure number of virtual functions for a device + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_DeviceServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'GetDevices': grpc.unary_unary_rpc_method_handler( + servicer.GetDevices, + request_deserializer=lifecycle_dot_lifecycle__pb2.GetDevicesRequest.FromString, + response_serializer=lifecycle_dot_lifecycle__pb2.DeviceListResponse.SerializeToString, + ), + 'SetNumVfs': grpc.unary_unary_rpc_method_handler( + servicer.SetNumVfs, + request_deserializer=lifecycle_dot_lifecycle__pb2.SetNumVfsRequest.FromString, + response_serializer=lifecycle_dot_lifecycle__pb2.VfCount.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'opi_api.lifecycle.v1.DeviceService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('opi_api.lifecycle.v1.DeviceService', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class DeviceService(object): + """Device lifecycle management service for device enumeration and configuration + """ + + @staticmethod + def GetDevices(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/opi_api.lifecycle.v1.DeviceService/GetDevices', + lifecycle_dot_lifecycle__pb2.GetDevicesRequest.SerializeToString, + lifecycle_dot_lifecycle__pb2.DeviceListResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def SetNumVfs(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/opi_api.lifecycle.v1.DeviceService/SetNumVfs', + lifecycle_dot_lifecycle__pb2.SetNumVfsRequest.SerializeToString, + lifecycle_dot_lifecycle__pb2.VfCount.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + +class HeartbeatServiceStub(object): + """Heartbeat service for lifecycle health monitoring + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.Ping = channel.unary_unary( + '/opi_api.lifecycle.v1.HeartbeatService/Ping', + request_serializer=lifecycle_dot_lifecycle__pb2.PingRequest.SerializeToString, + response_deserializer=lifecycle_dot_lifecycle__pb2.PingResponse.FromString, + _registered_method=True) + + +class HeartbeatServiceServicer(object): + """Heartbeat service for lifecycle health monitoring + """ + + def Ping(self, request, context): + """Check xPU lifecycle health status + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_HeartbeatServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'Ping': grpc.unary_unary_rpc_method_handler( + servicer.Ping, + request_deserializer=lifecycle_dot_lifecycle__pb2.PingRequest.FromString, + response_serializer=lifecycle_dot_lifecycle__pb2.PingResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'opi_api.lifecycle.v1.HeartbeatService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('opi_api.lifecycle.v1.HeartbeatService', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class HeartbeatService(object): + """Heartbeat service for lifecycle health monitoring + """ + + @staticmethod + def Ping(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/opi_api.lifecycle.v1.HeartbeatService/Ping', + lifecycle_dot_lifecycle__pb2.PingRequest.SerializeToString, + lifecycle_dot_lifecycle__pb2.PingResponse.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True)