Skip to content

Commit 6a3f54e

Browse files
committed
CNS API contracts for NUMA-Aware Pods
1 parent 0c92e89 commit 6a3f54e

File tree

7 files changed

+1216
-165
lines changed

7 files changed

+1216
-165
lines changed

cns/api.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const (
3232
V1Prefix = "/v0.1"
3333
V2Prefix = "/v0.2"
3434
EndpointPath = "/network/endpoints/"
35+
// IBDevice API paths
36+
IBDevicesPodPath = "/ibdevices/pod/" // PUT /ibdevices/pod/{podname-podnamespace}
37+
IBDevicesPath = "/ibdevices/" // GET /ibdevices/{mac-address-of-device}
3538
// Service Fabric SWIFTV2 mode
3639
StandaloneSWIFTV2 SWIFTV2Mode = "StandaloneSWIFTV2"
3740
// K8s SWIFTV2 mode
@@ -382,3 +385,33 @@ type GetVMUniqueIDResponse struct {
382385
Response Response `json:"response"`
383386
VMUniqueID string `json:"vmuniqueid"`
384387
}
388+
389+
// IBDevice API Contracts
390+
391+
// AssignIBDevicesToPodRequest represents the request to assign InfiniBand devices to a pod
392+
// PUT /ibdevices/pod/{podname-podnamespace}
393+
type AssignIBDevicesToPodRequest struct {
394+
PodID string `json:"podID"` // podname-podnamespace format
395+
DeviceIDs []string `json:"deviceIds"` // Array of MAC addresses like ["60:45:bd:a4:b5:7a", "7c:1e:52:07:11:36"]
396+
}
397+
398+
// AssignIBDevicesToPodResponse represents the response for assigning InfiniBand devices to a pod
399+
type AssignIBDevicesToPodResponse struct {
400+
Response Response `json:"response"` // Contains cnsCode (int) and message (string)
401+
}
402+
403+
// GetIBDeviceInfoRequest represents the request to get InfiniBand device information
404+
// GET /ibdevices/{mac-address-of-device} - no request body needed for GET
405+
type GetIBDeviceInfoRequest struct {
406+
DeviceID string `json:"deviceID"` // MAC address of the device (from URL path)
407+
}
408+
409+
// GetIBDeviceInfoResponse represents the response containing InfiniBand device information
410+
type GetIBDeviceInfoResponse struct {
411+
Response Response `json:"response,omitempty"` // Standard CNS response (optional for success cases)
412+
DeviceID string `json:"deviceID"` // MAC address of the device
413+
PodID string `json:"podID"` // Pod that the device is assigned to
414+
Status string `json:"status"` // Device status (e.g., "assigned", "available")
415+
ErrorCode int `json:"errorCode"` // Error code if applicable
416+
Msg string `json:"msg"` // Additional message or error description
417+
}

cns/grpc/proto/server.proto

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ service CNS {
1515
// Retrieves detailed information about a specific node.
1616
// Primarily used for health checks.
1717
rpc GetNodeInfo(NodeInfoRequest) returns (NodeInfoResponse);
18+
19+
// Assigns InfiniBand devices to a pod.
20+
rpc AssignIBDevicesToPod(AssignIBDevicesToPodRequest) returns (AssignIBDevicesToPodResponse);
21+
22+
// Retrieves information about a specific InfiniBand device.
23+
rpc GetIBDeviceInfo(GetIBDeviceInfoRequest) returns (GetIBDeviceInfoResponse);
1824
}
1925

2026
// SetOrchestratorInfoRequest is the request message for setting the orchestrator information.
@@ -41,3 +47,29 @@ message NodeInfoResponse {
4147
string status = 5; // The current status of the node (e.g., running, stopped).
4248
string message = 6; // Additional information about the node's health or status.
4349
}
50+
51+
// AssignIBDevicesToPodRequest is the request message for assigning InfiniBand devices to a pod.
52+
message AssignIBDevicesToPodRequest {
53+
string podID = 1; // The pod ID in format podname-podnamespace.
54+
repeated string deviceIds = 2; // List of device MAC addresses.
55+
}
56+
57+
// AssignIBDevicesToPodResponse is the response message for assigning InfiniBand devices to a pod.
58+
message AssignIBDevicesToPodResponse {
59+
int32 cnsCode = 1; // CNS response code (0 for success).
60+
string message = 2; // Response message.
61+
}
62+
63+
// GetIBDeviceInfoRequest is the request message for retrieving InfiniBand device information.
64+
message GetIBDeviceInfoRequest {
65+
string deviceID = 1; // The device ID (MAC address).
66+
}
67+
68+
// GetIBDeviceInfoResponse is the response message containing InfiniBand device information.
69+
message GetIBDeviceInfoResponse {
70+
string deviceID = 1; // The device ID (MAC address).
71+
string podID = 2; // The pod ID that the device is assigned to.
72+
string status = 3; // The status of the device.
73+
int32 errorCode = 4; // Error code if applicable.
74+
string msg = 5; // Additional message or error description.
75+
}

0 commit comments

Comments
 (0)