Exemplo n.º 1
0
    def get_supported_devices(self):
        """Get information about existing supported devices on the system.

        :return: list of objects describing found supported devices
        :rtype: list(NetworkDeviceInfo)
        """
        # TODO guard on system (provides_system_bus)
        supported_devices = []
        if not self.nm_available:
            log.debug("Supported devices can't be determined.")
            return supported_devices

        for device in self.nm_client.get_devices():
            if device.get_device_type() not in supported_device_types:
                continue
            dev_info = NetworkDeviceInfo()
            dev_info.set_from_nm_device(device)
            if not all((dev_info.device_name, dev_info.device_type,
                        dev_info.hw_address)):
                log.warning(
                    "Missing value when setting NetworkDeviceInfo from NM device: %s",
                    dev_info)
            supported_devices.append(dev_info)

        return supported_devices
Exemplo n.º 2
0
    def GetSupportedDevices(self) -> List[Structure]:
        """Get info about existing network devices supported by the module.

        :return: list of objects describing supported devices found on the system
        """
        dev_infos = self.implementation.get_supported_devices()
        return NetworkDeviceInfo.to_structure_list(dev_infos)
Exemplo n.º 3
0
def get_supported_devices():
    """Get existing network devices supported by the installer.

    :return: basic information about the devices
    :rtype: list(NetworkDeviceInfo)
    """
    network_proxy = NETWORK.get_proxy()
    return NetworkDeviceInfo.from_structure_list(network_proxy.GetSupportedDevices())
Exemplo n.º 4
0
def get_supported_devices():
    """Get existing network devices supported by the installer.

    :return: basic information about the devices
    :rtype: list(NetworkDeviceInfo)
    """
    network_proxy = NETWORK.get_proxy()
    return NetworkDeviceInfo.from_structure_list(network_proxy.GetSupportedDevices())
Exemplo n.º 5
0
def get_interface_hw_address(iface):
    """Get hardware address of network interface."""
    network_proxy = NETWORK.get_proxy()
    device_infos = NetworkDeviceInfo.from_structure_list(network_proxy.GetSupportedDevices())

    for info in device_infos:
        if info.device_name == iface:
            return info.hw_address
    return ""
Exemplo n.º 6
0
def get_interface_hw_address(iface):
    """Get hardware address of network interface."""
    network_proxy = NETWORK.get_proxy()
    device_infos = NetworkDeviceInfo.from_structure_list(network_proxy.GetSupportedDevices())

    for info in device_infos:
        if info.device_name == iface:
            return info.hw_address
    return ""
Exemplo n.º 7
0
    def refresh(self):
        self._nicCombo.remove_all()

        network_proxy = NETWORK.get_proxy()
        ethernet_devices = [NetworkDeviceInfo.from_structure(device)
                            for device in network_proxy.GetSupportedDevices()
                            if device['device-type'] == NM.DeviceType.ETHERNET]
        for dev_info in ethernet_devices:
            self._nicCombo.append_text("%s - %s" % (dev_info.device_name, dev_info.hw_address))

        self._nicCombo.set_active(0)
Exemplo n.º 8
0
    def refresh(self):
        self._nicCombo.remove_all()

        network_proxy = NETWORK.get_proxy()
        ethernet_devices = [apply_structure(device, NetworkDeviceInfo())
                            for device in network_proxy.GetSupportedDevices()
                            if device['device-type'] == NM.DeviceType.ETHERNET]
        for dev_info in ethernet_devices:
            self._nicCombo.append_text("%s - %s" % (dev_info.device_name, dev_info.hw_address))

        self._nicCombo.set_active(0)
Exemplo n.º 9
0
    def refresh(self):
        self._nicCombo.remove_all()

        network_proxy = NETWORK.get_proxy()
        device_infos = NetworkDeviceInfo.from_structure_list(
            network_proxy.GetSupportedDevices())
        for dev_info in device_infos:
            if dev_info.device_type == NM.DeviceType.ETHERNET:
                self._nicCombo.append_text(
                    "%s - %s" % (dev_info.device_name, dev_info.hw_address))

        self._nicCombo.set_active(0)
        self._addButton.set_sensitive(bool(self.nic))
Exemplo n.º 10
0
    def get_supported_devices(self):
        """Get information about existing supported devices on the system.

        :return: list of objects describing found supported devices
        :rtype: list(NetworkDeviceInfo)
        """
        # TODO guard on system (provides_system_bus)
        supported_devices = []
        if not self.nm_available:
            log.debug("Supported devices can't be determined.")
            return supported_devices

        for device in self.nm_client.get_devices():
            if device.get_device_type() not in supported_device_types:
                continue
            dev_info = NetworkDeviceInfo()
            dev_info.set_from_nm_device(device)
            if not all((dev_info.device_name, dev_info.device_type, dev_info.hw_address)):
                log.warning("Missing value when setting NetworkDeviceInfo from NM device: %s", dev_info)
            supported_devices.append(dev_info)

        return supported_devices