dbusmock.templates.networkmanager ================================= .. py:module:: dbusmock.templates.networkmanager .. autoapi-nested-parse:: NetworkManager mock template This creates the expected methods and properties of the main org.freedesktop.NetworkManager object, but no devices. You can specify any property such as 'NetworkingEnabled', or 'WirelessEnabled' etc. in "parameters". Attributes ---------- .. autoapisummary:: dbusmock.templates.networkmanager.__author__ dbusmock.templates.networkmanager.__copyright__ dbusmock.templates.networkmanager.BUS_NAME dbusmock.templates.networkmanager.MAIN_OBJ dbusmock.templates.networkmanager.MANAGER_IFACE dbusmock.templates.networkmanager.MANAGER_OBJ dbusmock.templates.networkmanager.SETTINGS_OBJ dbusmock.templates.networkmanager.SETTINGS_IFACE dbusmock.templates.networkmanager.DEVICE_IFACE dbusmock.templates.networkmanager.WIRELESS_DEVICE_IFACE dbusmock.templates.networkmanager.ACCESS_POINT_IFACE dbusmock.templates.networkmanager.CSETTINGS_IFACE dbusmock.templates.networkmanager.ACTIVE_CONNECTION_IFACE dbusmock.templates.networkmanager.SYSTEM_BUS dbusmock.templates.networkmanager.IS_OBJECT_MANAGER Classes ------- .. autoapisummary:: dbusmock.templates.networkmanager.NMState dbusmock.templates.networkmanager.NMConnectivityState dbusmock.templates.networkmanager.NMActiveConnectionState dbusmock.templates.networkmanager.InfrastructureMode dbusmock.templates.networkmanager.DeviceState dbusmock.templates.networkmanager.NM80211ApSecurityFlags dbusmock.templates.networkmanager.NM80211ApFlags Functions --------- .. autoapisummary:: dbusmock.templates.networkmanager.activate_connection dbusmock.templates.networkmanager.deactivate_connection dbusmock.templates.networkmanager.add_and_activate_connection dbusmock.templates.networkmanager.get_device_by_ip_iface dbusmock.templates.networkmanager.set_networking_enabled dbusmock.templates.networkmanager.load dbusmock.templates.networkmanager.SetProperty dbusmock.templates.networkmanager.SetGlobalConnectionState dbusmock.templates.networkmanager.SetConnectivity dbusmock.templates.networkmanager.SetNetworkingEnabled dbusmock.templates.networkmanager.SetDeviceActive dbusmock.templates.networkmanager.SetDeviceDisconnected dbusmock.templates.networkmanager.AddEthernetDevice dbusmock.templates.networkmanager.AddWiFiDevice dbusmock.templates.networkmanager.AddAccessPoint dbusmock.templates.networkmanager.AddWiFiConnection dbusmock.templates.networkmanager.AddActiveConnection dbusmock.templates.networkmanager.RemoveAccessPoint dbusmock.templates.networkmanager.RemoveWifiConnection dbusmock.templates.networkmanager.RemoveActiveConnection dbusmock.templates.networkmanager.SettingsAddConnection dbusmock.templates.networkmanager.SettingsGetConnectionByUuid dbusmock.templates.networkmanager.ConnectionUpdate dbusmock.templates.networkmanager.ConnectionGetSettings dbusmock.templates.networkmanager.ConnectionGetSecrets dbusmock.templates.networkmanager.ConnectionDelete Module Contents --------------- .. py:data:: __author__ :value: 'Iftikhar Ahmad' .. py:data:: __copyright__ :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ (c) 2012 Canonical Ltd. (c) 2017 - 2022 Martin Pitt """ .. raw:: html
.. py:data:: BUS_NAME :value: 'org.freedesktop.NetworkManager' .. py:data:: MAIN_OBJ :value: '/org/freedesktop' .. py:data:: MANAGER_IFACE :value: 'org.freedesktop.NetworkManager' .. py:data:: MANAGER_OBJ :value: '/org/freedesktop/NetworkManager' .. py:data:: SETTINGS_OBJ :value: '/org/freedesktop/NetworkManager/Settings' .. py:data:: SETTINGS_IFACE :value: 'org.freedesktop.NetworkManager.Settings' .. py:data:: DEVICE_IFACE :value: 'org.freedesktop.NetworkManager.Device' .. py:data:: WIRELESS_DEVICE_IFACE :value: 'org.freedesktop.NetworkManager.Device.Wireless' .. py:data:: ACCESS_POINT_IFACE :value: 'org.freedesktop.NetworkManager.AccessPoint' .. py:data:: CSETTINGS_IFACE :value: 'org.freedesktop.NetworkManager.Settings.Connection' .. py:data:: ACTIVE_CONNECTION_IFACE :value: 'org.freedesktop.NetworkManager.Connection.Active' .. py:data:: SYSTEM_BUS :value: True .. py:data:: IS_OBJECT_MANAGER :value: True .. py:class:: NMState Global state As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMState .. py:attribute:: NM_STATE_UNKNOWN :value: 0 .. py:attribute:: NM_STATE_ASLEEP :value: 10 .. py:attribute:: NM_STATE_DISCONNECTED :value: 20 .. py:attribute:: NM_STATE_DISCONNECTING :value: 30 .. py:attribute:: NM_STATE_CONNECTING :value: 40 .. py:attribute:: NM_STATE_CONNECTED_LOCAL :value: 50 .. py:attribute:: NM_STATE_CONNECTED_SITE :value: 60 .. py:attribute:: NM_STATE_CONNECTED_GLOBAL :value: 70 .. py:class:: NMConnectivityState Connectvity state As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMConnectivityState .. py:attribute:: NM_CONNECTIVITY_UNKNOWN :value: 0 .. py:attribute:: NM_CONNECTIVITY_NONE :value: 1 .. py:attribute:: NM_CONNECTIVITY_PORTAL :value: 2 .. py:attribute:: NM_CONNECTIVITY_LIMITED :value: 3 .. py:attribute:: NM_CONNECTIVITY_FULL :value: 4 .. py:class:: NMActiveConnectionState Active connection state As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMActiveConnectionState .. py:attribute:: NM_ACTIVE_CONNECTION_STATE_UNKNOWN :value: 0 .. py:attribute:: NM_ACTIVE_CONNECTION_STATE_ACTIVATING :value: 1 .. py:attribute:: NM_ACTIVE_CONNECTION_STATE_ACTIVATED :value: 2 .. py:attribute:: NM_ACTIVE_CONNECTION_STATE_DEACTIVATING :value: 3 .. py:attribute:: NM_ACTIVE_CONNECTION_STATE_DEACTIVATED :value: 4 .. py:class:: InfrastructureMode Infrastructure mode As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NM80211Mode .. py:attribute:: NM_802_11_MODE_UNKNOWN :value: 0 .. py:attribute:: NM_802_11_MODE_ADHOC :value: 1 .. py:attribute:: NM_802_11_MODE_INFRA :value: 2 .. py:attribute:: NM_802_11_MODE_AP :value: 3 .. py:attribute:: NAME_MAP .. py:class:: DeviceState Device states As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMDeviceState .. py:attribute:: UNKNOWN :value: 0 .. py:attribute:: UNMANAGED :value: 10 .. py:attribute:: UNAVAILABLE :value: 20 .. py:attribute:: DISCONNECTED :value: 30 .. py:attribute:: PREPARE :value: 40 .. py:attribute:: CONFIG :value: 50 .. py:attribute:: NEED_AUTH :value: 60 .. py:attribute:: IP_CONFIG :value: 70 .. py:attribute:: IP_CHECK :value: 80 .. py:attribute:: SECONDARIES :value: 90 .. py:attribute:: ACTIVATED :value: 100 .. py:attribute:: DEACTIVATING :value: 110 .. py:attribute:: FAILED :value: 120 .. py:class:: NM80211ApSecurityFlags Security flags As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NM80211ApSecurityFlags .. py:attribute:: NM_802_11_AP_SEC_NONE :value: 0 .. py:attribute:: NM_802_11_AP_SEC_PAIR_WEP40 :value: 1 .. py:attribute:: NM_802_11_AP_SEC_PAIR_WEP104 :value: 2 .. py:attribute:: NM_802_11_AP_SEC_PAIR_TKIP :value: 4 .. py:attribute:: NM_802_11_AP_SEC_PAIR_CCMP :value: 8 .. py:attribute:: NM_802_11_AP_SEC_GROUP_WEP40 :value: 16 .. py:attribute:: NM_802_11_AP_SEC_GROUP_WEP104 :value: 32 .. py:attribute:: NM_802_11_AP_SEC_GROUP_TKIP :value: 64 .. py:attribute:: NM_802_11_AP_SEC_GROUP_CCMP :value: 128 .. py:attribute:: NM_802_11_AP_SEC_KEY_MGMT_PSK :value: 256 .. py:attribute:: NM_802_11_AP_SEC_KEY_MGMT_802_1X :value: 512 .. py:attribute:: NAME_MAP .. py:class:: NM80211ApFlags Device flags As per https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NM80211ApFlags .. py:attribute:: NM_802_11_AP_FLAGS_NONE :value: 0 .. py:attribute:: NM_802_11_AP_FLAGS_PRIVACY :value: 1 .. py:function:: activate_connection(self, conn, dev, ap) .. py:function:: deactivate_connection(self, active_conn_path) .. py:function:: add_and_activate_connection(self, conn_conf, dev, ap) .. py:function:: get_device_by_ip_iface(_self, iface) .. py:function:: set_networking_enabled(self, networking_enabled) .. py:function:: load(mock, parameters) .. py:function:: SetProperty(_self, path, iface, name, value) .. py:function:: SetGlobalConnectionState(self, state) .. py:function:: SetConnectivity(self, connectivity) .. py:function:: SetNetworkingEnabled(self, networking_enabled) .. py:function:: SetDeviceActive(_self, device_path, active_connection_path) .. py:function:: SetDeviceDisconnected(_self, device_path) .. py:function:: AddEthernetDevice(self, device_name, iface_name, state) Add an ethernet device. You have to specify device_name, device interface name (e. g. eth0), and state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values please visit https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMDeviceState Please note that this does not set any global properties. Returns the new object path. .. py:function:: AddWiFiDevice(self, device_name, iface_name, state) Add a WiFi Device. You have to specify device_name, device interface name (e. g. wlan0) and state. You can use the predefined DeviceState values (e. g. DeviceState.ACTIVATED) or supply a numeric value. For valid state values, please visit https://developer.gnome.org/NetworkManager/unstable/nm-dbus-types.html#NMDeviceState Please note that this does not set any global properties. Returns the new object path. .. py:function:: AddAccessPoint(self, dev_path, ap_name, ssid, hw_address, mode, frequency, rate, strength, security) Add an access point to an existing WiFi device. You have to specify WiFi Device path, Access Point object name, ssid, hw_address, mode, frequency, rate, strength and security. For valid access point property values, please visit https://developer.gnome.org/NetworkManager/unstable/gdbus-org.freedesktop.NetworkManager.AccessPoint.html Please note that this does not set any global properties. Returns the new object path. .. py:function:: AddWiFiConnection(self, dev_path, connection_name, ssid_name, _key_mgmt) Add an available connection to an existing WiFi device and access point. You have to specify WiFi Device path, Connection object name, SSID and key management. The SSID must match one of the previously created access points. Please note that this only sets minimal global properties in ipv{4,6}, no others. Returns the new object path. .. py:function:: AddActiveConnection(self, devices, connection_device, specific_object, name, state) Add an active connection to an existing WiFi device. You have to a list of the involved WiFi devices, the connection path, the access point path, ActiveConnection object name and connection state. Please note that this does not set any global properties. Returns the new object path. .. py:function:: RemoveAccessPoint(self, dev_path, ap_path) Remove the specified access point. You have to specify the device to remove the access point from, and the path of the access point. Please note that this does not set any global properties. .. py:function:: RemoveWifiConnection(self, dev_path, connection_path) Remove the specified WiFi connection. You have to specify the device to remove the connection from, and the path of the Connection. Please note that this does not set any global properties. .. py:function:: RemoveActiveConnection(self, dev_path, active_connection_path) Remove the specified ActiveConnection. You have to specify the device to remove the connection from, and the path of the ActiveConnection. Please note that this does not set any global properties. .. py:function:: SettingsAddConnection(self, connection_settings) Add a connection. connection_settings is a String String Variant Map Map. See https://developer.gnome.org/NetworkManager/0.9/spec.html #type-String_String_Variant_Map_Map If you omit uuid, this method adds one for you. .. py:function:: SettingsGetConnectionByUuid(self, conn_uuid) .. py:function:: ConnectionUpdate(self, settings) Update settings on a connection. settings is a String String Variant Map Map. See https://developer.gnome.org/NetworkManager/0.9/spec.html#type-String_String_Variant_Map_Map .. py:function:: ConnectionGetSettings(self) .. py:function:: ConnectionGetSecrets(self, setting) .. py:function:: ConnectionDelete(self) Deletes a connection. This also * removes the deleted connection from any device, * removes any active connection(s) it might be associated with, * removes it from the Settings interface, * as well as deletes the object from the mock. Note: If this was the only active connection, we change the global connection state.