diff --git a/tacker/db/migration/alembic_migrations/versions/8f7145914cb0_remove_infra_driver_column.py b/tacker/db/migration/alembic_migrations/versions/8f7145914cb0_remove_infra_driver_column.py new file mode 100644 index 000000000..4d2c1eacd --- /dev/null +++ b/tacker/db/migration/alembic_migrations/versions/8f7145914cb0_remove_infra_driver_column.py @@ -0,0 +1,39 @@ +# Copyright 2016 OpenStack Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +"""remove infra_driver column + +Revision ID: 8f7145914cb0 +Revises: 0ae5b1ce3024 +Create Date: 2016-12-08 17:28:26.609343 + +""" + +# revision identifiers, used by Alembic. +revision = '8f7145914cb0' +down_revision = '0ae5b1ce3024' + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + + +def upgrade(active_plugins=None, options=None): + op.drop_column('vnfd', 'infra_driver') + + +def downgrade(active_plugins=None, options=None): + op.add_column('vnfd', sa.Column('infra_driver', mysql.VARCHAR(length=255), + nullable=True)) diff --git a/tacker/db/migration/alembic_migrations/versions/HEAD b/tacker/db/migration/alembic_migrations/versions/HEAD index 6823db079..aae89762b 100644 --- a/tacker/db/migration/alembic_migrations/versions/HEAD +++ b/tacker/db/migration/alembic_migrations/versions/HEAD @@ -1 +1 @@ -0ae5b1ce3024 \ No newline at end of file +8f7145914cb0 \ No newline at end of file diff --git a/tacker/db/vnfm/vnfm_db.py b/tacker/db/vnfm/vnfm_db.py index f2f4ad8aa..85b1d6d36 100644 --- a/tacker/db/vnfm/vnfm_db.py +++ b/tacker/db/vnfm/vnfm_db.py @@ -59,9 +59,6 @@ class VNFD(model_base.BASE, models_v1.HasId, models_v1.HasTenant, # In future, single service VM may accomodate multiple services. service_types = orm.relationship('ServiceType', backref='vnfd') - # driver to create hosting vnf. e.g. noop, heat, etc... - infra_driver = sa.Column(sa.String(255)) - # driver to communicate with service managment mgmt_driver = sa.Column(sa.String(255)) @@ -184,8 +181,7 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin): vnfd.service_types) } key_list = ('id', 'tenant_id', 'name', 'description', - 'infra_driver', 'mgmt_driver', - 'created_at', 'updated_at') + 'mgmt_driver', 'created_at', 'updated_at') res.update((key, vnfd[key]) for key in key_list) return self._fields(res, fields) @@ -206,10 +202,6 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin): res.update((key, vnf_db[key]) for key in key_list) return self._fields(res, fields) - @staticmethod - def _infra_driver_name(vnf_dict): - return vnf_dict['vnfd']['infra_driver'] - @staticmethod def _mgmt_driver_name(vnf_dict): return vnf_dict['vnfd']['mgmt_driver'] @@ -222,9 +214,8 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin): vnfd = vnfd['vnfd'] LOG.debug(_('vnfd %s'), vnfd) tenant_id = self._get_tenant_id_for_create(context, vnfd) - infra_driver = vnfd.get('infra_driver') - mgmt_driver = vnfd.get('mgmt_driver') service_types = vnfd.get('service_types') + mgmt_driver = vnfd.get('mgmt_driver') if (not attributes.is_attr_set(service_types)): LOG.debug(_('service types unspecified')) @@ -237,7 +228,6 @@ class VNFMPluginDb(vnfm.VNFMPluginBase, db_base.CommonDbMixin): tenant_id=tenant_id, name=vnfd.get('name'), description=vnfd.get('description'), - infra_driver=infra_driver, mgmt_driver=mgmt_driver) context.session.add(vnfd_db) for (key, value) in vnfd.get('attributes', {}).items(): diff --git a/tacker/extensions/vnfm.py b/tacker/extensions/vnfm.py index b9cda48b1..5da36c955 100644 --- a/tacker/extensions/vnfm.py +++ b/tacker/extensions/vnfm.py @@ -31,14 +31,6 @@ from tacker.services import service_base LOG = logging.getLogger(__name__) -class InfraDriverNotSpecified(exceptions.InvalidInput): - message = _('infra driver is not specified') - - -class MGMTDriverNotSpecified(exceptions.InvalidInput): - message = _('mgmt driver is not specified') - - class MultipleMGMTDriversSpecified(exceptions.InvalidInput): message = _('More than one MGMT Driver per vnfd is not supported') @@ -219,20 +211,6 @@ RESOURCE_ATTRIBUTE_MAP = { 'is_visible': True, 'default': attr.ATTR_NOT_SPECIFIED, }, - 'infra_driver': { - 'allow_post': True, - 'allow_put': False, - 'validate': {'type:string': None}, - 'is_visible': True, - 'default': "", - }, - 'mgmt_driver': { - 'allow_post': True, - 'allow_put': False, - 'validate': {'type:string': None}, - 'is_visible': True, - 'default': "", - }, 'attributes': { 'allow_post': True, 'allow_put': False, diff --git a/tacker/releasenotes/notes/remove-passing-infra-and-mgmt-driver-in-api-954fe28b1294a2d6.yaml b/tacker/releasenotes/notes/remove-passing-infra-and-mgmt-driver-in-api-954fe28b1294a2d6.yaml new file mode 100644 index 000000000..4e7bb5ea7 --- /dev/null +++ b/tacker/releasenotes/notes/remove-passing-infra-and-mgmt-driver-in-api-954fe28b1294a2d6.yaml @@ -0,0 +1,3 @@ +--- +fixes: + - Removed passing infa and mgmt driver in API. diff --git a/tacker/tests/unit/db/utils.py b/tacker/tests/unit/db/utils.py index 9d5aa1714..740142399 100644 --- a/tacker/tests/unit/db/utils.py +++ b/tacker/tests/unit/db/utils.py @@ -47,7 +47,6 @@ def get_dummy_vnfd_obj(): return {u'vnfd': {u'service_types': [{u'service_type': u'vnfd'}], 'name': 'dummy_vnfd', 'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437', - u'mgmt_driver': u'noop', u'attributes': {u'vnfd': yaml.safe_load( tosca_vnfd_openwrt)}, 'description': 'dummy_vnfd_description'}, diff --git a/tacker/tests/unit/services/vm/test_servicevm_extension.py b/tacker/tests/unit/services/vm/test_servicevm_extension.py index fcbbb6140..dd233d49f 100644 --- a/tacker/tests/unit/services/vm/test_servicevm_extension.py +++ b/tacker/tests/unit/services/vm/test_servicevm_extension.py @@ -60,8 +60,6 @@ class TackerExtensionTestCase(test_api_v2_extension.ExtensionTestCase): 'description': 'mytemplate0', 'service_types': [{'service_type': 'SERVICE0'}, {'service_type': 'SERVICE1'}], - 'infra_driver': 'noop', - 'mgmt_driver': 'noop', 'attributes': {'key0': 'value0', 'key1': 'value1'}, } } @@ -89,8 +87,6 @@ class TackerExtensionTestCase(test_api_v2_extension.ExtensionTestCase): 'description': 'description0', 'service_types': [{'service_type': 'SERVICE0'}, {'service_type': 'SERVICE1'}], - 'infra_driver': 'noop', - 'mgmt_driver': 'noop', 'attributes': {'key0': 'value0', 'key1': 'value1'}, }] instance = self.plugin.return_value @@ -111,8 +107,6 @@ class TackerExtensionTestCase(test_api_v2_extension.ExtensionTestCase): 'description': 'description0', 'service_types': [{'service_type': 'SERVICE0'}, {'service_type': 'SERVICE1'}], - 'infra_driver': 'noop', - 'mgmt_driver': 'noop', 'attributes': {'key0': 'value0', 'key1': 'value1'}, } instance = self.plugin.return_value @@ -138,7 +132,6 @@ class TackerExtensionTestCase(test_api_v2_extension.ExtensionTestCase): 'name': 'instance0', 'service_type_id': _uuid(), 'service_table_id': _uuid(), - 'mgmt_driver': 'noop', 'mgmt_address': 'no-address', 'service_contexts': [ {'network_id': _uuid(), }, @@ -163,7 +156,6 @@ class TackerExtensionTestCase(test_api_v2_extension.ExtensionTestCase): 'name': 'instance0', 'service_type_id': _uuid(), 'service_table_id': _uuid(), - 'mgmt_driver': 'noop', 'mgmt_address': 'no-address', 'service_contexts': [ {'network_id': _uuid(), }, diff --git a/tacker/tests/unit/vm/test_plugin.py b/tacker/tests/unit/vm/test_plugin.py index c8ba574ec..b232c781e 100644 --- a/tacker/tests/unit/vm/test_plugin.py +++ b/tacker/tests/unit/vm/test_plugin.py @@ -123,9 +123,7 @@ class TestVNFMPlugin(db_base.SqlTestCase): id='eb094833-995e-49f0-a047-dfb56aaf7c4e', tenant_id='ad7ebc56538745a08ef7c5e97f8bd437', name='fake_template', - description='fake_template_description', - infra_driver='fake_driver', - mgmt_driver='fake_mgmt_driver') + description='fake_template_description') session.add(device_template) session.flush() return device_template diff --git a/tacker/vnfm/plugin.py b/tacker/vnfm/plugin.py index 7ab9339c4..21d52a415 100644 --- a/tacker/vnfm/plugin.py +++ b/tacker/vnfm/plugin.py @@ -21,7 +21,6 @@ import yaml import eventlet from oslo_config import cfg from oslo_log import log as logging -from oslo_log import versionutils from oslo_utils import excutils from toscaparser.tosca_template import ToscaTemplate @@ -151,12 +150,6 @@ class VNFMPlugin(vnfm_db.VNFMPluginDb, VNFMMgmtMixin): LOG.debug(_('vnfd %s'), vnfd_data) - if 'infra_driver' in vnfd_data or 'mgmt_driver' in vnfd_data: - versionutils.report_deprecated_feature(LOG, "Deriving " - "infra_driver and mgmt_driver from VNFD API is deprecated and" - " will be removed in Ocata. infra_driver will be automatically" - " derived from target vim type. mgmt_driver will be derived " - "from TOSCA template values.") name = vnfd_data['name'] if self._get_by_name(context, vnfm_db.VNFD, name): raise exceptions.DuplicateResourceName(resource='VNFD', name=name)