diff --git a/aif.xsd b/aif.xsd index f9b3e58..19d1609 100644 --- a/aif.xsd +++ b/aif.xsd @@ -159,7 +159,7 @@ - + @@ -214,6 +214,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -536,7 +645,8 @@ - + @@ -622,69 +732,24 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - - + + + + + + diff --git a/aif/network/__init__.py b/aif/network/__init__.py new file mode 100644 index 0000000..20a8caa --- /dev/null +++ b/aif/network/__init__.py @@ -0,0 +1,16 @@ +try: + from . import _common +except ImportError: + pass # GI isn't supported, so we don't even use a fallback. + +# TODO: use DBus interface for systemd but fallback to subprocess? +# http://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html +# https://www.youtube.com/watch?v=ZUX9Fx8Rwzg +# https://www.youtube.com/watch?v=lBQgMGPxqNo +# https://github.com/facebookincubator/pystemd has some unit/service examples +# try: +# from . import networkd +# except ImportError: +# from . import networkd_fallback as networkd + +from . import netctl diff --git a/aif/network/_common.py b/aif/network/_common.py new file mode 100644 index 0000000..a8686f5 --- /dev/null +++ b/aif/network/_common.py @@ -0,0 +1,13 @@ +import gi +gi.require_version('NM', '2.0') +from gi.repository import NM, GLib + +NM.ensure_init([None]) + + +def addBDPlugin(plugin_name): + plugins = NM.get_available_plugin_names() + plugins.append(plugin_name) + plugins = list(set(plugins)) # Deduplicate + spec = NM.plugin_specs_from_names(plugins) + return(NM.ensure_init(spec)) diff --git a/aif/network/netctl.py b/aif/network/netctl.py new file mode 100644 index 0000000..e69de29 diff --git a/aif/network.py b/aif/network/networkd.py similarity index 51% rename from aif/network.py rename to aif/network/networkd.py index 41c438f..dca0967 100644 --- a/aif/network.py +++ b/aif/network/networkd.py @@ -1 +1,4 @@ import ipaddress +import socket + + diff --git a/aif/network/networkd_fallback.py b/aif/network/networkd_fallback.py new file mode 100644 index 0000000..e69de29 diff --git a/aif/network/networkmanager.py b/aif/network/networkmanager.py new file mode 100644 index 0000000..e69de29 diff --git a/aif/network/networkmanager_fallback.py b/aif/network/networkmanager_fallback.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/aif.xml b/examples/aif.xml index bf518f3..d8e9a52 100644 --- a/examples/aif.xml +++ b/examples/aif.xml @@ -119,8 +119,8 @@ - - + +
dhcp
@@ -133,7 +133,14 @@ 8.8.8.8 -
+ + + + wpa2 + personal + ABadWiFiPassword + +