summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-10-10 10:04:06 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-11-22 10:18:26 +0100
commite397582cca6e86e14dcf897b182f1136bea1ba64 (patch)
treeeee20e4ae5bd47a7d9b29d68864f44c3176c8e32 /examples
parent1b90ad41bba08726136b062e61bb59303a9137fa (diff)
downloadNetworkManager-e397582cca6e86e14dcf897b182f1136bea1ba64.tar.gz
libnm: export interface flags
Add libnm support for the new InterfaceFlags property of NMDevice.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/python/gi/get-interface-flags.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/python/gi/get-interface-flags.py b/examples/python/gi/get-interface-flags.py
new file mode 100755
index 0000000000..756999169b
--- /dev/null
+++ b/examples/python/gi/get-interface-flags.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2019 Red Hat, Inc.
+#
+
+import gi
+gi.require_version('NM', '1.0')
+from gi.repository import GLib, NM
+
+if __name__ == "__main__":
+ client = NM.Client.new(None)
+ devices = client.get_devices()
+
+ for d in devices:
+ print("{:<16} {:<16} {}".format(d.get_iface(),
+ "(" + d.get_type_description() + ")",
+ NM.utils_enum_to_str(NM.DeviceInterfaceFlags,
+ d.get_interface_flags())))