Removes quantum.common.utils.str_uuid()

Replaced str_uuid() with openstack.common.uuidutils.generate_uuid()

Fixes bug #1082236

Change-Id: Ib09b070bfa1de4435c831d1d3c0fb0b0d12011bd
This commit is contained in:
Zhongyue Luo 2012-11-15 09:02:20 +08:00
parent f562c49fe8
commit 75eb91431b
11 changed files with 93 additions and 96 deletions

View File

@ -20,16 +20,15 @@
"""Utilities and helper functions.""" """Utilities and helper functions."""
import os import os
import signal import signal
import uuid
from eventlet.green import subprocess from eventlet.green import subprocess
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import log as logging from quantum.openstack.common import log as logging
TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -118,11 +117,6 @@ def find_config_file(options, config_file):
return cfg_file return cfg_file
def str_uuid():
"""Return a uuid as a string"""
return str(uuid.uuid4())
def _subprocess_setup(): def _subprocess_setup():
# Python installs a SIGPIPE handler by default. This is usually not what # Python installs a SIGPIPE handler by default. This is usually not what
# non-Python subprocesses expect. # non-Python subprocesses expect.

View File

@ -1,17 +1,19 @@
# Copyright (c) 2012 OpenStack, LLC. # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack LLC.
# All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License"); you may
# you may not use this file except in compliance with the License. # not use this file except in compliance with the License. You may obtain
# You may obtain a copy of the License at # a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# implied. # License for the specific language governing permissions and limitations
# See the License for the specific language governing permissions and # under the License.
# limitations under the License.
import datetime import datetime
import random import random
@ -23,12 +25,12 @@ from sqlalchemy.orm import exc
from quantum.api.v2 import attributes from quantum.api.v2 import attributes
from quantum.common import constants from quantum.common import constants
from quantum.common import exceptions as q_exc from quantum.common import exceptions as q_exc
from quantum.common import utils
from quantum.db import api as db from quantum.db import api as db
from quantum.db import models_v2 from quantum.db import models_v2
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import log as logging from quantum.openstack.common import log as logging
from quantum.openstack.common import timeutils from quantum.openstack.common import timeutils
from quantum.openstack.common import uuidutils
from quantum import quantum_plugin_base_v2 from quantum import quantum_plugin_base_v2
@ -906,12 +908,13 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
# unneeded db action if the operation raises # unneeded db action if the operation raises
tenant_id = self._get_tenant_id_for_create(context, n) tenant_id = self._get_tenant_id_for_create(context, n)
with context.session.begin(subtransactions=True): with context.session.begin(subtransactions=True):
network = models_v2.Network(tenant_id=tenant_id, args = {'tenant_id': tenant_id,
id=n.get('id') or utils.str_uuid(), 'id': n.get('id') or uuidutils.generate_uuid(),
name=n['name'], 'name': n['name'],
admin_state_up=n['admin_state_up'], 'admin_state_up': n['admin_state_up'],
shared=n['shared'], 'shared': n['shared'],
status=constants.NET_STATUS_ACTIVE) 'status': constants.NET_STATUS_ACTIVE}
network = models_v2.Network(**args)
context.session.add(network) context.session.add(network)
return self._make_network_dict(network) return self._make_network_dict(network)
@ -1030,15 +1033,16 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
self._validate_subnet_cidr(context, network, s['cidr']) self._validate_subnet_cidr(context, network, s['cidr'])
# The 'shared' attribute for subnets is for internal plugin # The 'shared' attribute for subnets is for internal plugin
# use only. It is not exposed through the API # use only. It is not exposed through the API
subnet = models_v2.Subnet(tenant_id=tenant_id, args = {'tenant_id': tenant_id,
id=s.get('id') or utils.str_uuid(), 'id': s.get('id') or uuidutils.generate_uuid(),
name=s['name'], 'name': s['name'],
network_id=s['network_id'], 'network_id': s['network_id'],
ip_version=s['ip_version'], 'ip_version': s['ip_version'],
cidr=s['cidr'], 'cidr': s['cidr'],
enable_dhcp=s['enable_dhcp'], 'enable_dhcp': s['enable_dhcp'],
gateway_ip=s['gateway_ip'], 'gateway_ip': s['gateway_ip'],
shared=network.shared) 'shared': network.shared}
subnet = models_v2.Subnet(**args)
# perform allocate pools first, since it might raise an error # perform allocate pools first, since it might raise an error
pools = self._allocate_pools_for_subnet(context, s) pools = self._allocate_pools_for_subnet(context, s)
@ -1165,7 +1169,7 @@ class QuantumDbPluginV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
def create_port(self, context, port): def create_port(self, context, port):
p = port['port'] p = port['port']
port_id = p.get('id') or utils.str_uuid() port_id = p.get('id') or uuidutils.generate_uuid()
network_id = p['network_id'] network_id = p['network_id']
mac_address = p['mac_address'] mac_address = p['mac_address']
# NOTE(jkoelker) Get the tenant_id outside of the session to avoid # NOTE(jkoelker) Get the tenant_id outside of the session to avoid

