|
| 1 | +// SPDX-License-Identifier: Apache-2.0 |
| 2 | +// Copyright (c) 2025 The OPI Project Authors |
| 3 | +// Extracted from OpenShift DPU Operator |
| 4 | + |
| 5 | +syntax = "proto3"; |
| 6 | + |
| 7 | +package opi_api.lifecycle.v1; |
| 8 | + |
| 9 | +import "google/api/annotations.proto"; |
| 10 | + |
| 11 | +option go_package = "github.com/opiproject/opi-api/lifecycle/v1/gen/go"; |
| 12 | +option java_multiple_files = true; |
| 13 | +option java_outer_classname = "LifecycleProto"; |
| 14 | +option java_package = "opi_api.lifecycle.v1"; |
| 15 | + |
| 16 | +// Lifecycle management service for xPU initialization |
| 17 | +service LifeCycleService { |
| 18 | + // Initialize the xPU (DPU/IPU/etc) |
| 19 | + rpc Init(InitRequest) returns (IpPort) { |
| 20 | + option (google.api.http) = { |
| 21 | + post: "/v1/lifecycle/init" |
| 22 | + body: "*" |
| 23 | + }; |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +// Device lifecycle management service for device enumeration and configuration |
| 28 | +service DeviceService { |
| 29 | + // Retrieve available devices managed by the xPU |
| 30 | + rpc GetDevices(GetDevicesRequest) returns (DeviceListResponse) { |
| 31 | + option (google.api.http) = {get: "/v1/lifecycle/devices"}; |
| 32 | + } |
| 33 | + |
| 34 | + // Configure number of virtual functions for a device |
| 35 | + rpc SetNumVfs(SetNumVfsRequest) returns (VfCount) { |
| 36 | + option (google.api.http) = { |
| 37 | + post: "/v1/lifecycle/devices/vfs" |
| 38 | + body: "*" |
| 39 | + }; |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +// Heartbeat service for lifecycle health monitoring |
| 44 | +service HeartbeatService { |
| 45 | + // Check xPU lifecycle health status |
| 46 | + rpc Ping(PingRequest) returns (PingResponse) { |
| 47 | + option (google.api.http) = {get: "/v1/lifecycle/heartbeat/ping"}; |
| 48 | + } |
| 49 | +} |
| 50 | + |
| 51 | +// xPU initialization request |
| 52 | +message InitRequest { |
| 53 | + // xPU mode flag (e.g., DPU mode vs host mode) |
| 54 | + bool dpu_mode = 1; |
| 55 | + // xPU identifier string |
| 56 | + string dpu_identifier = 2; |
| 57 | +} |
| 58 | + |
| 59 | +// Request message for GetDevices |
| 60 | +message GetDevicesRequest { |
| 61 | + // Empty request - no parameters needed |
| 62 | +} |
| 63 | + |
| 64 | +// Request message for SetNumVfs |
| 65 | +message SetNumVfsRequest { |
| 66 | + // Number of virtual functions to configure |
| 67 | + int32 vf_cnt = 1; |
| 68 | +} |
| 69 | + |
| 70 | +// IP and port response for initialization |
| 71 | +message IpPort { |
| 72 | + // IP address for xPU communication |
| 73 | + string ip = 1; |
| 74 | + // Port number for xPU communication |
| 75 | + int32 port = 2; |
| 76 | +} |
| 77 | + |
| 78 | +// Virtual function count configuration |
| 79 | +message VfCount { |
| 80 | + // Number of virtual functions to configure |
| 81 | + int32 vf_cnt = 1; |
| 82 | +} |
| 83 | + |
| 84 | +// Topology information for device location |
| 85 | +message TopologyInfo { |
| 86 | + // Node identifier where device is located |
| 87 | + string node = 1; |
| 88 | +} |
| 89 | + |
| 90 | +// Device information structure |
| 91 | +message Device { |
| 92 | + // Device identifier (e.g., "ens5f0", "eth0") |
| 93 | + string id = 1; |
| 94 | + // Device health status |
| 95 | + string health = 2; |
| 96 | + // Topology location information |
| 97 | + TopologyInfo topology = 3; |
| 98 | +} |
| 99 | + |
| 100 | +// Device enumeration response |
| 101 | +message DeviceListResponse { |
| 102 | + // Map of device ID to device information |
| 103 | + map<string, Device> devices = 1; |
| 104 | +} |
| 105 | + |
| 106 | +// Ping request for health monitoring |
| 107 | +message PingRequest { |
| 108 | + // Request timestamp (nanoseconds since epoch) |
| 109 | + int64 timestamp = 1; |
| 110 | + // Identifier of the sender |
| 111 | + string sender_id = 2; |
| 112 | +} |
| 113 | + |
| 114 | +// Ping response for health monitoring |
| 115 | +message PingResponse { |
| 116 | + // Response timestamp (nanoseconds since epoch) |
| 117 | + int64 timestamp = 1; |
| 118 | + // Identifier of the responder |
| 119 | + string responder_id = 2; |
| 120 | + // Health status indicator |
| 121 | + bool healthy = 3; |
| 122 | +} |
0 commit comments