Remove infra and mgmt parsing logic from API
This patch removes the logic of fetching infra and mgmt driver information from API and storing it in DB. Change-Id: Iccf5ecf016fb7f32e8e3d7fdc4f204bb58bee670 Partial-Bug: #1630936 Depends-On: I4684e69b8993e6c35503317503dd73e2c13f44dd
This commit is contained in:
parent
a7e3732db6
commit
267ba6e55a
@ -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))
|
@ -1 +1 @@
|
||||
0ae5b1ce3024
|
||||
8f7145914cb0
|
@ -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():
|
||||
|
@ -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,
|
||||
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
fixes:
|
||||
- Removed passing infa and mgmt driver in API.
|
@ -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'},
|
||||
|
@ -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(), },
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user