diff --git a/rest_device.go b/rest_device.go index 495f8a2..850ba7c 100644 --- a/rest_device.go +++ b/rest_device.go @@ -24,13 +24,6 @@ const ( //DeviceLicenseModeBYOL indicates device software license mode where //customer provides his own, externally procured device license DeviceLicenseModeBYOL = "BYOL" - //Connectivity type ZNPD indicates device with no internet - ConnectivityZnpd = "ZNPD" - //ZNPD indicates device with no internet - Znpd = "PRIVATE" - //DeviceManagementTypeSelfZnpd indicates device management mode where customer - //fully manages the device and device is created with no internet access - DeviceManagementTypeSelfZnpd = "SELF-CONFIGURED-ZNPD" ) type restDeviceUpdateRequest struct { @@ -246,14 +239,12 @@ func mapDeviceAPIToDomain(apiDevice api.Device) *Device { } if apiDevice.DeviceManagementType != nil { if *apiDevice.DeviceManagementType == DeviceManagementTypeSelf { - if apiDevice.Connectivity != nil && strings.EqualFold(*apiDevice.Connectivity, ConnectivityZnpd) { - device.Connectivity = String(Znpd) - } device.IsSelfManaged = Bool(true) } else { device.IsSelfManaged = Bool(false) } } + device.Connectivity = apiDevice.Connectivity device.Interfaces = mapDeviceInterfacesAPIToDomain(apiDevice.Interfaces) device.VendorConfiguration = apiDevice.VendorConfig device.UserPublicKey = mapDeviceUserPublicKeyAPIToDomain(apiDevice.UserPublicKey) @@ -386,15 +377,12 @@ func createDeviceRequest(device Device) api.DeviceRequest { req.InterfaceCount = device.InterfaceCount if device.IsSelfManaged != nil { if *device.IsSelfManaged { - if device.Connectivity != nil && strings.EqualFold(*device.Connectivity, Znpd) { - req.DeviceManagementType = String(DeviceManagementTypeSelfZnpd) - } else { - req.DeviceManagementType = String(DeviceManagementTypeSelf) - } + req.DeviceManagementType = String(DeviceManagementTypeSelf) } else { req.DeviceManagementType = String(DeviceManagementTypeEquinix) } } + req.Connectivity = device.Connectivity req.Core = device.CoreCount req.AdditionalBandwidth = device.AdditionalBandwidth req.SshInterfaceId = device.WanInterfaceId diff --git a/rest_device_test.go b/rest_device_test.go index bcc05e7..85ea270 100644 --- a/rest_device_test.go +++ b/rest_device_test.go @@ -75,10 +75,10 @@ func TestCreateDevice(t *testing.T) { //then assert.Nil(t, err, "Error is not returned") assert.Equal(t, uuid, resp.UUID, "UUID matches") - verifyDeviceRequest(t, device, req, false) + verifyDeviceRequest(t, device, req) } -func TestCreateZnpdDevice(t *testing.T) { +func TestCreateDeviceWithConnectivityTypeAsPrivate(t *testing.T) { //given resp := api.DeviceRequestResponse{} if err := readJSONData("./test-fixtures/ne_device_create_resp.json", &resp); err != nil { @@ -138,7 +138,7 @@ func TestCreateZnpdDevice(t *testing.T) { //then assert.Nil(t, err, "Error is not returned") assert.Equal(t, uuid, resp.UUID, "UUID matches") - verifyDeviceRequest(t, device, req, true) + verifyDeviceRequest(t, device, req) } func TestCreateRedundantDevice(t *testing.T) { @@ -494,7 +494,7 @@ func verifyDeviceInterface(t *testing.T, inf DeviceInterface, apiInf api.DeviceI assert.Equal(t, apiInf.Type, inf.Type, "Type matches") } -func verifyDeviceRequest(t *testing.T, device Device, req api.DeviceRequest, isZnpd bool) { +func verifyDeviceRequest(t *testing.T, device Device, req api.DeviceRequest) { assert.Equal(t, device.Throughput, req.Throughput, "Throughput matches") assert.Equal(t, device.ThroughputUnit, req.ThroughputUnit, "ThroughputUnit matches") assert.Equal(t, device.MetroCode, req.MetroCode, "MetroCode matches") @@ -519,11 +519,8 @@ func verifyDeviceRequest(t *testing.T, device Device, req api.DeviceRequest, isZ assert.Equal(t, device.Version, req.Version, "Version matches") assert.Equal(t, device.InterfaceCount, req.InterfaceCount, "InterfaceCount matches") if *device.IsSelfManaged { - if isZnpd { - assert.Equal(t, DeviceManagementTypeSelfZnpd, StringValue(req.DeviceManagementType), "DeviceManagementType matches") - } else { - assert.Equal(t, DeviceManagementTypeSelf, StringValue(req.DeviceManagementType), "DeviceManagementType matches") - } + + assert.Equal(t, DeviceManagementTypeSelf, StringValue(req.DeviceManagementType), "DeviceManagementType matches") } else { assert.Equal(t, DeviceManagementTypeEquinix, StringValue(req.DeviceManagementType), "DeviceManagementType matches") } @@ -536,7 +533,7 @@ func verifyDeviceRequest(t *testing.T, device Device, req api.DeviceRequest, isZ } func verifyRedundantDeviceRequest(t *testing.T, primary, secondary Device, req api.DeviceRequest) { - verifyDeviceRequest(t, primary, req, false) + verifyDeviceRequest(t, primary, req) assert.Equal(t, secondary.MetroCode, req.Secondary.MetroCode, "Secondary MetroCode matches") assert.Equal(t, secondary.LicenseToken, req.Secondary.LicenseToken, "LicenseFileID matches") assert.Equal(t, secondary.LicenseFileID, req.Secondary.LicenseFileID, "LicenseFileID matches")