コード例 #1
0
 def test_is_connected_when_wireless_and_carrier_active(self):
     """is_connected is True if wireless /sys/net/devname/carrier is 1."""
     self.assertFalse(net.is_connected('eth0'))
     ensure_file(os.path.join(self.sysdir, 'eth0', 'wireless'))
     self.assertFalse(net.is_connected('eth0'))
     write_file(os.path.join(self.sysdir, 'eth0', 'carrier'), "1")
     self.assertTrue(net.is_connected('eth0'))
コード例 #2
0
ファイル: test_init.py プロジェクト: cloud-init/cloud-init
 def test_is_connected_when_wireless_and_carrier_active(self):
     """is_connected is True if wireless /sys/net/devname/carrier is 1."""
     self.assertFalse(net.is_connected('eth0'))
     ensure_file(os.path.join(self.sysdir, 'eth0', 'wireless'))
     self.assertFalse(net.is_connected('eth0'))
     write_file(os.path.join(self.sysdir, 'eth0', 'carrier'), "1")
     self.assertTrue(net.is_connected('eth0'))
コード例 #3
0
 def test_is_connected_when_physically_connected(self):
     """is_connected is True when /sys/net/devname/iflink reports 2."""
     self.assertFalse(net.is_connected('eth0'))
     write_file(os.path.join(self.sysdir, 'eth0', 'iflink'), "2")
     self.assertTrue(net.is_connected('eth0'))
コード例 #4
0
ファイル: test_init.py プロジェクト: cloud-init/cloud-init
 def test_is_connected_when_physically_connected(self):
     """is_connected is True when /sys/net/devname/iflink reports 2."""
     self.assertFalse(net.is_connected('eth0'))
     write_file(os.path.join(self.sysdir, 'eth0', 'iflink'), "2")
     self.assertTrue(net.is_connected('eth0'))
コード例 #5
0
 def is_connected(self, devname: DeviceName) -> bool:
     return net.is_connected(devname)