@@ -11,6 +11,7 @@ import (
1111
1212 "github.com/Azure/azure-container-networking/cns/common"
1313 "github.com/Azure/azure-container-networking/cns/types"
14+ "github.com/Azure/azure-container-networking/cns/types/infiniband"
1415 "github.com/Azure/azure-container-networking/crd/nodenetworkconfig/api/v1alpha"
1516 "github.com/pkg/errors"
1617)
@@ -32,6 +33,9 @@ const (
3233 V1Prefix = "/v0.1"
3334 V2Prefix = "/v0.2"
3435 EndpointPath = "/network/endpoints/"
36+ // IBDevice API paths
37+ IBDevicesPodPath = "/ibdevices/pod/" // PUT /ibdevices/pod/{podname-podnamespace}
38+ IBDevicesPath = "/ibdevices/" // GET /ibdevices/{mac-address-of-device}
3539 // Service Fabric SWIFTV2 mode
3640 StandaloneSWIFTV2 SWIFTV2Mode = "StandaloneSWIFTV2"
3741 // K8s SWIFTV2 mode
@@ -382,3 +386,33 @@ type GetVMUniqueIDResponse struct {
382386 Response Response `json:"response"`
383387 VMUniqueID string `json:"vmuniqueid"`
384388}
389+
390+ // IBDevice API Contracts
391+
392+ // AssignIBDevicesToPodRequest represents the request to assign InfiniBand devices to a pod
393+ // PUT /ibdevices/pod/{podname-podnamespace}
394+ type AssignIBDevicesToPodRequest struct {
395+ PodID string `json:"podID"` // podname-podnamespace format
396+ MACAddresses []string `json:"macAddresses"` // Array of MAC addresses like ["60:45:bd:a4:b5:7a", "7c:1e:52:07:11:36"]
397+ }
398+
399+ // AssignIBDevicesToPodResponse represents the response for assigning InfiniBand devices to a pod
400+ type AssignIBDevicesToPodResponse struct {
401+ ErrorCode infiniband.ErrorCode `json:"errorCode"` // Error code if applicable
402+ Message string `json:"message"` // Additional message or error description
403+ }
404+
405+ // GetIBDeviceInfoRequest represents the request to get InfiniBand device information
406+ // GET /ibdevices/{mac-address-of-device} - no request body needed for GET
407+ type GetIBDeviceInfoRequest struct {
408+ MACAddress string `json:"macAddress"` // MAC address of the device (from URL path)
409+ }
410+
411+ // GetIBDeviceInfoResponse represents the response containing InfiniBand device information
412+ type GetIBDeviceInfoResponse struct {
413+ MACAddress string `json:"macAddress"` // MAC address of the device
414+ PodID string `json:"podID"` // Pod that the device is assigned to
415+ Status infiniband.Status `json:"status"` // Device status (e.g., "pendingProgramming", "error", "programmed", "pendingDeletion", "available")
416+ ErrorCode infiniband.ErrorCode `json:"errorCode"` // Error code if applicable
417+ Message string `json:"message"` // Additional message or error description
418+ }
0 commit comments