Skip to content

Commit 8149bdf

Browse files
authored
Added support to pass bandwidth tier for license for C8000V autonomous and C8000V-SDWAN(controller mode) device types (#35)
1 parent 324c2b3 commit 8149bdf

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

client.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ type Device struct {
286286
ProjectID *string
287287
DiverseFromDeviceUUID *string
288288
DiverseFromDeviceName *string
289+
Tier *int
289290
}
290291

291292
// DeviceInterface describes Network Edge device interface

internal/api/device.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type Device struct {
3333
OrderReference *string `json:"orderReference,omitempty"`
3434
InterfaceCount *int `json:"interfaceCount,omitempty"`
3535
Core *DeviceCoreInformation `json:"core,omitempty"`
36+
Tier *DeviceCoreInformation `json:"tier,omitempty"`
3637
DeviceManagementType *string `json:"deviceManagementType,omitempty"`
3738
SshInterfaceID *string `json:"sshInterfaceId,omitempty"`
3839
Interfaces []DeviceInterface `json:"interfaces,omitempty"`
@@ -80,6 +81,7 @@ type DeviceRequest struct {
8081
Connectivity *string `json:"connectivity,omitempty"`
8182
ProjectID *string `json:"projectId,omitempty"`
8283
DiverseFromDeviceUUID *string `json:"diverseFromDeviceUuid,omitempty"`
84+
Tier *int `json:"tier,omitempty"`
8385
}
8486

8587
// SecondaryDeviceRequest describes secondary device part of device creation request
@@ -133,6 +135,7 @@ type DeviceCoreInformation struct {
133135
Core *int `json:"core,omitempty"`
134136
Memory *int `json:"memory,omitempty"`
135137
Unit *string `json:"unit,omitempty"`
138+
Tier *int `json:"tier,omitempty"`
136139
}
137140

138141
// DeviceRequestResponse describes response for device creation request

rest_device.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ func mapDeviceAPIToDomain(apiDevice api.Device) *Device {
250250
if apiDevice.Core != nil {
251251
device.CoreCount = apiDevice.Core.Core
252252
}
253+
if apiDevice.Core != nil {
254+
device.Tier = apiDevice.Core.Tier
255+
}
253256
if apiDevice.DeviceManagementType != nil {
254257
if *apiDevice.DeviceManagementType == DeviceManagementTypeSelf {
255258
device.IsSelfManaged = Bool(true)
@@ -364,6 +367,7 @@ func mapDeviceClusterNodeDetailDomainToAPI(clusterNodeDetail *ClusterNodeDetail)
364367
func createDeviceRequest(device Device) api.DeviceRequest {
365368
req := api.DeviceRequest{}
366369
req.Throughput = device.Throughput
370+
req.Tier = device.Tier
367371
req.ThroughputUnit = device.ThroughputUnit
368372
req.MetroCode = device.MetroCode
369373
req.DeviceTypeCode = device.TypeCode

rest_device_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var testDevice = Device{
2727
PackageCode: String("VM100"),
2828
TermLength: Int(24),
2929
ProjectID: String("68ccfd49-39b1-478e-957a-67c72f719d7a"),
30+
Tier: Int(1),
3031
DiverseFromDeviceUUID: String("ed7891bd-15b4-4f72-ac56-d96cfdacddcc"),
3132
Throughput: Int(1),
3233
ThroughputUnit: String("Gbps"),
@@ -469,6 +470,8 @@ func verifyDevice(t *testing.T, device Device, resp api.Device) {
469470
assert.Equal(t, resp.OrderReference, device.OrderReference, "OrderReference matches")
470471
assert.Equal(t, resp.InterfaceCount, device.InterfaceCount, "InterfaceCount matches")
471472
assert.Equal(t, resp.Core.Core, device.CoreCount, "Core.Core matches")
473+
assert.Equal(t, resp.Core.Tier, device.Tier, "Core.Tier matches")
474+
472475
if *resp.DeviceManagementType == DeviceManagementTypeEquinix {
473476
assert.False(t, *device.IsSelfManaged, "DeviceManagementType matches")
474477
} else {
@@ -498,6 +501,7 @@ func verifyDeviceInterface(t *testing.T, inf DeviceInterface, apiInf api.DeviceI
498501

499502
func verifyDeviceRequest(t *testing.T, device Device, req api.DeviceRequest) {
500503
assert.Equal(t, device.Throughput, req.Throughput, "Throughput matches")
504+
assert.Equal(t, device.Tier, req.Tier, "Tier matches")
501505
assert.Equal(t, device.ThroughputUnit, req.ThroughputUnit, "ThroughputUnit matches")
502506
assert.Equal(t, device.MetroCode, req.MetroCode, "MetroCode matches")
503507
assert.Equal(t, device.TypeCode, req.DeviceTypeCode, "TypeCode matches")

0 commit comments

Comments
 (0)