View File

@ -1,6 +1,5 @@
"""
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Nicira Networks, Inc. All rights reserved. # Copyright 2012 Nicira Networks, Inc. All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -17,7 +16,6 @@
# #
# @author: Dan Wendlandt, Nicira, Inc # @author: Dan Wendlandt, Nicira, Inc
# #
"""
import netaddr import netaddr
import sqlalchemy as sa import sqlalchemy as sa
@ -28,14 +26,13 @@ import webob.exc as w_exc
from quantum.api.v2 import attributes from quantum.api.v2 import attributes
from quantum.common import exceptions as q_exc from quantum.common import exceptions as q_exc
from quantum.common import utils
from quantum.db import db_base_plugin_v2 from quantum.db import db_base_plugin_v2
from quantum.db import model_base from quantum.db import model_base
from quantum.db import models_v2 from quantum.db import models_v2
from quantum.extensions import l3 from quantum.extensions import l3
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import log as logging from quantum.openstack.common import log as logging
from quantum.openstack.common import uuidutils
from quantum import policy from quantum import policy
@ -143,7 +140,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
with context.session.begin(subtransactions=True): with context.session.begin(subtransactions=True):
# pre-generate id so it will be available when # pre-generate id so it will be available when
# configuring external gw port # configuring external gw port
router_db = Router(id=utils.str_uuid(), router_db = Router(id=uuidutils.generate_uuid(),
tenant_id=tenant_id, tenant_id=tenant_id,
name=r['name'], name=r['name'],
admin_state_up=r['admin_state_up'], admin_state_up=r['admin_state_up'],
@ -553,7 +550,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
def create_floatingip(self, context, floatingip): def create_floatingip(self, context, floatingip):
fip = floatingip['floatingip'] fip = floatingip['floatingip']
tenant_id = self._get_tenant_id_for_create(context, fip) tenant_id = self._get_tenant_id_for_create(context, fip)
fip_id = utils.str_uuid() fip_id = uuidutils.generate_uuid()
f_net_id = fip['floating_network_id'] f_net_id = fip['floating_network_id']
if not self._network_is_external(context, f_net_id): if not self._network_is_external(context, f_net_id):

View File

@ -1,23 +1,25 @@
# Copyright (c) 2012 OpenStack, LLC. # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack LLC.
# All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License"); you may
# you may not use this file except in compliance with the License. # not use this file except in compliance with the License. You may obtain
# You may obtain a copy of the License at # a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# implied. # License for the specific language governing permissions and limitations
# See the License for the specific language governing permissions and # under the License.
# limitations under the License.
import sqlalchemy as sa import sqlalchemy as sa
from sqlalchemy import orm from sqlalchemy import orm
from quantum.common import utils
from quantum.db import model_base from quantum.db import model_base
from quantum.openstack.common import uuidutils
class HasTenant(object): class HasTenant(object):
@ -28,7 +30,9 @@ class HasTenant(object):
class HasId(object): class HasId(object):
"""id mixin, add to subclasses that have an id.""" """id mixin, add to subclasses that have an id."""
id = sa.Column(sa.String(36), primary_key=True, default=utils.str_uuid) id = sa.Column(sa.String(36),
primary_key=True,
default=uuidutils.generate_uuid)
class IPAvailabilityRange(model_base.BASEV2): class IPAvailabilityRange(model_base.BASEV2):

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Nicira Networks, Inc. All rights reserved. # Copyright 2012 Nicira Networks, Inc. All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -22,7 +22,6 @@ from sqlalchemy import orm
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from sqlalchemy.orm import scoped_session from sqlalchemy.orm import scoped_session
from quantum.common import utils
from quantum.db import model_base from quantum.db import model_base
from quantum.db import models_v2 from quantum.db import models_v2
from quantum.extensions import securitygroup as ext_sg from quantum.extensions import securitygroup as ext_sg
@ -119,7 +118,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
with context.session.begin(subtransactions=True): with context.session.begin(subtransactions=True):
security_group_db = SecurityGroup(id=s.get('id') or ( security_group_db = SecurityGroup(id=s.get('id') or (
utils.str_uuid()), uuidutils.generate_uuid()),
description=s['description'], description=s['description'],
tenant_id=tenant_id, tenant_id=tenant_id,
name=s['name'], name=s['name'],
@ -129,7 +128,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
for ethertype in self.sg_supported_ethertypes: for ethertype in self.sg_supported_ethertypes:
# Allow intercommunication # Allow intercommunication
db = SecurityGroupRule( db = SecurityGroupRule(
id=utils.str_uuid(), tenant_id=tenant_id, id=uuidutils.generate_uuid(), tenant_id=tenant_id,
security_group=security_group_db, security_group=security_group_db,
direction='ingress', direction='ingress',
ethertype=ethertype, ethertype=ethertype,
@ -249,7 +248,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
rule = rule_dict['security_group_rule'] rule = rule_dict['security_group_rule']
tenant_id = self._get_tenant_id_for_create(context, rule) tenant_id = self._get_tenant_id_for_create(context, rule)
db = SecurityGroupRule( db = SecurityGroupRule(
id=utils.str_uuid(), tenant_id=tenant_id, id=uuidutils.generate_uuid(), tenant_id=tenant_id,
security_group_id=rule['security_group_id'], security_group_id=rule['security_group_id'],
direction=rule['direction'], direction=rule['direction'],
external_id=rule.get('external_id'), external_id=rule.get('external_id'),

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation. All rights reserved. # Copyright 2012 NEC Corporation. All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -20,8 +20,8 @@ import logging
from sqlalchemy.orm import exc from sqlalchemy.orm import exc
from quantum.api.v2 import attributes from quantum.api.v2 import attributes
from quantum.common import utils
from quantum.db import db_base_plugin_v2 from quantum.db import db_base_plugin_v2
from quantum.openstack.common import uuidutils
from quantum.plugins.nec.common import exceptions as q_exc from quantum.plugins.nec.common import exceptions as q_exc
from quantum.plugins.nec.db import models as nmodels from quantum.plugins.nec.db import models as nmodels
@ -84,7 +84,7 @@ class NECPluginV2Base(db_base_plugin_v2.QuantumDbPluginV2):
super(NECPluginV2Base, self).get_port(context, pf['in_port']) super(NECPluginV2Base, self).get_port(context, pf['in_port'])
params = {'tenant_id': tenant_id, params = {'tenant_id': tenant_id,
'id': pf.get('id') or utils.str_uuid(), 'id': pf.get('id') or uuidutils.generate_uuid(),
'network_id': pf['network_id'], 'network_id': pf['network_id'],
'priority': pf['priority'], 'priority': pf['priority'],
'action': pf['action'], 'action': pf['action'],

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation. All rights reserved. # Copyright 2012 NEC Corporation. All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -18,7 +18,7 @@
import random import random
import unittest import unittest
from quantum.common import utils from quantum.openstack.common import uuidutils
from quantum.plugins.nec.common import exceptions as nexc from quantum.plugins.nec.common import exceptions as nexc
from quantum.plugins.nec.db import api as ndb from quantum.plugins.nec.db import api as ndb
from quantum.plugins.nec.db import models as nmodels from quantum.plugins.nec.db import models as nmodels
@ -37,9 +37,9 @@ class NECPluginV2DBTest(unittest.TestCase):
def get_ofc_item_random_params(self): def get_ofc_item_random_params(self):
"""create random parameters for ofc_item test""" """create random parameters for ofc_item test"""
ofc_id = utils.str_uuid() ofc_id = uuidutils.generate_uuid()
quantum_id = utils.str_uuid() quantum_id = uuidutils.generate_uuid()
none = utils.str_uuid() none = uuidutils.generate_uuid()
return ofc_id, quantum_id, none return ofc_id, quantum_id, none
def testa_add_ofc_item(self): def testa_add_ofc_item(self):
@ -91,12 +91,12 @@ class NECPluginV2DBTest(unittest.TestCase):
def get_portinfo_random_params(self): def get_portinfo_random_params(self):
"""create random parameters for portinfo test""" """create random parameters for portinfo test"""
port_id = utils.str_uuid() port_id = uuidutils.generate_uuid()
datapath_id = hex(random.randint(0, 0xffffffff)) datapath_id = hex(random.randint(0, 0xffffffff))
port_no = random.randint(1, 100) port_no = random.randint(1, 100)
vlan_id = random.randint(0, 4095) vlan_id = random.randint(0, 4095)
mac = ':'.join(["%02x" % random.randint(0, 0xff) for x in range(6)]) mac = ':'.join(["%02x" % random.randint(0, 0xff) for x in range(6)])
none = utils.str_uuid() none = uuidutils.generate_uuid()
return port_id, datapath_id, port_no, vlan_id, mac, none return port_id, datapath_id, port_no, vlan_id, mac, none
def testd_add_portinfo(self): def testd_add_portinfo(self):

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation. All rights reserved. # Copyright 2012 NEC Corporation. All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -17,7 +17,7 @@
import unittest import unittest
from quantum.common import utils from quantum.openstack.common import uuidutils
from quantum.plugins.nec.common import config from quantum.plugins.nec.common import config
from quantum.plugins.nec.db import api as ndb from quantum.plugins.nec.db import api as ndb
from quantum.plugins.nec.db import models as nmodels from quantum.plugins.nec.db import models as nmodels
@ -38,11 +38,11 @@ class OFCManagerTest(unittest.TestCase):
def get_random_params(self): def get_random_params(self):
"""create random parameters for portinfo test""" """create random parameters for portinfo test"""
tenant = utils.str_uuid() tenant = uuidutils.generate_uuid()
network = utils.str_uuid() network = uuidutils.generate_uuid()
port = utils.str_uuid() port = uuidutils.generate_uuid()
_filter = utils.str_uuid() _filter = uuidutils.generate_uuid()
none = utils.str_uuid() none = uuidutils.generate_uuid()
return tenant, network, port, _filter, none return tenant, network, port, _filter, none
def testa_create_ofc_tenant(self): def testa_create_ofc_tenant(self):

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation. All rights reserved. # Copyright 2012 NEC Corporation. All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -18,7 +18,7 @@
import mox import mox
import unittest import unittest
from quantum.common import utils from quantum.openstack.common import uuidutils
from quantum.plugins.nec.common import ofc_client as ofc from quantum.plugins.nec.common import ofc_client as ofc
from quantum.plugins.nec.db import models as nmodels from quantum.plugins.nec.db import models as nmodels
from quantum.plugins.nec import drivers from quantum.plugins.nec import drivers
@ -50,9 +50,9 @@ class PFCDriverTestBase(unittest.TestCase):
def get_ofc_item_random_params(self): def get_ofc_item_random_params(self):
"""create random parameters for ofc_item test""" """create random parameters for ofc_item test"""
tenant_id = utils.str_uuid() tenant_id = uuidutils.generate_uuid()
network_id = utils.str_uuid() network_id = uuidutils.generate_uuid()
port_id = utils.str_uuid() port_id = uuidutils.generate_uuid()
portinfo = nmodels.PortInfo(id=port_id, datapath_id="0x123456789", portinfo = nmodels.PortInfo(id=port_id, datapath_id="0x123456789",
port_no=1234, vlan_id=321, port_no=1234, vlan_id=321,
mac="11:22:33:44:55:66") mac="11:22:33:44:55:66")

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation. All rights reserved. # Copyright 2012 NEC Corporation. All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -18,7 +18,7 @@
import mox import mox
import unittest import unittest
from quantum.common import utils from quantum.openstack.common import uuidutils
from quantum.plugins.nec.common import ofc_client from quantum.plugins.nec.common import ofc_client
from quantum.plugins.nec.db import models as nmodels from quantum.plugins.nec.db import models as nmodels
from quantum.plugins.nec import drivers from quantum.plugins.nec import drivers
@ -44,9 +44,9 @@ class TremaDriverTestBase():
def get_ofc_item_random_params(self): def get_ofc_item_random_params(self):
"""create random parameters for ofc_item test""" """create random parameters for ofc_item test"""
tenant_id = utils.str_uuid() tenant_id = uuidutils.generate_uuid()
network_id = utils.str_uuid() network_id = uuidutils.generate_uuid()
port_id = utils.str_uuid() port_id = uuidutils.generate_uuid()
portinfo = nmodels.PortInfo(id=port_id, datapath_id="0x123456789", portinfo = nmodels.PortInfo(id=port_id, datapath_id="0x123456789",
port_no=1234, vlan_id=321, port_no=1234, vlan_id=321,
mac="11:22:33:44:55:66") mac="11:22:33:44:55:66")
@ -185,7 +185,7 @@ class TremaFilterDriverTest(TremaDriverTestBase, unittest.TestCase):
"""create random parameters for ofc_item test""" """create random parameters for ofc_item test"""
t, n, p = (super(TremaFilterDriverTest, self). t, n, p = (super(TremaFilterDriverTest, self).
get_ofc_item_random_params()) get_ofc_item_random_params())
filter_id = utils.str_uuid() filter_id = uuidutils.generate_uuid()
filter_dict = {'tenant_id': t, filter_dict = {'tenant_id': t,
'id': filter_id, 'id': filter_id,
'network_id': n, 'network_id': n,

View File

@ -1,6 +1,5 @@
"""
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Nicira Networks, Inc. All rights reserved. # Copyright 2012 Nicira Networks, Inc. All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -17,7 +16,6 @@
# #
# @author: Dan Wendlandt, Nicira, Inc # @author: Dan Wendlandt, Nicira, Inc
# #
"""
import contextlib import contextlib
import copy import copy
@ -34,7 +32,6 @@ from quantum.api.v2 import attributes
from quantum.common import config from quantum.common import config
from quantum.common import exceptions as q_exc from quantum.common import exceptions as q_exc
from quantum.common.test_lib import test_config from quantum.common.test_lib import test_config
from quantum.common import utils
from quantum import context from quantum import context
from quantum.db import db_base_plugin_v2 from quantum.db import db_base_plugin_v2
from quantum.db import l3_db from quantum.db import l3_db
@ -42,10 +39,12 @@ from quantum.db import models_v2
from quantum.extensions import l3 from quantum.extensions import l3
from quantum import manager from quantum import manager
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import uuidutils
from quantum.tests.unit import test_api_v2 from quantum.tests.unit import test_api_v2
from quantum.tests.unit import test_db_plugin from quantum.tests.unit import test_db_plugin
from quantum.tests.unit import test_extensions from quantum.tests.unit import test_extensions
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
_uuid = test_api_v2._uuid _uuid = test_api_v2._uuid
@ -1043,19 +1042,19 @@ class L3NatDBTestCase(test_db_plugin.QuantumDbPluginV2TestCase):
def test_create_floatingip_invalid_floating_network_id_returns_400(self): def test_create_floatingip_invalid_floating_network_id_returns_400(self):
# API-level test - no need to create all objects for l3 plugin # API-level test - no need to create all objects for l3 plugin
res = self._create_floatingip('json', 'iamnotanuuid', res = self._create_floatingip('json', 'iamnotanuuid',
utils.str_uuid(), '192.168.0.1') uuidutils.generate_uuid(), '192.168.0.1')
self.assertEqual(res.status_int, 400) self.assertEqual(res.status_int, 400)
def test_create_floatingip_invalid_floating_port_id_returns_400(self): def test_create_floatingip_invalid_floating_port_id_returns_400(self):
# API-level test - no need to create all objects for l3 plugin # API-level test - no need to create all objects for l3 plugin
res = self._create_floatingip('json', utils.str_uuid(), res = self._create_floatingip('json', uuidutils.generate_uuid(),
'iamnotanuuid', '192.168.0.1') 'iamnotanuuid', '192.168.0.1')
self.assertEqual(res.status_int, 400) self.assertEqual(res.status_int, 400)
def test_create_floatingip_invalid_fixed_ip_address_returns_400(self): def test_create_floatingip_invalid_fixed_ip_address_returns_400(self):
# API-level test - no need to create all objects for l3 plugin # API-level test - no need to create all objects for l3 plugin
res = self._create_floatingip('json', utils.str_uuid(), res = self._create_floatingip('json', uuidutils.generate_uuid(),
utils.str_uuid(), 'iamnotnanip') uuidutils.generate_uuid(), 'iamnotnanip')
self.assertEqual(res.status_int, 400) self.assertEqual(res.status_int, 400)
def test_list_nets_external(self): def test_list_nets_external(self):