コード例 #1
0
 def test_interface_has_own_mac_true_when_not_stolen(self):
     """Return False from interface_has_own_mac when mac isn't stolen."""
     valid_assign_types = ['0', '1', '3']
     assign_path = os.path.join(self.sysdir, 'eth1', 'addr_assign_type')
     for _type in valid_assign_types:
         write_file(assign_path, _type)
         self.assertTrue(net.interface_has_own_mac('eth1'))
コード例 #2
0
ファイル: test_init.py プロジェクト: cloud-init/cloud-init
 def test_interface_has_own_mac_true_when_not_stolen(self):
     """Return False from interface_has_own_mac when mac isn't stolen."""
     valid_assign_types = ['0', '1', '3']
     assign_path = os.path.join(self.sysdir, 'eth1', 'addr_assign_type')
     for _type in valid_assign_types:
         write_file(assign_path, _type)
         self.assertTrue(net.interface_has_own_mac('eth1'))
コード例 #3
0
 def test_interface_has_own_mac_strict_errors_on_absent_assign_type(self):
     """When addr_assign_type is absent, interface_has_own_mac errors."""
     with self.assertRaises(ValueError):
         net.interface_has_own_mac('eth1', strict=True)
コード例 #4
0
 def test_interface_has_own_mac_false_when_stolen(self):
     """Return False from interface_has_own_mac when address is stolen."""
     write_file(os.path.join(self.sysdir, 'eth1', 'addr_assign_type'), '2')
     self.assertFalse(net.interface_has_own_mac('eth1'))
コード例 #5
0
ファイル: networking.py プロジェクト: waquidvp/cloud-init
 def interface_has_own_mac(self,
                           devname: DeviceName,
                           *,
                           strict: bool = False) -> bool:
     return net.interface_has_own_mac(devname, strict=strict)
コード例 #6
0
ファイル: test_init.py プロジェクト: cloud-init/cloud-init
 def test_interface_has_own_mac_strict_errors_on_absent_assign_type(self):
     """When addr_assign_type is absent, interface_has_own_mac errors."""
     with self.assertRaises(ValueError):
         net.interface_has_own_mac('eth1', strict=True)
コード例 #7
0
ファイル: test_init.py プロジェクト: cloud-init/cloud-init
 def test_interface_has_own_mac_false_when_stolen(self):
     """Return False from interface_has_own_mac when address is stolen."""
     write_file(os.path.join(self.sysdir, 'eth1', 'addr_assign_type'), '2')
     self.assertFalse(net.interface_has_own_mac('eth1'))