예제 #1
0
 def _device_configurations_changed(self, changes):
     self.DeviceConfigurationChanged([
         (
             NetworkDeviceConfiguration.to_structure(old),
             NetworkDeviceConfiguration.to_structure(new)
         )
         for old, new in changes
     ])
예제 #2
0
 def _update_editable_configurations(self):
     device_configurations = NetworkDeviceConfiguration.from_structure_list(
         self._network_module.GetDeviceConfigurations())
     self.editable_configurations = [
         dc for dc in device_configurations
         if dc.device_type in self.configurable_device_types
     ]
예제 #3
0
 def _update_editable_configurations(self):
     device_configurations = self._network_module.GetDeviceConfigurations()
     self.editable_configurations = [
         NetworkDeviceConfiguration.from_structure(dc)
         for dc in device_configurations
         if dc['device-type'] in self.configurable_device_types
     ]
예제 #4
0
 def _update_editable_configurations(self):
     device_configurations = self._network_module.proxy.GetDeviceConfigurations(
     )
     self.editable_configurations = [
         apply_structure(dc, NetworkDeviceConfiguration())
         for dc in device_configurations
         if dc['device-type'] in self.configurable_device_types
     ]
예제 #5
0
 def _connection_removed_cb(self, client, connection):
     uuid = connection.get_uuid()
     log.debug("NM connection removed: %s", uuid)
     # Remove the configuration if it does not have a device_name
     # which means it is a virtual device configurtation
     dev_cfgs = self.get_for_uuid(uuid)
     for cfg in dev_cfgs:
         if cfg.device_name:
             old_cfg = copy.deepcopy(cfg)
             cfg.connection_uuid = ""
             self.configurations_changed.emit([(old_cfg, cfg)])
             log.debug("connection uuid %s removed from %s", uuid, cfg)
         else:
             empty_cfg = NetworkDeviceConfiguration()
             self._device_configurations.remove(cfg)
             self.configurations_changed.emit([(cfg, empty_cfg)])
             log.debug("%s removed", cfg)
예제 #6
0
 def _device_removed_cb(self, client, device, *args):
     # We just remove the device from the NetworkDeviceConfiguration, keeping the object
     # assuming it is just a disconnected virtual device.
     iface = device.get_iface()
     log.debug("NM device removed: %s", iface)
     dev_cfgs = self.get_for_device(iface)
     for cfg in dev_cfgs:
         if cfg.connection_uuid and cfg.device_type in virtual_device_types:
             old_cfg = copy.deepcopy(cfg)
             cfg.device_name = ""
             self.configurations_changed.emit([(old_cfg, cfg)])
             log.debug("device name %s removed from %s", iface, cfg)
         else:
             empty_cfg = NetworkDeviceConfiguration()
             self._device_configurations.remove(cfg)
             self.configurations_changed.emit([(cfg, empty_cfg)])
             log.debug("%s removed", cfg)
예제 #7
0
 def add(self, device_name=None, connection_uuid=None, device_type=None):
     """Add a new NetworkDeviceConfiguration."""
     new_dev_cfg = NetworkDeviceConfiguration()
     if device_name is not None:
         new_dev_cfg.device_name = device_name
     if connection_uuid is not None:
         new_dev_cfg.connection_uuid = connection_uuid
     if device_type is not None:
         new_dev_cfg.device_type = device_type
     self._device_configurations.append(new_dev_cfg)
     log.debug("added %s", new_dev_cfg)
     self.configurations_changed.emit([(NetworkDeviceConfiguration(), new_dev_cfg)])
예제 #8
0
    def GetDeviceConfigurations(self) -> List[Structure]:
        """Get the state of network devices configuration.

        Contains only configuration of devices supported by Anaconda.

        Returns list of NetworkDeviceConfiguration objects holding
        configuration of a network device.

        For a physical device there is only single NetworkDeviceConfiguration
        object bound to the device name (the mandatory persistent element of
        the object).  The uuid corresponds to the configuration of the device
        for installed system.

        For a virtual device there can be multiple NetworkDeviceConfiguration
        objects, bound to uuid of the device configuration (the mandatory
        persistent element of the object).  The device name is set in the
        object only if there exists respective active device with the
        configuration given by uuid applied.

        Configurations correspond to NetworkManager persistent connections by
        their uuid.
        """
        dev_cfgs = self.implementation.get_device_configurations()
        return NetworkDeviceConfiguration.to_structure_list(dev_cfgs)
예제 #9
0
 def _update_editable_configurations(self):
     device_configurations = self._network_module.proxy.GetDeviceConfigurations()
     self.editable_configurations = [NetworkDeviceConfiguration.from_structure(dc)
                                     for dc in device_configurations
                                     if dc['device-type'] in self.configurable_device_types]