Skip to content

Commit bdda2cf

Browse files
Bernhard Kaindligo95862
authored andcommitted
add ConnectionTypeByDeviceType to get connection type
Use like: connection_type = ConnectionTypeByDeviceType[device.device_type]
1 parent 46e7366 commit bdda2cf

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

sdbus_async/networkmanager/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
ConnectionStateFlags,
2828
ConnectionStateReason,
2929
ConnectionType,
30+
ConnectionTypeByDeviceType,
3031
ConnectivityState,
3132
DeviceCapabilities,
3233
DeviceInterfaceFlags,
@@ -271,6 +272,7 @@
271272
'AccessPointCapabilities', 'BluetoothCapabilities',
272273
'ConnectionFlags', 'ConnectionState', 'ConnectionStateFlags',
273274
'ConnectionStateReason', 'ConnectivityState', 'ConnectionType',
275+
'ConnectionTypeByDeviceType',
274276
'DeviceCapabilities', 'DeviceInterfaceFlags', 'DeviceMetered',
275277
'DeviceState', 'DeviceStateReason', 'DeviceType', 'IpTunnelMode',
276278
'ModemCapabilities', 'NetworkManagerConnectivityState',

sdbus_async/networkmanager/enums.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,39 @@ class DeviceType(IntEnum):
596596
VRF = 31
597597

598598

599+
ConnectionTypeByDeviceType = {
600+
"ADSL": "adsl",
601+
"BLUETOOTH": "bluetooth",
602+
"BOND": "bond",
603+
"BRIDGE": "bridge",
604+
"CDMA": "cdma",
605+
"DUMMY": "dummy",
606+
"ETHERNET": "802-3-ethernet",
607+
"INFINIBAND": "infiniband",
608+
"IP_TUNNEL": "ip-tunnel",
609+
"MACSEC": "macsec",
610+
"MACVLAN": "macvlan",
611+
"MODEM": "gsm",
612+
"OLPC_MESH": "802-11-olpc-mesh",
613+
"OVS_BRIDGE": "ovs-bridge",
614+
"OVS_INTERFACE": "ovs-interface",
615+
"OVS_PORT": "ovs-port",
616+
"PPPOE": "pppoe",
617+
"SIXLOWPAN": "6lowpan",
618+
"TEAM": "team",
619+
"TUN": "tun",
620+
"VETH": "veth",
621+
"VLAN": "vlan",
622+
"VPN": "vpn",
623+
"VRF": "vrf",
624+
"VXLAN": "vxlan",
625+
"WIFI": "802-11-wireless",
626+
"WIFI_P2P": "wifi-p2p",
627+
"WIREGUARD": "wireguard",
628+
"WPAN": "wpan",
629+
}
630+
631+
599632
class DeviceMetered(IntEnum):
600633
"""Device Metered state
601634

0 commit comments

Comments
 (0)