With client.DevicePorts deprecated, how does one set a network type to hybrid-bonded?
With the old (apparently deprecated) syntax, creating a bonded network can be done like so:
metalClient.DevicePorts.DeviceToNetworkType(dev.ID, "hybrid-bonded")
Now, with the new metalClient.Ports object, you can ConvertToLayerTwo() and ConvertToLayerThree() but not ConvertToHybrid() (unless the docs are just very unclear?)
I should clarify, metalClient is the variable name used for a *Client object.
@gidoBOSSftw5731 sorry for the ridiculous delay.
ConvertToHybrid, which sets Hybrid Unbonded mode, is achieved by breaking the bond and setting the first device to Layer3 and the second device to Layer2. For example, DevicePortServiceOp.ConvertDevice does the following: https://github.com/packethost/packngo/blob/9693ea74e17ce69b8b5c969a9873566a18ba9804/device_ports.go#L232-L257
Hybrid Bonded mode is another mode to consider which does not require breaking the bond. VLANs can be assigned to a bond device in Layer3 mode, which will automatically convert that device to Hybrid Bonded mode.
There's more to learn about these modes, including the raw API calls needed to achieve them in the docs:
- https://deploy.equinix.com/developers/docs/metal/layer2-networking/hybrid-bonded-mode/
- https://deploy.equinix.com/developers/docs/metal/layer2-networking/hybrid-unbonded-mode/
Ah, thanks for the clarification. The documentation did not make it clear that the hybrid bonding would be done automatically when required, especially when it doesn't look like it was done automatically before (or else why have an option to force it?)