Replaces uuid.uuid4 with uuidutils.generate_uuid()
Openstack oslo_utils has a generate_uuid function for generating uuids. We should use that function when generating uuids for consistency. Change-Id: I493c787ebb5fc7fbed484b5e60b94b66e434bd15
This commit is contained in:
parent
107f89834c
commit
a214de6629
@ -11,11 +11,11 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_db.exception import DBDuplicateEntry
|
from oslo_db.exception import DBDuplicateEntry
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from sqlalchemy.orm import exc as orm_exc
|
from sqlalchemy.orm import exc as orm_exc
|
||||||
from sqlalchemy import sql
|
from sqlalchemy import sql
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class NfvoPluginDb(nfvo.NFVOPluginBase, db_base.CommonDbMixin):
|
|||||||
deleted_at=datetime.min)
|
deleted_at=datetime.min)
|
||||||
context.session.add(vim_db)
|
context.session.add(vim_db)
|
||||||
vim_auth_db = nfvo_db.VimAuth(
|
vim_auth_db = nfvo_db.VimAuth(
|
||||||
id=str(uuid.uuid4()),
|
id=uuidutils.generate_uuid(),
|
||||||
vim_id=vim.get('id'),
|
vim_id=vim.get('id'),
|
||||||
password=vim_cred.pop('password'),
|
password=vim_cred.pop('password'),
|
||||||
vim_project=vim.get('vim_project'),
|
vim_project=vim.get('vim_project'),
|
||||||
|
@ -12,11 +12,11 @@
|
|||||||
|
|
||||||
import ast
|
import ast
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_db.exception import DBDuplicateEntry
|
from oslo_db.exception import DBDuplicateEntry
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
@ -170,7 +170,7 @@ class NSPluginDb(network_service.NSPluginBase, db_base.CommonDbMixin):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
nsd_id = str(uuid.uuid4())
|
nsd_id = uuidutils.generate_uuid()
|
||||||
nsd_db = NSD(
|
nsd_db = NSD(
|
||||||
id=nsd_id,
|
id=nsd_id,
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
@ -181,7 +181,7 @@ class NSPluginDb(network_service.NSPluginBase, db_base.CommonDbMixin):
|
|||||||
context.session.add(nsd_db)
|
context.session.add(nsd_db)
|
||||||
for (key, value) in nsd.get('attributes', {}).items():
|
for (key, value) in nsd.get('attributes', {}).items():
|
||||||
attribute_db = NSDAttribute(
|
attribute_db = NSDAttribute(
|
||||||
id=str(uuid.uuid4()),
|
id=uuidutils.generate_uuid(),
|
||||||
nsd_id=nsd_id,
|
nsd_id=nsd_id,
|
||||||
key=key,
|
key=key,
|
||||||
value=value)
|
value=value)
|
||||||
@ -245,7 +245,7 @@ class NSPluginDb(network_service.NSPluginBase, db_base.CommonDbMixin):
|
|||||||
nsd_id = ns['nsd_id']
|
nsd_id = ns['nsd_id']
|
||||||
vim_id = ns['vim_id']
|
vim_id = ns['vim_id']
|
||||||
name = ns.get('name')
|
name = ns.get('name')
|
||||||
ns_id = str(uuid.uuid4())
|
ns_id = uuidutils.generate_uuid()
|
||||||
try:
|
try:
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
nsd_db = self._get_resource(context, NSD,
|
nsd_db = self._get_resource(context, NSD,
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
|
|
||||||
import random
|
import random
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from sqlalchemy import orm
|
from sqlalchemy import orm
|
||||||
from sqlalchemy.orm import exc as orm_exc
|
from sqlalchemy.orm import exc as orm_exc
|
||||||
from tacker._i18n import _
|
from tacker._i18n import _
|
||||||
@ -192,8 +192,8 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
|
|||||||
|
|
||||||
def create_vnffg(self, context, vnffg):
|
def create_vnffg(self, context, vnffg):
|
||||||
vnffg_dict = self._create_vnffg_pre(context, vnffg)
|
vnffg_dict = self._create_vnffg_pre(context, vnffg)
|
||||||
sfc_instance = str(uuid.uuid4())
|
sfc_instance = uuidutils.generate_uuid()
|
||||||
fc_instance = str(uuid.uuid4())
|
fc_instance = uuidutils.generate_uuid()
|
||||||
self._create_vnffg_post(context, sfc_instance,
|
self._create_vnffg_post(context, sfc_instance,
|
||||||
fc_instance, vnffg_dict)
|
fc_instance, vnffg_dict)
|
||||||
self._create_vnffg_status(context, vnffg_dict)
|
self._create_vnffg_status(context, vnffg_dict)
|
||||||
@ -222,7 +222,7 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
|
|||||||
tenant_id = self._get_tenant_id_for_create(context, template)
|
tenant_id = self._get_tenant_id_for_create(context, template)
|
||||||
|
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
template_id = str(uuid.uuid4())
|
template_id = uuidutils.generate_uuid()
|
||||||
template_db = VnffgTemplate(
|
template_db = VnffgTemplate(
|
||||||
id=template_id,
|
id=template_id,
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
@ -324,7 +324,7 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
|
|||||||
LOG.debug(_('vnffg %s'), vnffg)
|
LOG.debug(_('vnffg %s'), vnffg)
|
||||||
tenant_id = self._get_tenant_id_for_create(context, vnffg)
|
tenant_id = self._get_tenant_id_for_create(context, vnffg)
|
||||||
name = vnffg.get('name')
|
name = vnffg.get('name')
|
||||||
vnffg_id = vnffg.get('id') or str(uuid.uuid4())
|
vnffg_id = vnffg.get('id') or uuidutils.generate_uuid()
|
||||||
template_id = vnffg['vnffgd_id']
|
template_id = vnffg['vnffgd_id']
|
||||||
symmetrical = vnffg['symmetrical']
|
symmetrical = vnffg['symmetrical']
|
||||||
|
|
||||||
@ -362,9 +362,9 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
|
|||||||
status=constants.PENDING_CREATE)
|
status=constants.PENDING_CREATE)
|
||||||
context.session.add(vnffg_db)
|
context.session.add(vnffg_db)
|
||||||
|
|
||||||
nfp_id = str(uuid.uuid4())
|
nfp_id = uuidutils.generate_uuid()
|
||||||
sfc_id = str(uuid.uuid4())
|
sfc_id = uuidutils.generate_uuid()
|
||||||
classifier_id = str(uuid.uuid4())
|
classifier_id = uuidutils.generate_uuid()
|
||||||
|
|
||||||
nfp_db = VnffgNfp(id=nfp_id, vnffg_id=vnffg_id,
|
nfp_db = VnffgNfp(id=nfp_id, vnffg_id=vnffg_id,
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
@ -400,7 +400,7 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
|
|||||||
LOG.debug(_('acl_match %s'), match)
|
LOG.debug(_('acl_match %s'), match)
|
||||||
|
|
||||||
match_db_table = ACLMatchCriteria(
|
match_db_table = ACLMatchCriteria(
|
||||||
id=str(uuid.uuid4()),
|
id=uuidutils.generate_uuid(),
|
||||||
vnffgc_id=classifier_id,
|
vnffgc_id=classifier_id,
|
||||||
**match)
|
**match)
|
||||||
|
|
||||||
@ -663,7 +663,7 @@ class VnffgPluginDbMixin(vnffg.VNFFGPluginBase, db_base.CommonDbMixin):
|
|||||||
"""
|
"""
|
||||||
# this should be overridden with driver call to find ID given name
|
# this should be overridden with driver call to find ID given name
|
||||||
# for resource
|
# for resource
|
||||||
return str(uuid.uuid4())
|
return uuidutils.generate_uuid()
|
||||||
|
|
||||||
# called internally, not by REST API
|
# called internally, not by REST API
|
||||||
# instance_id = None means error on creation
|
# instance_id = None means error on creation
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_db.exception import DBDuplicateEntry
|
from oslo_db.exception import DBDuplicateEntry
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
@ -251,7 +250,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
vnfd_id = str(uuid.uuid4())
|
vnfd_id = uuidutils.generate_uuid()
|
||||||
vnfd_db = VNFD(
|
vnfd_db = VNFD(
|
||||||
id=vnfd_id,
|
id=vnfd_id,
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
@ -263,7 +262,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
|
|||||||
context.session.add(vnfd_db)
|
context.session.add(vnfd_db)
|
||||||
for (key, value) in vnfd.get('attributes', {}).items():
|
for (key, value) in vnfd.get('attributes', {}).items():
|
||||||
attribute_db = VNFDAttribute(
|
attribute_db = VNFDAttribute(
|
||||||
id=str(uuid.uuid4()),
|
id=uuidutils.generate_uuid(),
|
||||||
vnfd_id=vnfd_id,
|
vnfd_id=vnfd_id,
|
||||||
key=key,
|
key=key,
|
||||||
value=value)
|
value=value)
|
||||||
@ -271,7 +270,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
|
|||||||
for service_type in (item['service_type']
|
for service_type in (item['service_type']
|
||||||
for item in vnfd['service_types']):
|
for item in vnfd['service_types']):
|
||||||
service_type_db = ServiceType(
|
service_type_db = ServiceType(
|
||||||
id=str(uuid.uuid4()),
|
id=uuidutils.generate_uuid(),
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
vnfd_id=vnfd_id,
|
vnfd_id=vnfd_id,
|
||||||
service_type=service_type)
|
service_type=service_type)
|
||||||
@ -382,7 +381,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
|
|||||||
arg.value = value
|
arg.value = value
|
||||||
else:
|
else:
|
||||||
arg = VNFAttribute(
|
arg = VNFAttribute(
|
||||||
id=str(uuid.uuid4()), vnf_id=vnf_id,
|
id=uuidutils.generate_uuid(), vnf_id=vnf_id,
|
||||||
key=key, value=value)
|
key=key, value=value)
|
||||||
context.session.add(arg)
|
context.session.add(arg)
|
||||||
|
|
||||||
@ -392,7 +391,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
|
|||||||
tenant_id = self._get_tenant_id_for_create(context, vnf)
|
tenant_id = self._get_tenant_id_for_create(context, vnf)
|
||||||
vnfd_id = vnf['vnfd_id']
|
vnfd_id = vnf['vnfd_id']
|
||||||
name = vnf.get('name')
|
name = vnf.get('name')
|
||||||
vnf_id = str(uuid.uuid4())
|
vnf_id = uuidutils.generate_uuid()
|
||||||
attributes = vnf.get('attributes', {})
|
attributes = vnf.get('attributes', {})
|
||||||
vim_id = vnf.get('vim_id')
|
vim_id = vnf.get('vim_id')
|
||||||
placement_attr = vnf.get('placement_attr', {})
|
placement_attr = vnf.get('placement_attr', {})
|
||||||
@ -414,7 +413,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
|
|||||||
context.session.add(vnf_db)
|
context.session.add(vnf_db)
|
||||||
for key, value in attributes.items():
|
for key, value in attributes.items():
|
||||||
arg = VNFAttribute(
|
arg = VNFAttribute(
|
||||||
id=str(uuid.uuid4()), vnf_id=vnf_id,
|
id=uuidutils.generate_uuid(), vnf_id=vnf_id,
|
||||||
key=key, value=value)
|
key=key, value=value)
|
||||||
context.session.add(arg)
|
context.session.add(arg)
|
||||||
except DBDuplicateEntry as e:
|
except DBDuplicateEntry as e:
|
||||||
@ -602,7 +601,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin):
|
|||||||
# start actual creation of hosting vnf.
|
# start actual creation of hosting vnf.
|
||||||
# Waiting for completion of creation should be done backgroundly
|
# Waiting for completion of creation should be done backgroundly
|
||||||
# by another thread if it takes a while.
|
# by another thread if it takes a while.
|
||||||
instance_id = str(uuid.uuid4())
|
instance_id = uuidutils.generate_uuid()
|
||||||
vnf_dict['instance_id'] = instance_id
|
vnf_dict['instance_id'] = instance_id
|
||||||
self._create_vnf_post(context, vnf_dict['id'], instance_id, None,
|
self._create_vnf_post(context, vnf_dict['id'], instance_id, None,
|
||||||
vnf_dict)
|
vnf_dict)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import uuid
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
|
|
||||||
class WorkflowGeneratorBase(object):
|
class WorkflowGeneratorBase(object):
|
||||||
@ -18,7 +18,7 @@ class WorkflowGeneratorBase(object):
|
|||||||
self.resource = resource
|
self.resource = resource
|
||||||
self.action = action
|
self.action = action
|
||||||
self.wf_name = self.action + '_' + self.resource
|
self.wf_name = self.action + '_' + self.resource
|
||||||
self.wf_identifier = 'std.' + self.wf_name + str(uuid.uuid4())
|
self.wf_identifier = 'std.' + self.wf_name + uuidutils.generate_uuid()
|
||||||
self.task = getattr(self, self.wf_name)
|
self.task = getattr(self, self.wf_name)
|
||||||
self.input_dict = dict()
|
self.input_dict = dict()
|
||||||
self._build_basic_workflow()
|
self._build_basic_workflow()
|
||||||
|
@ -13,9 +13,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from tacker.common import log
|
from tacker.common import log
|
||||||
from tacker.nfvo.drivers.vnffg import abstract_vnffg_driver
|
from tacker.nfvo.drivers.vnffg import abstract_vnffg_driver
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ class VNFFGNoop(abstract_vnffg_driver.VnffgAbstractDriver):
|
|||||||
|
|
||||||
@log.log
|
@log.log
|
||||||
def create_chain(self, name, fc_id, vnfs, auth_attr=None):
|
def create_chain(self, name, fc_id, vnfs, auth_attr=None):
|
||||||
instance_id = str(uuid.uuid4())
|
instance_id = uuidutils.generate_uuid()
|
||||||
self._instances.add(instance_id)
|
self._instances.add(instance_id)
|
||||||
return instance_id
|
return instance_id
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ class VNFFGNoop(abstract_vnffg_driver.VnffgAbstractDriver):
|
|||||||
|
|
||||||
@log.log
|
@log.log
|
||||||
def create_flow_classifier(self, name, fc, auth_attr=None):
|
def create_flow_classifier(self, name, fc, auth_attr=None):
|
||||||
instance_id = str(uuid.uuid4())
|
instance_id = uuidutils.generate_uuid()
|
||||||
self._instances.add(instance_id)
|
self._instances.add(instance_id)
|
||||||
return instance_id
|
return instance_id
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
import uuid
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
from tacker.mistral import workflow_generator
|
from tacker.mistral import workflow_generator
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ class WorkflowGenerator(workflow_generator.WorkflowGeneratorBase):
|
|||||||
|
|
||||||
def build_input(self, ns, params):
|
def build_input(self, ns, params):
|
||||||
vnfds = ns['vnfd_details']
|
vnfds = ns['vnfd_details']
|
||||||
id = str(uuid.uuid4())
|
id = uuidutils.generate_uuid()
|
||||||
self.input_dict = {'vnf': {}}
|
self.input_dict = {'vnf': {}}
|
||||||
for vnfd_name, vnfd_info in (vnfds).items():
|
for vnfd_name, vnfd_info in (vnfds).items():
|
||||||
nodes = vnfd_info['instances']
|
nodes = vnfd_info['instances']
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
import copy
|
import copy
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import uuid
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from cryptography import fernet
|
from cryptography import fernet
|
||||||
@ -26,6 +25,7 @@ from oslo_config import cfg
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
from oslo_utils import strutils
|
from oslo_utils import strutils
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from tempfile import mkstemp
|
from tempfile import mkstemp
|
||||||
from toscaparser.tosca_template import ToscaTemplate
|
from toscaparser.tosca_template import ToscaTemplate
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ class NfvoPlugin(nfvo_db_plugin.NfvoPluginDb, vnffg_db.VnffgPluginDbMixin,
|
|||||||
strutils.mask_password(vim))
|
strutils.mask_password(vim))
|
||||||
vim_obj = vim['vim']
|
vim_obj = vim['vim']
|
||||||
vim_type = vim_obj['type']
|
vim_type = vim_obj['type']
|
||||||
vim_obj['id'] = str(uuid.uuid4())
|
vim_obj['id'] = uuidutils.generate_uuid()
|
||||||
vim_obj['status'] = 'PENDING'
|
vim_obj['status'] = 'PENDING'
|
||||||
try:
|
try:
|
||||||
self._vim_drivers.invoke(vim_type,
|
self._vim_drivers.invoke(vim_type,
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import uuid
|
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
from tacker import context
|
from tacker import context
|
||||||
from tacker.nfvo.drivers.vim import openstack_driver
|
from tacker.nfvo.drivers.vim import openstack_driver
|
||||||
@ -29,7 +30,7 @@ class FakeNeutronClient(mock.Mock):
|
|||||||
self.__chain_dict = {}
|
self.__chain_dict = {}
|
||||||
|
|
||||||
def flow_classifier_create(self, fc_create_dict):
|
def flow_classifier_create(self, fc_create_dict):
|
||||||
fc_id = uuid.uuid4()
|
fc_id = uuidutils.generate_uuid()
|
||||||
self.__fc_dict[fc_id] = fc_create_dict
|
self.__fc_dict[fc_id] = fc_create_dict
|
||||||
return fc_id
|
return fc_id
|
||||||
|
|
||||||
@ -54,7 +55,7 @@ class FakeNeutronClient(mock.Mock):
|
|||||||
self.__fc_dict.pop(fc_id)
|
self.__fc_dict.pop(fc_id)
|
||||||
|
|
||||||
def port_pair_create(self, port_pair):
|
def port_pair_create(self, port_pair):
|
||||||
pp_id = uuid.uuid4()
|
pp_id = uuidutils.generate_uuid()
|
||||||
self.__pp_dict[pp_id] = port_pair
|
self.__pp_dict[pp_id] = port_pair
|
||||||
return pp_id
|
return pp_id
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ class FakeNeutronClient(mock.Mock):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def port_pair_group_create(self, port_pair_group):
|
def port_pair_group_create(self, port_pair_group):
|
||||||
ppg_id = uuid.uuid4()
|
ppg_id = uuidutils.generate_uuid()
|
||||||
self.__ppg_dict[ppg_id] = port_pair_group
|
self.__ppg_dict[ppg_id] = port_pair_group
|
||||||
return ppg_id
|
return ppg_id
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ class FakeNeutronClient(mock.Mock):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def port_chain_create(self, port_chain):
|
def port_chain_create(self, port_chain):
|
||||||
chain_id = uuid.uuid4()
|
chain_id = uuidutils.generate_uuid()
|
||||||
self.__chain_dict[chain_id] = port_chain
|
self.__chain_dict[chain_id] = port_chain
|
||||||
return chain_id
|
return chain_id
|
||||||
|
|
||||||
@ -185,11 +186,14 @@ class TestChainSFC(base.TestCase):
|
|||||||
self.assertIsNotNone(fc_id)
|
self.assertIsNotNone(fc_id)
|
||||||
|
|
||||||
vnf_1 = {'name': 'test_create_chain_vnf_1',
|
vnf_1 = {'name': 'test_create_chain_vnf_1',
|
||||||
'connection_points': [uuid.uuid4(), uuid.uuid4()]}
|
'connection_points': [uuidutils.generate_uuid(),
|
||||||
|
uuidutils.generate_uuid()]}
|
||||||
vnf_2 = {'name': 'test_create_chain_vnf_2',
|
vnf_2 = {'name': 'test_create_chain_vnf_2',
|
||||||
'connection_points': [uuid.uuid4(), uuid.uuid4()]}
|
'connection_points': [uuidutils.generate_uuid(),
|
||||||
|
uuidutils.generate_uuid()]}
|
||||||
vnf_3 = {'name': 'test_create_chain_vnf_3',
|
vnf_3 = {'name': 'test_create_chain_vnf_3',
|
||||||
'connection_points': [uuid.uuid4(), uuid.uuid4()]}
|
'connection_points': [uuidutils.generate_uuid(),
|
||||||
|
uuidutils.generate_uuid()]}
|
||||||
vnfs = [vnf_1, vnf_2, vnf_3]
|
vnfs = [vnf_1, vnf_2, vnf_3]
|
||||||
|
|
||||||
result = self.sfc_driver.create_chain(name='fake_ffg',
|
result = self.sfc_driver.create_chain(name='fake_ffg',
|
||||||
@ -213,11 +217,14 @@ class TestChainSFC(base.TestCase):
|
|||||||
self.assertIsNotNone(fc_id)
|
self.assertIsNotNone(fc_id)
|
||||||
|
|
||||||
vnf_1 = {'name': 'test_delete_chain_vnf_1',
|
vnf_1 = {'name': 'test_delete_chain_vnf_1',
|
||||||
'connection_points': [uuid.uuid4(), uuid.uuid4()]}
|
'connection_points': [uuidutils.generate_uuid(),
|
||||||
|
uuidutils.generate_uuid()]}
|
||||||
vnf_2 = {'name': 'test_delete_chain_vnf_2',
|
vnf_2 = {'name': 'test_delete_chain_vnf_2',
|
||||||
'connection_points': [uuid.uuid4(), uuid.uuid4()]}
|
'connection_points': [uuidutils.generate_uuid(),
|
||||||
|
uuidutils.generate_uuid()]}
|
||||||
vnf_3 = {'name': 'test_delete_chain_vnf_3',
|
vnf_3 = {'name': 'test_delete_chain_vnf_3',
|
||||||
'connection_points': [uuid.uuid4(), uuid.uuid4()]}
|
'connection_points': [uuidutils.generate_uuid(),
|
||||||
|
uuidutils.generate_uuid()]}
|
||||||
vnfs = [vnf_1, vnf_2, vnf_3]
|
vnfs = [vnf_1, vnf_2, vnf_3]
|
||||||
|
|
||||||
chain_id = self.sfc_driver.create_chain(name='fake_ffg',
|
chain_id = self.sfc_driver.create_chain(name='fake_ffg',
|
||||||
|
@ -17,10 +17,10 @@ import codecs
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import mock
|
import mock
|
||||||
import os
|
import os
|
||||||
import uuid
|
|
||||||
|
|
||||||
|
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
from tacker import context
|
from tacker import context
|
||||||
from tacker.db.common_services import common_services_db_plugin
|
from tacker.db.common_services import common_services_db_plugin
|
||||||
@ -57,7 +57,7 @@ class FakeDriverManager(mock.Mock):
|
|||||||
def invoke(self, *args, **kwargs):
|
def invoke(self, *args, **kwargs):
|
||||||
if any(x in ['create', 'create_chain', 'create_flow_classifier'] for
|
if any(x in ['create', 'create_chain', 'create_flow_classifier'] for
|
||||||
x in args):
|
x in args):
|
||||||
return str(uuid.uuid4())
|
return uuidutils.generate_uuid()
|
||||||
elif 'execute_workflow' in args:
|
elif 'execute_workflow' in args:
|
||||||
mock_execution = mock.Mock()
|
mock_execution = mock.Mock()
|
||||||
mock_execution.id.return_value = \
|
mock_execution.id.return_value = \
|
||||||
@ -673,7 +673,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
|
|||||||
session.add(nsd_template)
|
session.add(nsd_template)
|
||||||
for (key, value) in attributes.items():
|
for (key, value) in attributes.items():
|
||||||
attribute_db = ns_db.NSDAttribute(
|
attribute_db = ns_db.NSDAttribute(
|
||||||
id=str(uuid.uuid4()),
|
id=uuidutils.generate_uuid(),
|
||||||
nsd_id='eb094833-995e-49f0-a047-dfb56aaf7c4e',
|
nsd_id='eb094833-995e-49f0-a047-dfb56aaf7c4e',
|
||||||
key=key,
|
key=key,
|
||||||
value=value)
|
value=value)
|
||||||
|
@ -14,10 +14,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from webob import exc
|
from webob import exc
|
||||||
import webtest
|
import webtest
|
||||||
|
|
||||||
@ -103,7 +102,7 @@ class ExtensionTestCase(testlib_api.WebTestCase):
|
|||||||
|
|
||||||
def _test_entity_delete(self, entity):
|
def _test_entity_delete(self, entity):
|
||||||
"""Does the entity deletion based on naming convention."""
|
"""Does the entity deletion based on naming convention."""
|
||||||
entity_id = str(uuid.uuid4())
|
entity_id = uuidutils.generate_uuid()
|
||||||
path = self._resource_prefix + '/' if self._resource_prefix else ''
|
path = self._resource_prefix + '/' if self._resource_prefix else ''
|
||||||
path += self._plural_mappings.get(entity, entity + 's')
|
path += self._plural_mappings.get(entity, entity + 's')
|
||||||
if self._translate_resource_name:
|
if self._translate_resource_name:
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import uuid
|
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
from oslo_utils import uuidutils
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from tacker import context
|
from tacker import context
|
||||||
@ -34,12 +34,12 @@ from tacker.vnfm import plugin
|
|||||||
class FakeDriverManager(mock.Mock):
|
class FakeDriverManager(mock.Mock):
|
||||||
def invoke(self, *args, **kwargs):
|
def invoke(self, *args, **kwargs):
|
||||||
if 'create' in args:
|
if 'create' in args:
|
||||||
return str(uuid.uuid4())
|
return uuidutils.generate_uuid()
|
||||||
|
|
||||||
if 'get_resource_info' in args:
|
if 'get_resource_info' in args:
|
||||||
return {'resources': {'name': 'dummy_vnf',
|
return {'resources': {'name': 'dummy_vnf',
|
||||||
'type': 'dummy',
|
'type': 'dummy',
|
||||||
'id': str(uuid.uuid4())}}
|
'id': uuidutils.generate_uuid()}}
|
||||||
|
|
||||||
|
|
||||||
class FakeVNFMonitor(mock.Mock):
|
class FakeVNFMonitor(mock.Mock):
|
||||||
|
@ -15,9 +15,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
# TODO(yamahata): once unittests are impletemted, move this there
|
# TODO(yamahata): once unittests are impletemted, move this there
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
from tacker.common import log
|
from tacker.common import log
|
||||||
from tacker.vnfm.infra_drivers import abstract_driver
|
from tacker.vnfm.infra_drivers import abstract_driver
|
||||||
@ -45,7 +44,7 @@ class DeviceNoop(abstract_driver.DeviceAbstractDriver):
|
|||||||
|
|
||||||
@log.log
|
@log.log
|
||||||
def create(self, **kwargs):
|
def create(self, **kwargs):
|
||||||
instance_id = str(uuid.uuid4())
|
instance_id = uuidutils.generate_uuid()
|
||||||
self._instances.add(instance_id)
|
self._instances.add(instance_id)
|
||||||
return instance_id
|
return instance_id
|
||||||
|
|
||||||
@ -73,4 +72,4 @@ class DeviceNoop(abstract_driver.DeviceAbstractDriver):
|
|||||||
|
|
||||||
def get_resource_info(self, plugin, context, vnf_info, auth_attr,
|
def get_resource_info(self, plugin, context, vnf_info, auth_attr,
|
||||||
region_name=None):
|
region_name=None):
|
||||||
return {'noop': {'id': str(uuid.uuid4()), 'type': 'noop'}}
|
return {'noop': {'id': uuidutils.generate_uuid(), 'type': 'noop'}}
|
||||||
|
Loading…
Reference in New Issue
Block a user