Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Deprecate helpers found in ports.go #230

Closed
displague opened this issue Dec 13, 2020 · 0 comments
Closed

Deprecate helpers found in ports.go #230

displague opened this issue Dec 13, 2020 · 0 comments

Comments

@displague
Copy link
Contributor

While working on #229, I noticed how many functions in ports.go are Device service helpers. These functions seem like good candidates for deprecation because they do not interact with the Ports API, they fetch devices and return properties of the device.

The code smell here is that these port service functions all include i.client.Device client calls and some of them mutate the supplied Device. Users that want these behaviors should use the API functions directly and not rely on these thin, misplaced, wrappers.

I will include the deprecation of these methods in this PR if others agree. The code in these functions could serve as Example tests for the functions they depend on.

Consider deprecating these functions which take a device id, fetch the device (with .Get) and return a property of device:

  • DevicePortServiceOp.GetPortByName returns device.GetPortByName
  • DevicePortServiceOp.DeviceNetworkType returns device.GetNetworkType
  • DevicePortServiceOp.GetAllEthPorts takes the supplied device, updates it via .Get, returns GetPhysicalPorts
  • DevicePortServiceOp.GetOddEthPorts same as GetAllEthPorts, except eth1 and eth3 only.
  • DevicePortServiceOp.DeviceToNetworkType takes the supplied device, updates it via .Get, returns DevicePortServiceOp.ConvertDevice using all supplied parameters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant