def test_get_node_by_port_addresses(self):
    wrong_node = utils.create_test_node(driver='driver-one', uuid=uuidutils.generate_uuid())
    node = utils.create_test_node(driver='driver-two', uuid=uuidutils.generate_uuid())
    addresses = []
    for i in (1, 2, 3):
        address = ('52:54:00:cf:2d:4%s' % i)
        utils.create_test_port(uuid=uuidutils.generate_uuid(), node_id=node.id, address=address)
        if (i > 1):
            addresses.append(address)
    utils.create_test_port(uuid=uuidutils.generate_uuid(), node_id=wrong_node.id, address='aa:bb:cc:dd:ee:ff')
    res = self.dbapi.get_node_by_port_addresses(addresses)
    self.assertEqual(node.uuid, res.uuid)
    self.assertEqual([], res.traits)
def test_get_node_by_port_addresses(self):
    wrong_node = utils.create_test_node(driver='driver-one', uuid=uuidutils.generate_uuid())
    node = utils.create_test_node(driver='driver-two', uuid=uuidutils.generate_uuid())
    addresses = []
    for i in (1, 2, 3):
        address = ('52:54:00:cf:2d:4%s' % i)
        utils.create_test_port(uuid=uuidutils.generate_uuid(), node_id=node.id, address=address)
        if (i > 1):
            addresses.append(address)
    utils.create_test_port(uuid=uuidutils.generate_uuid(), node_id=wrong_node.id, address='aa:bb:cc:dd:ee:ff')
    res = self.dbapi.get_node_by_port_addresses(addresses)
    self.assertEqual(node.uuid, res.uuid)
    self.assertEqual([], res.traits)