def test_populate_node_mapping_ironic_fake_pxe(self): client = mock.MagicMock() ironic_node = collections.namedtuple('node', ['uuid', 'driver', 'driver_info']) ironic_port = collections.namedtuple('port', ['address']) node = ironic_node('abcdef', 'fake_pxe', None) client.node.list_ports.return_value = [ironic_port('aaa')] client.node.list.return_value = [node] expected = {'mac': {'aaa': 'abcdef'}, 'pm_addr': {}, 'uuids': {'abcdef'}} self.assertEqual(expected, nodes._populate_node_mapping(client))
def test_populate_node_mapping_ironic_fake_pxe(self): client = mock.MagicMock() ironic_node = collections.namedtuple('node', ['uuid', 'driver', 'driver_info']) ironic_port = collections.namedtuple('port', ['address']) node = ironic_node('abcdef', 'fake_pxe', None) client.node.list_ports.return_value = [ironic_port('aaa')] client.node.list.return_value = [node] expected = {'mac': {'aaa': 'abcdef'}, 'pm_addr': {}, 'uuids': {'abcdef'}} self.assertEqual(expected, nodes._populate_node_mapping(client))
def test_populate_node_mapping_ironic(self): client = mock.MagicMock() ironic_node = collections.namedtuple('node', ['uuid', 'driver', 'driver_info']) ironic_port = collections.namedtuple('port', ['address']) node1 = ironic_node('abcdef', 'pxe_ssh', None) node2 = ironic_node('fedcba', 'pxe_ipmitool', {'ipmi_address': '10.0.1.2'}) node3 = ironic_node('xyz', 'ipmi', {'ipmi_address': '10.0.1.3'}) client.node.list_ports.side_effect = ([ironic_port('aaa')], [], []) client.node.list.return_value = [node1, node2, node3] expected = {'mac': {'aaa': 'abcdef'}, 'pm_addr': {'10.0.1.2': 'fedcba', '10.0.1.3': 'xyz'}, 'uuids': {'abcdef', 'fedcba', 'xyz'}} self.assertEqual(expected, nodes._populate_node_mapping(client))
def test_populate_node_mapping_ironic(self): client = mock.MagicMock() ironic_node = collections.namedtuple('node', ['uuid', 'driver', 'driver_info']) ironic_port = collections.namedtuple('port', ['address']) node1 = ironic_node('abcdef', 'pxe_ssh', None) node2 = ironic_node('fedcba', 'pxe_ipmitool', {'ipmi_address': '10.0.1.2'}) node3 = ironic_node('xyz', 'ipmi', {'ipmi_address': '10.0.1.3'}) client.node.list_ports.side_effect = ([ironic_port('aaa')], [], []) client.node.list.return_value = [node1, node2, node3] expected = {'mac': {'aaa': 'abcdef'}, 'pm_addr': {'10.0.1.2': 'fedcba', '10.0.1.3': 'xyz'}, 'uuids': {'abcdef', 'fedcba', 'xyz'}} self.assertEqual(expected, nodes._populate_node_mapping(client))