Closed bernhardkaindl closed 2 years ago
Hello,
I am pretty sure that getattr(ConnectionType, name)
provides same functionality with no code duplication.
getattr(sdbus_async.networkmanager.ConnectionType, 'VETH') == 'veth'
# True
@igo95862 Thanks! I noticed that a small fix is needed to make this work for Ethernet devices.
Please find the PR now updated to fix and use getattr(sdbus_async.networkmanager.ConnectionType, DeviceType(id).name) as suggested with the
netdevinfo` example updated to test it's use on real systems.
We added the enum sdbus_async.networkmanager.ConnectionType very recently, so it's not released yet and we can make this fix. I also checked my code and wasn't using ConnectionType.WIRED for anything yet.
Add a dictionary for getting the ConnectionType when having a DeviceType. Used for lookup of the available connections for a given device.
Update: Replaced with a fix for a small issue in the enum ConnectionType and a real-world example of it's use.