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

Add metal-core version to switch OS details #450

Merged
merged 2 commits into from
Jul 5, 2023
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
5 changes: 3 additions & 2 deletions cmd/metal-api/internal/metal/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ type Switch struct {
type Switches []Switch

type SwitchOS struct {
Vendor string `rethinkdb:"vendor" json:"vendor"`
Version string `rethinkdb:"version" json:"version"`
Vendor string `rethinkdb:"vendor" json:"vendor"`
Version string `rethinkdb:"version" json:"version"`
MetalCoreVersion string `rethinkdb:"metal_core_version" json:"metal_core_version"`
}

// Connection between switch port and machine.
Expand Down
1 change: 1 addition & 0 deletions cmd/metal-api/internal/service/switch-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ func (r *switchResource) registerSwitch(request *restful.Request, response *rest
}
s.OS.Vendor = spec.OS.Vendor
s.OS.Version = spec.OS.Version
s.OS.MetalCoreVersion = spec.OS.MetalCoreVersion
}
s.ManagementIP = spec.ManagementIP
s.ManagementUser = spec.ManagementUser
Expand Down
15 changes: 9 additions & 6 deletions cmd/metal-api/internal/service/v1/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ type SwitchBase struct {
}

type SwitchOS struct {
Vendor string `json:"vendor" description:"the operating system vendor the switch currently has" optional:"true"`
Version string `json:"version" description:"the operating system version the switch currently has" optional:"true"`
Vendor string `json:"vendor" description:"the operating system vendor the switch currently has" optional:"true"`
Version string `json:"version" description:"the operating system version the switch currently has" optional:"true"`
MetalCoreVersion string `json:"metal_core_version" description:"the version of metal-core running" optional:"true"`
}

type SwitchNics []SwitchNic
Expand Down Expand Up @@ -115,8 +116,9 @@ func NewSwitchResponse(s *metal.Switch, p *metal.Partition, nics SwitchNics, con
var os *SwitchOS
if s.OS != nil {
os = &SwitchOS{
Vendor: s.OS.Vendor,
Version: s.OS.Version,
Vendor: s.OS.Vendor,
Version: s.OS.Version,
MetalCoreVersion: s.OS.MetalCoreVersion,
}
}

Expand Down Expand Up @@ -174,8 +176,9 @@ func NewSwitch(r SwitchRegisterRequest) *metal.Switch {
var os *metal.SwitchOS
if r.OS != nil {
os = &metal.SwitchOS{
Vendor: r.OS.Vendor,
Version: r.OS.Version,
Vendor: r.OS.Vendor,
Version: r.OS.Version,
MetalCoreVersion: r.OS.MetalCoreVersion,
}
}

Expand Down
4 changes: 4 additions & 0 deletions spec/metal-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -4360,6 +4360,10 @@
},
"v1.SwitchOS": {
"properties": {
"metal_core_version": {
"description": "the version of metal-core running",
"type": "string"
},
"vendor": {
"description": "the operating system vendor the switch currently has",
"type": "string"
Expand Down
Loading