stubbing network out
This commit is contained in:
parent
856d89f231
commit
5371ae2361
1
aif.xsd
1
aif.xsd
@ -270,6 +270,7 @@
|
||||
WPA3?
|
||||
EAP,
|
||||
eduroam (https://github.com/rst0git/netctl-eduroam-config/blob/master/eduroam), etc. -->
|
||||
<!-- wep64, wep128, wpa-psk:tkip, wpa-psk:aes, wpa2-psk:tkip, wpa2-psk:aes, wpa2-psk:tkip/aes -->
|
||||
<xs:complexType name="t_wifi_crypto">
|
||||
<xs:all>
|
||||
<xs:element name="type" minOccurs="1" maxOccurs="1" default="wpa2">
|
||||
|
@ -3,14 +3,22 @@ try:
|
||||
except ImportError:
|
||||
pass # GI isn't supported, so we don't even use a fallback.
|
||||
|
||||
from . import netctl
|
||||
|
||||
# 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
|
||||
try:
|
||||
from . import networkd
|
||||
except ImportError:
|
||||
from . import networkd_fallback as networkd
|
||||
|
||||
from . import netctl
|
||||
|
||||
try:
|
||||
from . import networkmanager
|
||||
except ImportError:
|
||||
from . import networkmanager_fallback
|
||||
|
||||
from . import net
|
||||
|
@ -1,13 +1,3 @@
|
||||
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))
|
||||
gi.require_version('NM', '1.0')
|
||||
from gi.repository import GObject, NM, GLib
|
||||
|
19
aif/network/net.py
Normal file
19
aif/network/net.py
Normal file
@ -0,0 +1,19 @@
|
||||
class Network(object):
|
||||
def __init__(self, network_xml):
|
||||
self.xml = network_xml
|
||||
self.hostname = self.xml.attrib['hostname']
|
||||
self.provider = self.xml.attrib.get('provider', 'netctl')
|
||||
handler = None
|
||||
if self.provider == 'netctl':
|
||||
from . import netctl as handler
|
||||
elif self.provider == 'nm':
|
||||
from . import networkmanager as handler
|
||||
elif self.provider == 'systemd':
|
||||
from . import networkd as handler
|
||||
self.provider = handler
|
||||
if not self.provider:
|
||||
raise RuntimeError('Could not determine handler')
|
||||
self.connections = []
|
||||
|
||||
def _initConns(self):
|
||||
pass
|
@ -0,0 +1,23 @@
|
||||
from . import _common
|
||||
|
||||
_NM = _common.NM
|
||||
|
||||
|
||||
class Connection(object):
|
||||
def __init__(self, iface_xml):
|
||||
self.xml = iface_xml
|
||||
self.connection_type = None
|
||||
self.provider_type = 'NetworkManager'
|
||||
self.client = _NM.Client.new()
|
||||
|
||||
|
||||
class Ethernet(Connection):
|
||||
def __init__(self, iface_xml):
|
||||
super().__init__(iface_xml)
|
||||
self.connection_type = 'ethernet'
|
||||
|
||||
|
||||
class Wireless(Connection):
|
||||
def __init__(self, iface_xml):
|
||||
super().__init__(iface_xml)
|
||||
self.connection_type = 'wireless'
|
@ -0,0 +1 @@
|
||||
import subprocess
|
@ -85,6 +85,14 @@ TIP: Your distro's package manager should have most if not all of these availabl
|
||||
|
||||
NOTE: Some versions may be higher than actually needed.
|
||||
|
||||
////
|
||||
Need to revamp. Recommended vs. fallback plus required for both
|
||||
|
||||
Recommended:
|
||||
pygobject-introspection
|
||||
libblockdev
|
||||
libnm
|
||||
////
|
||||
|
||||
=== Necessary
|
||||
These are needed for using AIF-NG.
|
||||
|
Loading…
Reference in New Issue
Block a user