Skip to content

Commit

Permalink
NFV-27102: Changes to support cluster name update
Browse files Browse the repository at this point in the history
  • Loading branch information
schadalawada committed Jan 9, 2024
1 parent f051583 commit 9404688
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ type DeviceUpdateRequest interface {
WithAdditionalBandwidth(additionalBandwidth int) DeviceUpdateRequest
WithACLTemplate(templateID string) DeviceUpdateRequest
WithMgmtAclTemplate(mgmtAclTemplateUuid string) DeviceUpdateRequest
WithClusterName(clusterName string) DeviceUpdateRequest
Execute() error
}

Expand Down
1 change: 1 addition & 0 deletions internal/api/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ type DeviceUpdateRequest struct {
TermLength *int `json:"termLength,omitempty"`
VirtualDeviceName *string `json:"virtualDeviceName,omitempty"`
Core *int `json:"core,omitempty"`
ClusterName *string `json:"clusterName,omitempty"`
}

// DeviceAdditionalBandwidthUpdateRequest describes network device additional bandwidth update request
Expand Down
10 changes: 10 additions & 0 deletions rest_device.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ func (req *restDeviceUpdateRequest) WithCore(core int) DeviceUpdateRequest {
return req
}

// WithClusterName sets new cluster name in a composite device update request
func (req *restDeviceUpdateRequest) WithClusterName(clusterName string) DeviceUpdateRequest {
req.deviceFields["clusterName"] = clusterName
return req
}

// WithAdditionalBandwidth sets new additional bandwidth in a composite device update request
func (req *restDeviceUpdateRequest) WithAdditionalBandwidth(additionalBandwidth int) DeviceUpdateRequest {
req.additionalBandwidth = &additionalBandwidth
Expand Down Expand Up @@ -466,6 +472,10 @@ func (c RestClient) replaceDeviceFields(uuid string, fields map[string]interface
reqBody.Core = Int(v.(int))
okToSend = true
}
if v, ok := fields["clusterName"]; ok {
reqBody.ClusterName = String(v.(string))
okToSend = true
}
if okToSend {
path := "/ne/v1/devices/" + uuid
req := c.R().SetBody(&reqBody)
Expand Down

0 comments on commit 9404688

Please sign in to comment.