Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix link status report #21

Merged
merged 4 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/cfm-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,9 @@ components:
linkStatus:
type: string
description: Status of the link, such as LinkUp or LinkDown
linkState:
type: string
description: State of the link, such as Enabled or Disabled
memoryDeviceInformation:
type: object
required: [id]
Expand Down
6 changes: 4 additions & 2 deletions pkg/backend/httpfish.go
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,7 @@ func (service *httpfishService) GetPortDetails(ctx context.Context, settings *Co
ret.PortInformation.Width = int32(width)
}
ret.PortInformation.LinkStatus, _ = response.stringFromJSON("LinkStatus")
ret.PortInformation.LinkState, _ = response.stringFromJSON("LinkState")

status, _ := response.valueFromJSON("Status")

Expand All @@ -1370,9 +1371,10 @@ func (service *httpfishService) GetPortDetails(ctx context.Context, settings *Co
ret.PortInformation.StatusState = state
ret.Status = healthAndState

speed, err := response.floatFromJSON("CurrentSpeedGbps")
portField, err := response.valueFromJSON("Port")
if err == nil {
ret.PortInformation.CurrentSpeedGbps = int32(speed)
speedFloat, _ := portField.(map[string]interface{})["CurrentSpeedGbps"].(float64)
ret.PortInformation.CurrentSpeedGbps = int32(speedFloat)
}

// Extract GCXLID from endpoint
Expand Down
1 change: 1 addition & 0 deletions pkg/backend/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ type PortInformation struct {
StatusState string // The state of the resource
Width int32 // The number of lanes, phys, or other physical transport links that this port contains
LinkStatus string // The CXL link status
LinkState string // The CXL link state
}

type GetPortDetailsResponse struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/manager/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func (p *CxlBladePort) GetDetails(ctx context.Context) (openapi.PortInformation,
StatusState: response.PortInformation.StatusState,
Width: response.PortInformation.Width,
LinkStatus: response.PortInformation.LinkStatus,
LinkState: response.PortInformation.StatusState,
}

p.ValidateCache()
Expand Down
Loading