def test_active_connections_properties_vs_connection_settings(self): nm_active_cons = NMDbusActiveConnections() nm_settings = NMDbusSettings() iface = iface_name() with nm_connections(iface, IPV4ADDR): for active_con in nm_active_cons.connections(): settings_con = nm_settings.connection(active_con.con_path) assert active_con.uuid == settings_con.connection.uuid assert active_con.type == settings_con.connection.type assert active_con.id == settings_con.connection.id
def test_active_connections_properties_vs_connection_settings(self): nm_active_cons = NMDbusActiveConnections() nm_settings = NMDbusSettings() iface = iface_name() with dummy_devices(1) as nics: with nm_connections(iface, IPV4ADDR, slaves=nics): for active_con in nm_active_cons.connections(): settings_con = nm_settings.connection(active_con.con_path) assert active_con.uuid == settings_con.connection.uuid assert active_con.type == settings_con.connection.type assert active_con.id == settings_con.connection.id
def test_active_connections_properties_vs_connection_settings(self): nm_active_cons = NMDbusActiveConnections() nm_settings = NMDbusSettings() iface = iface_name() with dummy_devices(1) as nics: with nm_connections(iface, IPV4ADDR, slaves=nics): for active_con in nm_active_cons.connections(): connection_path = active_con.con_path() settings_con = nm_settings.connection(connection_path) assert active_con.uuid() == settings_con.connection.uuid assert active_con.type() == settings_con.connection.type assert active_con.id() == settings_con.connection.id
def test_device_attributes_existence(self): nm_device = NMDbusDevice() nm_settings = NMDbusSettings() device_count = 0 for device in nm_device.devices(): assert device.interface is not None assert device.state is not None assert device.active_connection_path is not None assert device.connections_path is not None for connection_path in device.connections_path: settings_con = nm_settings.connection(connection_path) assert settings_con.connection.uuid is not None device_count += 1 self.assertGreaterEqual(device_count, 1)
def test_device_attributes_existence(self): nm_device = NMDbusDevice() nm_settings = NMDbusSettings() device_count = 0 for device in nm_device.devices(): assert device.interface is not None assert device.state is not None assert device.active_connection_path is not None assert device.connections_path is not None for connection_path in device.connections_path: settings_con = nm_settings.connection(connection_path) assert settings_con.connection.uuid is not None device_count += 1 self.assertGreaterEqual(device_count, 1)
def _test_device_with_n_connections(self, con_count): nm_device = NMDbusDevice() nm_settings = NMDbusSettings() nm_act_cons = NMDbusActiveConnections() configured_connections = set() active_connections = set() iface = iface_name() with nm_connections(iface, IPV4ADDR, con_count=con_count): device = nm_device.device(iface) for connection_path in device.connections_path: settings_con = nm_settings.connection(connection_path) configured_connections.add(settings_con.connection.id) ac = nm_act_cons.connection(device.active_connection_path) active_connections.add(ac.id) self.assertEqual(con_count, len(configured_connections)) self.assertEqual(set([iface + '0']), active_connections)
def _test_device_with_n_connections(self, con_count): nm_device = NMDbusDevice() nm_settings = NMDbusSettings() nm_act_cons = NMDbusActiveConnections() configured_connections = set() active_connections = set() iface = iface_name() with dummy_devices(1) as nics: with nm_connections( iface, IPV4ADDR, slaves=nics, con_count=con_count ): device = nm_device.device(iface) for connection_path in device.connections_path(): settings_con = nm_settings.connection(connection_path) configured_connections.add(settings_con.connection.id) ac = nm_act_cons.connection(device.active_connection_path()) active_connections.add(ac.id()) self.assertEqual(con_count, len(configured_connections)) self.assertEqual(set([iface + '0']), active_connections)
def test_device_attributes_existence(self): nm_device = NMDbusDevice() nm_settings = NMDbusSettings() device_count = 0 iface = iface_name() with dummy_devices(1) as nics: with nm_connections(iface, IPV4ADDR, slaves=nics): for device in nm_device.devices(): try: assert device.interface() is not None assert device.state() is not None assert device.active_connection_path() is not None assert device.connections_path() is not None except errors.NMPropertiesNotFoundError: continue for connection_path in device.connections_path(): settings_con = nm_settings.connection(connection_path) assert settings_con.connection.uuid is not None device_count += 1 self.assertGreaterEqual(device_count, 1)
def test_device_attributes_existence(self): nm_device = NMDbusDevice() nm_settings = NMDbusSettings() device_count = 0 iface = iface_name() with dummy_devices(1) as nics: with nm_connections(iface, IPV4ADDR, slaves=nics): for device in nm_device.devices(): try: assert device.interface() is not None assert device.state() is not None assert device.active_connection_path() is not None assert device.connections_path() is not None except errors.NMPropertiesNotFoundError: continue for connection_path in device.connections_path(): settings_con = nm_settings.connection(connection_path) assert settings_con.connection.uuid is not None device_count += 1 self.assertGreaterEqual(device_count, 1)