Dropping explicit unicode literal

In python 3, all strings are considered as unicode string.

This patch drops the explicit unicode literal (u'...')
or (u"..") appearances from the unicode strings.

Note: The scope of the patch is to drop unicode literal prefix
from python source code files, documentation and comment are overlook.

Change-Id: I66389d3f4b236a50bd3f193d4e67c2ac10e6ca24
This commit is contained in:
Manpreet Kaur 2021-01-30 21:05:14 +05:30
parent a190526e47
commit 28cf5645e2
22 changed files with 344 additions and 344 deletions

View File

@ -58,7 +58,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
copyright = u'2016-present, OpenStack Foundation'
copyright = '2016-present, OpenStack Foundation'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -178,8 +178,8 @@ htmlhelp_basename = 'tackerdoc'
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
('index', 'Tacker.tex', u'OpenStack NFV Orchestration API Documentation',
u'OpenStack Foundation', 'manual'),
('index', 'Tacker.tex', 'OpenStack NFV Orchestration API Documentation',
'OpenStack Foundation', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of

View File

@ -59,8 +59,8 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'tacker'
copyright = u'2013, OpenStack Foundation'
project = 'tacker'
copyright = '2013, OpenStack Foundation'
# If true, '()' will be appended to :func: etc. cross-reference text.
add_function_parentheses = True
@ -95,8 +95,8 @@ html_extra_path = ['_extra']
latex_documents = [
('index',
'%s.tex' % project,
u'%s Documentation' % project,
u'OpenStack Foundation', 'manual'),
'%s Documentation' % project,
'OpenStack Foundation', 'manual'),
]
# Example configuration for intersphinx: refer to the Python standard library.

View File

@ -53,7 +53,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
copyright = u'2016, Tacker Developers'
copyright = '2016, Tacker Developers'
# Release do not need a version number in the title, they
# cover multiple versions.
@ -183,8 +183,8 @@ htmlhelp_basename = 'tackerdoc'
# [howto/manual]).
latex_documents = [
('index', 'TackerReleaseNotes.tex',
u'Tacker Release Notes Documentation',
u'Tacker Developers', 'manual'),
'Tacker Release Notes Documentation',
'Tacker Developers', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -213,8 +213,8 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'tackerreleasenotes', u'Tacker Release Notes Documentation',
[u'Tacker Developers'], 1)
('index', 'tackerreleasenotes', 'Tacker Release Notes Documentation',
['Tacker Developers'], 1)
]
# If true, show URL addresses after external links.
@ -227,8 +227,8 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'TackerReleaseNotes', u'Tacker Release Notes Documentation',
u'Tacker Developers', 'TackerReleaseNotes',
('index', 'TackerReleaseNotes', 'Tacker Release Notes Documentation',
'Tacker Developers', 'TackerReleaseNotes',
'Tacker Project.',
'Miscellaneous'),
]

View File

