Ejemplo n.º 1
0
    def test_list_hardware_info(self):
        self.hardware.list_network_interfaces = mock.Mock()
        self.hardware.list_network_interfaces.return_value = [
            hardware.NetworkInterface('eth0', '00:0c:29:8c:11:b1'),
            hardware.NetworkInterface('eth1', '00:0c:29:8c:11:b2'),
        ]

        self.hardware.get_cpus = mock.Mock()
        self.hardware.get_cpus.return_value = hardware.CPU(
            'Awesome CPU x14 9001', 9001, 14)

        self.hardware.get_memory = mock.Mock()
        self.hardware.get_memory.return_value = hardware.Memory(1017012)

        self.hardware.list_block_devices = mock.Mock()
        self.hardware.list_block_devices.return_value = [
            hardware.BlockDevice('/dev/sdj', 'big', 1073741824, True),
            hardware.BlockDevice('/dev/hdaa', 'small', 65535, False),
        ]

        hardware_info = self.hardware.list_hardware_info()
        self.assertEqual(hardware_info['memory'], self.hardware.get_memory())
        self.assertEqual(hardware_info['cpu'], self.hardware.get_cpus())
        self.assertEqual(hardware_info['disks'],
                         self.hardware.list_block_devices())
        self.assertEqual(hardware_info['interfaces'],
                         self.hardware.list_network_interfaces())
Ejemplo n.º 2
0
 def setUp(self):
     super(TestBaseIronicPythonAgent, self).setUp()
     self.api_client = ironic_api_client.APIClient(API_URL)
     self.hardware_info = {
         'interfaces': [
             hardware.NetworkInterface('eth0',
                                       '00:0c:29:8c:11:b1',
                                       vendor='0x15b3',
                                       product='0x1014'),
             hardware.NetworkInterface('eth1',
                                       '00:0c:29:8c:11:b2',
                                       lldp=[
                                           (1, '04885a92ec5459'),
                                           (2, '0545746865726e6574312f3138')
                                       ],
                                       vendor='0x15b3',
                                       product='0x1014'),
         ],
         'cpu':
         hardware.CPU('Awesome Jay CPU x10 9001', '9001', '10', 'ARMv9'),
         'disks': [
             hardware.BlockDevice('/dev/sdj', 'small', '9001', False),
             hardware.BlockDevice('/dev/hdj', 'big', '9002', False),
         ],
         'memory':
         hardware.Memory(total='8675309', physical_mb='8675'),
     }
Ejemplo n.º 3
0
 def setUp(self):
     super(BaseDiscoverTest, self).setUp()
     self.inventory = {
         'interfaces': [
             hardware.NetworkInterface(name='em1',
                                       mac_addr='aa:bb:cc:dd:ee:ff',
                                       ipv4_address='1.1.1.1'),
             hardware.NetworkInterface(name='em2',
                                       mac_addr='11:22:33:44:55:66',
                                       ipv4_address=None),
         ],
         'cpu': hardware.CPU(model_name='generic', frequency='3000',
                             count=4, architecture='x86_64'),
         'memory': hardware.Memory(total=11998396 * 1024,
                                   physical_mb=12288),
         'disks': [
             hardware.BlockDevice(name='/dev/sdc',
                                  model='Disk 2',
                                  size=500107862016,
                                  rotational=False),
             hardware.BlockDevice(name='/dev/sda',
                                  model='Too Small Disk',
                                  size=4294967295,
                                  rotational=False),
             hardware.BlockDevice(name='/dev/sdb',
                                  model='Disk 1',
                                  size=500107862016,
                                  rotational=True)
         ],
         'bmc_address': '1.2.3.4',
         'boot': hardware.BootInfo(current_boot_mode='bios',
                                   pxe_interface='boot:if')
     }
     self.failures = utils.AccumulatedFailures()
     self.data = {}
Ejemplo n.º 4
0
    def test_list_hardware_info(self):
        self.hardware.list_network_interfaces = mock.Mock()
        self.hardware.list_network_interfaces.return_value = [
            hardware.NetworkInterface('eth0', '00:0c:29:8c:11:b1'),
            hardware.NetworkInterface('eth1', '00:0c:29:8c:11:b2'),
        ]

        self.hardware.get_cpus = mock.Mock()
        self.hardware.get_cpus.return_value = hardware.CPU(
            'Awesome CPU x14 9001',
            9001,
            14,
            'x86_64')

        self.hardware.get_memory = mock.Mock()
        self.hardware.get_memory.return_value = hardware.Memory(1017012)

        self.hardware.list_block_devices = mock.Mock()
        self.hardware.list_block_devices.return_value = [
            hardware.BlockDevice('/dev/sdj', 'big', 1073741824, True),
            hardware.BlockDevice('/dev/hdaa', 'small', 65535, False),
        ]

        self.hardware.list_physical_devices = mock.Mock()
        self.hardware.list_physical_devices.return_value = [
            arcconf.PhysicalDisk(ID='0 0',
                                 ControllerID='1',
                                 Type='SAS',
                                 Size='558.91 GB'),
            arcconf.PhysicalDisk(ID='0 1',
                                 ControllerID='1',
                                 Type='SAS',
                                 Size='558.91 GB'),
        ]

        self.hardware.get_boot_info = mock.Mock()
        self.hardware.get_boot_info.return_value = hardware.BootInfo(
            current_boot_mode='bios', pxe_interface='boot:if')

        self.hardware.get_bmc_address = mock.Mock()
        self.hardware.get_system_vendor_info = mock.Mock()

        hardware_info = self.hardware.list_hardware_info()
        self.assertEqual(self.hardware.get_memory(),
                         hardware_info['memory'])
        self.assertEqual(self.hardware.get_cpus(), hardware_info['cpu'])
        self.assertEqual(self.hardware.list_block_devices(),
                         hardware_info['disks'])
        self.assertEqual(self.hardware.list_physical_devices(),
                         hardware_info['physical_disks'])
        self.assertEqual(self.hardware.list_network_interfaces(),
                         hardware_info['interfaces'])
        self.assertEqual(self.hardware.get_boot_info(),
                         hardware_info['boot'])
Ejemplo n.º 5
0
 def setUp(self):
     super(TestBaseIronicPythonAgent, self).setUp()
     self.api_client = ironic_api_client.APIClient(API_URL, DRIVER)
     self.hardware_info = {
         'interfaces': [
             hardware.NetworkInterface('eth0', '00:0c:29:8c:11:b1'),
             hardware.NetworkInterface('eth1', '00:0c:29:8c:11:b2'),
         ],
         'cpu': hardware.CPU('Awesome Jay CPU x10 9001', '9001', '10',
                             'ARMv9'),
         'disks': [
             hardware.BlockDevice('/dev/sdj', 'small', '9001', False),
             hardware.BlockDevice('/dev/hdj', 'big', '9002', False),
         ],
         'memory': hardware.Memory(total='8675309',
                                   physical_mb='8675'),
     }