@ -36,7 +36,7 @@ def get_filters(request, attr_info, skips=None):
Returns a dict of lists for the filters:
check=a&check=b&name=Bob&
becomes:
{'check': [u'a', u'b'], 'name': [u'Bob']}
{'check': ['a', 'b'], 'name': ['Bob']}
"""
res = {}
skips = skips or []

View File

@ -856,7 +856,7 @@ class VnfLcmController(wsgi.Controller):
type(
subscription_request_data.get('filter')))
filter_uni = subscription_request_data.get('filter')
filter = ast.literal_eval(str(filter_uni).replace("u'", "'"))
filter = ast.literal_eval(str(filter_uni).replace("'", "'"))
try:
vnf_lcm_subscription = vnf_lcm_subscription.create(filter)

View File

@ -36,9 +36,9 @@ def upgrade(active_plugins=None, options=None):
# commands auto generated by Alembic - please adjust! #
fk_constraint = ('deviceattributes', )
with migration.modify_foreign_keys_constraint(fk_constraint):
op.alter_column(u'deviceattributes', 'device_id',
op.alter_column('deviceattributes', 'device_id',
existing_type=mysql.VARCHAR(length=255),
nullable=False)
op.alter_column(u'devices', 'status', existing_type=mysql.VARCHAR(
op.alter_column('devices', 'status', existing_type=mysql.VARCHAR(
length=255), nullable=False)
# end Alembic commands #s

View File

@ -39,7 +39,7 @@ def upgrade(active_plugins=None, options=None):
sa.Column('name', sa.String(length=255), nullable=True),
sa.Column('description', sa.String(length=255), nullable=True),
sa.Column('placement_attr', sa.PickleType(), nullable=True),
sa.Column('shared', sa.Boolean(), server_default=sa.text(u'true'),
sa.Column('shared', sa.Boolean(), server_default=sa.text('true'),
nullable=False),
sa.PrimaryKeyConstraint('id'),
mysql_engine='InnoDB'
@ -55,8 +55,8 @@ def upgrade(active_plugins=None, options=None):
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('auth_url')
)
op.add_column(u'devices', sa.Column('placement_attr', sa.PickleType(),
op.add_column('devices', sa.Column('placement_attr', sa.PickleType(),
nullable=True))
op.add_column(u'devices', sa.Column('vim_id', sa.String(length=36),
op.add_column('devices', sa.Column('vim_id', sa.String(length=36),
nullable=False))
op.create_foreign_key(None, 'devices', 'vims', ['vim_id'], ['id'])

View File

@ -132,9 +132,9 @@ class Kubernetes_Driver(abstract_vim_driver.VimAbstractDriver):
def register_vim(self, vim_obj):
"""Validate Kubernetes VIM."""
if 'key_type' in vim_obj['auth_cred']:
vim_obj['auth_cred'].pop(u'key_type')
vim_obj['auth_cred'].pop('key_type')
if 'secret_uuid' in vim_obj['auth_cred']:
vim_obj['auth_cred'].pop(u'secret_uuid')
vim_obj['auth_cred'].pop('secret_uuid')
self.authenticate_vim(vim_obj)
self.discover_placement_attr(vim_obj)
self.encode_vim_auth(vim_obj['id'],

View File

@ -171,9 +171,9 @@ class OpenStack_Driver(abstract_vim_driver.VimAbstractDriver,
"""Validate and set VIM placements."""
if 'key_type' in vim_obj['auth_cred']:
vim_obj['auth_cred'].pop(u'key_type')
vim_obj['auth_cred'].pop('key_type')
if 'secret_uuid' in vim_obj['auth_cred']:
vim_obj['auth_cred'].pop(u'secret_uuid')
vim_obj['auth_cred'].pop('secret_uuid')
ks_client = self.authenticate_vim(vim_obj)
self.discover_placement_attr(vim_obj, ks_client)

View File

@ -67,11 +67,11 @@ class TestAttributes(base.BaseTestCase):
def test_validate_not_empty_string(self):
msg = attributes._validate_not_empty_string(' ', None)
self.assertEqual(u"' ' Blank strings are not permitted", msg)
self.assertEqual("' ' Blank strings are not permitted", msg)
def test_validate_not_empty_string_or_none(self):
msg = attributes._validate_not_empty_string_or_none(' ', None)
self.assertEqual(u"' ' Blank strings are not permitted", msg)
self.assertEqual("' ' Blank strings are not permitted", msg)
msg = attributes._validate_not_empty_string_or_none(None, None)
self.assertIsNone(msg)
@ -697,11 +697,11 @@ class TestAttributes(base.BaseTestCase):
def test_validate_dict_or_not_empty(self):
dictionary, constraints = self._construct_dict_and_constraints()
msg = attributes._validate_dict_not_empty({}, constraints)
self.assertEqual(msg, u"'{}' is not a valid dictionary or it is"
u" an empty dictionary")
self.assertEqual(msg, "'{}' is not a valid dictionary or it is"
" an empty dictionary")
msg = attributes._validate_dict_not_empty("", constraints)
self.assertEqual(msg, u"'' is not a valid dictionary or it is an"
u" empty dictionary")
self.assertEqual(msg, "'' is not a valid dictionary or it is an"
" empty dictionary")
def test_validate_non_negative(self):
for value in (-1, '-2'):

View File

@ -43,7 +43,7 @@ class RequestTestCase(base.BaseTestCase):
class ResourceTestCase(base.BaseTestCase):
def test_unmapped_tacker_error_with_json(self):
msg = u'\u7f51\u7edc'
msg = '\u7f51\u7edc'
class TestException(n_exc.TackerException):
message = msg
@ -86,7 +86,7 @@ class ResourceTestCase(base.BaseTestCase):
str(wsgi.JSONDeserializer().deserialize(res.body)))
def test_mapped_tacker_error_with_json(self):
msg = u'\u7f51\u7edc'
msg = '\u7f51\u7edc'
class TestException(n_exc.TackerException):
message = msg

View File

@ -83,45 +83,45 @@ hot_scale_nest_initial = _get_template('hot_scale_nest_initial.yaml')
def get_dummy_vnfd_obj():
return {u'vnfd': {u'service_types': [{u'service_type': u'vnfd'}],
'name': 'dummy_vnfd',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
u'attributes': {u'vnfd': yaml.safe_load(
tosca_vnfd_openwrt)},
'description': 'dummy_vnfd_description',
'template_source': 'onboarded',
u'auth': {u'tenantName': u'admin', u'passwordCredentials': {
u'username': u'admin', u'password': u'devstack'}}}}
return {'vnfd': {'service_types': [{'service_type': 'vnfd'}],
'name': 'dummy_vnfd',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'attributes': {'vnfd': yaml.safe_load(
tosca_vnfd_openwrt)},
'description': 'dummy_vnfd_description',
'template_source': 'onboarded',
'auth': {'tenantName': 'admin', 'passwordCredentials': {
'username': 'admin', 'password': 'devstack'}}}}
def get_invalid_vnfd_obj():
return {u'vnfd': {u'service_types': [{u'service_type': u'vnfd'}],
'name': 'dummy_vnfd',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
u'attributes': {u'vnfd': yaml.safe_load(
tosca_invalid_vnfd)},
'description': 'dummy_vnfd_description',
'template_source': 'onboarded',
u'auth': {u'tenantName': u'admin', u'passwordCredentials': {
u'username': u'admin', u'password': u'devstack'}}}}
return {'vnfd': {'service_types': [{'service_type': 'vnfd'}],
'name': 'dummy_vnfd',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'attributes': {'vnfd': yaml.safe_load(
tosca_invalid_vnfd)},
'description': 'dummy_vnfd_description',
'template_source': 'onboarded',
'auth': {'tenantName': 'admin', 'passwordCredentials': {
'username': 'admin', 'password': 'devstack'}}}}
def get_dummy_vnfd_obj_inline():
return {u'vnfd': {u'service_types': [{u'service_type': u'vnfd'}],
'name': 'tmpl-koeak4tqgoqo8cr4-dummy_inline_vnf',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
u'attributes': {u'vnfd': yaml.safe_load(
tosca_vnfd_openwrt)},
'template_source': 'inline',
u'auth': {u'tenantName': u'admin', u'passwordCredentials': {
u'username': u'admin', u'password': u'devstack'}}}}
return {'vnfd': {'service_types': [{'service_type': 'vnfd'}],
'name': 'tmpl-koeak4tqgoqo8cr4-dummy_inline_vnf',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'attributes': {'vnfd': yaml.safe_load(
tosca_vnfd_openwrt)},
'template_source': 'inline',
'auth': {'tenantName': 'admin', 'passwordCredentials': {
'username': 'admin', 'password': 'devstack'}}}}
def get_dummy_inline_vnf_obj():
return {'vnf': {'description': 'dummy_inline_vnf_description',
'vnfd_template': yaml.safe_load(tosca_vnfd_openwrt),
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_inline_vnf',
'attributes': {},
'vnfd_id': None}}
@ -130,8 +130,8 @@ def get_dummy_inline_vnf_obj():
def get_dummy_inline_cvnf_obj():
return {'vnf': {'description': 'dummy_inline_cvnf_description',
'vnfd_template': yaml.safe_load(tosca_cvnf_vnfd),
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_cvnf',
'attributes': {},
'vnfd_id': None}}
@ -139,9 +139,9 @@ def get_dummy_inline_cvnf_obj():
def get_dummy_vnf_obj():
return {'vnf': {'description': 'dummy_vnf_description',
'vnfd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnf',
'deleted_at': datetime.min,
'attributes': {},
@ -149,46 +149,46 @@ def get_dummy_vnf_obj():
def get_dummy_vnf_config_obj():
return {'vnf': {u'attributes': {u'config': {'vdus': {'vdu1': {
return {'vnf': {'attributes': {'config': {'vdus': {'vdu1': {
'config': {'firewall': 'dummy_firewall_values'}}}}}}}
def get_dummy_vnf_invalid_config_type_obj():
return {'vnf': {u'attributes': {u'config': 'dummy_config'}}}
return {'vnf': {'attributes': {'config': 'dummy_config'}}}
def get_dummy_vnf_invalid_param_content():
return {'vnf': {u'attributes': {u'param_values': {}}}}
return {'vnf': {'attributes': {'param_values': {}}}}
def get_dummy_vnf_param_obj():
return {'vnf': {u'attributes': {u'param_values':
return {'vnf': {'attributes': {'param_values':
{'flavor': 'm1.tiny',
'reservation_id': '99999999-3925-4c9e-9074-239a902b68d7'}}}}
def get_dummy_vnf_invalid_param_type_obj():
return {'vnf': {u'attributes': {u'param_values': 'dummy_param'}}}
return {'vnf': {'attributes': {'param_values': 'dummy_param'}}}
def get_dummy_vnf(status='PENDING_CREATE', scaling_group=False,
instance_id=None):
dummy_vnf = {'status': status, 'instance_id': instance_id, 'name':
u'test_openwrt', 'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'test_openwrt', 'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vnfd': {
'service_types': [{'service_type': u'vnfd',
'id': u'4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': u'OpenWRT with services',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': u'openwrt',
'attributes': {u'vnfd': tosca_vnfd_openwrt},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': u'openwrt_services'},
'service_types': [{'service_type': 'vnfd',
'id': '4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': 'OpenWRT with services',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': 'openwrt',
'attributes': {'vnfd': tosca_vnfd_openwrt},
'id': 'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': 'openwrt_services'},
'mgmt_ip_address': None, 'service_context': [],
'attributes': {u'param_values': u''},
'attributes': {'param_values': ''},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
'description': u'OpenWRT with services'}
'description': 'OpenWRT with services'}
if scaling_group:
dummy_vnf['attributes'].update({'scaling_group_names':
'{"SP1": "SP1_group"}',
@ -199,21 +199,21 @@ def get_dummy_vnf(status='PENDING_CREATE', scaling_group=False,
def get_dummy_vnf_test(status='PENDING_CREATE', scaling_group=False,
instance_id=None):
dummy_vnf = {'status': status, 'instance_id': instance_id, 'name':
u'test_openwrt', 'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'test_openwrt', 'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vnfd': {
'service_types': [{'service_type': u'vnfd',
'id': u'4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': u'OpenWRT with services',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': u'openwrt',
'attributes': {u'vnfd_simple': tosca_vnfd_openwrt},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': u'openwrt_services'},
'service_types': [{'service_type': 'vnfd',
'id': '4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': 'OpenWRT with services',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': 'openwrt',
'attributes': {'vnfd_simple': tosca_vnfd_openwrt},
'id': 'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': 'openwrt_services'},
'mgmt_ip_address': None, 'service_context': [],
'attributes': {u'param_values': u''},
'attributes': {'param_values': ''},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
'description': u'OpenWRT with services'}
'description': 'OpenWRT with services'}
if scaling_group:
dummy_vnf['attributes'].update({'scaling_group_names':
'{"SP1": "SP1_group"}',
@ -225,21 +225,21 @@ def get_dummy_vnf_etsi(status='PENDING_CREATE', scaling_group=False,
instance_id=None, flavour='Simple'):
vnfd_key = 'vnfd_' + flavour
dummy_vnf = {'status': status, 'instance_id': instance_id, 'name':
u'test_openwrt', 'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'test_openwrt', 'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vnfd': {
'service_types': [{'service_type': u'vnfd',
'id': u'4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': u'OpenWRT with services',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': u'openwrt',
'service_types': [{'service_type': 'vnfd',
'id': '4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': 'OpenWRT with services',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': 'openwrt',
'attributes': {vnfd_key: etsi_vnfd},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': u'openwrt_services'},
'id': 'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': 'openwrt_services'},
'mgmt_ip_address': None, 'service_context': [],
'attributes': {u'param_values': u''},
'attributes': {'param_values': ''},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
'description': u'OpenWRT with services'}
'description': 'OpenWRT with services'}
if scaling_group:
dummy_vnf['attributes'].update({'scaling_group_names':
'{"SP1": "SP1_group"}',
@ -249,39 +249,39 @@ def get_dummy_vnf_etsi(status='PENDING_CREATE', scaling_group=False,
def get_dummy_vnf_config_attr():
return {'status': 'PENDING_CREATE', 'instance_id': None, 'name':
u'test_openwrt', 'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vnfd': {'service_types': [{'service_type': u'vnfd',
'id': u'4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': u'OpenWRT with services',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': u'openwrt',
'attributes': {u'vnfd': tosca_vnfd_openwrt},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec', 'name':
u'openwrt_services'}, 'mgmt_ip_address': None,
'test_openwrt', 'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vnfd': {'service_types': [{'service_type': 'vnfd',
'id': '4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': 'OpenWRT with services',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': 'openwrt',
'attributes': {'vnfd': tosca_vnfd_openwrt},
'id': 'fb048660-dc1b-4f0f-bd89-b023666650ec', 'name':
'openwrt_services'}, 'mgmt_ip_address': None,
'service_context': [],
'attributes': {u'config': config_data},
'attributes': {'config': config_data},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
'description': u'OpenWRT with services'}
'description': 'OpenWRT with services'}
def get_dummy_vnf_param_attr():
return {'status': 'PENDING_CREATE', 'instance_id': None, 'name':
u'test_openwrt', 'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vnfd': {'service_types': [{'service_type': u'vnfd',
'id': u'4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': u'OpenWRT with services',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': u'openwrt',
'attributes': {u'vnfd': tosca_vnfd_openwrt_param},
'id': u'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': u'openwrt_services'},
'test_openwrt', 'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'vnfd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vnfd': {'service_types': [{'service_type': 'vnfd',
'id': '4a4c2d44-8a52-4895-9a75-9d1c76c3e738'}],
'description': 'OpenWRT with services',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'mgmt_driver': 'openwrt',
'attributes': {'vnfd': tosca_vnfd_openwrt_param},
'id': 'fb048660-dc1b-4f0f-bd89-b023666650ec',
'name': 'openwrt_services'},
'mgmt_url': None, 'service_context': [],
'attributes': {'heat_template': hot_data,
'param_values': param_data},
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
'description': u'OpenWRT with services'}
'description': 'OpenWRT with services'}
def get_dummy_vnf_update_config():
@ -327,75 +327,75 @@ def get_vim_auth_obj():
def get_dummy_vnffgd_obj():
return {u'vnffgd': {'name': 'dummy_vnffgd',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
u'template': {u'vnffgd': vnffgd_tosca_template},
'description': 'dummy_vnffgd_description',
'template_source': 'onboarded'}}
return {'vnffgd': {'name': 'dummy_vnffgd',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'template': {'vnffgd': vnffgd_tosca_template},
'description': 'dummy_vnffgd_description',
'template_source': 'onboarded'}}
def get_dummy_vnffgd_obj_inline():
return {u'vnffgd': {'name': 'dummy_vnffgd_inline',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
u'template': {u'vnffgd': vnffgd_tosca_template},
'description': 'dummy_vnffgd_description_inline',
'template_source': 'inline'}}
return {'vnffgd': {'name': 'dummy_vnffgd_inline',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'template': {'vnffgd': vnffgd_tosca_template},
'description': 'dummy_vnffgd_description_inline',
'template_source': 'inline'}}
def get_dummy_vnffgd_obj_no_description():
return {u'vnffgd': {'name': 'dummy_vnffgd',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
u'template': {u'vnffgd': vnffgd_tosca_template},
'template_source': 'onboarded'}}
return {'vnffgd': {'name': 'dummy_vnffgd',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'template': {'vnffgd': vnffgd_tosca_template},
'template_source': 'onboarded'}}
def get_dummy_vnffgd_obj_no_name():
return {u'vnffgd': {'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
u'template': {u'vnffgd': vnffgd_tosca_template},
'description': 'dummy_vnffgd_description',
'template_source': 'onboarded'}}
return {'vnffgd': {'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'template': {'vnffgd': vnffgd_tosca_template},
'description': 'dummy_vnffgd_description',
'template_source': 'onboarded'}}
def get_dummy_vnffg_obj():
return {'vnffg': {'description': 'dummy_vnffg_description',
'vnffgd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnffgd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg',
u'attributes': {u'template': vnffgd_tosca_template},
'attributes': {'template': vnffgd_tosca_template},
'vnf_mapping': {},
'symmetrical': False}}
def get_dummy_vnffg_no_classifier_obj():
return {'vnffg': {'description': 'dummy_vnffg_no_classifier_description',
'vnffgd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnffgd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg',
u'attributes': {
u'template': vnffgd_tosca_no_classifier_template},
'attributes': {
'template': vnffgd_tosca_no_classifier_template},
'vnf_mapping': {},
'symmetrical': False}}
def get_dummy_vnffg_obj_inline():
return {'vnffg': {'description': 'dummy_vnffg_description_inline',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg_inline',
u'attributes': {u'template': vnffgd_tosca_template},
'attributes': {'template': vnffgd_tosca_template},
'vnf_mapping': {},
'symmetrical': False,
'vnffgd_template': vnffgd_tosca_template}}
def get_dummy_vnffg_obj_update_vnffgd_template():
return {'vnffg': {'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
return {'vnffg': {'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg',
'symmetrical': False,
'vnffgd_template': vnffgd_tosca_template_for_update}}
def get_dummy_vnffg_obj_legacy_vnffgd_template():
return {'vnffg': {'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
return {'vnffg': {'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg',
'symmetrical': False,
'vnffgd_template': vnffgd_legacy_template}}
@ -403,12 +403,12 @@ def get_dummy_vnffg_obj_legacy_vnffgd_template():
def get_dummy_vnffg_param_obj():
return {'vnffg': {'description': 'dummy_vnf_description',
'vnffgd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnffgd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg',
u'attributes': {
u'template': vnffgd_tosca_param_template,
u'param_values':
'attributes': {
'template': vnffgd_tosca_param_template,
'param_values':
yaml.safe_load(vnffg_params)
},
'vnf_mapping': {},
@ -417,24 +417,24 @@ def get_dummy_vnffg_param_obj():
def get_dummy_vnffg_str_param_obj():
return {'vnffg': {'description': 'dummy_vnf_description',
'vnffgd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnffgd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg',
u'attributes': {
u'template': vnffgd_tosca_param_template,
u'param_values': 'value not dict format'},
'attributes': {
'template': vnffgd_tosca_param_template,
'param_values': 'value not dict format'},
'vnf_mapping': {},
'symmetrical': False}}
def get_dummy_vnffg_multi_param_obj():
return {'vnffg': {'description': 'dummy_vnf_description',
'vnffgd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnffgd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg',
u'attributes': {
u'template': vnffgd_tosca_multi_param_template,
u'param_values':
'attributes': {
'template': vnffgd_tosca_multi_param_template,
'param_values':
yaml.safe_load(vnffg_multi_params)
},
'vnf_mapping': {},
@ -443,10 +443,10 @@ def get_dummy_vnffg_multi_param_obj():
def get_dummy_vnffg_obj_vnf_mapping():
return {'vnffg': {'description': 'dummy_vnf_description',
'vnffgd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnffgd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg',
u'attributes': {u'template': vnffgd_tosca_template},
'attributes': {'template': vnffgd_tosca_template},
'vnf_mapping': {
'VNF1': '91e32c20-6d1f-47a4-9ba7-08f5e5effe07',
'VNF3': '7168062e-9fa1-4203-8cb7-f5c99ff3ee1b'
@ -456,11 +456,11 @@ def get_dummy_vnffg_obj_vnf_mapping():
def get_dummy_vnffg_obj_dupl_criteria():
return {'vnffg': {'description': 'dummy_vnffg_description',
'vnffgd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vnffgd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnffg',
u'attributes': {u'template':
vnffgd_tosca_dupl_criteria_template},
'attributes': {'template':
vnffgd_tosca_dupl_criteria_template},
'vnf_mapping': {},
'symmetrical': False}}
@ -468,25 +468,25 @@ def get_dummy_vnffg_obj_dupl_criteria():
def get_dummy_nsd_obj():
return {'nsd': {'description': 'dummy_nsd_description',
'name': 'dummy_NSD',
'tenant_id': u'8819a1542a5948b68f94d4be0fd50496',
'attributes': {u'nsd': nsd_tosca_template},
'tenant_id': '8819a1542a5948b68f94d4be0fd50496',
'attributes': {'nsd': nsd_tosca_template},
'template_source': 'onboarded'}}
def get_dummy_nsd_obj_inline():
return {'nsd': {'description': 'dummy_nsd_description_inline',
'name': 'dummy_NSD_inline',
'tenant_id': u'8819a1542a5948b68f94d4be0fd50496',
'attributes': {u'nsd': nsd_tosca_template},
'tenant_id': '8819a1542a5948b68f94d4be0fd50496',
'attributes': {'nsd': nsd_tosca_template},
'template_source': 'inline'}}
def get_dummy_ns_obj():
return {'ns': {'description': 'dummy_ns_description',
'id': u'ba6bf017-f6f7-45f1-a280-57b073bf78ea',
'nsd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'id': 'ba6bf017-f6f7-45f1-a280-57b073bf78ea',
'nsd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_ns',
'attributes': {
'param_values': {'nsd': {'vl1_name': 'net_mgmt',
@ -495,9 +495,9 @@ def get_dummy_ns_obj():
def get_dummy_ns_obj_inline():
return {'ns': {'description': 'dummy_ns_description_inline',
'id': u'ff35e3f0-0a11-4071-bce6-279fdf1c8bf9',
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'id': 'ff35e3f0-0a11-4071-bce6-279fdf1c8bf9',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_ns_inline',
'attributes': {
'param_values': {'nsd': {'vl1_name': 'net_mgmt',
@ -507,10 +507,10 @@ def get_dummy_ns_obj_inline():
def get_dummy_ns_obj_2():
return {'ns': {'description': 'dummy_ns_description',
'id': u'ba6bf017-f6f7-45f1-a280-57b073bf78ea',
'nsd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'id': 'ba6bf017-f6f7-45f1-a280-57b073bf78ea',
'nsd_id': 'eb094833-995e-49f0-a047-dfb56aaf7c4e',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': DUMMY_NS_2_NAME,
'attributes': {
'param_values': {'nsd': {'vl1_name': 'net_mgmt',

View File

@ -18,32 +18,32 @@ from tacker.tests.unit import base
def get_dummy_ns():
return {u'ns': {'description': '',
'tenant_id': u'a81900a92bda40588c52699e1873a92f',
'vim_id': u'96025dd5-ca16-49f3-9823-958eb04260c4',
'vnf_ids': '', u'attributes': {},
u'nsd_id': u'b8587afb-6099-4f56-abce-572c62e3d61d',
u'name': u'test_create_ns'},
'vnfd_details': {u'vnf1': {'instances': ['VNF1'],
'id': u'dec09ed4-f355-4ec8-a00b-8548f6575a80'},
u'vnf2': {'instances': ['VNF2'],
'id': u'9f8f2af7-6407-4f79-a6fe-302c56172231'}},
return {'ns': {'description': '',
'tenant_id': 'a81900a92bda40588c52699e1873a92f',
'vim_id': '96025dd5-ca16-49f3-9823-958eb04260c4',
'vnf_ids': '', 'attributes': {},
'nsd_id': 'b8587afb-6099-4f56-abce-572c62e3d61d',
'name': 'test_create_ns'},
'vnfd_details': {'vnf1': {'instances': ['VNF1'],
'id': 'dec09ed4-f355-4ec8-a00b-8548f6575a80'},
'vnf2': {'instances': ['VNF2'],
'id': '9f8f2af7-6407-4f79-a6fe-302c56172231'}},
'placement_attr': {}}
def get_dummy_vnffg_ns():
return {
u'ns': {
'ns': {
'description': '',
'vim_id': u'96025dd5-ca16-49f3-9823-958eb04260c4',
'vnf_ids': '', u'attributes': {},
u'nsd_id': u'b8587afb-6099-4f56-abce-572c62e3d61d',
u'name': u'test_create_ns'},
'vim_id': '96025dd5-ca16-49f3-9823-958eb04260c4',
'vnf_ids': '', 'attributes': {},
'nsd_id': 'b8587afb-6099-4f56-abce-572c62e3d61d',
'name': 'test_create_ns'},
'vnfd_details': {
u'vnf1': {'instances': ['VNF1'],
'id': u'dec09ed4-f355-4ec8-a00b-8548f6575a80'},
u'vnf2': {'instances': ['VNF2'],
'id': u'9f8f2af7-6407-4f79-a6fe-302c56172231'}},
'vnf1': {'instances': ['VNF1'],
'id': 'dec09ed4-f355-4ec8-a00b-8548f6575a80'},
'vnf2': {'instances': ['VNF2'],
'id': '9f8f2af7-6407-4f79-a6fe-302c56172231'}},
'placement_attr': {},
'vnffgd_templates': {
'VNFFG1': {
@ -97,16 +97,16 @@ def get_dummy_vnffg_ns():
def get_dummy_param():
return {u'vnf1': {'substitution_mappings': {u'VL1b8587afb-60': {
return {'vnf1': {'substitution_mappings': {'VL1b8587afb-60': {
'type': 'tosca.nodes.nfv.VL', 'properties': {
'network_name': u'net_mgmt',
'network_name': 'net_mgmt',
'vendor': 'tacker'}}, 'requirements': {
'virtualLink2': u'VL2b8587afb-60',
'virtualLink1': u'VL1b8587afb-60'}, u'VL2b8587afb-60': {
'virtualLink2': 'VL2b8587afb-60',
'virtualLink1': 'VL1b8587afb-60'}, 'VL2b8587afb-60': {
'type': 'tosca.nodes.nfv.VL',
'properties': {'network_name': u'net0',
'properties': {'network_name': 'net0',
'vendor': 'tacker'}}}},
u'nsd': {u'vl2_name': u'net0', u'vl1_name': u'net_mgmt'}}
'nsd': {'vl2_name': 'net0', 'vl1_name': 'net_mgmt'}}
def get_dummy_create_workflow():
@ -294,13 +294,13 @@ def get_dummy_create_vnffg_ns_workflow():
def dummy_delete_ns_obj():
return {'vnf_ids': u"{'VNF1': '5de5eca6-3e21-4bbd-a9d7-86458de75f0c'}",
'vnffg_ids': u"{}"}
return {'vnf_ids': "{'VNF1': '5de5eca6-3e21-4bbd-a9d7-86458de75f0c'}",
'vnffg_ids': "{}"}
def dummy_delete_vnffg_ns_obj():
return {'vnf_ids': u"{'VNF1': '5de5eca6-3e21-4bbd-a9d7-86458de75f0c'}",
'vnffg_ids': u"{'VNFFG1': '99066f25-3124-44f1-bc5d-bc0bf236b012'}"}
return {'vnf_ids': "{'VNF1': '5de5eca6-3e21-4bbd-a9d7-86458de75f0c'}",
'vnffg_ids': "{'VNFFG1': '99066f25-3124-44f1-bc5d-bc0bf236b012'}"}
def get_dummy_delete_workflow():

View File

@ -85,14 +85,14 @@ def get_by_name():
def dummy_get_vim_auth(*args, **kwargs):
return {'vim_auth': {u'username': u'admin', 'password': 'devstack',
u'project_name': u'nfv', u'user_id': u'',
u'user_domain_name': u'Default',
u'auth_url': u'http://10.0.4.207/identity/v3',
u'project_id': u'',
u'project_domain_name': u'Default'},
'vim_id': u'96025dd5-ca16-49f3-9823-958eb04260c4',
'vim_type': u'openstack', 'vim_name': u'VIM0'}
return {'vim_auth': {'username': 'admin', 'password': 'devstack',
'project_name': 'nfv', 'user_id': '',
'user_domain_name': 'Default',
'auth_url': 'http://10.0.4.207/identity/v3',
'project_id': '',
'project_domain_name': 'Default'},
'vim_id': '96025dd5-ca16-49f3-9823-958eb04260c4',
'vim_type': 'openstack', 'vim_name': 'VIM0'}
class FakeClient(mock.Mock):
@ -184,32 +184,32 @@ class FakeVNFMPlugin(mock.Mock):
def get_dummy_vnf1(self):
return {'description': 'dummy_vnf_description',
'vnfd_id': self.vnf1_vnfd_id,
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnf1',
'attributes': {}}
def get_dummy_vnf1_update(self):
return {'description': 'dummy_vnf_description',
'vnfd_id': self.vnf1_vnfd_id,
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnf1_update',
'attributes': {}}
def get_dummy_vnf3(self):
return {'description': 'dummy_vnf_description',
'vnfd_id': self.vnf3_vnfd_id,
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnf2',
'attributes': {}}
def get_dummy_vnf3_update(self):
return {'description': 'dummy_vnf_description',
'vnfd_id': self.vnf3_vnfd_id,
'vim_id': u'6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437',
'vim_id': '6261579e-d6f3-49ad-8bc3-a9cb974778ff',
'tenant_id': 'ad7ebc56538745a08ef7c5e97f8bd437',
'name': 'dummy_vnf_update',
'attributes': {}}
@ -307,7 +307,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
def test_delete_vim(self):
self._insert_dummy_vim()
vim_type = u'openstack'
vim_type = 'openstack'
vim_id = '6261579e-d6f3-49ad-8bc3-a9cb974778ff'
self.context.tenant_id = 'ad7ebc56538745a08ef7c5e97f8bd437'
vim_obj = self.nfvo_plugin._get_vim(self.context, vim_id)
@ -339,7 +339,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
'vim_project': {'name': 'new_project'},
'auth_cred': {'username': 'new_user',
'password': 'new_password'}}}
vim_type = u'openstack'
vim_type = 'openstack'
vim_auth_username = vim_dict['vim']['auth_cred']['username']
vim_project = vim_dict['vim']['vim_project']
self._insert_dummy_vim()
@ -378,7 +378,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
'vim_project': {'name': 'new_project'},
'auth_cred': {'username': 'new_user',
'password': 'new_password'}}}
vim_type = u'openstack'
vim_type = 'openstack'
vim_auth_username = vim_dict['vim']['auth_cred']['username']
vim_project = vim_dict['vim']['vim_project']
self._insert_dummy_vim_barbican()
@ -422,7 +422,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
name='fake_template',
description='fake_template_description',
template={u'vnffgd': utils.vnffgd_tosca_template},
template={'vnffgd': utils.vnffgd_tosca_template},
template_source='onboarded')
session.add(vnffg_template)
session.flush()
@ -435,7 +435,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
name='dummy_vnffgd_inline',
description='dummy_vnffgd_description_inline',
template={u'vnffgd': utils.vnffgd_tosca_template},
template={'vnffgd': utils.vnffgd_tosca_template},
template_source='inline')
session.add(vnffg_template)
session.flush()
@ -448,7 +448,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
name='fake_template',
description='fake_template_description',
template={u'vnffgd': utils.vnffgd_tosca_param_template})
template={'vnffgd': utils.vnffgd_tosca_param_template})
session.add(vnffg_template)
session.flush()
return vnffg_template
@ -460,7 +460,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
name='fake_template',
description='fake_template_description',
template={u'vnffgd': utils.vnffgd_tosca_multi_param_template})
template={'vnffgd': utils.vnffgd_tosca_multi_param_template})
session.add(vnffg_template)
session.flush()
return vnffg_template
@ -472,7 +472,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
name='fake_template',
description='fake_template_description',
template={u'vnffgd': utils.vnffgd_tosca_no_classifier_template})
template={'vnffgd': utils.vnffgd_tosca_no_classifier_template})
session.add(vnffg_template)
session.flush()
return vnffg_template
@ -484,7 +484,7 @@ class TestNfvoPlugin(db_base.SqlTestCase):
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
name='fake_template',
description='fake_template_description',
template={u'vnffgd': utils.vnffgd_tosca_dupl_criteria_template})
template={'vnffgd': utils.vnffgd_tosca_dupl_criteria_template})
session.add(vnffg_template)
session.flush()
return vnffg_template
@ -1007,20 +1007,20 @@ class TestNfvoPlugin(db_base.SqlTestCase):
def _insert_dummy_ns_template(self):
session = self.context.session
attributes = {
u'nsd': 'imports: [VNF1, VNF2]\ntopology_template:\n inputs:\n '
' vl1_name: {default: net_mgmt, description: name of VL1'
' virtuallink, type: string}\n vl2_name: {default: '
'net0, description: name of VL2 virtuallink, type: string'
'}\n node_templates:\n VL1:\n properties:\n '
' network_name: {get_input: vl1_name}\n vendor: '
'tacker\n type: tosca.nodes.nfv.VL\n VL2:\n '
'properties:\n network_name: {get_input: vl2_name}'
'\n vendor: tacker\n type: tosca.nodes.nfv.VL'
'\n VNF1:\n requirements:\n - {virtualLink1: '
'VL1}\n - {virtualLink2: VL2}\n type: tosca.node'
's.nfv.VNF1\n VNF2: {type: tosca.nodes.nfv.VNF2}\ntosca'
'_definitions_version: tosca_simple_profile_for_nfv_1_0_0'
'\n'}
'nsd': 'imports: [VNF1, VNF2]\ntopology_template:\n inputs:\n '
' vl1_name: {default: net_mgmt, description: name of VL1'
' virtuallink, type: string}\n vl2_name: {default: '
'net0, description: name of VL2 virtuallink, type: string'
'}\n node_templates:\n VL1:\n properties:\n '
' network_name: {get_input: vl1_name}\n vendor: '
'tacker\n type: tosca.nodes.nfv.VL\n VL2:\n '
'properties:\n network_name: {get_input: vl2_name}'
'\n vendor: tacker\n type: tosca.nodes.nfv.VL'
'\n VNF1:\n requirements:\n - {virtualLink1: '
'VL1}\n - {virtualLink2: VL2}\n type: tosca.node'
's.nfv.VNF1\n VNF2: {type: tosca.nodes.nfv.VNF2}\ntosca'
'_definitions_version: tosca_simple_profile_for_nfv_1_0_0'
'\n'}
nsd_template = ns_db.NSD(
id='eb094833-995e-49f0-a047-dfb56aaf7c4e',
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',
@ -1044,20 +1044,20 @@ class TestNfvoPlugin(db_base.SqlTestCase):
def _insert_dummy_ns_template_inline(self):
session = self.context.session
attributes = {
u'nsd': 'imports: [VNF1, VNF2]\ntopology_template:\n inputs:\n '
' vl1_name: {default: net_mgmt, description: name of VL1'
' virtuallink, type: string}\n vl2_name: {default: '
'net0, description: name of VL2 virtuallink, type: string'
'}\n node_templates:\n VL1:\n properties:\n '
' network_name: {get_input: vl1_name}\n vendor: '
'tacker\n type: tosca.nodes.nfv.VL\n VL2:\n '
'properties:\n network_name: {get_input: vl2_name}'
'\n vendor: tacker\n type: tosca.nodes.nfv.VL'
'\n VNF1:\n requirements:\n - {virtualLink1: '
'VL1}\n - {virtualLink2: VL2}\n type: tosca.node'
's.nfv.VNF1\n VNF2: {type: tosca.nodes.nfv.VNF2}\ntosca'
'_definitions_version: tosca_simple_profile_for_nfv_1_0_0'
'\n'}
'nsd': 'imports: [VNF1, VNF2]\ntopology_template:\n inputs:\n '
' vl1_name: {default: net_mgmt, description: name of VL1'
' virtuallink, type: string}\n vl2_name: {default: '
'net0, description: name of VL2 virtuallink, type: string'
'}\n node_templates:\n VL1:\n properties:\n '
' network_name: {get_input: vl1_name}\n vendor: '
'tacker\n type: tosca.nodes.nfv.VL\n VL2:\n '
'properties:\n network_name: {get_input: vl2_name}'
'\n vendor: tacker\n type: tosca.nodes.nfv.VL'
'\n VNF1:\n requirements:\n - {virtualLink1: '
'VL1}\n - {virtualLink2: VL2}\n type: tosca.node'
's.nfv.VNF1\n VNF2: {type: tosca.nodes.nfv.VNF2}\ntosca'
'_definitions_version: tosca_simple_profile_for_nfv_1_0_0'
'\n'}
nsd_template = ns_db.NSD(
id='be18005d-5656-4d81-b499-6af4d4d8437f',
tenant_id='ad7ebc56538745a08ef7c5e97f8bd437',

View File

@ -173,7 +173,7 @@ class SerializerTest(base.BaseTestCase):
serializer = wsgi.Serializer()
result = serializer.deserialize(data_string, content_type)
self.assertEqual({'body': {u'servers': [u'test=pass']}}, result)
self.assertEqual({'body': {'servers': ['test=pass']}}, result)
class RequestDeserializerTest(testtools.TestCase):
@ -466,7 +466,7 @@ class JSONDictSerializerTest(base.BaseTestCase):
self.assertEqual(expected_json, result)
def test_json_with_unicode(self):
input_dict = dict(servers=dict(a=(2, u'\u7f51\u7edc')))
input_dict = dict(servers=dict(a=(2, '\u7f51\u7edc')))
expected_json = b'{"servers":{"a":[2,"\\u7f51\\u7edc"]}}'
serializer = wsgi.JSONDictSerializer()
result = serializer.serialize(input_dict)
@ -517,14 +517,14 @@ class JSONDeserializerTest(base.BaseTestCase):
def test_json_with_utf8(self):
data = b'{"a": "\xe7\xbd\x91\xe7\xbb\x9c"}'
as_dict = {'body': {'a': u'\u7f51\u7edc'}}
as_dict = {'body': {'a': '\u7f51\u7edc'}}
deserializer = wsgi.JSONDeserializer()